public static void SaveEntry(string sData)
 {
     BagConsumption oEntry = JsonConvert.DeserializeObject<BagConsumption>(sData);
     string sType = oEntry.sType;
     using (var dbContext = new aspet_devEntities())
     {
         if (sType == "Raw")
         {
             Modals.RawMaterial oData = dbContext.RawMaterials.Where(x => x.wMaterialId == oEntry.wMaterialId).SingleOrDefault();
             oData.Status = 1;
             dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Modified;
         }
         else if (sType == "Packing")
         {
             PackingMaterial oData = dbContext.PackingMaterials.Where(x => x.wPackingId == oEntry.wMaterialId).SingleOrDefault();
             oData.Status = 1;
             dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Modified;
         }
         else if (sType == "Clrs")
         {
             Modals.Color oData = dbContext.Colors.Where(x => x.wColorId == oEntry.wMaterialId).SingleOrDefault();
             oData.Status = 1;
             dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Modified;
         }
         else if (sType == "Others")
         {
             MaterialOther oData = dbContext.MaterialOthers.Where(x => x.wOtherId == oEntry.wMaterialId).SingleOrDefault();
             oData.Status = 1;
             dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Modified;
         }
         oEntry.date = DateTime.Now;
         dbContext.BagConsumptions.Add(oEntry);
         dbContext.SaveChanges();
     }
 }
        public static void SaveEntry(string sData)
        {
            supplier oEntry = JsonConvert.DeserializeObject<supplier>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                dbContext.suppliers.Add(oEntry);
                dbContext.SaveChanges();
            }
        }
 public static string LoadData()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         var oList = dbContext.trucks.OrderByDescending(obj => obj.wTruckId).ToList();
         sReturn = JsonConvert.SerializeObject(oList);
     }
     return sReturn;
 }
        public static void SaveEntry(string sData)
        {
            MaterialEntry oEntry = JsonConvert.DeserializeObject<MaterialEntry>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                dbContext.MaterialEntries.Add(oEntry);
                dbContext.SaveChanges();
            }
        }
 public static string GetBrands()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         var oList = dbContext.Brands.ToList();
         sReturn = JsonConvert.SerializeObject(oList);
     }
     return sReturn;
 }
 public static string GetShiftIncharges()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         List<User> olstShiftIncharge = dbContext.Users.Where(ouser => ouser.wRoleId <= 2 || ouser.wRoleId == 5).ToList();
         sReturn = JsonConvert.SerializeObject(olstShiftIncharge);
     }
     return sReturn;
 }
        public static void SaveTruck(string sData)
        {
            truck otruck = JsonConvert.DeserializeObject<truck>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                dbContext.trucks.Add(otruck);
                dbContext.SaveChanges();
            }
        }
 public static string GetSupervisors()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         List<User> olst = dbContext.Users.Where(ouser => ouser.wRoleId <= 3 || ouser.wRoleId == 3).ToList();
         sReturn = JsonConvert.SerializeObject(olst);
     }
     return sReturn;
 }
 public static string GetSupplier()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         List<supplier> olstStat = dbContext.suppliers.ToList();
         sReturn = JsonConvert.SerializeObject(olstStat);
     }
     return sReturn;
 }
Beispiel #10
0
        public static void UpdateEntry(string sData)
        {
            AspProdNet.Modals.supplier oEntry = JsonConvert.DeserializeObject<AspProdNet.Modals.supplier>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Modified;
                dbContext.SaveChanges();
            }
        }
 public static string LoadData()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         var oList = dbContext.PackingMaterials.Where(obj => obj.Status == 0).OrderByDescending(obj => obj.wPackingId).ToList();
         sReturn = JsonConvert.SerializeObject(oList);
     }
     return sReturn;
 }
Beispiel #12
0
        public static string LoadData()
        {
            string sReturn = "";
            using (var dbContext = new aspet_devEntities())
            {
                var oList = dbContext.suppliers.ToList();

                sReturn = JsonConvert.SerializeObject(oList);
            }
            return sReturn;
        }
