// GIA ĐÌNH. public bool Update_GiaDinh(GiaDinh giaDinh) { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "SP_Update_GIADINH"; cmd.Parameters.Add("@MADV", SqlDbType.NVarChar).Value = giaDinh.MaDV; cmd.Parameters.Add("@QUANHE", SqlDbType.NVarChar).Value = giaDinh.QuanHe; cmd.Parameters.Add("@HOTEN", SqlDbType.NVarChar).Value = giaDinh.HoTen; cmd.Parameters.Add("@NAMSINH", SqlDbType.NVarChar).Value = giaDinh.NamSinh; cmd.Parameters.Add("@QUEQUAN", SqlDbType.NVarChar).Value = giaDinh.QueQuan; cmd.Parameters.Add("@DIACHI", SqlDbType.NVarChar).Value = giaDinh.DiaChi; cmd.Connection = _conn; try { _conn.Open(); cmd.ExecuteNonQuery(); return(true); } catch { return(false); } finally { _conn.Close(); } }
// Insert Gia đình private GiaDinh Insert_GD() { string maDV = txt_GD_MaDV.Text; string quanHe = txt_GD_QH.Text; string hoTen = txt_GD_Hoten.Text; string namSinh = txt_GD_Namsinh.Text; string queQuan = txt_GD_Quequan.Text; string diaChi = rtxt_GD_Diachi.Text; if (maDV == "" || quanHe == "" || hoTen == "" || namSinh == "" || queQuan == "" || diaChi == "") { MessageBox.Show("Vui lòng nhập đầy đủ Thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } else { _giaDinh = new GiaDinh(maDV, quanHe, hoTen, namSinh, queQuan, diaChi); return(_giaDinh); } }
// Update Gia đình private void Update_GD(GiaDinh giaDinh) { txt_GD_MaDV.Text = giaDinh.MaDV; txt_GD_QH.Text = giaDinh.QuanHe; txt_GD_Hoten.Text = giaDinh.HoTen; txt_GD_Namsinh.Text = giaDinh.NamSinh; txt_GD_Quequan.Text = giaDinh.QueQuan; rtxt_GD_Diachi.Text = giaDinh.DiaChi; //if (maDV == "" || quanHe == "" || hoTen == "" || namSinh == "" || queQuan == "" || diaChi == "") //{ // MessageBox.Show("Vui lòng nhập đầy đủ Thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); // return null; //} //else //{ // _giaDinh = new GiaDinh(maDV, quanHe, hoTen, namSinh, queQuan, diaChi); // return _giaDinh; //} }
protected void Page_Load(object sender, EventArgs e) { var Ten = Request["Ten"]; var Email = Request["Email"]; var NoiDung = Request["NoiDung"]; var P_ID = Request["P_ID"]; var ID = Request["ID"]; var Anh = Request["Anh"]; var LOAI_ID = Request["LOAI_ID"]; GiaDinh Item; switch (subAct) { case "add": #region add Item = new GiaDinh(); Item.ID = Guid.NewGuid(); Item.Anh = Anh; Item.Email = Email; if (!string.IsNullOrEmpty(LOAI_ID)) { Item.LOAI_ID = new Guid(LOAI_ID); } if (!string.IsNullOrEmpty(P_ID)) { Item.P_ID = new Guid(P_ID); } Item.NgayTao = DateTime.Now; Item.NoiDung = NoiDung; Item.Ten = Ten; Item.ThuTu = 0; Item.Username = Security.Username; Item = GiaDinhDal.Insert(Item); GiaDinhItem1.item = Item; GiaDinhItem1.Visible = true; //rendertext(Item.ID.ToString()); break; #endregion case "remove": #region add if(Security.IsAuthenticated()) { if(!string.IsNullOrEmpty(ID)) { Item = GiaDinhDal.SelectById(new Guid(ID)); if(Item.Username==Security.Username) { GiaDinhDal.DeleteById(new Guid(ID)); } } } break; #endregion case "upload": #region upload if (Security.IsAuthenticated()) { var key = Guid.NewGuid().ToString(); var img = new linh.controls.ImageProcess(Request.Files[0].InputStream, key); if (img.Width < 300) rendertext("300"); img.Resize(520); img.Save(Server.MapPath("~/lib/up/i/") + key + img.Ext); rendertext(key + img.Ext); } break; #endregion default: break; } }
private void btnUpdate_Click(object sender, EventArgs e) { switch (_itemValue) { case 0: { _thongTin = new ThongTin(); _thongTin.MaDV = txtMaDV.Text; _thongTin.HoTen = txtHoten.Text; _thongTin.TenKhaiSinh = txtTenKS.Text; _thongTin.BiDanh = txtBidanh.Text; _thongTin.GioiTinh = txtGioitinh.Text; _thongTin.NgaySinh = convertStringToDate(txtNgaysinh.Text); _thongTin.QueQuan = txtQuequan.Text; _thongTin.DiaChi = rtxtDiachi.Text; _thongTin.SDT = txtSDT.Text; _thongTin.Email = txtEmail.Text; _thongTin.DanToc = txtDantoc.Text; _thongTin.TonGiao = txtTongiao.Text; _thongTin.LinkAnh = _linkAnh; _frmUpdate = new frmUpdate(_thongTin, 0); _frmUpdate.Show(); break; } case 1: { _themThongTin = new ThemThongTin(); _themThongTin.MaDV = txt_TTT_MaDV.Text; _themThongTin.NgayVaoDoan = convertStringToDate(txt_TTT_NgayVD.Text); _themThongTin.NoiVaoDoan = txt_TTT_MaDV.Text; _themThongTin.NgayVaoDangL1 = convertStringToDate(txt_TTT_NgayVDL1.Text); _themThongTin.NoiVaoDangL1 = txt_TTT_MaDV.Text; _themThongTin.NgayChinhThucL1 = convertStringToDate(txt_TTT_NgayCTL1.Text); _themThongTin.NoiCongNhanL1 = txt_TTT_MaDV.Text; _themThongTin.NguoiGioiThieuL1 = txt_TTT_MaDV.Text; _frmUpdate = new frmUpdate(_themThongTin, 1); _frmUpdate.Show(); break; } case 2: { _trinhDo = new TrinhDo(); _trinhDo.MaDV = txt_TD_MaDV.Text; _trinhDo.TrinhDoPT = txt_TD_PT.Text; _trinhDo.ChuyenMon = txt_TD_Chuyenmon.Text; _trinhDo.HocVi = txt_TD_Hocvi.Text; _trinhDo.DTHocVi = convertStringToDate(txt_TD_CTHV.Text); _trinhDo.HocHam = txt_TD_Hocham.Text; _trinhDo.DTHocham = convertStringToDate(txt_TD_CTHH.Text); _trinhDo.LyLuanCT = txt_TD_Lyluan.Text; _trinhDo.NgoaiNgu = rtxt_TD_NN.Text; _frmUpdate = new frmUpdate(_trinhDo, 2); _frmUpdate.Show(); break; } case 3: { _quaTrinhCT = new QuaTrinhCongTac(); _quaTrinhCT.MaDV = txt_QT_MaDV.Text; _quaTrinhCT.MaPB = txt_QT_MaPB.Text; _quaTrinhCT.PhongBan = txt_QT_TenPB.Text; _quaTrinhCT.BatDau = convertStringToDate(txt_QT_Batdau.Text); _quaTrinhCT.KetThuc = convertStringToDate(txt_QT_Ketthuc.Text); _quaTrinhCT.CongViec = txt_QT_Congviec.Text; _quaTrinhCT.DiaDiem = txt_QT_Diadiem.Text; _quaTrinhCT.ChucVu = txt_QT_Chucvu.Text; _frmUpdate = new frmUpdate(_quaTrinhCT, 3); _frmUpdate.Show(); break; } case 4: { _daoTaoBD = new DaoTao_BoiDuong(); _daoTaoBD.MaDV = txt_DT_MaDV.Text; _daoTaoBD.BatDau = convertStringToDate(txt_DT_BD.Text); _daoTaoBD.KetThuc = convertStringToDate(txt_DT_KT.Text); _daoTaoBD.TenLop = txt_DT_Tenlop.Text; _daoTaoBD.HinhThuc = txt_DT_Hinhthuc.Text; _daoTaoBD.ChungChi = txt_DT_Chungchi.Text; _frmUpdate = new frmUpdate(_daoTaoBD, 4); _frmUpdate.Show(); break; } case 5: { _diNuocNgoai = new DiNuocNgoai(); _diNuocNgoai.MaDV = txt_DNN_MaDV.Text; _diNuocNgoai.BatDau = convertStringToDate(txt_DNN_BD.Text); _diNuocNgoai.KetThuc = convertStringToDate(txt_DNN_KT.Text); _diNuocNgoai.NoiDung = rtxt_DNN_ND.Text; _diNuocNgoai.DiaDiem = txt_DNN_DD.Text; _frmUpdate = new frmUpdate(_diNuocNgoai, 5); _frmUpdate.Show(); break; } case 6: { _khenThuong = new KhenThuong(); _khenThuong.MaDV = txt_KT_MaDV.Text; _khenThuong.ThoiGian = convertStringToDate(txt_KT_TG.Text); _khenThuong.HinhThuc = txt_KT_Hinhthuc.Text; _khenThuong.CapQD = txt_KT_CapQD.Text; _khenThuong.LyDo = rtxt_KT_Lydo.Text; _frmUpdate = new frmUpdate(_khenThuong, 6); _frmUpdate.Show(); break; } case 7: { _kyLuat = new KyLuat(); _kyLuat.MaDV = txt_KL_MaDV.Text; _kyLuat.ThoiGian = convertStringToDate(txt_KL_TG.Text); _kyLuat.HinhThuc = txt_KL_Hinhthuc.Text; _kyLuat.CapQD = txt_KL_CapQD.Text; _kyLuat.LyDo = rtxt_KL_Lydo.Text; _frmUpdate = new frmUpdate(_kyLuat, 7); _frmUpdate.Show(); break; } case 8: { _giaDinh = new GiaDinh(); _giaDinh.MaDV = txt_GD_MaDV.Text; _giaDinh.QuanHe = txt_GD_QH.Text; _giaDinh.HoTen = txt_GD_Hoten.Text; _giaDinh.NamSinh = txt_GD_Namsinh.Text; _giaDinh.QueQuan = txt_GD_Quequan.Text; _giaDinh.DiaChi = rtxt_GD_Diachi.Text; _frmUpdate = new frmUpdate(_giaDinh, 8); _frmUpdate.Show(); break; } case 9: { _tuNhanXet = new TuNhanXet(); _tuNhanXet.MaDV = txt_TNX_MaDV.Text; _tuNhanXet.PhamChat = txt_TNX_PC.Text; _tuNhanXet.DaoDuc = txt_TNX_DD.Text; _tuNhanXet.NangLuc = txt_TNX_NL.Text; _tuNhanXet.QuanHeQC = txt_TNX_QHQC.Text; _tuNhanXet.KhuyetDiem = txt_TNX_KD.Text; _frmUpdate = new frmUpdate(_tuNhanXet, 9); _frmUpdate.Show(); break; } } }
// GIA ĐÌNH. public bool Insert_GiaDinh(GiaDinh giaDinh) { return(dal_Insert.Insert_GiaDinh(giaDinh)); }
// GIA ĐÌNH. public bool Update_GiaDinh(GiaDinh giaDinh) { return(dal_Update.Update_GiaDinh(giaDinh)); }
public frmUpdate(Object obj, int item) { InitializeComponent(); gbThongTin.Visible = false; gbThemThongTin.Visible = false; gbTrinhdo.Visible = false; gbQuatrinhCT.Visible = false; gbDaoTao.Visible = false; gbDiNN.Visible = false; gbKhenThuong.Visible = false; gbKyluat.Visible = false; gbGiadinh.Visible = false; gbTuNhanXet.Visible = false; switch (item) { case 0: this._thongTin = (ThongTin)obj; Update_ThongTin(_thongTin); gbThongTin.Visible = true; break; case 1: this._themThongTin = (ThemThongTin)obj; Update_ThemThongTin(_themThongTin); gbThemThongTin.Visible = true; break; case 2: this._trinhDo = (TrinhDo)obj; Update_TrinhDo(_trinhDo); gbTrinhdo.Visible = true; break; case 3: this._quaTrinhCT = (QuaTrinhCongTac)obj; Update_QTCT(_quaTrinhCT); gbQuatrinhCT.Visible = true; break; case 4: this._daoTaoBD = (DaoTao_BoiDuong)obj; Update_DTBD(_daoTaoBD); gbDaoTao.Visible = true; break; case 5: this._diNuocNgoai = (DiNuocNgoai)obj; Update_DNN(_diNuocNgoai); gbDiNN.Visible = true; break; case 6: this._khenThuong = (KhenThuong)obj; Update_KT(_khenThuong); gbKhenThuong.Visible = true; break; case 7: this._kyLuat = (KyLuat)obj; Update_KL(_kyLuat); gbKyluat.Visible = true; break; case 8: this._giaDinh = (GiaDinh)obj; Update_GD(_giaDinh); gbGiadinh.Visible = true; break; case 9: this._tuNhanXet = (TuNhanXet)obj; Update_TNX(_tuNhanXet); gbTuNhanXet.Visible = true; break; } }