public bool XoaProduct(int maProduct)
        {
            Product Product = db.Products.Single(x => x.id == maProduct);

            db.Products.DeleteOnSubmit(Product);
            db.SubmitChanges();
            return(true);
        }
        public bool XoaProduct_Category(int maProduct_Category)
        {
            Product_Category Product_Category = db.Product_Categories.Single(x => x.id == maProduct_Category);

            db.Product_Categories.DeleteOnSubmit(Product_Category);
            db.SubmitChanges();
            return(true);
        }
Exemple #3
0
        public bool XoaEmployee(int maEmployee)
        {
            Employee employee = db.Employees.Single(x => x.id == maEmployee);

            db.Employees.DeleteOnSubmit(employee);
            db.SubmitChanges();
            suMana.XoaStore_User(maEmployee);
            return(true);
        }
Exemple #4
0
 public bool XoaInvoiceWithId(int maInvoice)
 {
     foreach (Invoice inc in ListInvoices())
     {
         if (inc.id == maInvoice)
         {
             db.Invoices.DeleteOnSubmit(inc);
             db.SubmitChanges();
             return(true);
         }
     }
     return(false);
 }
Exemple #5
0
        public bool DeleteFood(int id)
        {
            DBFoodDataContext db = new DBFoodDataContext();
            Food food            = db.Foods.FirstOrDefault(x => x.id == id);

            if (food == null)
            {
                return(false);
            }
            db.Foods.DeleteOnSubmit(food);
            db.SubmitChanges();
            return(true);
        }
 public bool XoaOneInvoice_Detail(int maInvoice_Detail, int id_product)
 {
     try
     {
         foreach (Invoice_Detail nv in ListInvoice_Details())
         {
             if (nv.id == maInvoice_Detail && nv.id_product == id_product)
             {
                 db.Invoice_Details.DeleteOnSubmit(nv);
                 db.SubmitChanges();
                 TinhTongTienHoaDon(maInvoice_Detail);
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception e)
     {
         //throw e;
         return(false);
     }
 }
        public bool DeleteUser(int userid)
        {
            DBFoodDataContext db       = new DBFoodDataContext();
            UserProfile       userinfo = db.UserProfiles.FirstOrDefault(x => x.UserId == userid);

            if (userinfo == null)
            {
                return(false);
            }
            db.UserProfiles.DeleteOnSubmit(userinfo);
            db.SubmitChanges();
            return(true);
        }
        public bool XoaStore_User(int maStore_User)
        {
            Store_User Store_User = db.Store_Users.Single(x => x.id == maStore_User);

            db.Store_Users.DeleteOnSubmit(Store_User);
            db.SubmitChanges();
            return(true);
        }
Exemple #9
0
 public bool InsertNewFood(string name, string type, int price)
 {
     try
     {
         DBFoodDataContext db = new DBFoodDataContext();
         Food food            = new Food();
         food.name  = name;
         food.type  = type;
         food.price = price;
         db.Foods.InsertOnSubmit(food);
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool AddUser(string username, string password, bool isactive)
 {
     try
     {
         DBFoodDataContext db       = new DBFoodDataContext();
         UserProfile       userinfo = new UserProfile();
         userinfo.UserName = username;
         userinfo.Password = password.Encrypt();
         userinfo.IsActive = isactive;
         db.UserProfiles.InsertOnSubmit(userinfo);
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #11
0
 public bool UpdateFood(int id, string name, string type, int price)
 {
     try
     {
         DBFoodDataContext db = new DBFoodDataContext();
         Food food            = db.Foods.FirstOrDefault(x => x.id == id);
         if (food == null)
         {
             return(false);
         }
         food.name  = name;
         food.type  = type;
         food.price = price;
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
 public bool UpdateUser(int userid, string username, string password, bool isactive)
 {
     try
     {
         DBFoodDataContext db       = new DBFoodDataContext();
         UserProfile       userinfo = db.UserProfiles.FirstOrDefault(x => x.UserId == userid);
         if (userinfo == null)
         {
             return(false);
         }
         userinfo.UserName = username;
         userinfo.Password = password;
         userinfo.IsActive = isactive;
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }