コード例 #1
0
        /// <summary>
        /// Update customer travel history with other detail.
        /// </summary>
        /// <param name="travel">Data transfer object contains customer data.</param>
        /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>
        public int UpdateCustomerTravelHistoryWithOther(TravelBDto travel)
        {
            Database db = null;
            DbCommand dbCmd = null;
            int Result = 0;
            try
            {
                db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
                dbCmd = db.GetStoredProcCommand(DALHelper.USP_CUST_TRAVEL_HISTORY_WITH_OTHER_UPDATE);
                db.AddInParameter(dbCmd, "@SR_NO", DbType.Int32, travel.SerialNo);
                db.AddInParameter(dbCmd, "@CUST_ID", DbType.Int32, travel.CustomerId);
                db.AddInParameter(dbCmd, "@YEAR_MONTH", DbType.Int32, travel.YearMonth);

                if (travel.AgentId != 0)
                    db.AddInParameter(dbCmd, "@AGENT_ID", DbType.Int32, travel.AgentId);
                else
                    db.AddInParameter(dbCmd, "@AGENT_ID", DbType.Int32, DBNull.Value);

                if (travel.TourTypeId != 0)
                    db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.String, travel.TourTypeId);
                else
                    db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.String, DBNull.Value);

                if (!String.IsNullOrEmpty(travel.CountryName))
                    db.AddInParameter(dbCmd, "@COUNTRY_NAME", DbType.String, travel.CountryName);
                else
                    db.AddInParameter(dbCmd, "@COUNTRY_NAME", DbType.String, DBNull.Value);

                if (travel.NoOfPersons != 0)
                    db.AddInParameter(dbCmd, "@NO_OF_PERSONS", DbType.Int32, travel.NoOfPersons);
                else
                    db.AddInParameter(dbCmd, "@NO_OF_PERSONS", DbType.Int32, DBNull.Value);

                if (!String.IsNullOrEmpty(travel.Description))
                    db.AddInParameter(dbCmd, "@DESCRIPTION", DbType.String, travel.Description);
                else
                    db.AddInParameter(dbCmd, "@DESCRIPTION", DbType.String, DBNull.Value);

                db.AddInParameter(dbCmd, "@USER_ID", DbType.Int32, travel.UserId);
                db.AddOutParameter(dbCmd, "@IS_INSERT", DbType.Int32, 1);
                db.ExecuteNonQuery(dbCmd);
                Result = Convert.ToInt32(db.GetParameterValue(dbCmd, "@IS_INSERT"));
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                {
                    throw ex;
                }
            }
            finally
            {
                DALHelper.Destroy(ref dbCmd);
            }
            return Result;
        }
コード例 #2
0
        /// <summary>
        /// Update customer detail.
        /// </summary>
        /// <param name="travel">Data transfer object contains customer data.</param>
        /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>
        public int UpdateCustomerNextTravelPlan(TravelBDto nextPlan)
        {
            Database db = null;
            DbCommand dbCmd = null;
            int Result = 0;
            try
            {
                db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
                dbCmd = db.GetStoredProcCommand(DALHelper.USP_CUST_NEXT_TRAVEL_PLAN_UPDATE);
                db.AddInParameter(dbCmd, "@SR_NO", DbType.Int32, nextPlan.SerialNo);
                db.AddInParameter(dbCmd, "@CUST_ID", DbType.Int32, nextPlan.CustomerId);
                db.AddInParameter(dbCmd, "@PLAN_YEAR_MONTH", DbType.Int32, nextPlan.YearMonth);

                if (!String.IsNullOrEmpty(nextPlan.CountryName))
                    db.AddInParameter(dbCmd, "@COUNTRY_NAME", DbType.String, nextPlan.CountryName);
                else
                    db.AddInParameter(dbCmd, "@COUNTRY_NAME", DbType.String, DBNull.Value);

                if (nextPlan.TourTypeId != 0)
                    db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.String, nextPlan.TourTypeId);
                else
                    db.AddInParameter(dbCmd, "@TOUR_TYPE_ID", DbType.String, DBNull.Value);

                if (nextPlan.TourId != 0)
                    db.AddInParameter(dbCmd, "@TOUR_ID", DbType.String, nextPlan.TourId);
                else
                    db.AddInParameter(dbCmd, "@TOUR_ID", DbType.String, DBNull.Value);

                if (nextPlan.NoOfPersons != 0)
                    db.AddInParameter(dbCmd, "@NO_OF_PERSONS", DbType.Int32, nextPlan.NoOfPersons);
                else
                    db.AddInParameter(dbCmd, "@NO_OF_PERSONS", DbType.Int32, DBNull.Value);

                if (!String.IsNullOrEmpty(nextPlan.Description))
                    db.AddInParameter(dbCmd, "@DESCRIPTION", DbType.String, nextPlan.Description);
                else
                    db.AddInParameter(dbCmd, "@DESCRIPTION", DbType.String, DBNull.Value);

                if (nextPlan.InquiryMode != 0)
                    db.AddInParameter(dbCmd, "@INQUIRY_MODE", DbType.Int32, nextPlan.InquiryMode);
                else
                    db.AddInParameter(dbCmd, "@INQUIRY_MODE", DbType.Int32, DBNull.Value);

                if (nextPlan.StatusId != 0)
                    db.AddInParameter(dbCmd, "@STATUS_ID", DbType.Int32, nextPlan.StatusId);
                else
                    db.AddInParameter(dbCmd, "@STATUS_ID", DbType.Int32, DBNull.Value);

                db.AddInParameter(dbCmd, "@USER_ID", DbType.Int32, nextPlan.UserId);
                db.AddOutParameter(dbCmd, "@IS_INSERT", DbType.Int32, 1);
                db.ExecuteNonQuery(dbCmd);
                Result = Convert.ToInt32(db.GetParameterValue(dbCmd, "@IS_INSERT"));
            }
            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                {
                    throw ex;
                }
            }
            finally
            {
                DALHelper.Destroy(ref dbCmd);
            }
            return Result;
        }