Exemple #1
0
            public string getAliasFromInformationName(Models.databaseDataContext data, String name)
            {
                if (String.IsNullOrEmpty(name))
                {
                    return("");
                }
                String alias  = RemoveUnicode(name);
                var    record = from ic in data.tbl_informations
                                where ic.alias.Equals(alias)
                                select ic;

                if (record != null)
                {
                    int count = record.Count();
                    if (count > 0)
                    {
                        alias += "-" + count;
                    }
                }

                return(alias);
            }
 public int getOrderAmount(Models.databaseDataContext data)
 {
     return(data.Orders.Count());
 }
 public void deleteAllAdmins(Models.databaseDataContext data)
 {
     data.tbl_admins.DeleteAllOnSubmit(data.tbl_admins);
     data.SubmitChanges();
 }
 public int getMemberAccountAmount(Models.databaseDataContext data)
 {
     return(data.Customers.Count());
 }
 public Models.Customer getMemberAccountByEmail(Models.databaseDataContext data, string email)
 {
     Models.Customer result = data.Customers.Where(n => n.email.Equals(email)).Single();
     return(result);
 }
 public List <Models.tbl_Product> getListAllProducts(Models.databaseDataContext data)
 {
     return(data.tbl_Products.OrderByDescending(a => a.NgayCapNhat).ToList());
 }
 public Models.tbl_Product getProductById(Models.databaseDataContext data, int id)
 {
     Models.tbl_Product result = data.tbl_Products.Where(n => n.ID == id).Single();
     return(result);
 }
 public int getProductsAmount(Models.databaseDataContext data)
 {
     return(data.tbl_Products.Count());
 }
Exemple #9
0
            public List <PromotionAddItemModel> getListPromotionAddItemModelFromListPromotionDetails(Models.databaseDataContext data, List <Models.tbl_promotion_detail> listPromotionDetails)
            {
                List <PromotionAddItemModel> result = new List <PromotionAddItemModel>();

                foreach (var promotionDetail in listPromotionDetails)
                {
                    Models.tbl_Product    item  = ProductHelper.getInstance().getProductById(data, promotionDetail.Idsp);
                    PromotionAddItemModel model = new PromotionAddItemModel();
                    model.proid   = promotionDetail.Idsp;
                    model.name    = item.TenSP;
                    model.price   = item.GiaHienTai;
                    model.modelid = promotionDetail.Idkm;
                    model.gift    = promotionDetail.Gift;
                    result.Add(model);
                }

                return(result);
            }
Exemple #10
0
 public List <Models.tbl_promotion_detail> getListPromotionDetailsByCategory(Models.databaseDataContext data, int idPromotion)
 {
     return(data.tbl_promotion_details.Where(n => n.Idsp == idPromotion).ToList());
 }
Exemple #11
0
 public List <Models.tbl_promotion> getListAllPromotion(Models.databaseDataContext data)
 {
     return(data.tbl_promotions.OrderByDescending(a => a.ngaytao).ToList());
 }
Exemple #12
0
 public Models.tbl_promotion_detail getPromotionDetailsById(Models.databaseDataContext data, int id)
 {
     Models.tbl_promotion_detail result = data.tbl_promotion_details.Where(n => n.Id == id).Single();
     return(result);
 }
Exemple #13
0
 public int getPromotionDetailsAmount(Models.databaseDataContext data)
 {
     return(data.tbl_promotion_details.Count());
 }
Exemple #14
0
 public void deleteAllPromotionDetails(Models.databaseDataContext data)
 {
     data.tbl_promotion_details.DeleteAllOnSubmit(data.tbl_promotion_details);
     data.SubmitChanges();
 }
Exemple #15
0
 public TaskController()
 {
     db = new databaseDataContext();
 }
Exemple #16
0
 public int getNewsCategoryAmount(Models.databaseDataContext data)
 {
     return(data.tbl_new_types.Count());
 }
 public Models.tbl_new getNewsById(Models.databaseDataContext data, int id)
 {
     Models.tbl_new result = data.tbl_news.Where(n => n.id == id).Single();
     return(result);
 }
