コード例 #1
0
        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());
        }
コード例 #2
0
 private void RemoveCurrentAgencyFromAgencyList()
 {
     if (EditingDto != null && AgencyList != null)
     {
         var agencyToRemove = AgencyList.FirstOrDefault(a => a.Key == EditingDto.Key);
         if (agencyToRemove != null)
         {
             AgencyList.Remove(agencyToRemove);
         }
     }
 }
コード例 #3
0
        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());
        }
コード例 #4
0
 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();
         }
     }
 }
コード例 #5
0
        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"));
            }
        }
コード例 #6
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());
        }
コード例 #7
0
 public int EditAgency([FromBody] AgencyList agency)
 {
     return(objdata.UpdateAgencyList(agency));
 }
コード例 #8
0
 public int CreateAgency([FromBody] AgencyList agency)
 {
     return(objdata.AddAgencyList(agency));
 }