public PriceTypeInfo GetInfo(int id) { PriceTypeInfo info = null; SqlParameter[] param = { new SqlParameter("@id", id) }; var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_Price_Type_GetById", param); if (r != null) { info = new PriceTypeInfo(); while (r.Read()) { info.id = Int32.Parse(r["id"].ToString()); info.name = r["name"].ToString(); info.link = r["link"].ToString(); info.sort = (object)r["sort"].ToString(); info.description = r["description"].ToString(); info.keyword = r["keyword"].ToString(); } r.Close(); r.Dispose(); } return(info); }
public int Add(PriceTypeInfo info) { SqlParameter[] param = { new SqlParameter("@name", info.name), new SqlParameter("@link", info.link), new SqlParameter("@sort", info.sort), new SqlParameter("@description", info.description), new SqlParameter("@keyword", info.keyword) }; return(int.Parse(DataHelper.ExecuteScalar(Config.ConnectString, "usp_Price_Type_Add", param).ToString())); }
public int Update(PriceTypeInfo info) { SqlParameter[] param = { new SqlParameter("@id", info.id) , new SqlParameter("@name",info.name), new SqlParameter("@link", info.link), new SqlParameter("@sort", info.sort), new SqlParameter("@description", info.description), new SqlParameter("@keyword", info.keyword) }; return(DataHelper.ExecuteNonQuery(Config.ConnectString, "usp_Price_Type_Update", param)); }
private bool AddNewCate() { if (string.IsNullOrEmpty(txtCategoryname.Text) || string.IsNullOrEmpty(txtSort.Text)) { ltrThongbao.Text = "Cần nhập đủ các trường!"; return(false); } var info = new PriceTypeInfo(); info.name = txtCategoryname.Text; var nextId = UntilityFunction.nextId("tbl_Price_Type"); info.link = Rewrite.GenCate(info.name, nextId, Rewrite.ListPrice); info.sort = int.Parse(txtSort.Text); info.description = txtMota.Text; info.keyword = txtTukhoa.Text; ServiceFactory.GetInstancePriceType().Add(info); return(true); }
public List <PriceTypeInfo> GetList(int pageIndex, int pageSize, out int total) { List <PriceTypeInfo> list = null; var t = 0; SqlParameter[] param = { new SqlParameter("@pageIndex", pageIndex), new SqlParameter("@pageSize", pageSize), new SqlParameter("@totalrow", DbType.Int32) { Direction = ParameterDirection.Output } }; SqlCommand comx; var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_Price_Type_GetList", param, out comx); if (r != null) { list = new List <PriceTypeInfo>(); while (r.Read()) { var info = new PriceTypeInfo(); info.id = Int32.Parse(r["id"].ToString()); info.name = r["name"].ToString(); info.link = r["link"].ToString(); info.sort = (object)r["sort"].ToString(); info.description = r["description"].ToString(); info.keyword = r["keyword"].ToString(); list.Add(info); } r.Close(); r.Dispose(); t = int.Parse(comx.Parameters[2].Value.ToString()); } total = t; return(list); }
public List <PriceTypeInfo> GetAll() { List <PriceTypeInfo> list = null; var r = DataHelper.ExecuteReader(Config.ConnectString, "usp_Price_Type_GetAll", null); if (r != null) { list = new List <PriceTypeInfo>(); while (r.Read()) { var info = new PriceTypeInfo(); info.id = Int32.Parse(r["id"].ToString()); info.name = r["name"].ToString(); info.link = r["link"].ToString(); info.sort = int.Parse(r["sort"].ToString()); list.Add(info); } r.Close(); r.Dispose(); } return(list); }