Пример #1
0
        public DataTable GetDaySaleTotal(int year, int month, SaleStatisticsType saleStatisticsType, int?siteId, int orderSource)
        {
            string    text = this.BuiderSqlStringByType(saleStatisticsType, siteId, orderSource);
            DataTable result;

            if (text == null)
            {
                result = null;
            }
            else
            {
                DbCommand sqlStringCommand = this.database.GetSqlStringCommand(text);
                this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime);
                this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime);
                DataTable dataTable      = this.CreateTable();
                decimal   monthSaleTotal = this.GetMonthSaleTotal(year, month, saleStatisticsType);
                int       dayCount       = this.GetDayCount(year, month);
                int       num            = (year == DateTime.Now.Year && month == DateTime.Now.Month) ? DateTime.Now.Day : dayCount;
                for (int i = 1; i <= num; i++)
                {
                    DateTime dateTime  = new DateTime(year, month, i);
                    DateTime dateTime2 = dateTime.AddDays(1.0);
                    this.database.SetParameterValue(sqlStringCommand, "@StartDate", dateTime);
                    this.database.SetParameterValue(sqlStringCommand, "@EndDate", dateTime2);
                    object  obj        = this.database.ExecuteScalar(sqlStringCommand);
                    decimal salesTotal = (obj == null) ? 0m : Convert.ToDecimal(obj);
                    this.InsertToTable(dataTable, i, salesTotal, monthSaleTotal);
                }
                result = dataTable;
            }
            return(result);
        }
Пример #2
0
        public decimal GetMonthSaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
        {
            string  text = this.BuiderSqlStringByType(saleStatisticsType);
            decimal result;

            if (text == null)
            {
                result = 0m;
            }
            else
            {
                System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(text);
                DateTime dateTime  = new DateTime(year, month, 1);
                DateTime dateTime2 = dateTime.AddMonths(1);
                this.database.AddInParameter(sqlStringCommand, "@StartDate", System.Data.DbType.DateTime, dateTime);
                this.database.AddInParameter(sqlStringCommand, "@EndDate", System.Data.DbType.DateTime, dateTime2);
                object  obj = this.database.ExecuteScalar(sqlStringCommand);
                decimal num = 0m;
                if (obj != null)
                {
                    num = Convert.ToDecimal(obj);
                }
                result = num;
            }
            return(result);
        }
Пример #3
0
        public DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType)
        {
            string str = this.BuiderSqlStringByType(saleStatisticsType);

            if (str == null)
            {
                return(null);
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str);

            this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime);
            this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime);
            DataTable table = this.CreateTable();
            int       num   = (year == DateTime.Now.Year) ? DateTime.Now.Month : 12;

            for (int i = 1; i <= num; i++)
            {
                DateTime time  = new DateTime(year, i, 1);
                DateTime time2 = time.AddMonths(1);
                this.database.SetParameterValue(sqlStringCommand, "@StartDate", time);
                this.database.SetParameterValue(sqlStringCommand, "@EndDate", time2);
                object  obj2          = this.database.ExecuteScalar(sqlStringCommand);
                decimal salesTotal    = (obj2 == null) ? 0M : Convert.ToDecimal(obj2);
                decimal yearSaleTotal = this.GetYearSaleTotal(year, saleStatisticsType);
                this.InsertToTable(table, i, salesTotal, yearSaleTotal);
            }
            return(table);
        }
Пример #4
0
 public DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     string query = this.BuiderSqlStringByType(saleStatisticsType);
     if (query == null)
     {
         return null;
     }
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);
     this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime);
     this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime);
     DataTable table = this.CreateTable();
     int num = (year == DateTime.Now.Year) ? DateTime.Now.Month : 12;
     for (int i = 1; i <= num; i++)
     {
         DateTime time = new DateTime(year, i, 1);
         DateTime time2 = time.AddMonths(1);
         this.database.SetParameterValue(sqlStringCommand, "@StartDate", time);
         this.database.SetParameterValue(sqlStringCommand, "@EndDate", time2);
         object obj2 = this.database.ExecuteScalar(sqlStringCommand);
         decimal salesTotal = (obj2 == null) ? 0M : Convert.ToDecimal(obj2);
         decimal yearSaleTotal = this.GetYearSaleTotal(year, saleStatisticsType);
         this.InsertToTable(table, i, salesTotal, yearSaleTotal);
     }
     return table;
 }
