public static ArticleClassDto GetOneArticleClassDto(string table,string strwhere) { ArticleClassDto articleClassDto = new ArticleClassDto(); articleClassDto = ArticleClassDal.GetOneArticleClass(table, strwhere); return articleClassDto; }
public static void AddArticleClass(ArticleClassDto articleClassDto) { SqlParameter[] arParames = ArticleClassDal.getParameters(articleClassDto); SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString); try { SqlHelper.ExecuteNonQuery(myconn, CommandType.StoredProcedure, "CreateArticleClass", arParames); } catch (SqlException ex) { throw ex; } finally { myconn.Close(); myconn.Dispose(); } }
public static List<ArticleClassDto> GetArticleClassList(string strwhere) { List<ArticleClassDto> articleClasslist = new List<ArticleClassDto>(); SqlParameter[] arParames = new SqlParameter[2]; arParames[0] = new SqlParameter("@table ", SqlDbType.VarChar, 200); arParames[0].Value = "QxsqArticleClass"; arParames[1] = new SqlParameter("@Where ", SqlDbType.VarChar, 8000); arParames[1].Value = strwhere; SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString); try { DataTable dt = null; DataSet ds = SqlHelper.ExecuteDataset(myconn, CommandType.StoredProcedure, "getModelByWhere", arParames); dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { ArticleClassDto articleClassDto = new ArticleClassDto(); articleClassDto = ArticleClassDal.getDataRowToArticleClassDto(dr); articleClasslist.Add(articleClassDto); } return articleClasslist; } catch (SqlException ex) { throw ex; } finally { myconn.Close(); myconn.Dispose(); } }
private static SqlParameter[] getParameters(ArticleClassDto articleClassDto) { SqlParameter[] arParames = new SqlParameter[2]; arParames[0] = new SqlParameter("@ArticleClassId", SqlDbType.Int); arParames[0].Value = articleClassDto.ArticleClassId; arParames[1] = new SqlParameter("@ArticleClassName", SqlDbType.VarChar, 500); arParames[1].Value = articleClassDto.ArticleClassName; return arParames; }
private static ArticleClassDto getDataRowToArticleClassDto(DataRow dr) { ArticleClassDto articleClassDto = new ArticleClassDto(); articleClassDto.ArticleClassId = int.Parse(dr["ArticleClassId"].ToString()); articleClassDto.ArticleClassName = dr["ArticleClassName"].ToString(); return articleClassDto; }
public static void UpdateArticleClassDto(ArticleClassDto articleClassDto) { ArticleClassDal.UpdateArticleClass(articleClassDto); }
public static void AddArticleClass(ArticleClassDto articleClassDto) { ArticleClassDal.AddArticleClass(articleClassDto); }