public IList <CaseType> GetCaseType(string strWhere) { IList <CaseType> list = null; SqlParameter[] para = { new SqlParameter("@StrWhere", strWhere) }; using (SqlDataReader dr = SqlHelper.ExecuteReader("proc_CaseType_GetByWhere", para, CommandType.StoredProcedure)) { if (dr.HasRows) { list = new List <CaseType>(); while (dr.Read()) { CaseType ct = new CaseType(); ct.ID = Convert.IsDBNull(dr["ID"]) ? 0 : Convert.ToInt32(dr["ID"]); ct.CTName = Convert.IsDBNull(dr["CTName"]) ? "" : dr["CTName"].ToString(); ct.ModelID = Convert.IsDBNull(dr["ModelID"]) ? 0 : Convert.ToInt32(dr["ModelID"]); list.Add(ct); } } } return(list); }
public bool AddCaseType(CaseType ct) { bool flag = false; SqlParameter[] paras = { new SqlParameter("@CTName", ct.CTName), new SqlParameter("@ModelID", ct.ModelID) }; flag = SqlHelper.ExecuteNonQuery("proc_CaseType_Add", paras, CommandType.StoredProcedure) > 0 ? true : false; return(flag); }
public IList <CaseType> GetAllCaseTypes() { IList <CaseType> list = new List <CaseType>(); using (SqlDataReader dr = SqlHelper.ExecuteReader("proc_GetAllCaseTypes", null, CommandType.StoredProcedure)) { while (dr.Read()) { CaseType ct = new CaseType(); ct.ID = Convert.ToInt32(dr["ID"]); ct.CTName = dr["CTName"].ToString(); ct.ModelID = Convert.ToInt32(dr["ModelID"]); list.Add(ct); } dr.Close(); } return(list); }
/// <summary> /// 通过ID获取CaseType实体--zfcony /// </summary> /// <param name="id">ID</param> /// <returns></returns> public CaseType GetCaseTypeByID(int id) { CaseType csty = new CaseType(); SqlParameter[] para = { new SqlParameter("@ID", id) }; using (SqlDataReader dr = SqlHelper.ExecuteReader("Pro_GetCaseTypebyID", para, CommandType.StoredProcedure)) { if (dr.Read()) { csty.ID = Convert.ToInt32(dr["ID"]); csty.ModelID = Convert.ToInt32(dr["ModelID"]); csty.CTName = Convert.ToString(dr["CTName"]); } dr.Close(); } return(csty); }
public IList <CaseType> GetCaseType() { IList <CaseType> list = null; //proc_CaseType_GetList using (SqlDataReader dr = SqlHelper.ExecuteReader("proc_CaseType_GetList", null, CommandType.StoredProcedure)) { if (dr.HasRows) { list = new List <CaseType>(); while (dr.Read()) { CaseType ct = new CaseType(); ct.ID = Convert.IsDBNull(dr["ID"]) ? 0 : Convert.ToInt32(dr["ID"]); ct.CTName = Convert.IsDBNull(dr["CTName"]) ? "" : dr["CTName"].ToString(); ct.ModelID = Convert.IsDBNull(dr["ModelID"]) ? 0 : Convert.ToInt32(dr["ModelID"]); list.Add(ct); } } dr.Close(); } return(list); }