Пример #5
0
 public DataTable GetDaySaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
 {
     string query = this.BuiderSqlStringByType(saleStatisticsType);
     if (query == null)
     {
         return null;
     }
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);
     this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime);
     this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime);
     DataTable table = this.CreateTable();
     decimal allSalesTotal = this.GetMonthSaleTotal(year, month, saleStatisticsType);
     int dayCount = this.GetDayCount(year, month);
     int num3 = ((year == DateTime.Now.Year) && (month == DateTime.Now.Month)) ? DateTime.Now.Day : dayCount;
     for (int i = 1; i <= num3; i++)
     {
         DateTime time = new DateTime(year, month, i);
         DateTime time2 = time.AddDays(1.0);
         this.database.SetParameterValue(sqlStringCommand, "@StartDate", time);
         this.database.SetParameterValue(sqlStringCommand, "@EndDate", time2);
         object obj2 = this.database.ExecuteScalar(sqlStringCommand);
         decimal salesTotal = (obj2 == null) ? 0M : Convert.ToDecimal(obj2);
         this.InsertToTable(table, i, salesTotal, allSalesTotal);
     }
     return table;
 }
Пример #6
0
        public DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType)
        {
            string str = this.BuiderSqlStringByType(saleStatisticsType);

            if (str == null)
            {
                return(null);
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str);
            DateTime  time             = DateTime.Now.AddDays(-6.0);
            DateTime  time2            = new DateTime(time.Year, time.Month, time.Day);
            DateTime  now = DateTime.Now;

            this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime, time2);
            this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime, now);
            decimal allSalesTotal = 0M;
            object  obj2          = this.database.ExecuteScalar(sqlStringCommand);

            if (obj2 != null)
            {
                allSalesTotal = Convert.ToDecimal(obj2);
            }
            DataTable table = this.CreateTable();

            for (int i = 0; i < 7; i++)
            {
                DateTime time4      = DateTime.Now.AddDays((double)-i);
                decimal  salesTotal = this.GetDaySaleTotal(time4.Year, time4.Month, time4.Day, saleStatisticsType);
                this.InsertToTable(table, time4.Day, salesTotal, allSalesTotal);
            }
            return(table);
        }
Пример #7
0
        public DataTable GetDaySaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
        {
            string str = this.BuiderSqlStringByType(saleStatisticsType);

            if (str == null)
            {
                return(null);
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str);

            this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime);
            this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime);
            DataTable table         = this.CreateTable();
            decimal   allSalesTotal = this.GetMonthSaleTotal(year, month, saleStatisticsType);
            int       dayCount      = this.GetDayCount(year, month);
            int       num3          = ((year == DateTime.Now.Year) && (month == DateTime.Now.Month)) ? DateTime.Now.Day : dayCount;

            for (int i = 1; i <= num3; i++)
            {
                DateTime time  = new DateTime(year, month, i);
                DateTime time2 = time.AddDays(1.0);
                this.database.SetParameterValue(sqlStringCommand, "@StartDate", time);
                this.database.SetParameterValue(sqlStringCommand, "@EndDate", time2);
                object  obj2       = this.database.ExecuteScalar(sqlStringCommand);
                decimal salesTotal = (obj2 == null) ? 0M : Convert.ToDecimal(obj2);
                this.InsertToTable(table, i, salesTotal, allSalesTotal);
            }
            return(table);
        }
