//Dropdown Function public ActionResult GetSectionDynamicFunction(int DepartmentID) { FM_ResponsibilityCenter_Section model = new FM_ResponsibilityCenter_Section(); model.SectionList = new SelectList((from s in TOSSDB.Functions.Where(a => a.DepartmentID == DepartmentID).ToList() select new { FunctionID = s.FunctionID, FunctionName = s.FunctionName }), "FunctionID", "FunctionName"); return(PartialView("Section/_DynamicDDFunctionName", model)); }
//Dropdown Department public ActionResult GetSectionDynamicDepartment() { FM_ResponsibilityCenter_Section model = new FM_ResponsibilityCenter_Section(); model.SectionList = new SelectList((from s in TOSSDB.Signatory_DepartmentTable.ToList() select new { DepartmentID = s.DepartmentID, DepartmentName = s.DepartmentName }), "DepartmentID", "DepartmentName"); return(PartialView("Section/_DynamicDDDepartmenName", model)); }
//Position Table Partial View public ActionResult Get_SectionTable() { FM_ResponsibilityCenter_Section model = new FM_ResponsibilityCenter_Section(); List <SectionList> tbl_Position = new List <SectionList>(); var SQLQuery = "SELECT SectionID ,SectionName,DepartmentName,FunctionName FROM DB_TOSS.dbo.Sections,Functions,Signatory_DepartmentTable WHERE Signatory_DepartmentTable.DepartmentID = Sections.DepartmentID AND Functions.FunctionID = Sections.FunctionID"; //SQLQuery += " WHERE (IsActive != 0)"; using (SqlConnection Connection = new SqlConnection(GlobalFunction.ReturnConnectionString())) { Connection.Open(); using (SqlCommand command = new SqlCommand("[dbo].[SP_SectionList]", Connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@SQLStatement", SQLQuery)); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { tbl_Position.Add(new SectionList() { SectionID = GlobalFunction.ReturnEmptyInt(dr[0]), SectionName = GlobalFunction.ReturnEmptyString(dr[1]), DepartmentName = GlobalFunction.ReturnEmptyString(dr[2]), FunctionName = GlobalFunction.ReturnEmptyString(dr[3]) }); } } Connection.Close(); } model.getSectionList = tbl_Position.ToList(); return(PartialView("Section/SectionTable", model.getSectionList)); }
//Delete Function public ActionResult DeleteSection(FM_ResponsibilityCenter_Section model, int SectionID) { Section tblFunction = (from e in TOSSDB.Sections where e.SectionID == SectionID select e).FirstOrDefault(); TOSSDB.Sections.Remove(tblFunction); TOSSDB.SaveChanges(); return(RedirectToAction("Index")); }
//Get Update SubSector public ActionResult Get_UpdateSection(FM_ResponsibilityCenter_Section model, int SectionID) { Section tblFunction = (from e in TOSSDB.Sections where e.SectionID == SectionID select e).FirstOrDefault(); model.getSectioncolumns.SectionID = tblFunction.SectionID; model.FunctionTempID = tblFunction.FunctionID; model.DepartmentTempID = tblFunction.DepartmentID; model.getSectioncolumns.SectionName = tblFunction.SectionName; return(PartialView("Section/_UpdateSection", model)); }
//Update SubSector public ActionResult UpdateSection(FM_ResponsibilityCenter_Section model) { Section tblFunction = (from e in TOSSDB.Sections where e.SectionID == model.getSectioncolumns.SectionID select e).FirstOrDefault(); tblFunction.SectionName = model.getSectioncolumns.SectionName; tblFunction.FunctionID = model.FunctionID; tblFunction.DepartmentID = model.DepartmentID; TOSSDB.Entry(tblFunction); TOSSDB.SaveChanges(); return(PartialView("Section/_UpdateSection", model)); }
//Add Function public JsonResult AddSection(FM_ResponsibilityCenter_Section model) { Section tblSection = new Section(); tblSection.SectionName = model.getSectioncolumns.SectionName; tblSection.FunctionID = model.FunctionID; tblSection.DepartmentID = model.DepartmentID; TOSSDB.Sections.Add(tblSection); TOSSDB.SaveChanges(); return(Json(tblSection)); }
//Get Add Position Partial View public ActionResult Get_AddSection() { FM_ResponsibilityCenter_Section model = new FM_ResponsibilityCenter_Section(); return(PartialView("Section/_AddSection", model)); }
public ActionResult SectionTab() { FM_ResponsibilityCenter_Section model = new FM_ResponsibilityCenter_Section(); return(PartialView("Section/SectionIndex", model)); }