private void gridView3_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            IDNK = gridView3.GetFocusedRowCellValue("ID") != null?Convert.ToInt32(gridView3.GetFocusedRowCellValue("ID")) : 0;

            string MKS = gridView3.GetFocusedRowCellValue("MAKHAISINH") != null?Convert.ToString(gridView3.GetFocusedRowCellValue("MAKHAISINH")) : "";

            xpQUATRINH.CriteriaString = "MAKHAISINH ='" + MKS + "'";
            xpQUANHE.CriteriaString   = "MAKHAISINH ='" + MKS + "'";
            xpTIENAN.CriteriaString   = "MAKHAISINH ='" + MKS + "'";
            xpDIENBIEN.CriteriaString = "MAKHAISINH ='" + MKS + "'";
            xpTAMVANG.CriteriaString  = "MAKHAISINH ='" + MKS + "'";
            Bientoancuc.IDNK          = IDNK;
            if (IDNK != 0)
            {
                ttnk = unitNHANKHAU.GetObjectByKey <NHANKHAU>(IDNK);
                BindingsTab();
            }
            else
            {
                textEdit1.EditValue      = null;
                textEdit2.EditValue      = null;
                textEdit3.EditValue      = null;
                dateEdit1.EditValue      = null;
                cboGT.EditValue          = null;
                textEdit9.EditValue      = null;
                comboBoxEdit10.EditValue = null;
                comboBoxEdit11.EditValue = null;
                cboQT.EditValue          = null;
                cb1.EditValue            = null;
                cb2.EditValue            = null;
                cb3.EditValue            = null;
                cb4.EditValue            = null;
                cb12.EditValue           = null;
                cb22.EditValue           = null;
                cb32.EditValue           = null;
                cb42.EditValue           = null;
                cb13.EditValue           = null;
                cb23.EditValue           = null;
                cb33.EditValue           = null;
                cb43.EditValue           = null;
                cb14.EditValue           = null;
                cb24.EditValue           = null;
                cb34.EditValue           = null;
                cb44.EditValue           = null;
                dc1.EditValue            = null;
                dc2.EditValue            = null;
                dc3.EditValue            = null;
                dc4.EditValue            = null;
                textEdit7.EditValue      = null;
                dateEdit2.EditValue      = null;
                textEdit8.EditValue      = null;
                textEdit10.EditValue     = null;
                textEdit11.EditValue     = null;
                textEdit12.EditValue     = null;
                picHA.EditValue          = null;
                textEdit4.EditValue      = null;
            }
        }
 public frmThemCongDan()
 {
     InitializeComponent();
     LoadDanToc();
     LoadTonGiao();
     cboGT.Properties.Items.AddEnum(typeof(GioiTinh), true);
     cboGTQH.Items.AddEnum(typeof(GioiTinh), true);
     cboGT.SelectedIndex = 0;
     ttnk = new NHANKHAU(unitNHANKHAU);
     //ttnk = unitNHANKHAU.GetObjectByKey<NHANKHAU>(7);
     BindingsTab();
 }
Beispiel #3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                if (textEdit2.Text == "")
                {
                    Messages.MessagesBox.Error("Vui lòng nhập tên chủ hộ!.");
                    textEdit2.Focus();
                }
                else
                {
                    try
                    {
                        NHANKHAU nhkh_ = new NHANKHAU(Session.DefaultSession);
                        nhkh_.SOHOKHAU      = Convert.ToInt32(textEdit1.Text);
                        nhkh_.HOTENKHAISINH = textEdit2.Text;
                        if (imageComboBoxEdit1.EditValue != null)
                        {
                            nhkh_.GIOITINH = Convert.ToInt32(imageComboBoxEdit1.EditValue);
                        }
                        if (dateEdit2.EditValue != null)
                        {
                            nhkh_.NGAYSINH = Convert.ToDateTime(dateEdit2.EditValue);
                        }
                        if (dateEdit2.EditValue != null)
                        {
                            nhkh_.DANTOC = comboBoxEdit1.EditValue.ToString();
                        }
                        if (cboQT.EditValue != null)
                        {
                            nhkh_.QUOCTICH = cboQT.EditValue.ToString();
                        }
                        if (cb4.EditValue != null)
                        {
                            nhkh_.IDQG4 = cb4.EditValue.ToString();
                        }
                        if (cb42.EditValue != null)
                        {
                            nhkh_.IDTINH4 = cb42.EditValue.ToString();
                        }
                        if (cb43.EditValue != null)
                        {
                            nhkh_.IDHUYEN4 = cb43.EditValue.ToString();
                        }
                        if (cb44.EditValue != null)
                        {
                            nhkh_.IDXA4 = cb44.EditValue.ToString();
                        }
                        if (dc4.EditValue != null)
                        {
                            nhkh_.DC4 = dc4.EditValue.ToString();
                        }
                        nhkh_.QUANHE = "Chủ hộ";
                        nhkh_.Save();
                    }
                    catch (Exception)
                    {
                        XtraMessageBox.Show("Vui lòng nhập đầy đủ thông tin!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    SplashScreenManager.ShowDefaultWaitForm("Đang tải", "Vui lòng chờ...");
                    try
                    {
                        unitOfWork1.CommitChanges();
                    }
                    catch (Exception)
                    { }

                    DialogResult h = XtraMessageBox.Show("Đã đăng ký hộ khẩu mới, vui lòng vào danh mục nhân khẩu để cập nhân thông tin chủ hộ (Số sổ hộ khẩu: " + textEdit1.Text + ")", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                    SplashScreenManager.CloseDefaultWaitForm();
                }
            }
            catch (Exception)
            {
                return;
            }
        }