/// <summary> /// Insert RoomType detail. /// </summary> /// <param name="xmlData">Data that converted into xml format.</param> /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns> public int InsertCurrency(CurrencyBDto objCurrencyLookupBDto) { Database db = null; DbCommand dbCmd = null; int Result = 0; try { db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING); dbCmd = db.GetStoredProcCommand(DALHelper.USP_BOOKING_CURRENCY_INSERT); db.AddInParameter(dbCmd, "@CURRENCY_NAME", DbType.String, objCurrencyLookupBDto.CurrencyName); db.AddInParameter(dbCmd, "@CURRENCY_SYMBOL", DbType.String, objCurrencyLookupBDto.CurrencySymbol); db.AddInParameter(dbCmd, "@CREATED_BY", DbType.Int32, objCurrencyLookupBDto.UserId); db.AddOutParameter(dbCmd, "@ISEXIST", DbType.Int32, 1); db.ExecuteNonQuery(dbCmd); Result = Convert.ToInt32(db.GetParameterValue(dbCmd, "@ISEXIST")); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } finally { DALHelper.Destroy(ref dbCmd); } return Result; }
private void Save() { try { int result = 0; objCurrencyLookup = new CurrencyLookupDal(); objCurrencyLookupBDto = new CurrencyBDto(); objCurrencyLookupBDto.CurrencyName = txtCurrency.Text; objCurrencyLookupBDto.CurrencySymbol = txtCurrencySymbol.Text; objCurrencyLookupBDto.UserId = objAuthorizationBDto.UserProfile.UserId; result = objCurrencyLookup.InsertCurrency(objCurrencyLookupBDto); if (result >= 1) { Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString()); Master.MessageCssClass = "successMessage"; bisEdit = false; } else { Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString()); Master.MessageCssClass = "errorMessage"; } BindGrid(); Reset(); } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME); if (rethrow) { throw ex; } } }