private void SaveDetails(FeeTypeModel feeTypeModel) { try { _feeType = new FeeType(); short output = _feeType.SaveFeeType(feeTypeModel); switch (output) { case 1: lblError.Visible = false; MessageBox.Show("Record Successfully Saved.", "Fee Type", MessageBoxButtons.OK, MessageBoxIcon.Information); gridFeeType.Refresh(); //bind Grid on Insert And Update. BindGrid(); ResetControls(); hdnFeeTypeID.Text = String.Empty; break; case -1: lblError.Visible = true; lblError.Text = "Error! Please contact to admin."; break; case 0: lblError.Visible = true; lblError.Text = "Record already Exit."; break; } } catch (Exception ex) { lblError.Visible = true; lblError.Text = "Error! Please contact to admin."; } }
private void btnSave_Click(object sender, EventArgs e) { if (ValidateControls()) { _feeTypeModel = new FeeTypeModel(); _feeTypeModel.FeeTypeID = string.IsNullOrWhiteSpace(hdnFeeTypeID.Text) ? null : (short?)Convert.ToInt16(hdnFeeTypeID.Text); _feeTypeModel.FeeType = txtFeeType.Text.ToProper(); _feeTypeModel.Active = chkActive.Checked == true ? true : false; _feeTypeModel.IsPurchasable = chkIsPurchasable.Checked == true ? true : false; SaveDetails(_feeTypeModel); } }
public JsonResult EditFeeType(FeeTypeModel model) { string result = "0"; if (model != null) { try { _feeManageService.UpdateFeeType(model.ToEntity <FeeType>()); result = "1"; } catch (Exception ex) { result = ex.Message; } } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult CreateFeeType(FeeTypeModel model) { var result = new ResponseResult(); if (model != null) { try { _feeManageService.CreateFeeType(model.ToEntity <FeeType>()); result.Result = true; result.Message = "Success"; } catch (Exception ex) { result.Result = false; result.Message = ex.Message; } } return(Json(result, JsonRequestBehavior.AllowGet)); }
public short SaveFeeType(FeeTypeModel feeTypeModel) { short result; try { using (SqlService sqlService = new SqlService(ConnectionString.ConnectionStrings)) { sqlService.AddParameter("@FeeTypeID", feeTypeModel.FeeTypeID); sqlService.AddParameter("@FeeType", feeTypeModel.FeeType); sqlService.AddParameter("@Active", feeTypeModel.Active); sqlService.AddParameter("@IsPurchasable", feeTypeModel.IsPurchasable); sqlService.AddOutputParameter("@Result", SqlDbType.SmallInt); sqlService.ExecuteSPNonQuery("dbo.USP_SaveFeeType"); result = (short)sqlService.Parameters["@Result"].Value; } } catch (Exception ex) { throw ex; } return(result); }