Ejemplo n.º 1
0
        /// <summary>
        /// Returns 0 if no patches were installed.
        /// </summary>
        /// <param name="major"></param>
        /// <param name="minor"></param>
        /// <param name="patch"></param>
        /// <param name="installDate"></param>
        /// <returns></returns>
        public static int GetMarketingSystemVersion(out int major, out int minor, out int patch, out DateTime installDate)
        {
            int retval = 0;

            major       = 0;
            minor       = 0;
            patch       = 0;
            installDate = DateTime.MinValue;

            DataCommand command = MarketingDataHelper.CreateDataCommand();

            command.CommandText = "GetMarketingSchemaVersionNumber";
            DataResult result = DataService.LoadDataSet(command);

            if (result.DataSet != null)
            {
                if (result.DataSet.Tables.Count > 0 && result.DataSet.Tables[0].Rows.Count > 0)
                {
                    DataRow row = result.DataSet.Tables[0].Rows[0];
                    major       = (int)row["Major"];
                    minor       = (int)row["Minor"];
                    patch       = (int)row["Patch"];
                    installDate = (DateTime)row["InstallDate"];
                }
            }

            return(retval);
        }
        /// <summary>
        /// Removes the expired.
        /// </summary>
        /// <param name="applicationId">The application id.</param>
        void RemoveExpired(Guid applicationId)
        {
            _Log.Info(String.Format("Starting to cancel expired promotion job for \"{0}\" application.", applicationId));

            try
            {
                DataCommand cmd = MarketingDataHelper.CreateDataCommand();
                cmd.CommandText = String.Format("ecf_mktg_CancelExpiredPromoReservations");
                cmd.Parameters  = new DataParameters();
                cmd.Parameters.Add(new DataParameter("ApplicationId", applicationId, DataParameterType.UniqueIdentifier));
                cmd.Parameters.Add(new DataParameter("Expires", MarketingConfiguration.Instance.ReservationTimeout, DataParameterType.Int));

                DataService.ExecuteNonExec(cmd);
                _Log.Info("Successfully completed.");
            }
            catch (Exception ex)
            {
                _Log.Error("Failed to cancel expired promotion reservations.", ex);
            }
        }