private void updateBaohiem() { if (KT_SuaBaohiem()) { DMBaohiem bh = new DMBaohiem(); bh.Sobaohiem = sobaohiemTextEdit.Text; if (cbloaibaohiem.Text == "Bảo hiểm y tế") { bh.Loaibaohiem = "yt"; } else { bh.Loaibaohiem = "tn"; } bh.Ngaycap = ngaycapDateEdit.Text; bh.Noicap = noicapTextEdit.Text; bh.Noikhambenh = noikhambenhTextEdit.Text; bh.Ngaynghiviec = ngaynghiDateEdit.Text; if (BUS_Baohiem.updateBaohiem(bh, soBH_truoc) == "true") { MessageBox.Show("Đã sửa thành công bảo hiểm cho nhân viên:" + hoten + "", "Thông báo"); MyGetdata(); this.Close(); } else { MessageBox.Show("Chú ý, Sửa thông tin thất bại", "chú ý"); } } }
// // tu ma nhan vien lay ra thong tin bao hiem cua nhan vien do // #region lấy thông tin bảo hiểm từ mã nhân viên public static List <DMBaohiem> selectBaohiemfromManv(string manv1) { List <DMBaohiem> bh = new List <DMBaohiem>(); DMBaohiem bh1; DataTable dt; string s = "select * from DMBaohiem where manv='" + manv1 + "'"; dt = DA.Ketnoi.ExcecuteQuery(s); for (int i = 0; i < dt.Rows.Count; i++) { bh1 = new DMBaohiem(); bh1.Sobaohiem = dt.Rows[i]["sobaohiem"].ToString(); if (dt.Rows[i]["loaibaohiem"].ToString() == "yt") { bh1.Loaibaohiem = "Bảo hiểm y tế"; } else { bh1.Loaibaohiem = "Bảo hiểm tai nạn"; } bh1.Ngaycap = dt.Rows[i]["ngaycap"].ToString(); bh1.Noicap = dt.Rows[i]["noicap"].ToString(); bh1.Noikhambenh = dt.Rows[i]["noikhambenh"].ToString(); bh1.Ngaynghiviec = dt.Rows[i]["ngaynghiviec"].ToString(); bh.Add(bh1); } return(bh); }
private void insertBaohiem() { if (KT_ThemBaohiem()) { DMBaohiem bh = new DMBaohiem(); bh.Sobaohiem = sobaohiemTextEdit.Text; if (cbloaibaohiem.Text == "Bảo hiểm y tế") { bh.Loaibaohiem = "yt"; } else { bh.Loaibaohiem = "tn"; } bh.Ngaycap = ngaycapDateEdit.Text; bh.Ngaynghiviec = ""; bh.Noicap = noicapTextEdit.Text; bh.Noikhambenh = noikhambenhTextEdit.Text; if (BUS_Baohiem.insertBaohiem(bh, manv) == "true") { MessageBox.Show("Đã thêm thành công bảo hiểm cho nhân viên:" + hoten + "", "Thông báo"); MygetData(); this.Close(); } else { MessageBox.Show("Chú ý, Thêm thông tin thất bại", "chú ý"); } } }
// them 1 bao hiem #region thêm 1 bảo hiểm public static string insetBaohiem(DMBaohiem BH, string manv1) { BH.Ngaycap = clConver.ConverDMY_MDY(DateTime.Parse(BH.Ngaycap)); string s = "insert into DMBaoHiem (sobaohiem,loaibaohiem,ngaycap,noicap,noikhambenh,manv) values ('{0}','{1}','{2}',N'{3}',N'{4}','{5}');"; string sql = string.Format(s, BH.Sobaohiem, BH.Loaibaohiem, BH.Ngaycap, BH.Noicap, BH.Noikhambenh, manv1); return(DA.Ketnoi.ExcuteNonQuery(sql)); }
// sua 1 bao hiem #region sửa bảo hiểm public static string UpdateBaohiem(DMBaohiem bh, string sobaohiemcu) { bh.Ngaycap = clConver.ConverDMY_MDY(DateTime.Parse(bh.Ngaycap)); bh.Ngaynghiviec = clConver.ConverDMY_MDY(DateTime.Parse(bh.Ngaynghiviec)); string SET = "sobaohiem='" + bh.Sobaohiem + "',loaibaohiem='" + bh.Loaibaohiem + "',ngaycap='" + bh.Ngaycap + "',"; SET += "noicap=N'" + bh.Noicap + "',noikhambenh=N'" + bh.Noikhambenh + "',ngaynghiviec='" + bh.Ngaynghiviec + "'"; string sql = string.Format("Update DMbaohiem SET {0} where sobaohiem= '{1}';", SET, sobaohiemcu); return(DA.Ketnoi.ExcuteNonQuery(sql)); }
public frmSuaBaohiem(DMBaohiem BH, string manv1, string ho, string ten) { this.manv = manv1; this.hoten = ho + " " + ten; this.soBH_truoc = BH.Sobaohiem; this.loaiBH = BH.Loaibaohiem; this.ngayCapBH = BH.Ngaycap; this.noiCapBH = BH.Noicap; this.noikhamBenh = BH.Noikhambenh; this.ngayNghiviec = BH.Ngaynghiviec; InitializeComponent(); }
private void suaBH() { if (dMBaoHiemGridControl.MainView.RowCount > 0) { DMBaohiem BH = new DMBaohiem(); BH.Sobaohiem = sobaohiemTextedit.Text; BH.Loaibaohiem = loaibaohiemTextEdit.Text; BH.Ngaycap = ngaycapDateEdit.Text; BH.Noicap = noicapTextEdit.Text; BH.Noikhambenh = noikhambenhTextEdit.Text; BH.Ngaynghiviec = ngaynghiviecDateEdit.Text; string manv1 = maNVTextEdit.Text; frmSuaBaohiem bh1 = new frmSuaBaohiem(BH, maNVTextEdit.Text, hoLotTextEdit.Text, tenTextEdit.Text); bh1.MyGetdata = new frmSuaBaohiem.GetString(ReloadBH); bh1.Show(); } else { MessageBox.Show("Không có bảo hiểm để sửa đổi", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
// // lay ra toan bo thong tin bao hiem tat ca bao hiem // #region lấy thông tin bảo hiểm full public static List <DMBaohiem> selectBaohiemFull() { List <DMBaohiem> bh = new List <DMBaohiem>(); DMBaohiem bh1; DataTable dt; string s = "select * from DMBaohiem"; dt = DA.Ketnoi.ExcecuteQuery(s); for (int i = 0; i < dt.Rows.Count; i++) { bh1 = new DMBaohiem(); string k = dt.Rows[i]["id"].ToString(); bh1.Id1 = int.Parse(k); bh1.Loaibaohiem = dt.Rows[i]["loaibaohiem"].ToString(); bh1.Ngaycap = dt.Rows[i]["ngaycap"].ToString(); bh1.Noicap = dt.Rows[i]["noicap"].ToString(); bh1.Noikhambenh = dt.Rows[i]["noikhambenh"].ToString(); bh1.Sobaohiem = dt.Rows[i]["sobaohiem"].ToString(); bh.Add(bh1); } return(bh); }
// sua bao hiem public static string updateBaohiem(DMBaohiem bh, string sobaohiemcu) { return(DAO_Baohiem.UpdateBaohiem(bh, sobaohiemcu)); }
// them 1 bao hiem public static string insertBaohiem(DMBaohiem BH, string manv1) { return(DAO_Baohiem.insetBaohiem(BH, manv1)); }