Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public ActionResult <EditCityResponseModel> EditCity([FromBody] EditCityInputModel data)
        {
            EditCityResponseModel res = new EditCityResponseModel();

            try
            {
                CityBL bl   = new CityBL(db);
                var    res2 = bl.Update(data);

                res.data     = res2;
                res.Message  = res.Message;
                res.Response = true;
                return(res);
            }
            catch (Exception ex)
            {
                res.Message  = ex.Message;
                res.Response = false;
                return(res);
            }
        }
Exemplo n.º 3
0
        public JsonResultEntity Update([FromBody] CityEntity cityEntity)
        {
            CityBL           cityBL   = new CityBL();
            JsonResultEntity response = new JsonResultEntity();

            try
            {
                var result = cityBL.Update(cityEntity);
                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);
        }
Exemplo n.º 4
0
        public ResponseModel Update(RequestModel model)
        {
            var cityBL = new CityBL();

            return(cityBL.Update(model.Data));
        }