public ActionResult AgentAdd(AgencyList agency) { DataTable typedata = SQLHelper.ProcDataTable("usp_EmployeeSelectorOn"); List <SelectListItem> typeList = new List <SelectListItem>(); foreach (DataRow row in typedata.Rows) { typeList.Add(new SelectListItem { Value = row["id"].ToString(), Text = row["name"].ToString() }); } ViewData["typelist"] = typeList; if (Request["save"] != null) { var user = Session["user"] as User; if (user != null) { agency.GrantorId = user.Eid; } AgencyList.AddInfo(agency); return(RedirectToAction("AgentConfig")); } else if (Request["back"] != null) { return(RedirectToAction("AgentConfig")); } return(PartialView()); }
private void RemoveCurrentAgencyFromAgencyList() { if (EditingDto != null && AgencyList != null) { var agencyToRemove = AgencyList.FirstOrDefault(a => a.Key == EditingDto.Key); if (agencyToRemove != null) { AgencyList.Remove(agencyToRemove); } } }
public ActionResult AgentHistory() { int eid = (Session["user"] as User).Eid; DataTable dt = SQLHelper.ProcDataTable("usp_Agent", new SqlParameter("@id", eid)); DataColumnCollection columns = dt.Columns; List <AgencyList> data = new List <AgencyList>(); foreach (DataRow row in dt.Rows) { AgencyList info = new AgencyList(); info = info.DBDataToAgency(row, columns); data.Add(info); } ViewData.Model = data; return(PartialView()); }
private void InitializeView() { if (!IsPostBack) { if (AgencyList != null && AgencyList.Count() > 0) { BindData(); } else { DisplayMessage("Cannot add to another Agency. The User has been already assigned to all existing Agencies.", true); EndRequest = true; Page.DataBind(); } } }
private void BindAgenciesForUser() { DropDownList AgenciesDLLObj = (DropDownList)formView.FindControl("ddlAgencies"); AgenciesDLLObj.DataSource = AgencyList; AgenciesDLLObj.DataTextField = "Value"; AgenciesDLLObj.DataValueField = "Key"; AgenciesDLLObj.DataBind(); if (AgencyList == null || AgencyList.Count() == 0) { AgenciesDLLObj.Items.Add(new ListItem("No agencies available", "0")); } else { AgenciesDLLObj.Items.Insert(0, new ListItem("-- Select agency --", "0")); } }
// // GET: /Agent/ public ActionResult AgentConfig() { User user = Session["user"] as User; if (user != null) { int eid = user.Eid; DataTable dt = SQLHelper.ProcDataTable("usp_Grantor", new SqlParameter("@id", eid)); DataColumnCollection columns = dt.Columns; List <AgencyList> data = new List <AgencyList>(); foreach (DataRow row in dt.Rows) { AgencyList info = new AgencyList(); info = info.DbDataToAgency(row, columns); data.Add(info); } ViewData.Model = data; } return(PartialView()); }
public int EditAgency([FromBody] AgencyList agency) { return(objdata.UpdateAgencyList(agency)); }
public int CreateAgency([FromBody] AgencyList agency) { return(objdata.AddAgencyList(agency)); }