Пример #8
0
        public System.Data.DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType)
        {
            string text = this.BuiderSqlStringByType(saleStatisticsType);

            System.Data.DataTable result;
            if (text == null)
            {
                result = null;
            }
            else
            {
                System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(text);
                DateTime dateTime  = DateTime.Now.AddDays(-6.0);
                DateTime dateTime2 = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day);
                DateTime now       = DateTime.Now;
                this.database.AddInParameter(sqlStringCommand, "@StartDate", System.Data.DbType.DateTime, dateTime2);
                this.database.AddInParameter(sqlStringCommand, "@EndDate", System.Data.DbType.DateTime, now);
                decimal allSalesTotal = 0m;
                object  obj           = this.database.ExecuteScalar(sqlStringCommand);
                if (obj != null)
                {
                    allSalesTotal = Convert.ToDecimal(obj);
                }
                System.Data.DataTable dataTable = this.CreateTable();
                for (int i = 0; i < 7; i++)
                {
                    DateTime dateTime3    = DateTime.Now.AddDays((double)(-(double)i));
                    decimal  daySaleTotal = this.GetDaySaleTotal(dateTime3.Year, dateTime3.Month, dateTime3.Day, saleStatisticsType);
                    this.InsertToTable(dataTable, dateTime3.Day, daySaleTotal, allSalesTotal);
                }
                result = dataTable;
            }
            return(result);
        }
Пример #9
0
        public System.Data.DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType)
        {
            string text = this.BuiderSqlStringByType(saleStatisticsType);

            System.Data.DataTable result;
            if (text == null)
            {
                result = null;
            }
            else
            {
                System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(text);
                this.database.AddInParameter(sqlStringCommand, "@StartDate", System.Data.DbType.DateTime);
                this.database.AddInParameter(sqlStringCommand, "@EndDate", System.Data.DbType.DateTime);
                System.Data.DataTable dataTable = this.CreateTable();
                int num = (year == DateTime.Now.Year) ? DateTime.Now.Month : 12;
                for (int i = 1; i <= num; i++)
                {
                    DateTime dateTime  = new DateTime(year, i, 1);
                    DateTime dateTime2 = dateTime.AddMonths(1);
                    this.database.SetParameterValue(sqlStringCommand, "@StartDate", dateTime);
                    this.database.SetParameterValue(sqlStringCommand, "@EndDate", dateTime2);
                    object  obj           = this.database.ExecuteScalar(sqlStringCommand);
                    decimal salesTotal    = (obj == null) ? 0m : Convert.ToDecimal(obj);
                    decimal yearSaleTotal = this.GetYearSaleTotal(year, saleStatisticsType);
                    this.InsertToTable(dataTable, i, salesTotal, yearSaleTotal);
                }
                result = dataTable;
            }
            return(result);
        }
Пример #10
0
        private string BuiderSqlStringByType(SaleStatisticsType saleStatisticsType, int?siteId, int orderSource)
        {
            StringBuilder stringBuilder = new StringBuilder();

            switch (saleStatisticsType)
            {
            case SaleStatisticsType.SaleCounts:
                stringBuilder.Append("SELECT COUNT(OrderId) FROM Ecshop_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                stringBuilder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderStatus != {2} AND OrderStatus!={3}", 1, 4, 9, 98);
                if (siteId >= 0)
                {
                    stringBuilder.AppendFormat(" AND SiteId = {0}", siteId);
                }
                if (orderSource > 0)
                {
                    stringBuilder.AppendFormat(" AND SourceOrder = {0}", orderSource);
                }
                break;

            case SaleStatisticsType.SaleTotal:
                stringBuilder.Append("SELECT Isnull(SUM(OrderTotal),0)");
                stringBuilder.Append(" FROM Ecshop_orders WHERE  (OrderDate BETWEEN @StartDate AND @EndDate)");
                stringBuilder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderStatus != {2} AND OrderStatus!={3}", 1, 4, 9, 98);
                if (siteId >= 0)
                {
                    stringBuilder.AppendFormat(" AND SiteId = {0}", siteId);
                }
                if (orderSource > 0)
                {
                    stringBuilder.AppendFormat(" AND SourceOrder = {0}", orderSource);
                }
                break;

            case SaleStatisticsType.Profits:
                stringBuilder.Append("SELECT IsNull(SUM(OrderProfit),0) FROM Ecshop_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                stringBuilder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderStatus != {2} AND OrderStatus!={3}", 1, 4, 9, 98);
                if (siteId >= 0)
                {
                    stringBuilder.AppendFormat(" AND SiteId = {0}", siteId);
                }
                if (orderSource > 0)
                {
                    stringBuilder.AppendFormat(" AND SourceOrder = {0}", orderSource);
                }
                break;
            }
            return(stringBuilder.ToString());
        }
