Monday, December 15, 2014
Friday, December 12, 2014
Upgrade from ASP.NET Identity 1.0 to 2.0
View -> Package Manager Console
PM > Enable-Migrations
PM > Add-Migration UpdateIdentifyName
PM > Update-Database -verbose
PM > Enable-Migrations
PM > Add-Migration UpdateIdentifyName
PM > Update-Database -verbose
using System.Data.Entity.Migrations;
public partial class UpdateIdentifyName : DbMigration
{
public override void Up()
{
RenameColumn(table: "dbo.AspNetUserClaims", name: "User_Id", newName: "UserId");
RenameIndex(table: "dbo.AspNetUserClaims", name: "IX_User_Id", newName: "IX_UserId");
DropPrimaryKey("dbo.AspNetUserLogins");
AddColumn("dbo.AspNetUsers", "FirstName", c => c.String(nullable: false, maxLength: 256));
AddColumn("dbo.AspNetUsers", "LastName", c => c.String(nullable: false, maxLength: 256));
AddColumn("dbo.AspNetUsers", "Email", c => c.String(maxLength: 256));
AddColumn("dbo.AspNetUsers", "EmailConfirmed", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "PhoneNumber", c => c.String());
AddColumn("dbo.AspNetUsers", "PhoneNumberConfirmed", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "TwoFactorEnabled", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "LockoutEndDateUtc", c => c.DateTime());
AddColumn("dbo.AspNetUsers", "LockoutEnabled", c => c.Boolean(nullable: false));
AddColumn("dbo.AspNetUsers", "AccessFailedCount", c => c.Int(nullable: false));
AlterColumn("dbo.AspNetUsers", "UserName", c => c.String(nullable: false, maxLength: 256));
AddColumn("dbo.AspNetUsers", "CreatedDateTime", c => c.DateTime(nullable: false));
AlterColumn("dbo.AspNetRoles", "Name", c => c.String(nullable: false, maxLength: 256));
AddPrimaryKey("dbo.AspNetUserLogins", new[] { "LoginProvider", "ProviderKey", "UserId" });
CreateIndex("dbo.AspNetUsers", "UserName", unique: true, name: "UserNameIndex");
CreateIndex("dbo.AspNetRoles", "Name", unique: true, name: "RoleNameIndex");
DropColumn("dbo.AspNetUsers", "Discriminator");
}
}
Tuesday, December 9, 2014
ASP.NET MVC File Upload through jQuery AJAX
HTML:
<input type="file" name="file" id="file" />
Javascript Submit:
var formData = new FormData();
var file = $("#file")[0].files[0];
formData.append("file", file);
formData.append("SourceId", 1234);
ajaxRequestFormData(window.urls.uploadAttachment, formData)
jQuery AJAX:
ajaxRequestFormData = function (url, model) {
$.ajax({
url: url,
type: "POST",
cache: false,
data: model,
dataType: "json",
contentType: false,
processData: false,
beforeSend: showProgress()
}).done(function (data) {
...
hideProgress();
}).fail(function () {
...
});
};
Controller Action:
public virtual ActionResult UploadAttachment(AttachmentDto attachment)
{
var file = Request.Files[0];
attachment.File = file;
var sourceId = attachment.SourceId;
...
}
Domain Class:
public class AttachmentDto
{
public HttpPostedFileBase File { get; set; }
public decimal SourceId { get; set; }
...
}
<input type="file" name="file" id="file" />
Javascript Submit:
var formData = new FormData();
var file = $("#file")[0].files[0];
formData.append("file", file);
formData.append("SourceId", 1234);
ajaxRequestFormData(window.urls.uploadAttachment, formData)
jQuery AJAX:
ajaxRequestFormData = function (url, model) {
$.ajax({
url: url,
type: "POST",
cache: false,
data: model,
dataType: "json",
contentType: false,
processData: false,
beforeSend: showProgress()
}).done(function (data) {
...
hideProgress();
}).fail(function () {
...
});
};
Controller Action:
public virtual ActionResult UploadAttachment(AttachmentDto attachment)
{
var file = Request.Files[0];
attachment.File = file;
var sourceId = attachment.SourceId;
...
}
Domain Class:
public class AttachmentDto
{
public HttpPostedFileBase File { get; set; }
public decimal SourceId { get; set; }
...
}
Wednesday, November 26, 2014
T-SQL Replace Method
update shows
set ProfileImagePath = replace(ProfileImagePath, '/Content/images/Shows/S', 's')
where Id = 1019
set ProfileImagePath = replace(ProfileImagePath, '/Content/images/Shows/S', 's')
where Id = 1019
Wednesday, November 19, 2014
Tuesday, November 11, 2014
Monday, October 27, 2014
Saturday, October 25, 2014
Wednesday, October 22, 2014
sencha generate app
PS C:\Dev\www\touch\touch-2.4.0> sencha generate app App /dev/www/apps/myapp
Sencha Cmd v5.0.2.270
[INF] Processing Build Descriptor : default
[INF] Loading app json manifest...
[INF] Concatenating output to file C:\dev\www\apps\myapp\build\temp\development\App\sencha-compiler\cmd-packages.js
[INF] writing content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
Sencha Cmd v5.0.2.270
[INF] Processing Build Descriptor : default
[INF] Loading app json manifest...
[INF] Concatenating output to file C:\dev\www\apps\myapp\build\temp\development\App\sencha-compiler\cmd-packages.js
[INF] writing content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
[INF] appending content to C:\dev\www\apps\myapp\bootstrap.js
Monday, October 20, 2014
Tuesday, October 14, 2014
Saturday, October 11, 2014
Thursday, October 2, 2014
Tuesday, September 30, 2014
Monday, August 25, 2014
Saturday, August 23, 2014
Wednesday, July 30, 2014
Friday, July 11, 2014
Saturday, June 14, 2014
Wednesday, May 28, 2014
Wednesday, May 21, 2014
Friday, May 2, 2014
Subscribe to:
Posts (Atom)












