protected bool update(DTONV a) { string day = a.Ngaysinh.ToString("yyyyMMdd"); string query = string.Format("UPDATE dbo.nhanvien SET tennv='{1}',namsinh = '{2}', gioitinh= {3},sdt = {4},diachi='{5} ',macv= {9},luong ={6} , trangthai = {7}, email = '{8}' WHERE MANV = '{0}'", a.Manv, a.Tennv, day, a.Gioitinh, a.Sdt, a.Diachi, a.Luong, a.Trangthai, a.Email, a.Macv); return(executenonquery(query)); }
protected bool add(DTONV a) { string day = a.Ngaysinh.ToString("yyyyMMdd"); string query = string.Format("INSERT dbo.nhanvien (tennv,namsinh,gioitinh, sdt, diachi,macv, luong,trangthai,email) VALUES ( N'{0}','{1}', {2}, {3}, N'{4}', {8},{5}, {6} ,' {7}' )", a.Tennv, day, a.Gioitinh, a.Sdt, a.Diachi, a.Luong, a.Trangthai, a.Email, a.Macv); return(executenonquery(query)); }
private void buttonsuanv_Click(object sender, EventArgs e) { string a = textBoxmanv.Text; string b = textBoxtennv.Text; DateTime c = dateTimePickernamsinhnv.Value; bool sdt = Int32.TryParse(textBoxsdtnv.Text, out int d); string k = textBoxemailnv.Text; string g = textBoxdiachinv.Text; bool luong = Int32.TryParse(textBoxluongnv.Text, out int h); string gt = comboBoxgoitinhnv.Text; int x; if (gt == "NAM") { x = 1; } else { x = 0; } string tt = comboBoxtrangthainv.Text; int y; if (tt == "ĐANG LÀM") { y = 1; } else { y = 0; } CV t = comboBoxchucvunv.SelectedItem as CV; int ma = t.Macv; DTONV p = new DTONV(a, b, c, x, d, g, h, y, k, ma); //int cv = comboBoxchucvunv. if (a != "" && b != "" && sdt != false && k != "" && g != "" && luong != false && gt != "" && tt != "") { if (nv.Update(p)) { loadnv(); } else { MessageBox.Show("sua that bai"); } } else { MessageBox.Show("sua that bai"); } }
public bool Update(DTONV a) { return(update(a)); }
public bool Add(DTONV a) { return(add(a)); }