public ActionResult EmployeeRegistration() { dict.Clear(); dict.Add("@mode", "get_all_states/Role"); DataSet ds = commonClass.return_dataset(dict, "proc_employee"); List <state> list_state = new List <state>(); List <Role> list_role = new List <Role>(); int count_state = ds.Tables[0].Rows.Count; int count_Role = ds.Tables[1].Rows.Count; if (count_state > 0) { for (int i = 0; i < count_state; i++) { state s = new state(); s.Id = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString()); s.State = ds.Tables[0].Rows[i]["state"].ToString(); list_state.Add(s); } if (count_Role > 0) { for (int i = 0; i < count_Role; i++) { Role r = new Role(); r.Id = Convert.ToInt32(ds.Tables[1].Rows[i]["id"].ToString()); r.role = ds.Tables[1].Rows[i]["Role"].ToString(); list_role.Add(r); } } ViewBag.getrole = list_role; ViewBag.getstate = list_state; } return(View()); }
public ActionResult AddRole() { List <MasterRole> RolesList = new List <MasterRole>(); List <StateMasterModal> StateList = new List <StateMasterModal>(); List <ZoneMastermodal> ZoneList = new List <ZoneMastermodal>(); List <DropdownLit> DropList = new List <DropdownLit>(); dict.Clear(); dict.Add("@mode", "GetRoleRecord"); DataSet dt = common_Class.return_dataset(dict, "Proc_role"); int r = Convert.ToInt32(dt.Tables.Count); if (r > 0) { for (int i = 0; i < dt.Tables[0].Rows.Count; i++) { MasterRole master = new MasterRole(); master.Id = Convert.ToInt32(dt.Tables[0].Rows[i]["id"]); master.RoleName = dt.Tables[0].Rows[i]["Role"].ToString(); master.active = Convert.ToInt32(dt.Tables[0].Rows[i]["Active"]).ToString() == "1" ? "Active" : "Deactive"; master.InsertedDate = dt.Tables[0].Rows[i]["inserted_on"].ToString(); RolesList.Add(master); } for (int j = 0; j < dt.Tables[1].Rows.Count; j++) { StateMasterModal state = new StateMasterModal(); state.Id = Convert.ToInt32(dt.Tables[1].Rows[j]["id"]); state.StateName = dt.Tables[1].Rows[j]["state"].ToString(); state.Active = Convert.ToInt32(dt.Tables[1].Rows[j]["Active"]).ToString() == "1" ? "Active" : "Deactive"; StateList.Add(state); } for (int k = 0; k < dt.Tables[2].Rows.Count; k++) { ZoneMastermodal zone = new ZoneMastermodal(); zone.Id = Convert.ToInt32(dt.Tables[2].Rows[k]["id"]); zone.StateId = Convert.ToInt32(dt.Tables[2].Rows[k]["State_id"]); zone.ZoneName = dt.Tables[2].Rows[k]["Zone"].ToString(); zone.StateName = dt.Tables[2].Rows[k]["state"].ToString(); zone.Active = Convert.ToInt32(dt.Tables[2].Rows[k]["active"]).ToString() == "1" ? "Active" : "Deactive"; ZoneList.Add(zone); } for (int l = 0; l < dt.Tables[3].Rows.Count; l++) { DropdownLit DDLState = new DropdownLit(); DDLState.Id = Convert.ToInt32(dt.Tables[3].Rows[l]["id"]); DDLState.DropName = dt.Tables[3].Rows[l]["state"].ToString(); DropList.Add(DDLState); } ViewBag.DropListState = DropList; ViewBag.GetZoneList = ZoneList; ViewBag.GetRoleList = RolesList; ViewBag.GetStateList = StateList; } return(View()); }
// Code By Nitin public ActionResult Index() { List <Area> area_list = new List <Area>(); //Add by lucky List <MasterRole> RolesList = new List <MasterRole>(); List <StateMasterModal> StateList = new List <StateMasterModal>(); List <ZoneMastermodal> ZoneList = new List <ZoneMastermodal>(); List <DropdownLit> DropList = new List <DropdownLit>(); //End dict.Clear(); //dict.Add("",""); dict.Add("@mode", "getAll_Area"); //DataTable dt = common_class.return_datatable(dict, "proc_Area"); DataSet dt = common_class.return_dataset(dict, "proc_Area"); int j = dt.Tables.Count; if (j > 0) { for (int i = 0; i < dt.Tables[0].Rows.Count; i++) { Area area = new Area(); area.id = Convert.ToInt32(dt.Tables[0].Rows[i]["id"].ToString()); area.Area_Name = dt.Tables[0].Rows[i]["Area_name"].ToString(); area.Zone_id = dt.Tables[0].Rows[i]["Zone"].ToString(); area.State_id = dt.Tables[0].Rows[i]["State"].ToString(); area.pincode = Convert.ToInt32(dt.Tables[0].Rows[i]["Pincode"].ToString()); area_list.Add(area); } //Add by lucky for (int k = 0; k < dt.Tables[1].Rows.Count; k++) { MasterRole master = new MasterRole(); master.Id = Convert.ToInt32(dt.Tables[1].Rows[k]["id"]); master.RoleName = dt.Tables[1].Rows[k]["Role"].ToString(); master.active = Convert.ToInt32(dt.Tables[1].Rows[k]["Active"]).ToString() == "1" ? "Active" : "Deactive"; master.InsertedDate = dt.Tables[1].Rows[k]["inserted_on"].ToString(); RolesList.Add(master); } for (int l = 0; l < dt.Tables[2].Rows.Count; l++) { StateMasterModal state = new StateMasterModal(); state.Id = Convert.ToInt32(dt.Tables[2].Rows[l]["id"]); state.StateName = dt.Tables[2].Rows[l]["state"].ToString(); state.Active = Convert.ToInt32(dt.Tables[2].Rows[l]["Active"]).ToString() == "1" ? "Active" : "Deactive"; StateList.Add(state); } for (int m = 0; m < dt.Tables[3].Rows.Count; m++) { ZoneMastermodal zone = new ZoneMastermodal(); zone.Id = Convert.ToInt32(dt.Tables[3].Rows[m]["id"]); zone.StateId = Convert.ToInt32(dt.Tables[3].Rows[m]["State_id"]); zone.ZoneName = dt.Tables[3].Rows[m]["Zone"].ToString(); zone.StateName = dt.Tables[3].Rows[m]["state"].ToString(); zone.Active = Convert.ToInt32(dt.Tables[3].Rows[m]["active"]).ToString() == "1" ? "Active" : "Deactive"; ZoneList.Add(zone); } for (int n = 0; n < dt.Tables[4].Rows.Count; n++) { DropdownLit DDLState = new DropdownLit(); DDLState.Id = Convert.ToInt32(dt.Tables[4].Rows[n]["id"]); DDLState.DropName = dt.Tables[4].Rows[n]["state"].ToString(); DropList.Add(DDLState); } ViewBag.DropListState = DropList; ViewBag.GetZoneList = ZoneList; ViewBag.GetRoleList = RolesList; ViewBag.GetStateList = StateList; //End ViewBag.list_Area = area_list; } return(View(area_list)); }