Пример #11
0
 public decimal GetDaySaleTotal(int year, int month, int day, SaleStatisticsType saleStatisticsType)
 {
     string query = this.BuiderSqlStringByType(saleStatisticsType);
     if (query == null)
     {
         return 0M;
     }
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);
     DateTime time = new DateTime(year, month, day);
     DateTime time2 = time.AddDays(1.0);
     this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime, time);
     this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime, time2);
     object obj2 = this.database.ExecuteScalar(sqlStringCommand);
     decimal num = 0M;
     if (obj2 != null)
     {
         num = Convert.ToDecimal(obj2);
     }
     return num;
 }
Пример #12
0
 private void LoadParameters()
 {
     if (!Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(Page.Request.QueryString["monthYear"]))
         {
             int.TryParse(Page.Request.QueryString["monthYear"], out monthYear);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["monthType"]))
         {
             monthType = (SaleStatisticsType)Convert.ToInt32(Page.Request.QueryString["monthType"]);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["dayYear"]))
         {
             int.TryParse(Page.Request.QueryString["dayYear"], out dayYear);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["dayMonth"]))
         {
             int.TryParse(Page.Request.QueryString["dayMonth"], out dayMonth);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["dayType"]))
         {
             dayType = (SaleStatisticsType)Convert.ToInt32(Page.Request.QueryString["dayType"]);
         }
         dropMonthForYaer.SelectedValue      = monthYear;
         radioMonthForSaleType.SelectedValue = monthType;
         dropDayForYear.SelectedValue        = dayYear;
         dropMoth.SelectedValue            = dayMonth;
         radioDayForSaleType.SelectedValue = dayType;
     }
     else
     {
         monthYear = dropMonthForYaer.SelectedValue;
         monthType = radioMonthForSaleType.SelectedValue;
         dayYear   = dropDayForYear.SelectedValue;
         dayMonth  = dropMoth.SelectedValue;
         dayType   = radioDayForSaleType.SelectedValue;
     }
 }
Пример #13
0
 private void LoadParameters()
 {
     if (!this.Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["monthYear"]))
         {
             int.TryParse(this.Page.Request.QueryString["monthYear"], out this.monthYear);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["monthType"]))
         {
             this.monthType = (SaleStatisticsType)System.Convert.ToInt32(this.Page.Request.QueryString["monthType"]);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayYear"]))
         {
             int.TryParse(this.Page.Request.QueryString["dayYear"], out this.dayYear);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayMonth"]))
         {
             int.TryParse(this.Page.Request.QueryString["dayMonth"], out this.dayMonth);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayType"]))
         {
             this.dayType = (SaleStatisticsType)System.Convert.ToInt32(this.Page.Request.QueryString["dayType"]);
         }
         this.dropMonthForYaer.SelectedValue      = this.monthYear;
         this.radioMonthForSaleType.SelectedValue = this.monthType;
         this.dropDayForYear.SelectedValue        = this.dayYear;
         this.dropMoth.SelectedValue            = this.dayMonth;
         this.radioDayForSaleType.SelectedValue = this.dayType;
     }
     else
     {
         this.monthYear = this.dropMonthForYaer.SelectedValue;
         this.monthType = this.radioMonthForSaleType.SelectedValue;
         this.dayYear   = this.dropDayForYear.SelectedValue;
         this.dayMonth  = this.dropMoth.SelectedValue;
         this.dayType   = this.radioDayForSaleType.SelectedValue;
     }
 }
Пример #14
0
        public decimal GetDaySaleTotal(int year, int month, int day, SaleStatisticsType saleStatisticsType)
        {
            string query = this.BuiderSqlStringByType(saleStatisticsType);

            if (query == null)
            {
                return(0M);
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);
            DateTime  time             = new DateTime(year, month, day);
            DateTime  time2            = time.AddDays(1.0);

            this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime, time);
            this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime, time2);
            object  obj2 = this.database.ExecuteScalar(sqlStringCommand);
            decimal num  = 0M;

            if (obj2 != null)
            {
                num = Convert.ToDecimal(obj2);
            }
            return(num);
        }
