Exemple #1
0
        public bool SetSave()
        {
            bool ReturnValue = false;

            try
            {
                if (DataValidator.IsValid(this.grpData))
                {
                    if (_Mode == (int)Common.Constant.Mode.Insert)
                    {
                        objStateBL.Insert(_CountryID, txtStateName.Text);
                    }
                    else if (_Mode == (int)Common.Constant.Mode.Modify)
                    {
                        objStateBL.Update(_StateID, _CountryID, txtStateName.Text);
                    }

                    if (objStateBL.Exception == null)
                    {
                        if (objStateBL.ErrorMessage != "")
                        {
                            lblErrorMessage.Text = objStateBL.ErrorMessage;
                            txtStateName.Focus();
                            ReturnValue = false;
                        }
                        else
                        {
                            lblErrorMessage.Text = "No error";
                            ReturnValue          = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(objStateBL.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ReturnValue = false;
                    }
                }
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("State", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
            return(ReturnValue);
        }