public int ChangePassword(ref Employees employees, string old_password, string new_password, string confim_passoword)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("ChangePassword(ref Employees employees, string old_password, string new_password, string confim_passowrd)");
             if (!old_password.Equals(Global.Employees.Password))
             {
                 return(INIT.VERIFY);
             }
             if (!new_password.Equals(confim_passoword))
             {
                 return(INIT.FAIL);
             }
             employees.Password = new_password;
             myShoeStoreEntities.Employees.AddOrUpdate(employees);
             myShoeStoreEntities.SaveChanges();
             return(INIT.SUSSESS);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #2
0
 public void Create(ref ModelShoes modelShoes)
 {
     using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
     {
         modelShoes.Status = 1;
         modelShoes        = myShoeStoreEntities.ModelShoes.Add(modelShoes);
         myShoeStoreEntities.SaveChanges();
     }
 }
Example #3
0
 public void Update(Import import)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             myShoeStoreEntities.Import.AddOrUpdate(import);
             myShoeStoreEntities.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #4
0
 public void Create(ref Import import)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             import = myShoeStoreEntities.Import.Add(import);//khong hieu tai sao ko lay het thong tin lien quan
             myShoeStoreEntities.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #5
0
 public void Update(Company company)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("Update(Company company)");
             myShoeStoreEntities.Company.AddOrUpdate(company);
             myShoeStoreEntities.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
 public void Create(ref Log log)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("Read()");
             log = myShoeStoreEntities.Log.Add(log);
             myShoeStoreEntities.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #7
0
 public Company Create(Company company)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("Create(string name)");
             company = myShoeStoreEntities.Company.Add(company);
             myShoeStoreEntities.SaveChanges();
             return(company);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
 public void UpdateEmployee(Employees employees)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("UpdateEmployee(Employees employees)");
             myShoeStoreEntities.Employees.AddOrUpdate(employees);
             myShoeStoreEntities.SaveChanges();
             Console.WriteLine("Chỉnh sửa thông tin thành công");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #9
0
 public void Delete(TypeShoe typeShoe)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("Delete(int id)");
             typeShoe.Status = 0;
             myShoeStoreEntities.TypeShoe.AddOrUpdate(typeShoe);
             if (myShoeStoreEntities.SaveChanges() != 1)
             {
                 throw new Exception();
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #10
0
 public TypeShoe Create(string typeName)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("Create(string typeName)");
             TypeShoe typeShoe = new TypeShoe();
             typeShoe.TypeName = typeName;
             typeShoe.Status   = 1;
             typeShoe          = myShoeStoreEntities.TypeShoe.Add(typeShoe);
             myShoeStoreEntities.SaveChanges();
             return(typeShoe);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #11
0
 public void Delete(ModelShoes modelShoes)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("Delete(ModelShoes modelShoes)");
             modelShoes.Status = 0;
             myShoeStoreEntities.ModelShoes.AddOrUpdate(modelShoes);
             if (myShoeStoreEntities.SaveChanges() != 1)
             {
                 throw new Exception();
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #12
0
 public void Delete(Import import, string note, long action_By, string action_Date)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Console.WriteLine("Delete(int id)");
             var        shoes   = import.Shoes.ToList();
             List <Log> listlog = new List <Log>();
             for (int i = shoes.Count - 1; i >= 0; i--)
             {
                 Log log = new Log();
                 log.Shoes_ID    = shoes[i].Shoes_ID;
                 log.Action_By   = action_By;
                 log.Action_Date = action_Date;
                 log.Action      = INIT.DELETE;
                 log.Amout       = shoes[i].Amount;
                 log.Note        = note;
                 log             = myShoeStoreEntities.Log.Add(log);
                 listlog.Add(log);
                 shoes[i].Status = 0;
                 myShoeStoreEntities.Shoes.AddOrUpdate(shoes[i]);
             }
             import.Status = 0;
             myShoeStoreEntities.Import.AddOrUpdate(import);
             myShoeStoreEntities.SaveChanges();
             for (int i = listlog.Count - 1; i >= 0; i--)
             {
                 Facade.EditUI(listlog[i]);
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
Example #13
0
 public Company Delete(int id)
 {
     try
     {
         using (MyShoeStoreEntities myShoeStoreEntities = new MyShoeStoreEntities())
         {
             Company company = Global.ListCompany.Where(c => c.Companny_ID == id).SingleOrDefault();
             Console.WriteLine("Delete(Company company)");
             company.Status = 0;
             myShoeStoreEntities.Company.AddOrUpdate(company);
             if (myShoeStoreEntities.SaveChanges() != 1)
             {
                 throw new Exception();
             }
             return(company);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }