с# get GOST 3410 certificate from container

public static X509Certificate2 GetCertFromCont(string pin, string CertCont)
        {
            CspParameters cspParameters = new CspParameters(75);
            cspParameters.KeyContainerName = CertCont;
            cspParameters.Flags = CspProviderFlags.NoPrompt;
 
 
 
            if (pin != "")
            {
                System.Security.SecureString s = new System.Security.SecureString();
                foreach (char z in pin)
                    s.AppendChar(z);
                cspParameters.KeyPassword = s;
            }
 
            try
            {
                Gost3410CryptoServiceProvider prov = new Gost3410CryptoServiceProvider(
                    cspParameters);
                return prov.ContainerCertificate;
            }
            catch (Exception e)
            {
                //System.Windows.MessageBox.Show(e.Message);
                return null;
            }
 
        }

VS2010 tfs http code 203 non-authoritative information

1 Service Pack 1 for Visual Studio 2010

2 Visual Studio 2010 SP1 Team Foundation Server 2012 Compatibility GDR - This patch found here

Introdution example from KnockoutJs

//HTML
<p>First name: <strong data-bind="text: firstName"></strong></p>
<p>Last name: <strong data-bind="text: lastName"></strong></p>

<p>First name: <input data-bind="value: firstName" /></p>
<p>Last name: <input data-bind="value: lastName" /></p>

<p>Full name: <strong data-bind="text: fullName"></strong></p>

<button data-bind="click: capitalizeLastName">Go caps</button>

----------------------------------------------------------------------

//JS
function AppViewModel({
    this.firstName ko.observable("Bert");
    this.lastName ko.observable("Bertington");
    
    this.fullName ko.computed(function({
    return this.firstName(" " this.lastName();    
    }this);
    
    this.capitalizeLastName function({
        var currentVal this.lastName();        // Read the current value
        this.lastName(currentVal.toUpperCase())// Write back a modified value
    };
}

ko.applyBindings(new AppViewModel());




Download KnockOutJS

c# Creating simple app using NinjaTrader API



1 First of all register there
http://www.ninjatraderbrokerage.com/free_futures_trading_demo

2 Download and install ninja trader
http://www.ninjatrader.com/ninjatrader/nt7/setup.exe

3 Create your project in Visual studio

4 Dont forget to add a link to NinjaTrader.client.dll


5 Add this code

6 Dont forget to type your demo login, password

7 Order was added !




8 Check out another functions of this DLL
http://www.ninjatrader.com/support/helpGuides/nt7/index.html?functions.htm


c# Create custom exception

  public class CertNotValidException : Exception
    {
        public CertNotValidException()
            : base() { }
 
        public CertNotValidException(string message)
            : base(message) { }
 
        public CertNotValidException(string format, params object[] args)
            : base(string.Format(format, args)) { }
 
        public CertNotValidException(string message, Exception innerException)
            : base(message, innerException) { }
 
        public CertNotValidException(string format, Exception innerException, params object[] args)
            : base(string.Format(format, args), innerException) { }
    }

Jquery UI Dialog

    $("#dialog").dialog({
        autoOpen: false,
        height: 500,
        width: 960
    });
 
$("#dialog").dialog("open");


<div id="dialog" title="Dialog title"></div>

ASP NET MVC JQuery table with ajax refresh



       var oProtocolTable = $('#ProtocolTable').DataTable({
        "bPaginate": false,
        "ordering": false,
        "bFilter": false,
        "bInfo": false,
        "bProcessing": true,
        "bLengthChange": false,
        "ajax": "/Home/ProtocolAjaxHandler",
        "language": {
            "url": "Content/Russian.txt"
        },
        "fnServerParams": function (aoData) {
            aoData.push({ "name": "GroupID", "value": GroupID });
            aoData.push({ "name": "OrgInn", "value": orgINN });
            aoData.push({ "name": "check_id", "value": check_id });
        }
    });
 
    $('#OrganisationRisk tbody').on('click', 'tr', function () {
        check_id = oOrganisationRisk.cell(this, 0).data();
        oProtocolTable.ajax.reload();
    });

 /// <summary>
    /// Class that encapsulates most common parameters sent by DataTables plugin
    /// </summary>
    public class JQueryDataTableParamModel
    {
        /// <summary>
        /// Request sequence number sent by DataTable, same value must be returned in response
        /// </summary>       
        public string sEcho{ get; set; }
 
        /// <summary>
        /// Text used for filtering
        /// </summary>
        public string sSearch{ get; set; }
 
        /// <summary>
        /// Number of records that should be shown in table
        /// </summary>
        public int iDisplayLength{ get; set; }
 
        /// <summary>
        /// First record that should be shown(used for paging)
        /// </summary>
        public int iDisplayStart{ get; set; }
 
        /// <summary>
        /// Number of columns in table
        /// </summary>
        public int iColumns{ get; set; }
 
        /// <summary>
        /// Number of columns that are used in sorting
        /// </summary>
        public int iSortingCols{ get; set; }
 
        /// <summary>
        /// Comma separated list of column names
        /// </summary>
        public string sColumns{ get; set; }
 
    }


  public ActionResult ProtocolAjaxHandler(JQueryDataTableParamModel param, int? GroupID, string OrgInn, int? check_id)
        {
            var riski = RiskiRepository.Show_Protocol(OrgInn ?? "", GroupID ?? 0, check_id ?? 0);
            if (riski == null)
                return Json(new
                {
                    data = new List<string>()
                },
                JsonRequestBehavior.AllowGet);
            return Json(new
            {
                aaData = from emp in riski
                         select new[] { emp.description, emp.date_check.ToShortDateString() }
 
            },
            JsonRequestBehavior.AllowGet);
 
        }