private void buttonsuaxe_Click(object sender, EventArgs e) { string ma = textBoxMAXE.Text; string ten = textBoxtenxe.Text; string nhasx = textBoxnhasxxe.Text; string ttbh = textBoxtnbaohanh.Text; string mt = textBoxmotaxe.Text; bool checkgia = Int32.TryParse(textBoxgiaxe.Text, out int gia); DTOXE a = new DTOXE(ma, ten, nhasx, mt, ttbh, gia); if (ma != "" && ten != "" && nhasx != "" && mt != "" && ttbh != "" && checkgia != false) { if (xe.Update(a)) { load(); } else { MessageBox.Show("sua that bai"); } } else { MessageBox.Show("sua that bai"); } }
public List <DTOXE> listxe(string b) { List <DTOXE> xe = new List <DTOXE>(); DataTable data = getxebynhasx(b); foreach (DataRow item in data.Rows) { DTOXE a = new DTOXE(item); xe.Add(a); } return(xe); }
private void buttonthemvaobillnhap_Click(object sender, EventArgs e) { DTOXE xeban = comboBoxxeban.SelectedItem as DTOXE; string a = xeban.Maxe; string b = xeban.Tenxe; NHASX sx = comboBoxnhasxban.SelectedItem as NHASX; string c = sx.Ma; int d = Convert.ToInt32(numericUpDownxeban.Value.ToString()); int f = xeban.Giaban * d; if (a != "" && b != "" && c != "" && d != 0) { listViewBAN.Items.Add(addlistban(a, b, c, d, f)); loadttienban(f); } }
private void buttonthembillnhap_Click(object sender, EventArgs e) { DTOXE xenhap = comboBoxxenhap.SelectedItem as DTOXE; string a = xenhap.Maxe; string b = xenhap.Tenxe; NHASX sx = comboBoxnhasxnhap.SelectedItem as NHASX; string c = sx.Ma; int d = Convert.ToInt32(numericUpDownnhap.Value.ToString()); int f = (xenhap.Giaban * d) / 10 * 7; if (a != "" && b != "" && c != "" && d != 0) { listViewnhap.Items.Add(addlistnhap(a, b, c, d, f)); loadttiennhap(f); comboBoxnhasxnhap.Enabled = false; } }
protected bool update(DTOXE a) { string query = string.Format("UPDATE dbo.XE SET tenxe= '{0} ', thongtinbaohanh='{1} ',mota= '{2} ', giaban= {3},manhasx='{5}' WHERE MAXE = '{4} '", a.Tenxe, a.Tnbh, a.Mota, a.Giaban, a.Maxe, a.Manhasx); return(executenonquery(query)); }
protected bool add(DTOXE a) { string query = string.Format("INSERT dbo.XE( tenxe,manhasx,soluong,thongtinbaohanh,mota,giaban) VALUES(N'{0}',N'{1}', 0,N'{2}', N'{3}',{4})", a.Tenxe, a.Manhasx, a.Tnbh, a.Mota, a.Giaban); return(executenonquery(query)); }
public bool Update(DTOXE a) { return(update(a)); }
public bool Add(DTOXE a) { return(add(a)); }