public JsonResult GetJsonOutputForGridDataUpdatePopup(string models) { JavaScriptSerializer jSerializer = new JavaScriptSerializer(); IList <DridDataObj> persons = new JavaScriptSerializer().Deserialize <IList <DridDataObj> >(models); DridDataObj temp = new DridDataObj(); foreach (DridDataObj m in persons) { temp = new DridDataObj { ProductID = m.ProductID, ProductName = m.ProductName, UnitPrice = m.UnitPrice, UnitsInStock = m.UnitsInStock, Discontinued = m.Discontinued, Category = m.Category, CreatedDate = m.CreatedDate, Duration = 2 }; } temp.ProductID = PM.insertUpdate(temp); temp.UniqueCode = PM.getUniqueCodeById(temp.ProductID.Value); /* * DemoVS4.Core.DAL.Product l = ctx.Products.Where(x => x.ProductID == 3).FirstOrDefault(); * if (l != null) * { * l.UnitPrice = 50; * ctx.SubmitChanges(); * } */ return(Json(temp)); }
public List <DridDataObj> SecureReadProduct(string AnyThing) { if (Authentication.Password == "test") { DemoVS4.Core.DAL.dbTestDataContext ctx = new Core.DAL.dbTestDataContext(); List <DemoVS4.Core.DAL.Product> List = ctx.Products.ToList(); List <DridDataObj> TempList = new List <DridDataObj>(); foreach (DemoVS4.Core.DAL.Product m in List) { DridDataObj temp = new DridDataObj(); temp = new DridDataObj { ProductID = m.ProductID, ProductName = m.ProductName, UnitPrice = m.UnitPrice.Value, UnitsInStock = m.UnitsInStock.Value, Discontinued = m.Discontinued.Value, Category = m.Category, CreatedDate = m.CreatedDateTime.Value, Duration = 20 }; TempList.Add(temp); } // return jSerializer.Serialize(TempList); return(TempList); } else { return(null); } }
public JsonResult GetJsonOutputForGridDataDeletePopup(string models) { JavaScriptSerializer jSerializer = new JavaScriptSerializer(); DridDataObj m = new JavaScriptSerializer().Deserialize <DridDataObj>(models); DridDataObj temp = new DridDataObj(); temp = new DridDataObj { ProductID = m.ProductID, ProductName = m.ProductName, UnitPrice = m.UnitPrice, UnitsInStock = m.UnitsInStock, Discontinued = m.Discontinued, Category = m.Category, CreatedDate = m.CreatedDate }; PM.DeleteRecordById(temp.ProductID); return(Json(new { value = "success" })); }
public void Delete(string models) { JavaScriptSerializer jSerializer = new JavaScriptSerializer(); IList <DridDataObj> persons = new JavaScriptSerializer().Deserialize <IList <DridDataObj> >(models); DridDataObj temp = new DridDataObj(); foreach (DridDataObj m in persons) { temp = new DridDataObj { ProductID = m.ProductID, ProductName = m.ProductName, UnitPrice = m.UnitPrice, UnitsInStock = m.UnitsInStock, Discontinued = m.Discontinued, Category = m.Category, CreatedDate = m.CreatedDate }; } PM.DeleteRecordById(temp.ProductID); Context.Response.Write(jSerializer.Serialize(temp)); }
public JsonResult GetJsonOutputForGridDataCreatePopup(string models) { JavaScriptSerializer jSerializer = new JavaScriptSerializer(); DridDataObj m = new JavaScriptSerializer().Deserialize <DridDataObj>(models); DridDataObj temp = new DridDataObj(); temp = new DridDataObj { ProductID = m.ProductID, ProductName = m.ProductName, UnitPrice = m.UnitPrice, UnitsInStock = m.UnitsInStock, Discontinued = m.Discontinued, Category = m.Category, CreatedDate = m.CreatedDate }; temp.ProductID = PM.insertUpdate(temp); temp.UniqueCode = PM.getUniqueCodeById(temp.ProductID.Value); return(Json(temp)); }
public void ReadPureJson() { DemoVS4.Core.DAL.dbTestDataContext ctx = new Core.DAL.dbTestDataContext(); List <DemoVS4.Core.DAL.Product> List = ctx.Products.ToList(); List <DridDataObj> TempList = new List <DridDataObj>(); foreach (DemoVS4.Core.DAL.Product m in List) { DridDataObj temp = new DridDataObj(); temp = new DridDataObj { ProductID = m.ProductID, ProductName = m.ProductName, UnitPrice = m.UnitPrice.Value, UnitsInStock = m.UnitsInStock.Value, Discontinued = m.Discontinued.Value, Category = m.Category, CreatedDate = m.CreatedDateTime.Value, Duration = 20 }; TempList.Add(temp); } Context.Response.Write(jSerializer.Serialize(TempList)); }
public void Create(string models) { JavaScriptSerializer jSerializer = new JavaScriptSerializer(); IList <DridDataObj> persons = new JavaScriptSerializer().Deserialize <IList <DridDataObj> >(models); DridDataObj temp = new DridDataObj(); foreach (DridDataObj m in persons) { temp = new DridDataObj { ProductID = 0, ProductName = m.ProductName, UnitPrice = m.UnitPrice, UnitsInStock = m.UnitsInStock, Discontinued = m.Discontinued, Category = m.Category, CreatedDate = m.CreatedDate, Duration = 10 }; } temp.ProductID = PM.insertUpdate(temp); temp.UniqueCode = PM.getUniqueCodeById(temp.ProductID.Value); Context.Response.Write(jSerializer.Serialize(temp)); }
public JsonResult GetJsonOutputForGridDataUpdateIncell(string models) { JavaScriptSerializer jSerializer = new JavaScriptSerializer(); IList <DridDataObj> persons = new JavaScriptSerializer().Deserialize <IList <DridDataObj> >(models); List <DridDataObj> tempItems = new List <DridDataObj>(); foreach (DridDataObj m in persons) { DridDataObj temp = new DridDataObj(); temp = new DridDataObj { ProductID = m.ProductID, ProductName = m.ProductName, UnitPrice = m.UnitPrice, UnitsInStock = m.UnitsInStock, Discontinued = m.Discontinued, Category = m.Category, CreatedDate = m.CreatedDate, Duration = 2 }; temp.ProductID = PM.insertUpdate(temp); temp.UniqueCode = PM.getUniqueCodeById(temp.ProductID.Value); tempItems.Add(temp); } return(Json(tempItems)); }