/// <summary>
 /// Insert CurrencyAgent detail.
 /// </summary>
 /// <param name="xmlData">Data that converted into xml format.</param>
 /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>
 public int InsertCurrencyAgent(AgentBDto objAgentBDto)
 {
     Database db = null;
     DbCommand dbCmd = null;
     int Result = 0;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand(DALHelper.USP_BOOKING_FOREIGN_CURRENCY_AGENT_INSERT);
         db.AddInParameter(dbCmd, "@FOREIGN_CURRENCY_AGENT_NAME", DbType.String, objAgentBDto.AgentName);
         db.AddInParameter(dbCmd, "@EMAIL", DbType.String, objAgentBDto.Email);
         db.AddInParameter(dbCmd, "@PHONE", DbType.String, objAgentBDto.Phone);
         db.AddInParameter(dbCmd, "@MOBILE", DbType.String, objAgentBDto.Mobile);
         db.AddInParameter(dbCmd, "@FAX", DbType.String, objAgentBDto.Fax);
         db.AddInParameter(dbCmd, "@USER_ID", DbType.Int32, objAgentBDto.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;
                objAgentLookup = new AgentDal();
                objAgentBDto = new AgentBDto();
                objAgentBDto.AgentName = txtAgentName.Text;
                objAgentBDto.Email = txtEmail.Text;
                objAgentBDto.Mobile = txtMobile.Text;
                objAgentBDto.Phone = txtPhone.Text;
                objAgentBDto.Fax = txtFax.Text;

                objAgentBDto.UserId = objAuthorizationBDto.UserProfile.UserId;
                result = objAgentLookup.InsertAgent(objAgentBDto);
                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; }
            }
        }
Exemple #3
0
 public int InsertCountry(AgentBDto objagentDDto)
 {
     Database db = null;
     DbCommand dbCmd = null;
     int Result = 0;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand("USP_ADMINISTRATION_COMMON_COUNTRY_TEST_MASTER_INSERT");
         db.AddInParameter(dbCmd, "@COUNTRY_NAME", DbType.String, objagentDDto.CountryName1);
         db.AddInParameter(dbCmd, " @CREATED_BY", DbType.Int32, objagentDDto.CtreatedBy1);
         db.AddInParameter(dbCmd, "@CREATED_DATE", DbType.DateTime, objagentDDto.CreatedDate1);
         db.AddInParameter(dbCmd, "@MODIFY_BY", DbType.Int32, objagentDDto.ModifyBy1);
         db.AddInParameter(dbCmd, "MODIFIED_DATE", DbType.DateTime, objagentDDto.ModifyDate1);
         db.ExecuteNonQuery(dbCmd);
         Result=Convert.ToInt32(db.GetParameterValue(dbCmd,"@ISEXIT"));
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         {
             throw ex;
         }
     }
     finally
     {
         DALHelper.Destroy(ref dbCmd);
     }
     return Result;
 }