Tuesday, November 24, 2015

How to schedule a SSIS package on SQL Server Agent


Source:
https://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/

Tuesday, November 10, 2015

ASP.Net MVC draw chart.js with jQuery Ajax call

Following is a Ajax call example:
//Read
var GetDataList = function (date, callback) {
    $.ajax({
        type: 'GET',
        url: '/Test/GetMyDataList',
        dataType: 'html',
        data: {
            date: date
        },
        success: function (data) {
            if (callback) callback(data);
        }
     });
 };
The above example passed data as parameter which contains date, and once the call is success, another callback function will be used to process the returned data.
//Save
var UpdateDatalist = function (model, callback, callback2) {
    $.ajax({
        type: 'POST',
        url: '/Test/UpdateDatalist',
        dataType: 'json',
        processData : false,
        data: JSON.stringify(model),
        cache: false,
        success: function (data) {
            if (data.ReturnedModel) callback2(data);
            if (isError(data)) return;
            if (callback) callback(data);
        }
    });
};
The above example send a JavaScript object as a JSON string to the server with an AJAX request, you need to convert the JavaScript object to a JSON string and send the string as raw data.

HTTP requests can be send as either, GET, POST, PUT, DELETE or HEAD requests.

Note here it's better to use List<Class> over Dictionary<Key, String> because List can be converted directly into JSON while you need to write customized code to convert Dictionary to JSON data.

Source:
http://forums.asp.net/t/2000850.aspx?json+data+to+a+chart+via+a+JsonResult+Action+in+MVC
https://gist.github.com/dancameron/18ad7e46399406259323
http://stackoverflow.com/questions/19894952/draw-a-chart-js-with-ajax-data-and-responsive-a-few-problems-and-questions
http://tutorials.jenkov.com/jquery/ajax.html#receiving-json

Applying Generic Repository and Unit of Work Pattern with ASP.NET MVC and Entity Framework


Source:
http://www.thereformedprogrammer.net/is-the-repository-pattern-useful-with-entity-framework/
http://www.thereformedprogrammer.net/is-the-repository-pattern-useful-with-entity-framework-part-2/
http://stackoverflow.com/questions/25953881/unit-of-work-repository-service-layer-with-dependency-injection
http://blog.longle.net/2013/05/11/genericizing-the-unit-of-work-pattern-repository-pattern-with-entity-framework-in-mvc/
http://techbrij.com/generic-repository-unit-of-work-entity-framework-unit-testing-asp-net-mvc
http://stackoverflow.com/questions/16572743/generic-repository-with-data-access-layer
http://www.codeguru.com/csharp/.net/net_asp/mvc/using-the-repository-pattern-with-asp.net-mvc-and-entity-framework.htm
http://ctrlcvprogrammer.blogspot.ca/2015/05/wanted-to-execute-stored-procedure-in.html

Wednesday, November 4, 2015

How to applying Store Procedures to build Entity Framework in ASP.Net MVC project


After you have successfully build your Entity Framework, you can update it if your tables or store procedures have been changed. Right click on the Entity Framework model in your solution explorer, choose Open, and click on Model Browser. Then right click on the root node of the model, and choose Update Model from Database, the data model will be updated. If you changed the database connection string in web.config, and create a new database connection using different connection name, the Model Browser will start a new wizard to connect to the new database. In this way you can switch different database for the predefined Entity Framework.

Source:
http://weblogs.asp.net/dotnetstories/using-stored-procedures-with-entity-framework-in-an-asp-net-application
http://beyondrelational.com/modules/2/blogs/64/posts/11620/entity-framework-40-bind-stored-procedure-with-result-entity-class.aspx

Monday, November 2, 2015

How to remove Source Control Binding from Visual Studio Project

If your project has been binding with TFS before, and you want to open the project locally, you will get following annoying information: The team foundation server http://some-tfs-server/ is currently not available, The solution will be opened locally. To remove the annoying information, deleted the .suo next to the .sln file, and then opened the .sln file in Notepad and deleted this entire section:
GlobalSection(TeamFoundationVersionControl) = preSolution
    SccNumberOfProjects = 2
    SccEnterpriseProvider = {xxxxx}
    SccTeamFoundationServer = http://some-tfs-server/
    SccLocalPath0 = .
    SccProjectUniqueName1 = xxDemo\\xxDemo.csproj
    SccProjectName1 = xxDemo
    SccLocalPath1 = xxDemo
EndGlobalSection
If you can connect to the TFS, you just want to simply unload the project from the source control server, go to File -> Source Control -> Change Source Control and then unbind and/or disconnect all projects and the solution.

This should remove all bindings from the solution and project files. (After this you can switch the SCC provider in Tools -> Options -> Source Control -> Plug-in Selection).

The SCC specification prescribes that all SCC providers should implement this behavior including VSS, TFS, etc.

Source:
http://stackoverflow.com/questions/358951/how-can-i-completely-remove-tfs-bindings