Friday, 16 June 2017

Entity Framework

Install Nuget Package from Visual Studio ( Entity Framework)
Add EntityFramework.dll
and EntityFramewok.SqlServer.dll into references.


1) If you want to select rows from Table :

          using (dbEntities db = new dbEntities())
            {
                var result = db.Customers.Select(x => x).OrderBy(x => x.Customer_ID).ToList();

                var result = db.QTMS_JohnToGo_Equipment.Where(x => x.Is_Deleted == false).Select(x                    => x).OrderBy(x => x.Equipment_ID).ToList();

                var lst  = db.QTMS_VipToGo_Equipment.Where(x => x.Is_Deleted == false &&                                 x.Equipment_ID == id).Select(x => x.Equipment_Description).ToList();

                if (lst != null && lst.Count() > 0)
                return JsonConvert.SerializeObject(lst);
            }

   //jquery code
   alert("My age is : " + Bresponse[0].Customer_Age);



//Code Behind for Adding / Update records in Entity Framework.
 [WebMethod]
        public static string GetCustomerData(string entity)
        {
            using (ViftechEntities db = new ViftechEntities())
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                Customer defaultdata = (Customer)js.Deserialize(entity, typeof(Customer));

                Customer obj;
                //update
                if (defaultdata.Customer_ID > 0)
                {
                   // obj = new Customer();
                    obj = db.Customers.Where(x => x.Customer_ID == defaultdata.Customer_ID).FirstOrDefault();
                    if (obj != null)
                    {
                        obj.Customer_Age = 12;
                        obj.Customer_Name = "Naya Naam";
                        db.SaveChanges();
                    }
                }

                    //add new
                else
                {
                    obj = new Customer();
                    obj.Customer_Name = "Salman";
                    obj.Customer_Age = 29;

                    db.Customers.Add(obj);
                    db.SaveChanges();
                }

                var result = db.Customers.Select(x => x).OrderBy(x => x.Customer_ID).ToList();
                return JsonConvert.SerializeObject(result);
            }
        }








Sunday, 17 July 2016

Aerial View of SandSpit beach..

Aerial View of SandSpit beach..


5G Internet Speed .

This is the Speed of 5G Internet .. You will be shocked to see the speed.


MQM AND PMLF workers joins PTI today...



More than 40 MQM AND PPP workers joins PTI today in a press conference..led by ARIF ALWI..





listen to the slogans that were used during rally in favor of Zakir Naik


A rally was organised in patna in favor of Dr.Zakir Naik...Islam zindabad and Pakistan zindabad slogans were raised during rally.one man get arrested by Police ..source of Indian Media....

Very Old and Rare Pictures of Karachi

Following are the most rare and oldest pictures of our Karachi city , some of pictures are older than our Pakistan.
High court Karachi 1950s
Kmc building under construction 1930s
1930 Street Scene Denso Hall. Karachi:

Queen Elizabeth visit Karachi 1960
Street scene Karachi 1943
Street scene Karachi 1940s

1950s bunder road Karachi
Paradise cinema Karachi 1960s




Habib Bank Plaza during its Construction


Exterior of the BVS - Parsi Virbaiji School, Karachi - 1873:




Fighting Game between Karachites , in 1947
Karachi in 1940's its Saddar Market.
















Inter Sindh Board Results Dates Announced.

Dates announced for the Result of Intermediate Sindh Board :