コード例 #1
0
        public bool UpdateAccomodationSeason(AccomodationSeasonDTO accomodationOldSeason, AccomodationSeasonDTO accomodationNewSeason)
        {
            string          sProcName;
            DatabaseManager oDB;

            try
            {
                sProcName = "up_Upd_AccomodationMasterSeasonDate";
                oDB       = new DatabaseManager();
                oDB.DbCmd = oDB.GetStoredProcCommand(sProcName);
                oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@AccomId", DbType.Int32, accomodationOldSeason.AccomodationId);

                if (accomodationOldSeason.SeasonStartDate == DateTime.MinValue)
                {
                    accomodationOldSeason.SeasonStartDate = GF.ParseDate("1900-01-01");
                }
                oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@OldSeasonStartDate", DbType.DateTime, accomodationOldSeason.SeasonStartDate);

                if (accomodationOldSeason.SeasonEndDate == DateTime.MinValue)
                {
                    accomodationOldSeason.SeasonEndDate = GF.ParseDate("1900-01-01");
                }
                oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@OldSeasonEndDate", DbType.DateTime, accomodationOldSeason.SeasonEndDate);

                if (accomodationNewSeason.SeasonStartDate == DateTime.MinValue)
                {
                    accomodationNewSeason.SeasonStartDate = GF.ParseDate("1900-01-01");
                }
                oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@NewSeasonStartDate", DbType.DateTime, accomodationNewSeason.SeasonStartDate);

                if (accomodationNewSeason.SeasonEndDate == DateTime.MinValue)
                {
                    accomodationNewSeason.SeasonEndDate = GF.ParseDate("1900-01-01");
                }
                oDB.DbDatabase.AddInParameter(oDB.DbCmd, "@NewSeasonEndDate", DbType.DateTime, accomodationNewSeason.SeasonEndDate);

                oDB.ExecuteNonQuery(oDB.DbCmd);
            }
            catch (Exception exp)
            {
                GF.LogError("clsAccomodationMaster.up_Upd_AccomodationMasterSeasonDate", exp.Message.ToString());
                oDB = null;
                return(false);
            }
            finally
            {
                oDB = null;
            }
            return(true);
        }