public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } int ProductTypeId = (from p in db.Product where p.ProductId == id select new { ProductTypeId = p.ProductGroup.ProductTypeId }).FirstOrDefault().ProductTypeId; BomDetail BomDetail = _BomDetailService.Find(id); if (BomDetail == null) { return(HttpNotFound()); } var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(ProductTypeId); //BomDetail.ProductTypeSettings = Mapper.Map<ProductTypeSettings, ProductTypeSettingsViewModel>(settings); return(View(BomDetail)); }
public ActionResult _Create(int Id) //Id ==>Sale Order Header Id { int ProductTypeId = (from p in db.Product where p.ProductId == Id select new { ProductTypeId = p.ProductGroup.ProductTypeId }).FirstOrDefault().ProductTypeId; ProductConsumptionLineViewModel s = new ProductConsumptionLineViewModel(); s.BaseProductId = Id; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(ProductTypeId); s.ProductTypeSettings = Mapper.Map <ProductTypeSettings, ProductTypeSettingsViewModel>(settings); var MainContens = _BomDetailService.GetConsumptionForIndex(Id); var LastMainContentLine = (from L in MainContens orderby L.BomDetailId descending select new { BomDetailId = L.BomDetailId, ProductId = L.ProductId }).FirstOrDefault(); if (LastMainContentLine != null) { s.ProductId = LastMainContentLine.ProductId; } PrepareViewBag(s); return(PartialView("_Create", s)); }
// GET: /ProductMaster/Edit/5 public ActionResult Edit(int id) { Dimension3 D1 = _Dimension3Service.Find(id); Dimension3ViewModel pt = Mapper.Map <Dimension3, Dimension3ViewModel>(D1); if (pt == null) { return(HttpNotFound()); } ViewBag.id = pt.ProductTypeId; ViewBag.Name = new ProductTypeService(_unitOfWork).Find(pt.ProductTypeId ?? 0).ProductTypeName; if (pt.ProductTypeId != null) { var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument((int)pt.ProductTypeId); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "ProductTypeSettings", new { id = id }).Warning("Please create Product Type Settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } pt.ProductTypeSettings = Mapper.Map <ProductTypeSettings, ProductTypeSettingsViewModel>(settings); } return(View("Create", pt)); }
// GET: /ProductMaster/Create public ActionResult Create(int id) { ProductGroup vm = new ProductGroup(); vm.IsActive = true; vm.ProductTypeId = id; ViewBag.id = id; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(id); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "ProductTypeSettings", new { id = id }).Warning("Please create Product Type Settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } //var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(id); string ProductTypeName = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId).ProductTypeName; ViewBag.Name = (settings.ProductGroupCaption ?? "Product Group") + "-" + ProductTypeName; ViewBag.ProductGroupCaption = settings.ProductGroupCaption ?? "Product Group"; ViewBag.SalesTaxProductCodeCaption = "Default " + (settings.SalesTaxProductCodeCaption ?? "Sales Tax Product Code"); ViewBag.IsVisibleSalesTaxProductCode = settings.isVisibleSalesTaxProductCode ?? false; //ViewBag.Name = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; return(View("Create", vm)); }
// GET: /ProductMaster/ public ActionResult Index(int id)//ProductTypeId { //return RedirectToAction("Create"); ViewBag.id = id; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(id); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "ProductTypeSettings", new { id = id }).Warning("Please create Product Type Settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } string ProductTypeName = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; ViewBag.Name = (settings.ProductGroupCaption ?? "Product Group") + "-" + ProductTypeName; //ViewBag.Name = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; var p = _ProductGroupService.GetProductGroupList(id); return(View(p)); }
// GET: /ProductMaster/Create public ActionResult Create(int id)//ProductType Id { Dimension1ViewModel vm = new Dimension1ViewModel(); vm.IsActive = true; vm.ProductTypeId = id; ViewBag.id = id; ViewBag.Name = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(id); if (settings == null && UserRoles.Contains("SysAdmin")) { return(RedirectToAction("Create", "ProductTypeSettings", new { id = id }).Warning("Please create Product Type Settings")); } else if (settings == null && !UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } vm.ProductTypeSettings = Mapper.Map <ProductTypeSettings, ProductTypeSettingsViewModel>(settings); return(View("Create", vm)); }
// GET: /ProductMaster/ public ActionResult Index(int id) { var p = _ProductCategoryService.GetProductCategoryList(id); ViewBag.id = id; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(id); string ProductTypeName = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; ViewBag.Name = (settings.ProductCategoryCaption ?? "Product Category") + "-" + ProductTypeName; //ViewBag.Name = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; return(View(p)); }
// GET: /ProductMaster/Create public ActionResult Create(int id) { ProductCategory vm = new ProductCategory(); vm.IsActive = true; vm.ProductTypeId = id; ViewBag.id = id; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(id); string ProductTypeName = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId).ProductTypeName; ViewBag.Name = (settings.ProductCategoryCaption ?? "Product Category") + "-" + ProductTypeName; ViewBag.ProductCategoryCaption = settings.ProductCategoryCaption ?? "Product Category"; ViewBag.SalesTaxProductCodeCaption = "Default " + (settings.SalesTaxProductCodeCaption ?? "Sales Tax Product Code"); ViewBag.IsVisibleSalesTaxProductCode = settings.isVisibleSalesTaxProductCode ?? false; //ViewBag.Name = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId).ProductTypeName; return(View("Create", vm)); }
// GET: /ProductMaster/Edit/5 public ActionResult Edit(int id) { ProductCategory pt = _ProductCategoryService.Find(id); if (pt == null) { return(HttpNotFound()); } ViewBag.id = pt.ProductTypeId; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(pt.ProductTypeId); string ProductTypeName = new ProductTypeService(_unitOfWork).Find(pt.ProductTypeId).ProductTypeName; ViewBag.Name = (settings.ProductCategoryCaption ?? "Product Category") + "-" + ProductTypeName; ViewBag.ProductCategoryCaption = settings.ProductCategoryCaption ?? "Product Category"; ViewBag.SalesTaxProductCodeCaption = "Default " + (settings.SalesTaxProductCodeCaption ?? "Sales Tax Product Code"); ViewBag.IsVisibleSalesTaxProductCode = settings.isVisibleSalesTaxProductCode ?? false; //ViewBag.Name = new ProductTypeService(_unitOfWork).Find(pt.ProductTypeId).ProductTypeName; return(View("Create", pt)); }
public ActionResult _Edit(int id) { ProductConsumptionLineViewModel s = _BomDetailService.GetProductConsumptionLineForEdit(id); PrepareViewBag(s); int ProductTypeId = (from p in db.Product where p.ProductId == s.BaseProductId select new { ProductTypeId = p.ProductGroup.ProductTypeId }).FirstOrDefault().ProductTypeId; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(ProductTypeId); s.ProductTypeSettings = Mapper.Map <ProductTypeSettings, ProductTypeSettingsViewModel>(settings); if (s == null) { return(HttpNotFound()); } return(PartialView("_Create", s)); }
// GET: /ProductTypeSettingMaster/Create public ActionResult Create(int id)//ProductTypeId { if (!UserRoles.Contains("SysAdmin")) { return(View("~/Views/Shared/InValidSettings.cshtml")); } var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettings(id); if (settings == null) { ProductTypeSettingsViewModel vm = new ProductTypeSettingsViewModel(); vm.ProductTypeName = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; vm.ProductTypeId = id; PrepareViewBag(vm); return(View("Create", vm)); } else { ProductTypeSettingsViewModel temp = AutoMapper.Mapper.Map <ProductTypeSettings, ProductTypeSettingsViewModel>(settings); temp.ProductTypeName = new ProductTypeService(_unitOfWork).Find(id).ProductTypeName; PrepareViewBag(temp); return(View("Create", temp)); } }
// GET: /DeliveryTermsMaster/ private void PrepareViewBag(int ProductTypeId, string Routeid) { var Caption = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettings(ProductTypeId); List <SelectListItem> temp = new List <SelectListItem>(); temp.Add(new SelectListItem { Text = Caption.Dimension1Caption.ToString() != "" ? Caption.Dimension1Caption.ToString() : StockInHandGroupOnConstants.Dimension1, Value = StockInHandGroupOnConstants.Dimension1 }); temp.Add(new SelectListItem { Text = Caption.Dimension2Caption.ToString() != "" ? Caption.Dimension2Caption.ToString() : StockInHandGroupOnConstants.Dimension2, Value = StockInHandGroupOnConstants.Dimension2 }); temp.Add(new SelectListItem { Text = Caption.Dimension3Caption.ToString() != "" ? Caption.Dimension3Caption.ToString() : StockInHandGroupOnConstants.Dimension3, Value = StockInHandGroupOnConstants.Dimension3 }); temp.Add(new SelectListItem { Text = Caption.Dimension4Caption.ToString() != "" ? Caption.Dimension4Caption.ToString() : StockInHandGroupOnConstants.Dimension4, Value = StockInHandGroupOnConstants.Dimension4 }); if (Routeid == "Stock") { temp.Add(new SelectListItem { Text = StockInHandGroupOnConstants.Godown, Value = StockInHandGroupOnConstants.Godown }); } else { temp.Add(new SelectListItem { Text = StockInHandGroupOnConstants.Person, Value = StockInHandGroupOnConstants.Person }); } temp.Add(new SelectListItem { Text = StockInHandGroupOnConstants.LotNo, Value = StockInHandGroupOnConstants.LotNo }); temp.Add(new SelectListItem { Text = StockInHandGroupOnConstants.Process, Value = StockInHandGroupOnConstants.Process }); temp.Add(new SelectListItem { Text = StockInHandGroupOnConstants.Product, Value = StockInHandGroupOnConstants.Product }); ViewBag.GroupOnList = new SelectList(temp, "Value", "Text"); List <SelectListItem> shwBal = new List <SelectListItem>(); shwBal.Add(new SelectListItem { Text = StockInHandShowBalanceConstants.GreaterThanZero, Value = StockInHandShowBalanceConstants.GreaterThanZero }); shwBal.Add(new SelectListItem { Text = StockInHandShowBalanceConstants.LessThanZero, Value = StockInHandShowBalanceConstants.LessThanZero }); shwBal.Add(new SelectListItem { Text = StockInHandShowBalanceConstants.NotZero, Value = StockInHandShowBalanceConstants.NotZero }); shwBal.Add(new SelectListItem { Text = StockInHandShowBalanceConstants.PeriodNegative, Value = StockInHandShowBalanceConstants.PeriodNegative }); shwBal.Add(new SelectListItem { Text = StockInHandShowBalanceConstants.Zero, Value = StockInHandShowBalanceConstants.Zero }); shwBal.Add(new SelectListItem { Text = StockInHandShowBalanceConstants.All, Value = StockInHandShowBalanceConstants.All }); ViewBag.ShowBalanceList = new SelectList(shwBal, "Value", "Text"); }
public ActionResult GetStockInHand(int id) { var settings = new StockInHandSettingService(_unitOfWork).GetTrailBalanceSetting(User.Identity.Name); List <string> UserRoles = (List <string>)System.Web.HttpContext.Current.Session["Roles"]; if (settings == null) { return(RedirectToAction("Create", "StockInHandSetting", new { ProductTypeId = id, ControllerName = "StockProcessDisplay" }).Warning("Please create Stock In Hand settings")); } string FromDate = settings.ToDate.HasValue ? settings.FromDate.Value.ToString("dd/MMM/yyyy") : ""; string ToDate = settings.ToDate.HasValue ? settings.ToDate.Value.ToString("dd/MMM/yyyy") : ""; Dimension1Types Dimension1Type = new ProductTypeService(_unitOfWork).GetProductTypeDimension1Types(id); Dimension2Types Dimension2Type = new ProductTypeService(_unitOfWork).GetProductTypeDimension2Types(id); ProductTypeSettings ProductTypeSetting = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettings(id); ProductType ProductType = new ProductTypeService(_unitOfWork).Find(id); if (ProductTypeSetting.Dimension1Caption == null) { ViewBag.Dimension1Caption = "Dimension1"; } else { ViewBag.Dimension1Caption = ProductTypeSetting.Dimension1Caption; } if (ProductTypeSetting.Dimension2Caption == null) { ViewBag.Dimension2Caption = "Dimension2"; } else { ViewBag.Dimension2Caption = ProductTypeSetting.Dimension2Caption; } if (ProductTypeSetting.Dimension3Caption == null) { ViewBag.Dimension3Caption = "Dimension3"; } else { ViewBag.Dimension3Caption = ProductTypeSetting.Dimension3Caption; } if (ProductTypeSetting.Dimension4Caption == null) { ViewBag.Dimension4Caption = "Dimension4"; } else { ViewBag.Dimension4Caption = ProductTypeSetting.Dimension4Caption; } if (ProductTypeSetting.ProductNameCaption == null) { ViewBag.ProductNameCaption = "Product"; } else { ViewBag.ProductNameCaption = ProductTypeSetting.ProductNameCaption; } ViewBag.FilterRemark = "( From Date : " + FromDate + " To Date : " + ToDate + " Product Type : " + ProductType.ProductTypeName + " )"; ViewBag.id = id; ViewBag.ControllerName = "StockProcessDisplay"; ViewBag.GroupOn = settings.GroupOn; //if(settings.DisplayType==DisplayTypeConstants.Balance) return(View("StockInHandIndex")); //else // return View("StockInHandSummaryIndex"); }
public ActionResult Post(ProductCategory vm) { ProductCategory pt = vm; var settings = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettingsForDocument(vm.ProductTypeId); if (ModelState.IsValid) { if (vm.ProductCategoryId <= 0) { pt.CreatedDate = DateTime.Now; pt.ModifiedDate = DateTime.Now; pt.CreatedBy = User.Identity.Name; pt.ModifiedBy = User.Identity.Name; pt.ObjectState = Model.ObjectState.Added; _ProductCategoryService.Create(pt); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); ViewBag.id = vm.ProductTypeId; ViewBag.Name = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId).ProductTypeName; ViewBag.ProductCategoryCaption = settings.ProductCategoryCaption ?? "Product Category"; ViewBag.SalesTaxProductCodeCaption = "Default " + (settings.SalesTaxProductCodeCaption ?? "Sales Tax Product Code"); ViewBag.IsVisibleSalesTaxProductCode = settings.isVisibleSalesTaxProductCode ?? false; return(View("Create", vm)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ProductCategry).DocumentTypeId, DocId = pt.ProductCategoryId, ActivityType = (int)ActivityTypeContants.Added, })); return(RedirectToAction("Create", new { id = pt.ProductTypeId }).Success("Data saved successfully")); } else { List <LogTypeViewModel> LogList = new List <LogTypeViewModel>(); ProductCategory temp = _ProductCategoryService.Find(pt.ProductCategoryId); ProductCategory ExRec = Mapper.Map <ProductCategory>(temp); temp.ProductCategoryName = pt.ProductCategoryName; temp.ProductTypeId = pt.ProductTypeId; temp.DefaultSalesTaxProductCodeId = pt.DefaultSalesTaxProductCodeId; temp.IsActive = pt.IsActive; temp.ModifiedDate = DateTime.Now; temp.ModifiedBy = User.Identity.Name; temp.ObjectState = Model.ObjectState.Modified; _ProductCategoryService.Update(temp); LogList.Add(new LogTypeViewModel { ExObj = ExRec, Obj = temp, }); XElement Modifications = new ModificationsCheckService().CheckChanges(LogList); try { _unitOfWork.Save(); } catch (Exception ex) { string message = _exception.HandleException(ex); ModelState.AddModelError("", message); ViewBag.id = vm.ProductTypeId; ViewBag.Name = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId).ProductTypeName; ViewBag.ProductCategoryCaption = settings.ProductCategoryCaption ?? "Product Category"; ViewBag.SalesTaxProductCodeCaption = "Default " + (settings.SalesTaxProductCodeCaption ?? "Sales Tax Product Code"); ViewBag.IsVisibleSalesTaxProductCode = settings.isVisibleSalesTaxProductCode ?? false; return(View("Create", pt)); } LogActivity.LogActivityDetail(LogVm.Map(new ActiivtyLogViewModel { DocTypeId = new DocumentTypeService(_unitOfWork).FindByName(MasterDocTypeConstants.ProductCategry).DocumentTypeId, DocId = temp.ProductCategoryId, ActivityType = (int)ActivityTypeContants.Modified, xEModifications = Modifications, })); return(RedirectToAction("Index", new { id = pt.ProductTypeId }).Success("Data saved successfully")); } } ViewBag.id = vm.ProductTypeId; ViewBag.Name = new ProductTypeService(_unitOfWork).Find(vm.ProductTypeId).ProductTypeName; return(View("Create", vm)); }
public ActionResult GetStockInHand(int id, string Routeid) { ProductTypeSettings ProductTypeSetting = new ProductTypeSettingsService(_unitOfWork).GetProductTypeSettings(id); if (ProductTypeSetting != null) { System.Web.HttpContext.Current.Session["Route"] = Routeid; System.Web.HttpContext.Current.Session["ProductTypeId"] = id; var settings = new StockInHandSettingService(_unitOfWork).GetTrailBalanceSetting(User.Identity.Name, id, Routeid); List <string> UserRoles = (List <string>)System.Web.HttpContext.Current.Session["Roles"]; //if (settings == null) //{ // return RedirectToAction("Create", "StockInHandSetting", new { ProductTypeId = id, ControllerName = "StockInHandDisplay" }).Warning("Please create Stock In Hand settings"); //} if (settings == null) { settings = new StockInHandSettingService(_unitOfWork).GetTrailBalanceSetting(id, Routeid); if (settings == null) { return(RedirectToAction("Create", "StockInHandSetting", new { ProductTypeId = id, ControllerName = "StockInHandDisplay", Route = Routeid }).Warning("Please create Stock In Hand settings")); } } string FromDate = settings.ToDate.HasValue ? settings.FromDate.Value.ToString("dd/MMM/yyyy") : ""; string ToDate = settings.ToDate.HasValue ? settings.ToDate.Value.ToString("dd/MMM/yyyy") : ""; Dimension1Types Dimension1Type = new ProductTypeService(_unitOfWork).GetProductTypeDimension1Types(id); Dimension2Types Dimension2Type = new ProductTypeService(_unitOfWork).GetProductTypeDimension2Types(id); ProductType ProductType = new ProductTypeService(_unitOfWork).Find(id); if (ProductTypeSetting.Dimension1Caption == null) { ViewBag.Dimension1Caption = "Dimension1"; } else { ViewBag.Dimension1Caption = ProductTypeSetting.Dimension1Caption; } if (ProductTypeSetting.Dimension2Caption == null) { ViewBag.Dimension2Caption = "Dimension2"; } else { ViewBag.Dimension2Caption = ProductTypeSetting.Dimension2Caption; } if (ProductTypeSetting.Dimension3Caption == null) { ViewBag.Dimension3Caption = "Dimension3"; } else { ViewBag.Dimension3Caption = ProductTypeSetting.Dimension3Caption; } if (ProductTypeSetting.Dimension4Caption == null) { ViewBag.Dimension4Caption = "Dimension4"; } else { ViewBag.Dimension4Caption = ProductTypeSetting.Dimension4Caption; } if (ProductTypeSetting.ProductNameCaption == null) { ViewBag.ProductNameCaption = "Product"; } else { ViewBag.ProductNameCaption = ProductTypeSetting.ProductNameCaption; } ViewBag.FilterRemark = "( From Date : " + FromDate + " To Date : " + ToDate + " Product Type : " + ProductType.ProductTypeName + " )"; ViewBag.id = id; ViewBag.ControllerName = "StockInHandDisplay"; ViewBag.GroupOn = settings.GroupOn; int ShowOpening = (settings.ShowOpening == true ? 1 : 0); ViewBag.ShowOpening = ShowOpening; if (Routeid == "Stock") { ViewBag.TitleName = "Stock In Hand Display"; } else { ViewBag.TitleName = "Stock Process Display"; } ViewBag.Routeid = Routeid; //if(settings.DisplayType==DisplayTypeConstants.Balance) return(View("StockInHandIndex")); } else { throw new ApplicationException("Product Type settings Is not Define"); } //else // return View("StockInHandSummaryIndex"); }