Пример #1
0
 public int? insertUpdate(DridDataObj obj) { 
 
     int? iReturn = 0;
     ctx.spUpdateInsertProduct(obj.ProductID, obj.ProductName, obj.UnitPrice, obj.UnitsInStock, obj.Discontinued, obj.Category, ref iReturn);
     if (iReturn >= 0)
         return iReturn;
     else
         return null;
 }
Пример #2
0
 public void Update(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 = 20 };
     }
     temp.ProductID = PM.insertUpdate(temp);
     temp.UniqueCode = PM.getUniqueCodeById(temp.ProductID.Value);
     //return temp;
     Context.Response.Write(jSerializer.Serialize(temp));
 }
Пример #3
0
        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));
        }
Пример #4
0
        public int?insertUpdate(DridDataObj obj)
        {
            int?iReturn = 0;

            ctx.spUpdateInsertProduct(obj.ProductID, obj.ProductName, obj.UnitPrice, obj.UnitsInStock, obj.Discontinued, obj.Category, ref iReturn);
            if (iReturn >= 0)
            {
                return(iReturn);
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        public List<DridDataObj> ReadProduct(string AnyThing)
        {
            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;
        }
Пример #6
0
        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);
        }
        public JsonResult GetJsonOutputForGridDataUpdatePopup(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);
            /*
            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 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 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);
        }
Пример #10
0
 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));
 }