public void EditPaper(string paperid, string papername)
        {
            var db        = new PrinteryContext();
            var exitPaper = db.Paper.FirstOrDefault(s => s.PaperId == paperid);

            if (exitPaper != null)
            {
                db.Set <Paper>().Attach(exitPaper);
                db.Entry(exitPaper).State = EntityState.Modified;
                exitPaper.PaperName       = papername;
                db.SaveChanges();
            }
        }
        public void UpdatePassword(string pwd, string empid)
        {
            var db      = new PrinteryContext();
            var exitEmp = db.Employee.FirstOrDefault(s => s.EmpId == empid);

            if (exitEmp != null)
            {
                db.Set <Employee>().Attach(exitEmp);
                db.Entry(exitEmp).State = EntityState.Modified;
                exitEmp.Password        = pwd;
                db.SaveChanges();
            }
        }
Exemple #3
0
        public void EditInk(string inkid, string inkname)
        {
            var db      = new PrinteryContext();
            var exitInk = db.InkStock.FirstOrDefault(s => s.InkId == inkid);

            if (exitInk != null)
            {
                db.Set <InkStock>().Attach(exitInk);
                db.Entry(exitInk).State = EntityState.Modified;
                exitInk.InkName         = inkname;
                db.SaveChanges();
            }
        }
        public void EditProduct(ProductGoodsViewModel product)
        {
            var db          = new PrinteryContext();
            var exitProduct = db.Product.FirstOrDefault(s => s.ProductID == product.ProductID);

            if (exitProduct != null)
            {
                db.Set <Product>().Attach(exitProduct);
                db.Entry(exitProduct).State = EntityState.Modified;
                exitProduct.ProductName     = product.ProductName;
                exitProduct.eachPrice       = product.eachPrice;
                db.SaveChanges();
            }
        }
        public void EditEmployee(EmployeeViewModel emp)
        {
            var db      = new PrinteryContext();
            var exitEmp = db.Employee.FirstOrDefault(s => s.EmpId == emp.EmpId);

            if (exitEmp != null)
            {
                db.Set <Employee>().Attach(exitEmp);
                db.Entry(exitEmp).State = EntityState.Modified;
                exitEmp.Ename           = emp.Ename;
                exitEmp.Department      = emp.Department;
                exitEmp.UserGroup       = emp.UserGroup;
                exitEmp.Sex             = emp.Sex;
                db.SaveChanges();
            }
        }
        public void EditCustomer(CustomerViewModel cms)
        {
            var db      = new PrinteryContext();
            var exitCms = db.Customer.FirstOrDefault(s => s.CustomerId == cms.CustomerId);

            if (exitCms != null)
            {
                db.Set <Customer>().Attach(exitCms);
                db.Entry(exitCms).State = EntityState.Modified;
                exitCms.CustomerName    = cms.CustomerName;
                exitCms.Contact         = cms.Contact;
                exitCms.Phone           = cms.Phone;
                exitCms.MobilePhone     = cms.MobilePhone;
                exitCms.CAddress        = cms.CAddress;
                db.SaveChanges();
            }
        }
        public void UpdateEmployeeInfo(EmployeeViewModel emp)
        {
            var db      = new PrinteryContext();
            var exitEmp = db.Employee.FirstOrDefault(s => s.EmpId == emp.EmpId);

            if (exitEmp != null)
            {
                db.Set <Employee>().Attach(exitEmp);
                db.Entry(exitEmp).State = EntityState.Modified;
                exitEmp.Ename           = emp.Ename;
                exitEmp.Department      = emp.Department;
                exitEmp.Nation          = emp.Nation;
                exitEmp.Sex             = emp.Sex;
                exitEmp.QQ    = emp.QQ;
                exitEmp.Phone = emp.Phone;
                db.SaveChanges();
            }
        }
        public void EditProExi(addProExiViewModel pro)
        {
            PrinteryContext pr      = new PrinteryContext();
            var             exitPro = pr.ProductionExpense.FirstOrDefault(s => s.ProExId == pro.ProExId);

            if (exitPro != null)
            {
                pr.Set <ProductionExpense>().Attach(exitPro);
                pr.Entry(exitPro).State = EntityState.Modified;
                exitPro.ProductId       = pro.ProductId;
                exitPro.ProductName     = pro.ProductName;
                exitPro.InkId1          = pro.InkId1;
                exitPro.InkId2          = pro.InkId2;
                exitPro.InkId1Count     = pro.InkId1Count;
                exitPro.InkId2Count     = pro.InkId2Count;
                exitPro.PaperId1        = pro.PaperId1;
                exitPro.PaperId2        = pro.PaperId2;
                exitPro.PaperId2Count   = pro.PaperId2Count;
                pr.SaveChanges();
            }
        }