public static int ThemBanAn(BanAn_DTO BanAn, string maNH) { Provider provider = new Provider(); string sql = string.Format("insert into BanAn values ({0},'{1}','{2}',{3})", BanAn.MaKhuVuc, BanAn.LoaiBan, maNH, BanAn.TrangThai); SqlCommand cm = provider.CreateCommandStringSql(sql); return provider.ExecuteInsertUpdateDelete(cm); }
public static int CapNhatBanAn(BanAn_DTO BanAn) { Provider provider = new Provider(); string sql = string.Format("update BanAn set TrangThai={0} where MaBan={1}", BanAn.TrangThai, BanAn.MaBan); SqlCommand cm = provider.CreateCommandStringSql(sql); return provider.ExecuteInsertUpdateDelete(cm); }
private List<BanAn_DTO> ConvertToList(DataTable dt) { List<BanAn_DTO> ls = new List<BanAn_DTO>(); foreach (DataRow row in dt.Rows) { BanAn_DTO banan = new BanAn_DTO(); banan.MaBan = (int)row.ItemArray[0]; banan.MaKhuVuc = (int)row.ItemArray[1]; banan.LoaiBan = (String)row.ItemArray[2]; banan.MaNH = (String)row.ItemArray[3]; banan.TrangThai = (int)row.ItemArray[4]; ls.Add(banan); } return ls; }
public static int ThemBanAn(BanAn_DTO BanAn, string maNH) { return BanAn_DAO.ThemBanAn(BanAn, maNH); }
public static int CapNhatBanAn(BanAn_DTO BanAn) { return BanAn_DAO.CapNhatBanAn(BanAn); }