Beispiel #13
0
        public static void SaveEntry(string sData)
        {
            User oEntry = JsonConvert.DeserializeObject<User>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                oEntry.timestamp = DateTime.Now;
                dbContext.Users.Add(oEntry);
                dbContext.SaveChanges();
            }
        }
        public static void DeleteEntry(string sData)
        {
            AspProdNet.Modals.ResinMoistrRpt oEntry = JsonConvert.DeserializeObject<AspProdNet.Modals.ResinMoistrRpt>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Deleted;
                //  dbContext.RawMaterials.Remove(dbContext.Entry(oEntry));
                dbContext.SaveChanges();
            }
        }
 public static string LoadSingleData(string sId)
 {
     string sReturn = "";
     int id = Convert.ToInt16(sId);
     using (var dbContext = new aspet_devEntities())
     {
         var oList = dbContext.ResinMoistrRpts.Where(obj => obj.wRsinRptId == id).SingleOrDefault();
         sReturn = JsonConvert.SerializeObject(oList);
     }
     return sReturn;
 }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var dbContext = new aspet_devEntities())
            {
                List<Shift> olstStat = dbContext.Shifts.ToList();
                ddlShft.DataSource = olstStat;
                ddlShft.DataTextField = "sShift";
                ddlShft.DataValueField = "wShiftId";

                ddlShft.DataBind();
            }
        }
        public static void UpdateEntry(string sData)
        {
            AspProdNet.Modals.ResinMoistrRpt oEntry = JsonConvert.DeserializeObject<AspProdNet.Modals.ResinMoistrRpt>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                oEntry.wDateTime = DateTime.Now;
                oEntry.Status = 0;
                dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Modified;
                dbContext.SaveChanges();
            }
        }
        public static void SaveEntry(string sData)
        {
            AspProdNet.Modals.ResinMoistrRpt oEntry = JsonConvert.DeserializeObject<AspProdNet.Modals.ResinMoistrRpt>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                oEntry.wDateTime = DateTime.Now;
                oEntry.Status = 0;
                dbContext.ResinMoistrRpts.Add(oEntry);
                dbContext.SaveChanges();
            }
        }
 public static string LoadData()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         var oList = dbContext.BagConsumptions.OrderByDescending(obj => obj.date).ToList();
         //var oList = dbContext.BagConsumptions.Join(dbContext.Users, po => po.wShiftUserId, mo => mo.wUserId, (main, mo) => new { main, mo.sUser })
         //    .Join(dbContext.Shifts, sh => sh.main.wShift, shf => shf.wShiftId, (main1, shd) => new { main1,shd.sShift}).ToList();
         sReturn = JsonConvert.SerializeObject(oList);
     }
     return sReturn;
 }
 public static string LoadSingleData(string sId)
 {
     string sReturn = "";
     int id = Convert.ToInt16(sId);
     using (var dbContext = new aspet_devEntities())
     {
         List<object> oList = new List<object>();
         oList.Add(dbContext.VisualReports.Where(obj => obj.wVisualId == id).SingleOrDefault());
         oList.Add(dbContext.VCavities.Where(obj => obj.wVisualId == id).ToList());
         sReturn = JsonConvert.SerializeObject(oList);
     }
     return sReturn;
 }
