//---------------------------------------------------------------------------------------------------------// public static void Insert(ECHITIETHOADON OCHITIETHOADON) { SqlParameter[] pr = new SqlParameter[4]; pr[0] = new SqlParameter(@"SOHOADON", OCHITIETHOADON.SOHOADON); pr[1] = new SqlParameter(@"MASP", OCHITIETHOADON.MASP); pr[2] = new SqlParameter(@"SOLUONG", OCHITIETHOADON.SOLUONG); pr[3] = new SqlParameter(@"CHIETKHAU", OCHITIETHOADON.CHIETKHAU); DataAccseL.ExecuteNonQuery(CommandType.StoredProcedure, "CHITIETHOADON_Insert", pr); }
public ECHITIETHOADON(string vSOHOADON, string vMASP) { ECHITIETHOADON OCHITIETHOADON = BCHITIETHOADON.SelectByID(vSOHOADON, MASP); this.SOHOADON = OCHITIETHOADON.SOHOADON; this.MASP = OCHITIETHOADON.MASP; this.SOLUONG = OCHITIETHOADON.SOLUONG; this.CHIETKHAU = OCHITIETHOADON.CHIETKHAU; }
private void btnSua_Click(object sender, EventArgs e) { ECHITIETHOADON ect = new ECHITIETHOADON(); ect.SOHOADON = txtshd.Text.Trim(); ect.MASP = txtmasp.Text.Trim(); int sl = 0; int.TryParse(txtsl.Text.Trim(), out sl); ect.SOLUONG = sl; float ck = 0; float.TryParse(txtck.Text.Trim(), out ck); ect.CHIETKHAU = ck; BCHITIETHOADON.Update(ect); txttongtien.Text = tongtien() + ""; }
private void btnThem_Click(object sender, EventArgs e) { ECHITIETHOADON ect = new ECHITIETHOADON(); ect.SOHOADON = txtshd.Text.Trim(); ect.MASP = txtmasp.Text.Trim(); int sl = 0; int.TryParse(txtsl.Text.Trim(), out sl); ect.SOLUONG = sl; float ck = 0; float.TryParse(txtck.Text.Trim(), out ck); ect.CHIETKHAU = ck; BCHITIETHOADON.Insert(ect); dgvData.DataSource = BCHITIETHOADON.SelectAll(txtshd.Text.Trim()); txttongtien.Text = tongtien() + ""; }
//---------------------------------------------------------------------------------------------------------// private static ECHITIETHOADON GetOneCHITIETHOADON(IDataReader idr) { ECHITIETHOADON OCHITIETHOADON = new ECHITIETHOADON(); if (idr["SOHOADON"] != DBNull.Value) OCHITIETHOADON.SOHOADON = (string)idr["SOHOADON"]; if (idr["MASP"] != DBNull.Value) OCHITIETHOADON.MASP = (string)idr["MASP"]; if (idr["SOLUONG"] != DBNull.Value) OCHITIETHOADON.SOLUONG = (int)idr["SOLUONG"]; if (idr["CHIETKHAU"] != DBNull.Value) OCHITIETHOADON.CHIETKHAU = (float)idr["CHIETKHAU"]; return OCHITIETHOADON; }
public static ECHITIETHOADON SelectByID(string SOHOADON, string MASP) { ECHITIETHOADON OCHITIETHOADON = new ECHITIETHOADON(); SqlParameter[] pr = new SqlParameter[2]; pr[0] = new SqlParameter(@"SOHOADON", SOHOADON); pr[1] = new SqlParameter(@"MASP", MASP); IDataReader idr = DataAccseL.ExecuteReader(CommandType.StoredProcedure, "CHITIETHOADON_SelectByID", pr); if (idr.Read()) OCHITIETHOADON = GetOneCHITIETHOADON(idr); idr.Close(); idr.Dispose(); return OCHITIETHOADON; }
public static void Update(ECHITIETHOADON OCHITIETHOADON) { SqlParameter[] pr = new SqlParameter[4]; pr[0] = new SqlParameter(@"SOHOADON", OCHITIETHOADON.SOHOADON); pr[1] = new SqlParameter(@"MASP", OCHITIETHOADON.MASP); pr[2] = new SqlParameter(@"SOLUONG", OCHITIETHOADON.SOLUONG); pr[3] = new SqlParameter(@"CHIETKHAU", OCHITIETHOADON.CHIETKHAU); SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "CHITIETHOADON_Update", pr); }