Пример #1
0
        public void InsertProductHeader(ProductHeaderModel model)
        {
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    ProductHeader table = new ProductHeader();
                    table.ProductTableTitleDescription = model.ProductTableTitleDescription;
                    table.ProductCategoryId = model.ProductCategoryId;

                    vdc.ProductHeaders.InsertOnSubmit(table);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Пример #2
0
        public void UpdateHeader(ProductHeaderModel model)
        {
            try
            {
                ProductHeader table = new ProductHeader();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.ProductHeaders.Single(a => a.ProductLabelId == model.ProductLabelId);
                    table.ProductTableTitleDescription = model.ProductTableTitleDescription;
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Пример #3
0
        public List<ProductHeaderModel> GetProductHeaderByProductCategoryId(int productCategoryId)
        {
            List<ProductHeaderModel> modelList = new List<ProductHeaderModel>();
            ProductHeaderModel model = new ProductHeaderModel();
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductHeaders.ToList()
                                       where p.ProductCategoryId == productCategoryId
                                       orderby p.ProductLabelId ascending
                                       select p;

                    foreach (var item in list)
                    {
                        model = new ProductHeaderModel();
                        model.ProductLabelId = item.ProductLabelId;
                        model.ProductCategoryId = item.ProductCategoryId;
                        model.ProductTableTitleDescription = item.ProductTableTitleDescription;
                        modelList.Add(model);
                    }

                    return modelList;

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Пример #4
0
        public ProductHeaderModel GetProductHeaderByHeaderId(int productLabelId)
        {
            ProductHeaderModel model = new ProductHeaderModel();
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductHeaders.ToList()
                               where p.ProductLabelId == productLabelId
                               select p;
                    if (list != null)
                    {
                        model.ProductCategoryId = list.FirstOrDefault().ProductCategoryId;
                        model.ProductLabelId = list.FirstOrDefault().ProductLabelId;
                        model.ProductTableTitleDescription = list.FirstOrDefault().ProductTableTitleDescription;
                    }

                    return model;
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Пример #5
0
        public List<ProductCategoryModel> GenerateProductCategoryModel()
        {
            List<ProductCategoryModel> modelList = new List<ProductCategoryModel>();
            ProductCategoryModel model = new ProductCategoryModel();
            ProductHeaderModel model2 = new ProductHeaderModel();
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductCategories.ToList()
                                       orderby p.ProductCategoryId ascending
                                       select p;

                    foreach (var item in list)
                    {
                        model = new ProductCategoryModel();
                        model.ProductCategoryId = item.ProductCategoryId;
                        model.ProductCategory = item.ProductCategory1;
                        //model.ProductHeaderModel = GetProductHeaderByProductCategoryId(item.ProductCategoryId);
                        model.PriceListModel = GetPriceListByProductCategoryId(item.ProductCategoryId);
                        modelList.Add(model);
                    }

                    return modelList;

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Пример #6
0
        public ActionResult AddHeader(string tableHeader, int productCategoryId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();
            ProductHeaderModel model = new ProductHeaderModel();
            try
            {
                model.ProductCategoryId = productCategoryId;
                model.ProductTableTitleDescription = tableHeader;
                dataService.InsertProductHeader(model);
                return RedirectToAction("Edit", "Price");
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Пример #7
0
        public ActionResult EditHeader(int headerId)
        {
            CommonDataService cds = new CommonDataService();

            CommonModel cm = new CommonModel();

            cm = cds.GenerateCommonModel();
            Session["FaceBook"] = cm.FaceBook;
            Session["Twitter"] = cm.Twitter;
            Session["Youtube"] = cm.Youtube;
            Session["Instagram"] = cm.Instagram;
            Session["PhoneNumber"] = cm.PhoneNumber;
            Session["Email"] = cm.Email;
            Session["ShoppingHours"] = cm.ShoppingHours;
            PriceDataService dataService = new PriceDataService();
            ProductHeaderModel model = new ProductHeaderModel();
            try
            {
                model = dataService.GetProductHeaderByHeaderId(headerId);
                return View(model);
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }