//DV Type #region //Table Internal Revenue Allotment public ActionResult Get_DVTypeTable() { FM_Disbursement_DVType model = new FM_Disbursement_DVType(); List <DVTypeList> tbl_DVType = new List <DVTypeList>(); var SQLQuery = "SELECT * FROM DB_TOSS.dbo.DVTypeTable"; //SQLQuery += " WHERE (IsActive != 0)"; using (SqlConnection Connection = new SqlConnection(GlobalFunction.ReturnConnectionString())) { Connection.Open(); using (SqlCommand command = new SqlCommand("[dbo].[SP_DVTypeList]", Connection)) { command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@SQLStatement", SQLQuery)); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { tbl_DVType.Add(new DVTypeList() { DVTypeID = GlobalFunction.ReturnEmptyInt(dr[0]), DVTypeName = GlobalFunction.ReturnEmptyString(dr[1]), }); } } Connection.Close(); } model.getDVTypeList = tbl_DVType.ToList(); return(PartialView("DVType/_DVTypeTable", model.getDVTypeList)); }
//Delete DVType public ActionResult DeleteDVType(FM_Disbursement_DVType model, int DVTypeID) { DVTypeTable tblDvType = (from e in TOSSDB.DVTypeTables where e.DVTypeID == DVTypeID select e).FirstOrDefault(); TOSSDB.DVTypeTables.Remove(tblDvType); TOSSDB.SaveChanges(); return(RedirectToAction("Index")); }
//Get Update DVType public ActionResult Get_UpdateDVType(FM_Disbursement_DVType model, int DVTypeID) { DVTypeTable tblDVType = (from e in TOSSDB.DVTypeTables where e.DVTypeID == DVTypeID select e).FirstOrDefault(); model.getDVTypecolumns.DVTypeID = tblDVType.DVTypeID; model.getDVTypecolumns.DVTypeName = tblDVType.DVTypeName; return(PartialView("DVType/_UpdateDVType", model)); }
//Update DVType public ActionResult UpdateDVType(FM_Disbursement_DVType model) { DVTypeTable tblDVType = (from e in TOSSDB.DVTypeTables where e.DVTypeID == model.getDVTypecolumns.DVTypeID select e).FirstOrDefault(); tblDVType.DVTypeName = model.getDVTypecolumns.DVTypeName; TOSSDB.Entry(tblDVType); TOSSDB.SaveChanges(); return(PartialView("DVType/_UpdateDVType", model)); }
//Add DVType public JsonResult AddDVType(FM_Disbursement_DVType model) { DVTypeTable tblDvType = new DVTypeTable(); tblDvType.DVTypeName = model.getDVTypecolumns.DVTypeName; TOSSDB.DVTypeTables.Add(tblDvType); TOSSDB.SaveChanges(); return(Json(tblDvType)); }
//Get Add DVType Partial View public ActionResult Get_AddDVType() { FM_Disbursement_DVType model = new FM_Disbursement_DVType(); return(PartialView("DVType/_AddDVType", model)); }