Ejemplo n.º 1
0
        public bool SetSave()
        {
            bool ReturnValue = false;

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

                    if (objCountryBL.Exception == null)
                    {
                        if (objCountryBL.ErrorMessage != "")
                        {
                            lblErrorMessage.Text = objCountryBL.ErrorMessage;
                            txtCountryName.Focus();
                            ReturnValue = false;
                        }
                        else
                        {
                            lblErrorMessage.Text = "No error";
                            ReturnValue          = true;
                        }
                    }
                    else
                    {
                        MessageBox.Show(objCountryBL.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ReturnValue = false;
                    }
                }
            }
            catch (Exception exc)
            {
                Utill.Common.ExceptionLogger.writeException("Country", exc.StackTrace);
                MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception");
            }
            return(ReturnValue);
        }
Ejemplo n.º 2
0
        public JsonResultEntity Update([FromBody] CountryEntity countryEntity)
        {
            CountryBL        countryBL = new CountryBL();
            JsonResultEntity response  = new JsonResultEntity();

            try
            {
                var result = countryBL.Update(countryEntity);
                if (result.HasWarning() || result.Value == null)
                {
                    response.Message = String.Join(",", result.Warning);
                    return(response);
                }
                response.Success = true;
                response.Data    = result.Value;
            }
            catch (Exception e)
            {
                response.Message = e.Message;
                LoggerHelper.Error(e);
            }
            return(response);
        }