Tuesday, October 31, 2017

Join Query Multiple Tables Order by descending Order

var year = (from ep in _adminContext.table1
                    join e in _adminContext.table2 on ep.idequals e.id
                    join t in _adminContext.table3 on e.idequals t.id
                    orderby t.Date descending
                    where t.status == "A"
                    select new
                    {
                        id= ep.id

                    }).FirstOrDefault();

asynchronous option to be false

the asynchronous choice to be false to induce a synchronous Ajax request. Then your asking will set some information before your Main perform return.
Here's what your code would seem like if modified as suggested:

beforecreate: function (node, targetNode, type, to) {
    jQuery.ajax({
            url: 'http://example.com/catalog/create/' + targetNode.id + '?name=' + encode(to.inp[0].value),
            success: function (result) {
            if (result.isOk == false
                 alert(result.message);
            },
            async: false
         });
}
<script>
    // ...
    $.ajax(... async: false ...); // Hey browser! first complete this request,
                                  // then go for other codes

    $.ajax(...); // Executed after the completion of the previous async:false request.

</script>

Difference between Managed and unmanaged code


Managed code - Executed by the CLR instead of being executed by the operating system.

Unmanaged code - Executed directly by the operating system(OS) and not by the CLR

Adding an existing project to GitHub using the command line

How to Add project to git hub
1) Create new repository Copy Repository Url

2) Open ur project in Visual Studio
3) type: git init
git add *
ls

And Execte git hub generated commands

Build Connection String Dynamically

Entities _context = (Entities)HttpContext.Current.Session[SessionNames.xContext];
using WebSession = System.Web.HttpContext;

#region Build Connection String Dynamically
        public string BuildConnectionString(string dataSource, string database, string userId, string password)
        {
           //  string connect = BuildConnectionString(dataSource, custDbName, dbUserId, dbUserPassword);
            EntityConnectionStringBuilder retval = new EntityConnectionStringBuilder();
            //// Build the connection string from the provided datasource and database
            try
            {

                SqlConnectionStringBuilder sqlBuilder =
                    new SqlConnectionStringBuilder
                    {
                        DataSource = "x.x.x.x",
                        InitialCatalog = "xTemplate",
                        UserID = "x",
                        Password = "x",
                        IntegratedSecurity = false,
                        MultipleActiveResultSets = true
                    };


                retval = new EntityConnectionStringBuilder
                {
                    Metadata = "res://*/x.Client.csdl|res://*/x.Client.ssdl|res://*/x.Client.msl",
                    Provider = "System.Data.SqlClient",
                    ProviderConnectionString = sqlBuilder.ToString()
                };
                BuildDatabaseContext(retval.ToString());

            }
            catch (Exception e)
            {
               
                    throw;
            }
            return retval.ToString();
        }
        public void BuildDatabaseContext(string connectionString)
        {
            try
            {
                StoreContext(connectionString);
            }
            catch (Exception e)
            {
                    throw;
            }
        }
        public void StoreContext(string connect)
        {
            try
            {
                Entities context = new Entities(connect);
                WebSession.Current.Session[SessionNames.xContext] = context;
            }
            catch (Exception e)
            {
               
                    throw;
             }
        }

        #endregion