public ActionResult ListRequiredSupport() { RequiredSupportTypes requiredSupportTypes = new RequiredSupportTypes(); requiredSupportTypes.RequiredSupportList = useCase_DAL.ListrequiredSupportTypes().ToList(); return(PartialView(requiredSupportTypes.RequiredSupportList)); }
public RequiredSupportTypes FindRequiredSupportType(int id) { RequiredSupportTypes _retVal = new RequiredSupportTypes(); SqlConnection objCon = new SqlConnection(); SqlCommand objCom; ConnectionString(objCon); objCom = new SqlCommand("Select intSupportTypeID,strSupportType,strSupportTypeDescr,dtmCreated,strCreatorID,dtmModified,strModifierID FROM GIOS.GIOS_URequiredSupportTypes where intSupportTypeID = " + id, objCon); objCon.Open(); SqlDataReader reader = objCom.ExecuteReader(); while (reader.Read()) { _retVal.intSupportTypeID = Convert.ToInt32(reader["intSupportTypeID"]); _retVal.strSupportType = reader["strSupportType"].ToString(); _retVal.strSupportTypeDescr = reader["strSupportTypeDescr"].ToString(); _retVal.dtmCreated = Convert.ToDateTime(reader["dtmCreated"]); _retVal.strCreatorID = reader["strCreatorID"].ToString(); if (reader["dtmModified"] == System.DBNull.Value) { _retVal.dtmModified = null; } else { _retVal.dtmModified = Convert.ToDateTime(reader["dtmModified"]); } _retVal.strModifierID = reader["strModifierID"].ToString(); } reader.Close(); objCon.Close(); return(_retVal); }
public ActionResult RequiredSupportList() { RequiredSupportTypes requiredSupportTypes = new RequiredSupportTypes { RequiredSupportList = useCase_DAL.ListrequiredSupportTypes().ToList() }; return(Json(requiredSupportTypes.RequiredSupportList, JsonRequestBehavior.AllowGet)); }
// GET: UseCase/Admin/Edit/5 public ActionResult UpdateRequiredSupport(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var supportTypeToEdit = useCase_DAL.FindRequiredSupportType(id); RequiredSupportTypes reqSupType = supportTypeToEdit; return(PartialView(reqSupType)); }
public ActionResult CreateRequiredSupport([Bind(Include = "strSupportType, strSupportTypeDescr")] RequiredSupportTypes newSupportType) { try { newSupportType.strCreatorID = GetUserID(); string message = useCase_DAL.CreateEditRequiredSupportType("I", newSupportType); ViewBag.Err = message; return(RedirectToAction("Index")); } catch { // ViewBag.Err(ex.Message); return(View()); } }
public ActionResult UpdateRequiredSupport(int id, [Bind(Include = "intSupportTypeID, strSupportType, strSupportTypeDescr, strCreatorID")] RequiredSupportTypes modSupportType) { try { // TODO: Add update logic here modSupportType.strModifierID = GetUserID(); string message = useCase_DAL.CreateEditRequiredSupportType("U", modSupportType); ViewBag.Err = message; return(RedirectToAction("Index")); } catch { return(View()); } }
public string CreateEditRequiredSupportType(string AddUpdateFlag, RequiredSupportTypes requiredSupportTypes) { string _retVal; SqlConnection objCon = new SqlConnection(); SqlCommand objCom; try { ConnectionString(objCon); objCom = new SqlCommand("GIOS.GIOS_UCAddUpdateRequiredSupportType", objCon); objCom.CommandType = System.Data.CommandType.StoredProcedure; objCom.Parameters.Add(new SqlParameter("@AddupdateFlag", AddUpdateFlag)); objCom.Parameters.Add(new SqlParameter("@strSupportType", requiredSupportTypes.strSupportType)); objCom.Parameters.Add(new SqlParameter("@strSupportTypeDescr", requiredSupportTypes.strSupportTypeDescr)); if (AddUpdateFlag == "I") { objCom.Parameters.Add(new SqlParameter("@strUserID", requiredSupportTypes.strCreatorID)); objCom.Parameters.Add(new SqlParameter("@intSupportTypeID", requiredSupportTypes.intSupportTypeID)); }//Need to pass blank value since its new else { objCom.Parameters.Add(new SqlParameter("@strUserID", requiredSupportTypes.strModifierID)); objCom.Parameters.Add(new SqlParameter("@intSupportTypeID", requiredSupportTypes.intSupportTypeID)); } objCon.Open(); objCom.ExecuteScalar(); objCon.Close(); _retVal = "Sucess"; } catch (Exception ex) { _retVal = ex.Message; } return(_retVal); }
public IEnumerable <RequiredSupportTypes> ListrequiredSupportTypes() { List <RequiredSupportTypes> _retVal = new List <RequiredSupportTypes>(); SqlConnection objCon = new SqlConnection(); SqlCommand objCom; RequiredSupportTypes reqSup; ConnectionString(objCon); objCom = new SqlCommand("Select intSupportTypeID,strSupportType,strSupportTypeDescr,dtmCreated,strCreatorID,dtmModified,strModifierID FROM GIOS.GIOS_URequiredSupportTypes", objCon); objCon.Open(); SqlDataReader reader = objCom.ExecuteReader(); while (reader.Read()) { reqSup = new RequiredSupportTypes(); reqSup.intSupportTypeID = Convert.ToInt32(reader["intSupportTypeID"]); reqSup.strSupportType = reader["strSupportType"].ToString(); reqSup.strSupportTypeDescr = reader["strSupportTypeDescr"].ToString(); reqSup.dtmCreated = Convert.ToDateTime(reader["dtmCreated"]); reqSup.strCreatorID = reader["strCreatorID"].ToString(); if (reader["dtmModified"] == System.DBNull.Value) { reqSup.dtmModified = null; } else { reqSup.dtmModified = Convert.ToDateTime(reader["dtmModified"]); } reqSup.strModifierID = reader["strModifierID"].ToString(); _retVal.Add(reqSup); } reader.Close(); objCon.Close(); return(_retVal); }