Пример #15
0
        public decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType)
        {
            string str = this.BuiderSqlStringByType(saleStatisticsType);

            if (str == null)
            {
                return(0M);
            }
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(str);
            DateTime  time             = new DateTime(year, 1, 1);
            DateTime  time2            = time.AddYears(1);

            this.database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime, time);
            this.database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime, time2);
            object  obj2 = this.database.ExecuteScalar(sqlStringCommand);
            decimal num  = 0M;

            if (obj2 != null)
            {
                num = Convert.ToDecimal(obj2);
            }
            return(num);
        }
Пример #16
0
        private string BuiderSqlStringByType(SaleStatisticsType saleStatisticsType)
        {
            StringBuilder stringBuilder = new StringBuilder();

            switch (saleStatisticsType)
            {
            case SaleStatisticsType.SaleCounts:
                stringBuilder.Append("SELECT COUNT(OrderId) FROM Hishop_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                stringBuilder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderStatus != {2}", 1, 4, 9);
                break;

            case SaleStatisticsType.SaleTotal:
                stringBuilder.Append("SELECT Isnull(SUM(OrderTotal),0)");
                stringBuilder.Append(" FROM Hishop_orders WHERE  (OrderDate BETWEEN @StartDate AND @EndDate)");
                stringBuilder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderStatus != {2}", 1, 4, 9);
                break;

            case SaleStatisticsType.Profits:
                stringBuilder.Append("SELECT IsNull(SUM(OrderProfit),0) FROM Hishop_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                stringBuilder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1} AND OrderStatus != {2}", 1, 4, 9);
                break;
            }
            return(stringBuilder.ToString());
        }
Пример #17
0
 public abstract decimal GetYearDistributionTotal(int year, SaleStatisticsType saleStatisticsType);
Пример #18
0
 public abstract DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType);
Пример #19
0
 private void LoadParameters()
 {
     if (!this.Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["monthYear"]))
         {
             int.TryParse(this.Page.Request.QueryString["monthYear"], out this.monthYear);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["monthType"]))
         {
             this.monthType = (SaleStatisticsType) Convert.ToInt32(this.Page.Request.QueryString["monthType"]);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayYear"]))
         {
             int.TryParse(this.Page.Request.QueryString["dayYear"], out this.dayYear);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayMonth"]))
         {
             int.TryParse(this.Page.Request.QueryString["dayMonth"], out this.dayMonth);
         }
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayType"]))
         {
             this.dayType = (SaleStatisticsType) Convert.ToInt32(this.Page.Request.QueryString["dayType"]);
         }
         this.dropMonthForYaer.SelectedValue = this.monthYear;
         this.radioMonthForSaleType.SelectedValue = this.monthType;
         this.dropDayForYear.SelectedValue = this.dayYear;
         this.dropMoth.SelectedValue = this.dayMonth;
         this.radioDayForSaleType.SelectedValue = this.dayType;
     }
     else
     {
         this.monthYear = this.dropMonthForYaer.SelectedValue;
         this.monthType = this.radioMonthForSaleType.SelectedValue;
         this.dayYear = this.dropDayForYear.SelectedValue;
         this.dayMonth = this.dropMoth.SelectedValue;
         this.dayType = this.radioDayForSaleType.SelectedValue;
     }
 }
Пример #20
0
 public static DataTable GetDaySaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
 {
     return new DateStatisticDao().GetDaySaleTotal(year, month, saleStatisticsType);
 }
Пример #21
0
 public static decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return(SalesProvider.Instance().GetYearSaleTotal(year, saleStatisticsType));
 }
Пример #22
0
 public static decimal GetYearDistributionTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return DistributorProvider.Instance().GetYearDistributionTotal(year, saleStatisticsType);
 }