Beispiel #21
0
 public static string LoadData()
 {
     string sReturn = "";
     using (var dbContext = new aspet_devEntities())
     {
         // var oList = dbContext.Users.Include(oInc => oInc.).OrderBy(oUsr=>oUsr.sUser).ToList();
         var List = from oUser in dbContext.Users
                    join roles in dbContext.UserRoles
                    on oUser.wRoleId equals roles.wRoleId
                    select new { oUser, roles };
         sReturn = JsonConvert.SerializeObject(List);
     }
     return sReturn;
 }
        public static void DeleteEntry(string sData)
        {
            AspProdNet.Modals.VisualReport oEntry = JsonConvert.DeserializeObject<AspProdNet.Modals.VisualReport>(sData);

            using (var dbContext = new aspet_devEntities())
            {
                dbContext.Entry(oEntry).State = System.Data.Entity.EntityState.Deleted;
                //  dbContext.PackingMaterials.Remove(dbContext.Entry(oEntry));
                dbContext.VCavities.Where(obj => obj.wVisualId == oEntry.wVisualId).ToList().ForEach(olst =>
                {
                    dbContext.Entry(olst).State = System.Data.Entity.EntityState.Deleted;
                });
                dbContext.SaveChanges();
            }
        }
 public static string CheckUserLogin(string sUserName, string sPassWord)
 {
     string msg = "";
     using (var dbContext = new aspet_devEntities())
     {
         User oCurr = dbContext.Users.Where(oUser => oUser.sUser == sUserName).SingleOrDefault();
         if (oCurr == null || oCurr.sUser == null)
             msg = "Invalid User name or Password";
         else if (oCurr.sPassword != sPassWord)
             msg = "Invalid User name or Password";
         else if (oCurr.sPassword == sPassWord)
             msg = "Done";
     }
     return msg;
 }
        private void LoadObjects()
        {
            using (var dbContext = new aspet_devEntities())
            {
                List<User> olstUser = dbContext.Users.ToList();
                ddlChkd.DataSource = olstUser;
                ddlChkd.DataTextField = "sUser";
                ddlChkd.DataValueField = "wUserId";

                ddlChkd.DataBind();

                ddlprep.DataSource = olstUser;
                ddlprep.DataTextField = "sUser";
                ddlprep.DataValueField = "wUserId";

                ddlprep.DataBind();

            }
        }
        private void LoadObjects()
        {
            using (var dbContext = new aspet_devEntities())
            {
                List<User> olst = dbContext.Users.Where(ouser => ouser.wRoleId <= 3 || ouser.wRoleId == 3).ToList();
                ddlSupervisor.DataSource = olst;
                ddlSupervisor.DataTextField = "sUser";
                ddlSupervisor.DataValueField = "wUserId";

                ddlSupervisor.DataBind();

                List<station> olstStat = dbContext.stations.ToList();
                ddlStation.DataSource = olstStat;
                ddlStation.DataTextField = "sStation";
                ddlStation.DataValueField = "wStationId";

                ddlStation.DataBind();

            }
        }
        private void LoadObjects()
        {
            using (var dbContext = new aspet_devEntities())
            {
                List<Material> olst = dbContext.Materials.ToList();
                ddlMaterial.DataSource = olst;
                ddlMaterial.DataTextField = "sMaterial";
                ddlMaterial.DataValueField = "wMaterial";

                ddlMaterial.DataBind();

                List<supplier> olstStat = dbContext.suppliers.ToList();
                ddlSuplier.DataSource = olstStat;
                ddlSuplier.DataTextField = "sSupplier";
                ddlSuplier.DataValueField = "wSupplierId";

                ddlSuplier.DataBind();

            }
        }
        public static void SaveEntry(string sData, string sHandData)
        {
            Production oEntry = JsonConvert.DeserializeObject<Production>(sData);
            List<ProdHandling> olstHdn = JsonConvert.DeserializeObject < List<ProdHandling>>(sHandData);
            using (var dbContext = new aspet_devEntities())
            {
                dbContext.Productions.Add(oEntry);

                dbContext.SaveChanges();
                dbContext.Entry(oEntry).GetDatabaseValues();

                foreach (ProdHandling ohdn in olstHdn)
                {
                    ohdn.wProductionId = oEntry.wProductionId;
                }

                dbContext.ProdHandlings.AddRange(olstHdn);
                dbContext.SaveChanges();
            }
        }
        public static void SaveEntry(string sData, string sHandData)
        {
            VisualReport oEntry = JsonConvert.DeserializeObject<VisualReport>(sData);
            List<VCavity> olstHdn = JsonConvert.DeserializeObject<List<VCavity>>(sHandData);
            using (var dbContext = new aspet_devEntities())
            {
                oEntry.Date = DateTime.Now;
                dbContext.VisualReports.Add(oEntry);

                dbContext.SaveChanges();
                dbContext.Entry(oEntry).GetDatabaseValues();

                foreach (VCavity ohdn in olstHdn)
                {
                    ohdn.wVisualId = oEntry.wVisualId;
                }

                dbContext.VCavities.AddRange(olstHdn);
                dbContext.SaveChanges();
            }
        }
        public static string SaveBrands(string sBrand)
        {
            string sReturn = "";

            using (var dbContext = new aspet_devEntities())
            {
                Brand oBrand = new Brand();
                oBrand.Name = sBrand;
                dbContext.Brands.Add(oBrand);
                dbContext.SaveChanges();
                dbContext.Entry(oBrand).GetDatabaseValues();
                sReturn = oBrand.wBrandId.ToString();
            }
            return sReturn;
        }
        public static string SaveSupplier(string sBrand)
        {
            string sReturn = "";

            using (var dbContext = new aspet_devEntities())
            {
                supplier oBrand = new supplier();
                oBrand.sSupplier = sBrand;
                dbContext.suppliers.Add(oBrand);
                dbContext.SaveChanges();
                dbContext.Entry(oBrand).GetDatabaseValues();
                sReturn = oBrand.wSupplierId.ToString();
            }
            return sReturn;
        }