Exemplo n.º 1
0
 public Employee SaveEmployee(Employee e)
 {
     SalesERPDAL salesDal = new SalesERPDAL();
     salesDal.Employees.Add(e);
     salesDal.SaveChanges();
     return e;
 }
Exemplo n.º 2
0
 public void Update(Employee emp)
 {
     using (var db = new SalesERPDAL())
     {
         db.Entry(emp).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void Add(Employee emp)
 {
     using (var db = new SalesERPDAL())
     {
         db.Employees.Add(emp);
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
        public Employee SaveEmployee(Employee emp)
        {
            SalesERPDAL salesDal = new SalesERPDAL();

            salesDal.Employees.Add(emp);
            salesDal.SaveChanges();
            return(emp);
        }
 public void UpdateEmp(Employee emp)
 {
     using (var a = new SalesERPDAL())
     {
         a.Entry(emp).State = EntityState.Modified;
         a.SaveChanges();
     }
 }
 public void Add(Employee emp)
 {
     using (var a = new SalesERPDAL())
     {
         a.Employees.Add(emp);
         a.SaveChanges();
     }
 }
        public Employee SaveEmployee(Employee e)
        {
            SalesERPDAL sales = new SalesERPDAL();

            sales.Employees.Add(e);
            sales.SaveChanges();
            return(e);
        }
 public void EditorEmployee(Employee e)
 {
     using (var db = new SalesERPDAL())
     {
         //Employee emp = db.Employees.Find(id);
         db.Entry(e).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemplo n.º 9
0
 public void Update(Employee emp)
 {
     using (SalesERPDAL dal = new SalesERPDAL())
     {
         //状态修改
         dal.Entry(emp).State = EntityState.Modified;
         dal.SaveChanges();
     }
 }
Exemplo n.º 10
0
 //删除
 public void DeleteSaveEmployee(int id)
 {
     using (SalesERPDAL dal = new SalesERPDAL())
     {
         Employee emp = dal.Employee.Find(id);
         dal.Entry(emp).State = EntityState.Deleted;
         dal.SaveChanges();
     }
 }
Exemplo n.º 11
0
 public Cliente SaveEmployee(Cliente e)
 {
     using (var context = new SalesERPDAL())
     {
         context.Employees.Add(e);
         context.SaveChanges();
         return(e);
     }
 }
Exemplo n.º 12
0
 //删除方法
 public void Delete(int id)
 {
     using (SalesERPDAL sales = new SalesERPDAL())
     {
         Employee emp = sales.Employees.Find(id);
         sales.Entry(emp).State = System.Data.Entity.EntityState.Deleted;
         sales.SaveChanges();
     }
 }
Exemplo n.º 13
0
        public ActionResult SaveEmployee(Employee e)
        {
            SalesERPDAL dd = new SalesERPDAL();

            dd.Employees.Add(e);
            dd.SaveChanges();

            return(Index());
        }
Exemplo n.º 14
0
 public void Delete(int id)
 {
     using (var db = new SalesERPDAL())
     {
         Employee emp = db.Employees.Find(id);
         db.Entry(emp).State = EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemplo n.º 15
0
 //新增
 public void AddSaveEmployee(Employee emp)
 {
     using (SalesERPDAL dal = new SalesERPDAL())
     {
         //将给定实体以“已添加”状态添加到集的基础上下文中,这样一来,当调用 SaveChanges 时,会将该实体插入到数据库中。
         dal.Employee.Add(emp);
         //将所有更新保存至dal(将在此上下文中所做的所有更改保存到基础数据库。)
         dal.SaveChanges();
     }
 }
 public string InsertGroupMsgs(InsertDataViewModel data)
 {
     try
     {
         using (SalesERPDAL salesDal = new SalesERPDAL())
         {
             GroupMsg result = salesDal.GroupMsgs.Add(data.groupMsg);
             FileMsg fResult = salesDal.FileMsgs.Add(data.fileMsg);
             salesDal.SaveChanges();
             return "Success";
         }
     }
     catch (Exception ex)
     {
         return "Fail:" + ex.Message;
     }
 }
 public Employee SaveEmployee(Employee e)
 {
     try
     {
         SalesERPDAL salesERPDAL = new SalesERPDAL();
         salesERPDAL.Employees.Add(e);
         salesERPDAL.SaveChanges();
         return(e);
     }
     catch (Exception ex)
     {
         Employee tmp = new Employee();
         tmp.UserID = null;
         tmp.Name   = ex.Message;
         return(tmp);
     }
 }
 public bool Delete(string[] userIDs)
 {
     try
     {
         using (SalesERPDAL salesERPDAL = new SalesERPDAL())
         {
             foreach (var v in userIDs)
             {
                 var valList = from u in salesERPDAL.Employees where u.UserID == v && u.Authentication != 1 select u;
                 var val     = valList.FirstOrDefault();
                 if (val != null)
                 {
                     salesERPDAL.Employees.Remove(val);
                 }
             }
             salesERPDAL.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemplo n.º 19
0
 public void UploadEmployees(List<Employee> employees)
 {
     SalesERPDAL salesDal = new SalesERPDAL();
     salesDal.Employees.AddRange(employees);
     salesDal.SaveChanges();
 }
Exemplo n.º 20
0
 public Employee SaveEmployee(Employee e)
 {
     dalObj.Employees.Add(e);
     dalObj.SaveChanges();
     return(e);
 }