Пример #23
0
 string BuiderSqlStringByType(SaleStatisticsType saleStatisticsType)
 {
     StringBuilder builder = new StringBuilder();
     switch (saleStatisticsType)
     {
         case SaleStatisticsType.SaleCounts:
             {
                 builder.Append("SELECT COUNT(OrderId) FROM Hishop_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                 builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1}", 1, 4);
                 break;
             }
         case SaleStatisticsType.SaleTotal:
             {
                 builder.Append("SELECT Isnull(SUM(OrderTotal),0)");
                 builder.Append(" FROM Hishop_orders WHERE  (OrderDate BETWEEN @StartDate AND @EndDate)");
                 builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1}", 1, 4);
                 break;
             }
         case SaleStatisticsType.Profits:
             {
                 builder.Append("SELECT IsNull(SUM(OrderProfit),0) FROM Hishop_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                 builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1}", 1, 4);
                 break;
             }
     }
     return builder.ToString();
 }
Пример #24
0
 public static decimal GetMonthSaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
 {
     return(SalesProvider.Instance().GetMonthSaleTotal(year, month, saleStatisticsType));
 }
Пример #25
0
 public override DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType)
 {
     string query = BuiderSqlStringByType(saleStatisticsType);
     if (query == null)
     {
         return null;
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(query);
     DateTime time = DateTime.Now.AddDays(-7.0);
     DateTime time2 = new DateTime(time.Year, time.Month, time.Day);
     DateTime now = DateTime.Now;
     database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime, time2);
     database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime, now);
     decimal allSalesTotal = 0M;
     object obj2 = database.ExecuteScalar(sqlStringCommand);
     if (obj2 != null)
     {
         allSalesTotal = Convert.ToDecimal(obj2);
     }
     DataTable table = CreateTable();
     for (int i = 0; i < 7; i++)
     {
         DateTime time4 = DateTime.Now.AddDays((double)-i);
         decimal salesTotal = GetDaySaleTotal(time4.Year, time4.Month, time4.Day, saleStatisticsType);
         InsertToTable(table, time4.Day, salesTotal, allSalesTotal);
     }
     return table;
 }
Пример #26
0
 public override decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     string query = BuiderSqlStringByType(saleStatisticsType);
     if (query == null)
     {
         return 0M;
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand(query);
     DateTime time = new DateTime(year, 1, 1);
     DateTime time2 = time.AddYears(1);
     database.AddInParameter(sqlStringCommand, "@StartDate", DbType.DateTime, time);
     database.AddInParameter(sqlStringCommand, "@EndDate", DbType.DateTime, time2);
     object obj2 = database.ExecuteScalar(sqlStringCommand);
     decimal num = 0M;
     if (obj2 != null)
     {
         num = Convert.ToDecimal(obj2);
     }
     return num;
 }
Пример #27
0
        string BuiderSqlStringByType(SaleStatisticsType saleStatisticsType)
        {
            StringBuilder builder = new StringBuilder();
            switch (saleStatisticsType)
            {
                case SaleStatisticsType.SaleCounts:
                    builder.Append("SELECT COUNT(OrderId) FROM distro_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                    builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1}", 1, 4);
                    break;

                case SaleStatisticsType.SaleTotal:
                    builder.Append("SELECT Isnull(SUM(OrderTotal),0)");
                    builder.Append(" FROM distro_orders WHERE  (OrderDate BETWEEN @StartDate AND @EndDate)");
                    builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1}", 1, 4);
                    break;

                case SaleStatisticsType.Profits:
                    builder.Append("SELECT IsNull(SUM(OrderProfit),0) FROM distro_Orders WHERE (OrderDate BETWEEN @StartDate AND @EndDate)");
                    builder.AppendFormat(" AND OrderStatus != {0} AND OrderStatus != {1}", 1, 4);
                    break;
            }
            return (builder.ToString() + string.Format(" AND DistributorUserId={0}", HiContext.Current.User.UserId));
        }
Пример #28
0
 public abstract decimal GetMonthDistributionTotal(int year, int month, SaleStatisticsType saleStatisticsType);
Пример #29
0
 public abstract DataTable GetMonthDistributionTotal(int year, SaleStatisticsType saleStatisticsType);
