Exemplo n.º 1
0
        private bool vSaveStudents(int vCheck)
        {
            boHocVien             = new BO_HOCVIEN();
            hocvien               = new HOCVIEN();
            hocvien.HOV_Code      = txtStudentCode.Text;
            hocvien.HOV_FirstName = txtFirstName.Text.Trim();
            hocvien.HOV_LastName  = txtLastName.Text.Trim();
            hocvien.HOV_FullName  = txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim();
            hocvien.HOV_BirthDay  = txtBirthDay.Text;
            hocvien.HOV_Address   = txtAddress.Text;
            hocvien.HOV_Phone     = txtPhone.Text;
            hocvien.HOV_GhiChu    = memoRemarks.Text.Trim();
            hocvien.HOV_QuocTich  = txtQuocTich.Text.Trim();
            hocvien.HOV_NoiSinh   = lookUpBirthPlace.GetColumnValue("TIN_ID").ToString();
            hocvien.HOV_DonVi     = lookUpDonvi.GetColumnValue("DON_ID").ToString();

            if (vCheck == 1)
            {
                gHocVienID = boHocVien.insert(hocvien);
                flagSave   = true;
            }
            else if (vCheck == 2)
            {
                //hocvien.HOV_ID = mIdStudents;
                //boHocVien.update(hocvien);
                ////mIdStudents lấy lúc selectRow
                //loadDataToGrid();
            }
            return(flagSave);
        }
Exemplo n.º 2
0
        private bool sSaveStudents(int sCheck)
        {
            hocvien               = new HOCVIEN();
            boHv                  = new BO_HOCVIEN();
            hocvien.HOV_Code      = txtStudentCode.Text;
            hocvien.HOV_FirstName = txtFirstName.Text.Trim();
            hocvien.HOV_LastName  = txtLastName.Text.Trim();
            hocvien.HOV_FullName  = txtFirstName.Text.Trim() + " " + txtLastName.Text.Trim();
            hocvien.HOV_BirthDay  = txtBirthDay.Text;
            hocvien.HOV_Address   = txtAddress.Text;
            hocvien.HOV_Phone     = txtPhone.Text;
            hocvien.HOV_GhiChu    = memoRemarks.Text.Trim();
            hocvien.HOV_QuocTich  = txtQuocTich.Text.Trim();
            if (lookUpBirthPlace.ItemIndex < 0)
            {
                MessageBox.Show("Chưa chọn nơi sinh", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            else
            {
                hocvien.HOV_NoiSinh = lookUpBirthPlace.GetColumnValue("TIN_ID").ToString();
            }
            if (lookUpDonvi.ItemIndex < 0)
            {
                MessageBox.Show("Chưa chọn đơn vị", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            else
            {
                hocvien.HOV_DonVi = lookUpDonvi.GetColumnValue("DON_ID").ToString();
            }

            if (sCheck == 1)
            {
                gIDHocVien = boHv.insert(hocvien);
                flagSave   = true;
            }
            else
            if (sCheck == 2)
            {
                hocvien.HOV_ID = gIDHocVien;
                boHv.update(hocvien);
                loadDataToGrid();
            }
            return(flagSave);
        }
Exemplo n.º 3
0
 private bool saveData()
 {
     hocvien               = new HOCVIEN();
     boHv                  = new BO_HOCVIEN();
     hocvien.HOV_Code      = txtCode.Text;
     hocvien.HOV_FirstName = txtNameF.Text.Trim();
     hocvien.HOV_LastName  = txtNameL.Text.Trim();
     hocvien.HOV_FullName  = txtNameF.Text.Trim() + " " + txtNameL.Text.Trim();
     hocvien.HOV_BirthDay  = txtBirthDay.Text;
     hocvien.HOV_Address   = txtAddress.Text;
     hocvien.HOV_Phone     = txtFone.Text;
     if (lookUpBirthPlace.ItemIndex < 0)
     {
         //sQueQuan = " ";
         MessageBox.Show("Chưa chọn nơi sinh", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     else
     {
         hocvien.HOV_NoiSinh = lookUpBirthPlace.GetColumnValue("TIN_ID").ToString();
     }
     if (lookUpDonvi.ItemIndex < 0)
     {
         MessageBox.Show("Chưa chọn đơn vị", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     else
     {
         hocvien.HOV_DonVi = lookUpDonvi.GetColumnValue("DON_ID").ToString();
     }
     hocvien.HOV_GhiChu   = txtGhiChu.Text.Trim();
     hocvien.HOV_QuocTich = txtQuocTich.Text.Trim();
     try
     {
         boHv.insert(hocvien);
         vFlagSave = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(false);
     }
     return(vFlagSave);
 }