public ActionResult Create(SalesTarget model) { model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); model.FyId = new FinancialYearRepository().getfinyear(OrganizationId); var repo = new SalesTargetRepository(); bool isexists = repo.IsFieldExists(repo.ConnectionString(), "SalesTarget", "SalesTargetRefNo", model.SalesTargetRefNo, null, null); if (!isexists) { var result = new SalesTargetRepository().InsertSalesTarget(model); if (result.OrganizationId > 0) { TempData["Success"] = "Added Successfully!"; TempData["SalesTargetRefNo"] = result.SalesTargetRefNo; return(RedirectToAction("Create")); } else { dropdown(); TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["SalesTargetRefNo"] = null; return(View("Create", model)); } } else { dropdown(); TempData["error"] = "This Organization Name Alredy Exists!!"; TempData["SalesTargetRefNo"] = null; return(View("Create", model)); } }
public ActionResult Delete(SalesTarget model) { model.CreatedBy = UserID.ToString(); int result = new SalesTargetRepository().DeleteSalesTarget(model); if (result == 0) { TempData["Success"] = "Deleted Successfully"; TempData["SalesTargetRefNo"] = model.SalesTargetRefNo; return(RedirectToAction("Create")); } else { if (result == 1) { TempData["error"] = "Sorry!! You Cannot Delete This Sales Target It Is Already In Use"; TempData["SalesTargetRefNo"] = null; } else { TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["SalesTargetRefNo"] = null; } return(RedirectToAction("Create")); } }
public ActionResult Edit(int Id) { dropdown(); ViewBag.Title = "Edit"; SalesTarget objSalesTarget = new SalesTargetRepository().GetSalesTarget(Id); return(View("Create", objSalesTarget)); }
public ActionResult SalesIncentiveReport(int?FyId) { var model = new SalesTargetRepository().GetSalesIncentiveReportDetails(UserID, UserRolename, FyId); Session["BussData"] = model; return(PartialView("_SalesIncentiveReport", model)); //return PartialView("_SalesIncentiveReport", new SalesTargetRepository().GetSalesIncentiveReportDetails(UserID,UserRolename,FyId)); }
public ActionResult FillSalesTargetList(int?page) { int itemsPerPage = 10; int pageNumber = page ?? 1; var repo = new SalesTargetRepository(); var List = repo.FillSalesTargetList(); return(PartialView("SalesTargetListView", List)); }
public ActionResult Create(SalesTarget model) { if (!ModelState.IsValid) { var allErrors = ModelState.Values.SelectMany(v => v.Errors); return(View(model)); } Result res = new SalesTargetRepository().Insert(model); if (res.Value) { TempData["Success"] = "Saved Successfully!"; } else { } return(RedirectToAction("Create")); }
public void dropdown() { var repo = new SalesTargetRepository(); var List = repo.FillMonth(); ViewBag.Month = new SelectList(List, "Id", "Name"); var desrepo = new SalesTargetRepository(); var workDescription = desrepo.FillWorkDescription(); ViewBag.workDes = new SelectList(workDescription, "Id", "Name"); DropdownRepository repos = new DropdownRepository(); var result = repos.OrganizationDropdown(); ViewBag.OrganizationName = new SelectList(result, "Id", "Name"); // ViewBag.OrganizationName = new SelectList(new DropdownRepository().OrganizationDropdown(OrganizationId), "Id", "Name"); }