public ActionResult Detail(int detailId = 0) { PoDetailViewModel model = new PoDetailViewModel(); PoManager manager = new PoManager(); EmployeeManager empManager = new EmployeeManager(); CommissionManager comManager = new CommissionManager(); if (detailId > 0) { ViewBag.Action = "Edit"; int currentProfilerId = 0; // if role is not "Able" then has to get profilerId if (Helper.UserRole != "1") { currentProfilerId = empManager.GetEmployeeDetail(0).ProfileId; } model = manager.GetPoDetail(detailId); if (currentProfilerId.Equals(model.SalesProfileId1) || currentProfilerId.Equals(model.SalesProfileId2) || currentProfilerId.Equals(model.SalesProfileId3)) { model.IsOwner = true; } else { model.IsOwner = false; } } else { ViewBag.Action = "New"; model = manager.MappingCommissionDetail(model); model.IsOwner = true; model.PoDate = DateTime.UtcNow; model.CommissionRate = comManager.GetCommissionRate(false); } // Set config model.CommissionPayRate = Helper.CommissionPayRate; model.CommissionForSale = Helper.CommissionForSale; // Set Lookup List <LookupModel> lookupEmployee = new List <LookupModel> { new LookupModel { Key = "-1", Value = "Please select employee" } }; lookupEmployee.AddRange(empManager.GetLookup()); model.LookupEmployee = lookupEmployee; model.LookupProductType = Helper.LookupProductType; model.LookupProductBrand = Helper.LookupProductBrand; model.LookupTransportLocation = Helper.LookupTransportationProvince; model.LookupPosition = Helper.LookupPosition; return(View(model)); }
public ActionResult Rate() { CommissionManager manager = new CommissionManager(); CommissionRateViewModel model = manager.GetCommissionRate(); return(View(model)); }