Example #1
0
        public ActionResult Add(ProductCategoryModel pcm)
        {
            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();
            try
            {
                dataService.InsertProductCategory(pcm);
                return RedirectToAction("Edit", "Price");
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                dataService = null;
            }
        }
Example #2
0
        public void UpdateProductCategory(ProductCategoryModel pcm)
        {
            try
            {
                ProductCategory table = new ProductCategory();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    table = vdc.ProductCategories.Single(a => a.ProductCategoryId == pcm.ProductCategoryId);
                    table.ProductCategoryId = pcm.ProductCategoryId;
                    table.ProductCategory1 = pcm.ProductCategory;
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #3
0
        public void InsertProductCategory(ProductCategoryModel pcm)
        {
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    ProductCategory receivedPM = new ProductCategory();
                    receivedPM.ProductCategory1 = pcm.ProductCategory;

                    vdc.ProductCategories.InsertOnSubmit(receivedPM);
                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #4
0
        public ProductCategoryModel GetProductCategoryModelByProductCategoryId(int productCategoryId)
        {
            ProductCategoryModel model = new ProductCategoryModel();
            try
            {
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    var list = from p in vdc.ProductCategories.ToList()
                               where p.ProductCategoryId == productCategoryId
                               select p;
                    if (list != null)
                    {
                        model.ProductCategoryId = list.FirstOrDefault().ProductCategoryId;
                        model.ProductCategory = list.FirstOrDefault().ProductCategory1;
                    }

                    return model;

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Example #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;
            }
        }
Example #6
0
        public ActionResult EditCategory(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();
            ProductCategoryModel model = new ProductCategoryModel();
            try
            {
                model = dataService.GetProductCategoryModelByProductCategoryId(productCategoryId);

                return View(model);
            }
            catch (Exception ex)
            {

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