Пример #30
0
 private void LoadParameters()
 {
     if (!Page.IsPostBack)
     {
         if (!string.IsNullOrEmpty(Page.Request.QueryString["monthYear"]))
         {
             int.TryParse(Page.Request.QueryString["monthYear"], out monthYear);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["monthType"]))
         {
             monthType = (SaleStatisticsType)Convert.ToInt32(Page.Request.QueryString["monthType"]);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["dayYear"]))
         {
             int.TryParse(Page.Request.QueryString["dayYear"], out dayYear);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["dayMonth"]))
         {
             int.TryParse(Page.Request.QueryString["dayMonth"], out dayMonth);
         }
         if (!string.IsNullOrEmpty(Page.Request.QueryString["dayType"]))
         {
             dayType = (SaleStatisticsType)Convert.ToInt32(Page.Request.QueryString["dayType"]);
         }
         dropDayForYear.SelectedValue = dayYear;
         dropMoth.SelectedValue = dayMonth;
         radioDayForSaleType.SelectedValue = dayType;
         dropMonthForYaer.SelectedValue = monthYear;
         radioMonthForSaleType.SelectedValue = monthType;
     }
     else
     {
         monthYear = dropMonthForYaer.SelectedValue;
         monthType = radioMonthForSaleType.SelectedValue;
         dayYear = dropDayForYear.SelectedValue;
         dayMonth = dropMoth.SelectedValue;
         dayType = radioDayForSaleType.SelectedValue;
     }
 }
Пример #31
0
 public abstract DataTable GetDaySaleTotal(int year, int month, SaleStatisticsType saleStatisticsType);
Пример #32
0
 public static DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return(SalesProvider.Instance().GetMonthSaleTotal(year, saleStatisticsType));
 }
Пример #33
0
 public static decimal GetDaySaleTotal(int year, int month, int day, SaleStatisticsType saleStatisticsType)
 {
     return SubsiteSalesProvider.Instance().GetDaySaleTotal(year, month, day, saleStatisticsType);
 }
Пример #34
0
 public static DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType)
 {
     return(SalesProvider.Instance().GetWeekSaleTota(saleStatisticsType));
 }
Пример #35
0
 public abstract decimal GetDaySaleTotal(int year, int month, int day, SaleStatisticsType saleStatisticsType);
Пример #36
0
 public static DataTable GetMonthDistributionTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return DistributorProvider.Instance().GetMonthDistributionTotal(year, saleStatisticsType);
 }
Пример #37
0
 public static decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return new DateStatisticDao().GetYearSaleTotal(year, saleStatisticsType);
 }
Пример #38
0
 public static DataTable GetDaySaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
 {
     return SubsiteSalesProvider.Instance().GetDaySaleTotal(year, month, saleStatisticsType);
 }
Пример #39
0
 public static decimal GetMonthSaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
 {
     return SalesProvider.Instance().GetMonthSaleTotal(year, month, saleStatisticsType);
 }
Пример #40
0
 public static decimal GetDaySaleTotal(int year, int month, int day, SaleStatisticsType saleStatisticsType)
 {
     return new DateStatisticDao().GetDaySaleTotal(year, month, day, saleStatisticsType);
 }
Пример #41
0
 public static decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return SalesProvider.Instance().GetYearSaleTotal(year, saleStatisticsType);
 }
Пример #42
0
 public abstract decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType);
Пример #43
0
 public abstract decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType);
Пример #44
0
 public static DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return SalesProvider.Instance().GetMonthSaleTotal(year, saleStatisticsType);
 }
Пример #45
0
 public abstract System.Data.DataTable GetMonthDistributionTotal(int year, SaleStatisticsType saleStatisticsType);
Пример #46
0
 public static DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType)
 {
     return SalesProvider.Instance().GetWeekSaleTota(saleStatisticsType);
 }
Пример #47
0
 public static DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType)
 {
     return new DateStatisticDao().GetWeekSaleTota(saleStatisticsType);
 }
Пример #48
0
 public static decimal GetYearSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return(new DateStatisticDao().GetYearSaleTotal(year, saleStatisticsType));
 }
Пример #49
0
 public abstract decimal GetDaySaleTotal(int year, int month, int day, SaleStatisticsType saleStatisticsType);
