//Table Sector public ActionResult Get_SectorTable() { FM_Sector model = new FM_Sector(); List <SectorList> tbl_Sector = new List <SectorList>(); var SQLQuery = "SELECT * FROM DB_TOSS.dbo.Sector"; //SQLQuery += " WHERE (IsActive != 0)"; using (SqlConnection Connection = new SqlConnection(GlobalFunction.ReturnConnectionString())) { Connection.Open(); using (SqlCommand command = new SqlCommand("[dbo].[SP_SectorsList]", Connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@SQLStatement", SQLQuery)); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { tbl_Sector.Add(new SectorList() { SectorID = GlobalFunction.ReturnEmptyInt(dr[0]), SectorName = GlobalFunction.ReturnEmptyString(dr[1]), SectorCode = GlobalFunction.ReturnEmptyString(dr[2]), }); } } Connection.Close(); } model.getSectorList = tbl_Sector.ToList(); return(PartialView("Sector/_SectorTable", model.getSectorList)); }
public ActionResult GetDynamicSectorCode() { FM_Sector model = new FM_Sector(); model.SubSectorList = new SelectList((from s in TOSSDB.Sectors.ToList() select new { SectorID = s.SectorID, SectorCode = s.SectorCode }), "SectorID", "SectorCode"); return(PartialView("SubSector/_DynamicLSectorCode", model)); }
//Delete Sector public ActionResult DeleteSectors(FM_Sector model, int SectorID) { Sector tblSector = (from e in TOSSDB.Sectors where e.SectorID == SectorID select e).FirstOrDefault(); TOSSDB.Sectors.Remove(tblSector); TOSSDB.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult GetSelectedSectorCodeField(int SubSectorID) { FM_Sector model = new FM_Sector(); SubSector tblSector = (from e in TOSSDB.SubSectors where e.SubSectorID == SubSectorID select e).FirstOrDefault(); model.SubsectorCodeID = tblSector.SubSectorCode; return(PartialView("SubSector/_DynamicLSectorCode", model)); }
public ActionResult GetSelectedDynamicSector(int SectorNameIDTempID) { FM_Sector model = new FM_Sector(); model.SubSectorList = new SelectList((from s in TOSSDB.Sectors.ToList() select new { SectorID = s.SectorID, SectorName = s.SectorName }), "SectorID", "SectorName"); model.SubSectorNameID = SectorNameIDTempID; return(PartialView("SubSector/_DynamicDDSectorName", model)); }
//Get Update Sector public ActionResult Get_UpdateSector(FM_Sector model, int SectorID) { Sector tblSector = (from e in TOSSDB.Sectors where e.SectorID == SectorID select e).FirstOrDefault(); model.getSectorcolumns.SectorID = tblSector.SectorID; model.getSectorcolumns.SectorName = tblSector.SectorName; model.getSectorcolumns.SectorCode = tblSector.SectorCode; return(PartialView("Sector/_UpdateSectors", model)); }
//Update Sector public ActionResult UpdateSector(FM_Sector model) { Sector tblSector = (from e in TOSSDB.Sectors where e.SectorID == model.getSectorcolumns.SectorID select e).FirstOrDefault(); tblSector.SectorName = model.getSectorcolumns.SectorName; tblSector.SectorCode = model.getSectorcolumns.SectorCode; TOSSDB.Entry(tblSector); TOSSDB.SaveChanges(); return(PartialView("Sector/_UpdateSectors", model)); }
//Add Sector public JsonResult AddSectors(FM_Sector model) { Sector tblSector = new Sector(); tblSector.SectorName = model.getSectorcolumns.SectorName; tblSector.SectorCode = model.getSectorcolumns.SectorCode; TOSSDB.Sectors.Add(tblSector); TOSSDB.SaveChanges(); return(Json(tblSector)); }
//Get Add Sector Partial View public ActionResult Get_AddSector() { FM_Sector model = new FM_Sector(); return(PartialView("Sector/_AddSectors", model)); }
public ActionResult SubSectorTab() { FM_Sector model = new FM_Sector(); return(PartialView("SubSector/SubSectorIndex", model)); }