public ActionResult InsertState(StateMasterModal model) { dict.Clear(); dict.Add("@State_Name", model.StateName); dict.Add("@mode", "InsertState"); int i = common_class.return_nonquery(dict, "proc_Area"); var Result = i > 0 ? Convert.ToBoolean(true).ToString() : Convert.ToBoolean(false).ToString(); return(Json(Result, JsonRequestBehavior.AllowGet)); }
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()); }
public ActionResult UpdateState(StateMasterModal model) { dict.Clear(); dict.Add("@State_id", model.Id); if (model.Id > 0 && model.StateName != null) { dict.Add("@State_Name", model.StateName); dict.Add("@mode", "UpdateState"); int i = common_class.return_nonquery(dict, "proc_Area"); bool Result1 = i > 0 ? true : false; return(Json(Result1, JsonRequestBehavior.AllowGet)); } else if (model.Id > 0 && model.StateName == null) { dict.Add("@mode", "StateRoleActive/Diactivate"); DataTable dt = common_class.return_datatable(dict, "proc_Area"); int Result2 = Convert.ToInt32(dt.Rows[0][0].ToString()); return(Json(Result2, JsonRequestBehavior.AllowGet)); } return(Json(3, JsonRequestBehavior.AllowGet)); }
// 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)); }