public ActionResult QuataInMonth() { SalePlanModel SalePlanModel1 = (SalePlanModel)Session[SalePlanModel.USER_SALE_PLAN_SESSION]; if (SalePlanModel1 == null) { SalePlanModel1 = new SalePlanModel(); DateTime Date1 = DateTime.Now; SalePlanModel1.Month = Date1.Month; SalePlanModel1.Year = Date1.Year; Session[SalePlanModel.USER_SALE_PLAN_SESSION] = SalePlanModel1; } SalePlanModel1.PlanOfficeType = SalePlanModel.PlanType.QUOTA_IN_MONTH.ToString(); ViewData["PlanTypeList"] = SalePlanModel.PlanTypeList; DateTime SearchDate = DateUtils.Convert2DateTime("01/" + DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year); ViewData["SalePlans4Com"] = UsersServices1.getPlanComs(SearchDate); ViewData["SalePlans4Dept"] = UsersServices1.getPlanDepts(SearchDate); if (User1.ComId != null) { ViewData["SalePlans4Salses"] = UsersServices1.getQuataInMonth(User1.ComId.Value, SearchDate); } return(View(SalePlanModel1)); }
public ActionResult ManagerPlan4Sales(long Id, SalePlanModel SalePlanModel1) { Session[SalePlanModel.USER_SALE_PLAN_SESSION] = SalePlanModel1; DateTime SearchDate = DateUtils.Convert2DateTime("01/" + DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year); SalePlan SalePlan1 = UsersServices1.getSalePlanByUser(Id, SearchDate); User UserSale = UsersServices1.getUserById(Id); UsersServices1.UpdateSalePlan(Id, SearchDate, SalePlanModel1.PlanValue); ViewData["SalePlans"] = UsersServices1.getPlanDept(User1.DeptId.Value, SearchDate); return(RedirectToAction("ManagerPlan4Sales", new { id = 0 })); }
public ActionResult ManagerPlan4Sales(long Id) { SalePlanModel SalePlanModel1 = null; try { SalePlanModel1 = (SalePlanModel)Session[SalePlanModel.USER_SALE_PLAN_SESSION]; if (SalePlanModel1 == null) { SalePlanModel1 = new SalePlanModel(); DateTime Date1 = DateTime.Now; SalePlanModel1.Month = Date1.Month; SalePlanModel1.Year = Date1.Year; Session[SalePlanModel.USER_SALE_PLAN_SESSION] = SalePlanModel1; } DateTime SearchDate = DateUtils.Convert2DateTime("01/" + DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year); ViewData["PlanFor"] = DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year; User UserSale = UsersServices1.getUserById(Id); if (UserSale != null) { ViewData["Action"] = "Update"; SalePlan SalePlan1 = UsersServices1.getSalePlanByUser(Id, SearchDate); SalePlanModel1.SaleName = UserSale.FullName; if (SalePlan1 != null) { SalePlanModel1.PlanValue = Convert.ToDouble(SalePlan1.PlanValue); } else { SalePlanModel1.PlanValue = 0; } } SalePlan DeptSalePlan = UsersServices1.getSalePlanByDept(User1.DeptId.Value, SearchDate); if (DeptSalePlan == null) { ViewData["DeptSalePlan"] = "0.0"; } else { ViewData["DeptSalePlan"] = DeptSalePlan.PlanValue.Value.ToString("0.0"); } ViewData["SalePlans"] = UsersServices1.getPlanDept(User1.DeptId.Value, SearchDate); } catch (Exception e) { } return(View(SalePlanModel1)); }
public ActionResult Plan4Depts(long Id, SalePlanModel SalePlanModel1) { if (SalePlanModel.PlanType.OFFICE.ToString().Equals(SalePlanModel1.PlanOfficeType)) { return(RedirectToAction("DirectorPlan4Sales", new { id = 0 })); } if (SalePlanModel.PlanType.QUOTA_IN_MONTH.ToString().Equals(SalePlanModel1.PlanOfficeType)) { return(RedirectToAction("QuataInMonth", new { id = 0 })); } Session[SalePlanModel.USER_SALE_PLAN_SESSION] = SalePlanModel1; DateTime SearchDate = DateUtils.Convert2DateTime("01/" + DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year); UsersServices1.UpdateSalePlanDept(Id, SearchDate, SalePlanModel1.PlanValue); ViewData["SalePlans"] = UsersServices1.getPlanDepts(User1.ComId.Value, SearchDate); return(RedirectToAction("Plan4Depts", new { id = 0 })); }
public ActionResult Plan4Depts(long Id) { SalePlanModel SalePlanModel1 = (SalePlanModel)Session[SalePlanModel.USER_SALE_PLAN_SESSION]; if (SalePlanModel1 == null) { SalePlanModel1 = new SalePlanModel(); DateTime Date1 = DateTime.Now; SalePlanModel1.Month = Date1.Month; SalePlanModel1.Year = Date1.Year; Session[SalePlanModel.USER_SALE_PLAN_SESSION] = SalePlanModel1; } DateTime SearchDate = DateUtils.Convert2DateTime("01/" + DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year); ViewData["PlanFor"] = DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year; Department DepartmentSale = UsersServices1.getDepartmentById(Id); if (DepartmentSale != null) { ViewData["Action"] = "Update"; SalePlan SalePlan1 = UsersServices1.getSalePlanByDept(Id, SearchDate); SalePlanModel1.SaleName = DepartmentSale.DeptName; if (SalePlan1 != null) { SalePlanModel1.PlanValue = Convert.ToDouble(SalePlan1.PlanValue); } else { SalePlanModel1.PlanValue = 0; } } SalePlanModel1.PlanOfficeType = SalePlanModel.PlanType.DEPARTMENT.ToString(); ViewData["PlanTypeList"] = SalePlanModel.PlanTypeList; ViewData["SalePlans"] = UsersServices1.getPlanDepts(User1.ComId.Value, SearchDate); return(View(SalePlanModel1)); }
public ActionResult DirectorPlan4Sales(long Id) { SalePlanModel SalePlanModel1 = (SalePlanModel)Session[SalePlanModel.USER_SALE_PLAN_SESSION]; if (SalePlanModel1 == null) { SalePlanModel1 = new SalePlanModel(); DateTime Date1 = DateTime.Now; SalePlanModel1.Month = Date1.Month; SalePlanModel1.Year = Date1.Year; Session[SalePlanModel.USER_SALE_PLAN_SESSION] = SalePlanModel1; } DateTime SearchDate = DateUtils.Convert2DateTime("01/" + DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year); ViewData["PlanFor"] = DateUtils.ConvertDay(SalePlanModel1.Month.ToString()) + "/" + SalePlanModel1.Year; Company Company1 = UsersServices1.getCompanyById(Id); if (Company1 != null) { ViewData["Action"] = "Update"; SalePlan SalePlan1 = UsersServices1.getSalePlanByCom(Id, SearchDate); SalePlanModel1.SaleName = Company1.CompanyName; if (SalePlan1 != null) { SalePlanModel1.PlanValue = Convert.ToDouble(SalePlan1.PlanValue); } else { SalePlanModel1.PlanValue = 0; } } SalePlanModel1.PlanOfficeType = SalePlanModel.PlanType.OFFICE.ToString(); ViewData["PlanTypeList"] = SalePlanModel.PlanTypeList; ViewData["SalePlans"] = UsersServices1.getPlanComs(SearchDate); return(View(SalePlanModel1)); }