/// <summary>
 /// Valids the data.
 /// </summary>
 /// <returns></returns>
 protected override bool ValidData()
 {
     if (string.IsNullOrEmpty(AccountingObjectCode))
     {
         XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResEmployeeCode"),
                             ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtEmployeeCode.Focus();
         return(false);
     }
     if (_accountingObjectPresenter.CodeIsExist(AccountingObjectId, AccountingObjectCode, true))
     {
         XtraMessageBox.Show(String.Format(ResourceHelper.GetResourceValueByName("ResEmployeeCodeDuplicate"), AccountingObjectCode),
                             ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtEmployeeCode.Focus();
         return(false);
     }
     if (string.IsNullOrEmpty(AccountingObjectName))
     {
         XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResEmployeeName"),
                             ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
         txtEmployeeName.Focus();
         return(false);
     }
     if (string.IsNullOrEmpty(DepartmentId))
     {
         XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResEmptyDepartmentID"),
                             ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
         gridLookUpEditDepartment.Focus();
         return(false);
     }
     return(true);
 }
        protected override bool ValidData()
        {
            if (ActionMode == ActionModeEnum.AddNew)
            {
                if (_accountingObjectPresenter.CodeIsExist(null, AccountingObjectCode))
                {
                    XtraMessageBox.Show("Mã đối tượng đã tồn tại", ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtAcountingObjectCode.Focus();
                    return(false);
                }
            }

            if (ActionMode == ActionModeEnum.Edit && _accountingObjectPresenter.CodeIsExist(Convert.ToInt32(KeyValue), AccountingObjectCode))
            {
                XtraMessageBox.Show("Mã đối tượng đã tồn tại", ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAcountingObjectCode.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(txtAcountingObjectCode.Text))
            {
                XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResAccountingCode"), ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAcountingObjectCode.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtAccountingObjectName.Text))
            {
                XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResAccountingName"), ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAccountingObjectName.Focus();
                return(false);
            }
            if (gridAccountingObjectCategoryId.EditValue == null)
            {
                XtraMessageBox.Show(ResourceHelper.GetResourceValueByName("ResAccountingType"), ResourceHelper.GetResourceValueByName("ResDetailContent"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                gridAccountingObjectCategoryId.Focus();
                return(false);
            }
            return(true);
        }