Пример #50
0
        private void LoadParameters()
        {
            if (!this.Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["monthYear"]))
                {
                    int.TryParse(this.Page.Request.QueryString["monthYear"], out this.monthYear);
                }
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["monthType"]))
                {
                    this.monthType = (SaleStatisticsType)System.Convert.ToInt32(this.Page.Request.QueryString["monthType"]);
                }
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayYear"]))
                {
                    int.TryParse(this.Page.Request.QueryString["dayYear"], out this.dayYear);
                }
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayMonth"]))
                {
                    int.TryParse(this.Page.Request.QueryString["dayMonth"], out this.dayMonth);
                }
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["dayType"]))
                {
                    this.dayType = (SaleStatisticsType)System.Convert.ToInt32(this.Page.Request.QueryString["dayType"]);
                }
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["siteId"]))//站点Id
                {
                    this.siteId = new int?(int.Parse(this.Page.Request.QueryString["siteId"]));
                }
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["orderSource"]))//
                {
                    int.TryParse(this.Page.Request.QueryString["orderSource"], out this.orderSource);
                }

                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["siteIds"]))//站点Id
                {
                    this.siteIds = new int?(int.Parse(this.Page.Request.QueryString["siteIds"]));
                }
                if (!string.IsNullOrEmpty(this.Page.Request.QueryString["orderSources"]))//
                {
                    int.TryParse(this.Page.Request.QueryString["orderSources"], out this.orderSources);
                }

                //this.dropMonthForYaer.SelectedValue = this.monthYear;
                //this.radioMonthForSaleType.SelectedValue = this.monthType;
                //this.dropDayForYear.SelectedValue = this.dayYear;
                //this.dropMoth.SelectedValue = this.dayMonth;
                //this.radioDayForSaleType.SelectedValue = this.dayType;
                //this.sitesDropDownList.SelectedValue = this.siteId;
                //this.ddlOrderSource.SelectedValue = this.ddlOrderSource.ToString();

                //this.sitesDropDownLists.SelectedValue = this.siteIds;
                //this.ddlOrderSources.SelectedValue = this.ddlOrderSources.ToString();
                return;
            }
            this.monthYear    = this.dropMonthForYaer.SelectedValue;
            this.monthType    = this.radioMonthForSaleType.SelectedValue;
            this.dayYear      = this.dropDayForYear.SelectedValue;
            this.dayMonth     = this.dropMoth.SelectedValue;
            this.dayType      = this.radioDayForSaleType.SelectedValue;
            this.siteId       = this.sitesDropDownList.SelectedValue;
            this.orderSource  = (int)(OrderSource)System.Enum.Parse(typeof(OrderSource), this.ddlOrderSource.SelectedValue);
            this.siteIds      = this.sitesDropDownLists.SelectedValue;
            this.orderSources = (int)(OrderSource)System.Enum.Parse(typeof(OrderSource), this.ddlOrderSources.SelectedValue);
        }
Пример #51
0
 public abstract DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType);
Пример #52
0
 public abstract DataTable GetDaySaleTotal(int year, int month, SaleStatisticsType saleStatisticsType);
Пример #53
0
 public static System.Data.DataTable GetWeekSaleTota(SaleStatisticsType saleStatisticsType)
 {
     return(new DateStatisticDao().GetWeekSaleTota(saleStatisticsType));
 }
Пример #54
0
 public abstract DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType);
Пример #55
0
 public static decimal GetMonthSaleTotal(int year, int month, SaleStatisticsType saleStatisticsType)
 {
     return(new DateStatisticDao().GetMonthSaleTotal(year, month, saleStatisticsType));
 }
Пример #56
0
 public abstract decimal GetMonthDistributionTotal(int year, int month, SaleStatisticsType saleStatisticsType);
Пример #57
0
 public static System.Data.DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return(new DateStatisticDao().GetMonthSaleTotal(year, saleStatisticsType));
 }
Пример #58
0
 public abstract decimal GetYearDistributionTotal(int year, SaleStatisticsType saleStatisticsType);
Пример #59
0
 public static DataTable GetMonthSaleTotal(int year, SaleStatisticsType saleStatisticsType)
 {
     return new DateStatisticDao().GetMonthSaleTotal(year, saleStatisticsType);
 }