Exemple #18
0
 public Models.tbl_new_type getNewsCategoryById(Models.databaseDataContext data, int id)
 {
     Models.tbl_new_type result = data.tbl_new_types.Where(n => n.Id == id).Single();
     return(result);
 }
 public int getProductCategoryAmount(Models.databaseDataContext data)
 {
     return(data.tbl_product_types.Count());
 }
Exemple #20
0
 public List <Models.tbl_new> getListOtherNewsByCategory(Models.databaseDataContext data, int id, int idNewType)
 {
     return(data.tbl_news.OrderByDescending(a => a.NgayCapNhat).Where(n => n.id == idNewType && n.id != id).ToList());
 }
 public Models.tbl_product_type getProductCategoryById(Models.databaseDataContext data, int id)
 {
     Models.tbl_product_type result = data.tbl_product_types.Where(n => n.ID == id).Single();
     return(result);
 }
Exemple #22
0
 public void deleteAllProducer(Models.databaseDataContext data)
 {
     deleteAllProduct(data);
     data.tbl_producers.DeleteAllOnSubmit(data.tbl_producers);
     data.SubmitChanges();
 }
 public List <Models.tbl_Product> getListOtherProductsByCategory(Models.databaseDataContext data, int id, int idProductType)
 {
     return(data.tbl_Products.OrderByDescending(a => a.NgayCapNhat).Where(n => n.IDLoaiSP == idProductType && n.ID != id).ToList());
 }
Exemple #24
0
 public Models.tbl_producer getProducerById(Models.databaseDataContext data, int id)
 {
     Models.tbl_producer result = data.tbl_producers.Where(n => n.Id == id).Single();
     return(result);
 }
 public bool loginAdmin(Models.databaseDataContext data, string username, string password)
 {
     return(checkThisAdminAccountExist(data, username, password));
 }
Exemple #26
0
 public List <Models.tbl_Product> getListOtherProductsByProducer(Models.databaseDataContext data, int id, int idProducer)
 {
     return(data.tbl_Products.OrderByDescending(a => a.NgayCapNhat).Where(n => n.Idhangsx == idProducer && n.ID != id).ToList());
 }
 public void deleteAllCustomers(Models.databaseDataContext data)
 {
     data.Customers.DeleteAllOnSubmit(data.Customers);
     data.SubmitChanges();
 }
 public void deleteAllNews(Models.databaseDataContext data)
 {
     data.tbl_news.DeleteAllOnSubmit(data.tbl_news);
     data.SubmitChanges();
 }
 public void deleteAllOrderDetails(Models.databaseDataContext data)
 {
     data.OrderDetails.DeleteAllOnSubmit(data.OrderDetails);
     data.SubmitChanges();
 }
 public int getNewsAmount(Models.databaseDataContext data)
 {
     return(data.tbl_news.Count());
 }
            public List <ShoppingCardItemModel> getListShoppingCardItemModelFromListOrderDetails(Models.databaseDataContext data, List <Models.OrderDetail> listOrderDetails)
            {
                List <ShoppingCardItemModel> result = new List <ShoppingCardItemModel>();

                foreach (var orderDetail in listOrderDetails)
                {
                    Models.tbl_Product    item  = ProductHelper.getInstance().getProductById(data, orderDetail.idsp.Value);
                    ShoppingCardItemModel model = new ShoppingCardItemModel();
                    model.id       = orderDetail.idsp.Value;
                    model.name     = item.TenSP;
                    model.image    = item.UrlHinh;
                    model.quantity = orderDetail.soluong.Value;
                    model.price    = item.GiaHienTai;
                    model.total    = model.price * model.quantity;
                    model.orderid  = orderDetail.iddh.HasValue ? orderDetail.iddh.Value : 0;
                    model.modelid  = orderDetail.id;
                    result.Add(model);
                }

                return(result);
            }
Exemple #32
0
 public LoginController()
 {
     db = new databaseDataContext();
     db.CreateDatabase();
 }