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

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

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