public ActionResult RequestVDA() { int idCARRDetail = int.Parse(Request.Form["idcarrdetail"]); ViewBag.Title = "Request VDA"; string userName = Session["accountname"].ToString(); var controller = DependencyResolver.Current.GetService <ContractController>(); controller.ControllerContext = new ControllerContext(this.Request.RequestContext, controller); ViewBag.SubmitDisable = false; //Details used in Partial Info Bar var MyCarrDetail = db.CARRDetails.Where(x => x.idCARRDetail == idCARRDetail && x.ActiveFlag == true).FirstOrDefault(); var MyCarr = db.CARRs.Where(x => x.idCarr == MyCarrDetail.idCARR).FirstOrDefault(); ViewBag.idCARRDetail = idCARRDetail; ViewBag.MyCarr = MyCarr; ViewBag.MyCarrDetail = MyCarrDetail; //Get Approval List - goes to DFL ViewBag.userList = HelperDropdowns.getContractsUserList(); return(View()); }
[Authorize] //[Authorize(Roles = "Admin")] public ActionResult UserMaintenance() { ViewBag.Title = "User Maintenance"; string sql = @" select aur.id, aur.idApplication, aur.ActiveDirectory, ar.Role, aur.ActiveFlag FROM COM.applicationUserRoles aur join COM.applicationRoles ar on ar.id = aur.idRole WHERE aur.idApplication = 1 and aur.ActiveFlag = 1 order by aur.ActiveDirectory"; String connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["PuroDB"].ConnectionString; DataTable dt = new DataTable(); SqlConnection connection = new SqlConnection(connectionString); connection.Open(); SqlDataAdapter da = new SqlDataAdapter(sql, connection); da.Fill(dt); connection.Close(); connection.Dispose(); ViewBag.result = dt; List <SelectListItem> userRoleList = HelperDropdowns.getUserRoles(); ViewBag.userRoleList = userRoleList; string userrole = Session["userrole"].ToString(); ViewBag.userrole = userrole; return(View()); }
public ActionResult EditAccess() { string username = Request.Form["username"].Trim(); var aur = db.applicationUserRoles.Where(x => x.ActiveDirectory.Equals(username)).FirstOrDefault(); List <SelectListItem> districts = HelperDropdowns.getDistrictList(); List <SelectListItem> regions = HelperDropdowns.getRegionList(); List <SelectListItem> users = HelperDropdowns.getUserList(); var previouslySelectedDistricts = db.ApplicationDistrictsAlloweds.Where(x => x.ActiveDirectory.Equals(username)).ToList(); var previouslySelectedBranches = db.ApplicationRegionsAlloweds.Where(x => x.ActiveDirectory.Equals(username)).ToList(); var previouslySelectDR = db.ApplicationUsersAlloweds.Where(x => x.ActiveDirectory.Equals(username)).ToList(); var signature = db.Signatures.Where(x => x.ActiveDirectory.Equals(username)).FirstOrDefault(); List <SelectListItem> userRoleList = HelperDropdowns.getUserRoles(); ViewBag.userRoleList = userRoleList; ViewBag.applicationUserRoles = aur; ViewBag.districtList = districts; ViewBag.regionList = regions; ViewBag.userList = users; ViewBag.previouslySelectedDistricts = previouslySelectedDistricts; ViewBag.previouslySelectedBranches = previouslySelectedBranches; ViewBag.previouslySelectDR = previouslySelectDR; ViewBag.signature = signature != null ? "../" + signature.ImageURL.Trim().Replace("\\", "/") : ""; ViewBag.Title = "Edit Access"; return(View(aur)); }
public ActionResult SubmitContracts() { int idCARRDetail = int.Parse(Request.Form["idcarrdetail"]); ViewBag.Title = "Submit to Contracts"; string userName = Session["accountname"].ToString(); var controller = DependencyResolver.Current.GetService <ContractController>(); controller.ControllerContext = new ControllerContext(this.Request.RequestContext, controller); //Determine what is still required ViewBag.SubmitDisable = false; List <string> reqlist = controller.CheckAllRequiredAccountFields(idCARRDetail); //Requirements needed bool requirementsFlag = reqlist.Count > 0 ? true : false; if (reqlist.Count > 0) { ViewBag.SubmitDisable = true; } string ReqHdr = controller.CheckAccountRequiredHdr(reqlist); ViewBag.ReqHdr = ReqHdr; ViewBag.MyReqlist = reqlist; //Details used in Partial Info Bar var MyCarrDetail = db.CARRDetails.Where(x => x.idCARRDetail == idCARRDetail && x.ActiveFlag == true).FirstOrDefault(); var MyCarr = db.CARRs.Where(x => x.idCarr == MyCarrDetail.idCARR).FirstOrDefault(); ViewBag.idCARRDetail = idCARRDetail; ViewBag.MyCarr = MyCarr; ViewBag.MyCarrDetail = MyCarrDetail; //Get Approval List - goes to DFL ViewBag.userList = HelperDropdowns.getDFLUserList(); return(View()); }
public ActionResult EditAccounts() { int idCARRDetail = int.Parse(Request.Form["idcarrdetail"]); int idService = int.Parse(Request.Form["idservice"]); int idLocation = int.Parse(Request.Form["idlocation"]); ViewBag.Title = "Contracts - Edit Account"; var MyCarrDetail = db.CARRDetails.Where(x => x.idCARRDetail == idCARRDetail).FirstOrDefault(); var MyCarr = db.CARRs.Where(x => x.idCarr == MyCarrDetail.idCARR).FirstOrDefault(); var MyLocation = db.CARRLocations.Where(x => x.idLocation == idLocation).FirstOrDefault(); var MyService = db.Services.Where(x => x.idService == idService).FirstOrDefault(); var MyLocationContact = db.Contacts.Where(x => x.idContact == MyLocation.idBranchContact).FirstOrDefault(); //var MyBillingOption = db.DropdownsOptions.Where(x => x.Value == MyService.idBillingOption.ToString()).FirstOrDefault(); //ViewBag.billingoptionselected = MyBillingOption.Name; var MyPrimary = from contact in db.Contacts join service in db.Services.Where(a => a.ActiveFlag == true && a.primaryBillingFlag == true) on contact.idContact equals service.idBillingContact join location in db.CARRLocations.Where(b => b.ActiveFlag == true) on service.idLocation equals location.idLocation join detail in db.CARRDetails.Where(c => c.idCARRDetail == MyCarrDetail.idCARRDetail && c.ActiveFlag == true) on location.idCARRDetail equals detail.idCARRDetail into primarycontact from pc in primarycontact.DefaultIfEmpty() select new { contact.idContact, contact.FirstName, contact.LastName, contact.Title, contact.PhoneNumber, contact.Address1, contact.Address2, contact.City, contact.State, contact.PostalCode, contact.Country }; Contact tempcontact = new Contact(); tempcontact.idContact = 0; tempcontact.FirstName = ""; tempcontact.LastName = ""; tempcontact.Title = ""; tempcontact.PhoneNumber = ""; tempcontact.Address1 = ""; tempcontact.Address2 = ""; tempcontact.City = ""; tempcontact.State = ""; tempcontact.PostalCode = ""; tempcontact.Country = ""; if (MyPrimary != null) { foreach (var p in MyPrimary) { if (p.FirstName != null) { tempcontact.FirstName = p.FirstName; } if (p.LastName != null) { tempcontact.LastName = p.LastName; } if (p.Title != null) { tempcontact.Title = p.Title; } if (p.PhoneNumber != null) { tempcontact.PhoneNumber = p.PhoneNumber; } if (p.Address1 != null) { tempcontact.Address1 = p.Address1; } if (p.Address2 != null) { tempcontact.Address2 = p.Address2; } if (p.City != null) { tempcontact.City = p.City; } if (p.State != null) { tempcontact.State = p.State; } if (p.PostalCode != null) { tempcontact.PostalCode = p.PostalCode; } if (p.Country != null) { tempcontact.Country = p.Country; } } } ViewBag.MyPrimary = tempcontact; //YesNo Flags, Default to false ViewBag.freightauditorselected = "0"; if (MyService.freightAuditorFlag == true) { ViewBag.freightauditorselected = "1"; } ViewBag.combinebillingselected = "0"; if (MyService.combineBillingFlag == true) { ViewBag.combinebillingselected = "1"; } ViewBag.separatebillingselected = "0"; if (MyService.separateBillingFlag == true) { ViewBag.separatebillingselected = "1"; } ViewBag.primarybillingselected = "0"; if (MyService.primaryBillingFlag == true) { ViewBag.primarybillingselected = "1"; } List <SelectListItem> statelist = HelperDropdowns.getStateList(); ViewBag.stateList = statelist; List <SelectListItem> localSRIDList = HelperDropdowns.getLocalSRIDList(); List <SelectListItem> strategicSRIDList = HelperDropdowns.getStrategicSRIDList(); ViewBag.localsridList = localSRIDList; ViewBag.strategicsridList = strategicSRIDList; //Details used in Partial Info Bar ViewBag.MyCarr = MyCarr; ViewBag.MyCarrDetail = MyCarrDetail; ViewBag.MyLocation = MyLocation; ViewBag.MyService = MyService; ViewBag.MyLocationContact = MyLocationContact; var MyDropdowns = db.DropdownsOptions; if (MyCarrDetail.idCarrType != null) { var MyCarrType = MyDropdowns.Where(t => t.Value == MyCarrDetail.idCarrType.ToString()).First(); ViewBag.MyCarrType = MyCarrType.Name; } var controller = DependencyResolver.Current.GetService <ContractController>(); controller.ControllerContext = new ControllerContext(this.Request.RequestContext, controller); bool DisableChanges = controller.disableChangesAcctCreation(idCARRDetail); ViewBag.DisableChanges = DisableChanges; return(View()); }
public ActionResult Complete() { int idCARRDetail = int.Parse(Request.Form["idcarrdetail"]); var MyCarrDetail = db.CARRDetails.Where(x => x.idCARRDetail == idCARRDetail && x.ActiveFlag == true).FirstOrDefault(); //var cc = new ContractController(); var controller = DependencyResolver.Current.GetService <ContractController>(); controller.ControllerContext = new ControllerContext(this.Request.RequestContext, controller); bool DisableChanges = controller.disableChanges(idCARRDetail); ViewBag.DisableChanges = DisableChanges; ViewBag.Title = "Complete the CARR"; //Determine what is still required ViewBag.SubmitDisable = false; List <string> reqlist = new List <string>(); ViewBag.MyReqlist = new List <string>(); bool requirementsFlag = false; //Requirements needed but only for Net New or Upsell if (MyCarrDetail.idCarrType == 2 || MyCarrDetail.idCarrType == 4) { reqlist = controller.CheckAllRequiredAccountNumbers(idCARRDetail); requirementsFlag = reqlist.Count > 0 ? true : false; if (reqlist.Count > 0) { ViewBag.SubmitDisable = true; ViewBag.MyReqlist = reqlist; } } string ReqHdr = controller.CheckAccountRequiredHdr(reqlist); ViewBag.ReqHdr = ReqHdr; ViewBag.idCARRDetail = idCARRDetail; ViewBag.SubmitTo = ""; string userrole = Session["userrole"].ToString(); ViewBag.userrole = userrole; if (userrole == "Sales") { ViewBag.SubmitTo = MyCarrDetail.SalesManager; } if (userrole == "SalesDSM") { ViewBag.SubmitTo = MyCarrDetail.DistrictManager; } //check RoutingDefaults table to see who the SubmitTo default should be if (ViewBag.SubmitTo == "") { var MyRoutingDefault = db.RoutingDefaults.Where(x => x.Role == userrole).FirstOrDefault(); if (MyRoutingDefault != null) { ViewBag.SubmitTo = MyRoutingDefault.RouteToUser.Trim(); } } var MyCarr = db.CARRs.Where(x => x.idCarr == MyCarrDetail.idCARR).FirstOrDefault(); //Details used in Partial Info Bar ViewBag.MyCarr = MyCarr; ViewBag.MyCarrDetail = MyCarrDetail; var MyDropdowns = db.DropdownsOptions; if (MyCarrDetail.idCarrType != null) { var MyCarrType = MyDropdowns.Where(t => t.Value == MyCarrDetail.idCarrType.ToString()).First(); ViewBag.MyCarrType = MyCarrType.Name; } List <SelectListItem> userList = HelperDropdowns.getUserList(); ViewBag.userLIst = userList; //Three Different Possibilities for Disabling Submit Button string userName = Session["accountname"].ToString(); var routing = db.Routings.Where(x => x.idRouting == MyCarrDetail.idRoutedTo).FirstOrDefault(); string routedToName = routing.RoutedTo.Trim(); ViewBag.routedToName = routedToName; //CARR is routed to a different user bool routedFlag = !userName.Equals(routedToName) ? true : false; //pricing is complete bool pricingFlag = MyCarrDetail.PricingReqCompleteFlag.Equals(true) ? true : false; //CARR is complete bool completedFlag = MyCarrDetail.CompletedFlag.Equals(true) ? true : false; ViewBag.RoutedFlag = routedFlag; ViewBag.PricingFlag = pricingFlag; ViewBag.CompletedFlag = completedFlag; ViewBag.RequirementsFlag = requirementsFlag; return(View()); }