protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { Chain.BLL.SysNotice bllNotice = new Chain.BLL.SysNotice(); DataTable dtNotice = bllNotice.GetList(5, "", "SysNoticeTime desc").Tables[0]; this.rptNotice.DataSource = dtNotice; this.rptNotice.DataBind(); this.txtMemStartTime.Value = DateTime.Now.AddDays(-20.0).ToString("yyyy-MM-dd"); this.txtMemEndTime.Value = DateTime.Now.ToString("yyyy-MM-dd"); int shopID = this.UserModel.UserShopID; this.sltShop.Value = shopID.ToString(); Chain.Model.SysShop modelShop = new Chain.BLL.SysShop().GetModel(this.UserModel.UserShopID); if (modelShop.ShopImageUrl != null && modelShop.ShopImageUrl.ToString() != "") { this.spShopPhoto.Src = modelShop.ShopImageUrl; } this.spShopName.InnerHtml = modelShop.ShopName; this.spShopContactMan.InnerHtml = modelShop.ShopContactMan; this.spShopTel.InnerHtml = modelShop.ShopTelephone; this.spShopAddress.InnerHtml = this.BindAddress(this.UserModel.UserShopID); Chain.BLL.SysGroup bllGroup = new Chain.BLL.SysGroup(); Chain.Model.SysGroup modelGroup = bllGroup.GetModel(this.UserModel.UserGroupID); this.spGroupName.InnerHtml = modelGroup.GroupName; Chain.BLL.Mem bllMem = new Chain.BLL.Mem(); Chain.BLL.MemRecharge bllMemRecharge = new Chain.BLL.MemRecharge(); Chain.BLL.OrderLog bllOrderLog = new Chain.BLL.OrderLog(); Chain.BLL.MemCount bllMemCount = new Chain.BLL.MemCount(); string strMemToday = "CONVERT(varchar(10),MemCreateTime,120) = CONVERT(varchar(10),GETDATE(),120) AND MemID > 0"; string strMemYesterday = "CONVERT(varchar(10),MemCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120) AND MemID > 0"; string strMoneyToday = "CONVERT(varchar(10),RechargeCreateTime,120) = CONVERT(varchar(10),GETDATE(),120)"; string strMoneyYesterday = "CONVERT(varchar(10),RechargeCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120)"; string strGetMoneyToday = "CONVERT(varchar(10),OrderCreateTime,120) = CONVERT(varchar(10),GETDATE(),120)"; string strGetMoneyYesterday = "CONVERT(varchar(10),OrderCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120)"; string strGetCountMoneyToday = "CONVERT(varchar(10),CountCreateTime,120) = CONVERT(varchar(10),GETDATE(),120)"; string strGetCountMoneyYesterday = "CONVERT(varchar(10),CountCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120)"; if (modelShop.ShopID > 1) { strMemToday += string.Format(" AND MemShopID = {0}", shopID); strMemYesterday += string.Format(" AND MemShopID = {0}", shopID); strMoneyToday += string.Format(" AND RechargeShopID = {0}", shopID); strMoneyYesterday += string.Format(" AND RechargeShopID = {0}", shopID); strGetMoneyToday += string.Format(" AND OrderShopID = {0}", shopID); strGetMoneyYesterday += string.Format(" AND OrderShopID = {0}", shopID); strGetCountMoneyToday += string.Format(" AND CountShopID = {0}", shopID); strGetCountMoneyYesterday += string.Format(" AND CountShopID = {0}", shopID); } this.spMemToday.InnerHtml = bllMem.GetRecordCount(strMemToday).ToString(); this.spMemYesterday.InnerHtml = bllMem.GetRecordCount(strMemYesterday).ToString(); int memtoday = int.Parse(this.spMemToday.InnerHtml); int memyesterday = int.Parse(this.spMemYesterday.InnerHtml); decimal rate; if (memtoday > memyesterday) { this.imgMemberRate.Src = "images/icon (18).png"; if (memyesterday != 0) { rate = memtoday - memyesterday / memyesterday; } else { rate = 1m; } } else { if (memyesterday != 0) { rate = memyesterday - memtoday / memyesterday; } else { rate = 0m; } this.imgMemberRate.Src = "images/icon (1).png"; } this.spMemberRate.InnerHtml = (rate * 100m).ToString("F1") + "%"; this.spMoneyToday.InnerHtml = bllMemRecharge.GetRecMoney(strMoneyToday).ToString("F2"); this.spMoneyYesterday.InnerHtml = bllMemRecharge.GetRecMoney(strMoneyYesterday).ToString("F2"); decimal moneytoday = decimal.Parse(this.spMoneyToday.InnerHtml); decimal moneyyesterday = decimal.Parse(this.spMoneyYesterday.InnerHtml); if (moneytoday > moneyyesterday) { this.imgMoneyRate.Src = "images/icon (18).png"; if (moneyyesterday != 0m) { rate = moneytoday - moneyyesterday / moneyyesterday; } else { rate = 1m; } } else { if (moneyyesterday != 0m) { rate = moneyyesterday - moneytoday / moneyyesterday; } else { rate = 0m; } this.imgMoneyRate.Src = "images/icon (1).png"; } this.spMoneyRate.InnerHtml = (rate * 100m).ToString("F1") + "%"; this.spGetMoneyToday.InnerHtml = (bllOrderLog.GetTotalCash(strGetMoneyToday) + bllMemCount.GetTotalCash(strGetCountMoneyToday) + Convert.ToDecimal(this.spMoneyToday.InnerHtml)).ToString("F2"); this.spGetMoneyYesterday.InnerHtml = (bllOrderLog.GetTotalCash(strGetMoneyYesterday) + bllMemCount.GetTotalCash(strGetCountMoneyYesterday) + Convert.ToDecimal(this.spMoneyYesterday.InnerHtml)).ToString("F2"); decimal cashtoday = decimal.Parse(this.spGetMoneyToday.InnerHtml); decimal cashyesterday = decimal.Parse(this.spGetMoneyYesterday.InnerHtml); if (moneytoday > cashyesterday) { this.imgCashRate.Src = "images/icon (18).png"; if (cashyesterday != 0m) { rate = cashtoday - cashyesterday / cashyesterday; } else { rate = 1m; } } else { if (cashyesterday != 0m) { rate = cashyesterday - cashtoday / cashyesterday; } else { rate = 0m; } this.imgCashRate.Src = "images/icon (1).png"; } this.spCashRate.InnerHtml = (rate * 100m).ToString("F1") + "%"; } }
protected void Page_Load(object sender, EventArgs e) { this.shopID = this._UserShopID; this.UserGroupID = this._UserGroupID; this.userid = this._UserID; this.txtMemStartTime.Value = DateTime.Now.AddDays(-20.0).ToString("yyyy-MM-dd"); this.txtMemEndTime.Value = DateTime.Now.ToString("yyyy-MM-dd"); this.strOrder = " SysNoticeTime desc"; this.sltShop.Value = this.shopID.ToString(); Chain.BLL.SysNotice bllNotice = new Chain.BLL.SysNotice(); DataTable dtNotice = bllNotice.GetList(5, this.strSql, this.strOrder).Tables[0]; this.rpNotice.DataSource = dtNotice; this.rpNotice.DataBind(); Chain.BLL.Mem bllMem = new Chain.BLL.Mem(); Chain.BLL.OrderLog bllLog = new Chain.BLL.OrderLog(); Chain.BLL.SysShop bllShop = new Chain.BLL.SysShop(); Chain.Model.SysShop modelShop = bllShop.GetModel(this.shopID); this.lblShopName.Text = modelShop.ShopName; this.lblShopAddress.Text = modelShop.ShopAddress; this.lblShopMem.Text = modelShop.ShopContactMan; this.lblShopPhone.Text = modelShop.ShopTelephone; if (this.shopID != 1 && PubFunction.curParameter.bolShopPointManage) { this.lblPointCount.Text = modelShop.PointCount.ToString(); } else { this.lblPoint.Visible = false; } if (this.shopID != 1 && PubFunction.curParameter.bolShopSmsManage) { this.lblSmsCount.Text = modelShop.SmsCount.ToString(); } else { this.lblSms.Visible = false; } Chain.Model.SysGroup modelSysGroup = new Chain.BLL.SysGroup().GetModel(this.UserGroupID); this.lbGroupName.Text = modelSysGroup.GroupName; Chain.BLL.MemRecharge bllMemRecharge = new Chain.BLL.MemRecharge(); Chain.BLL.OrderLog bllOrderLog = new Chain.BLL.OrderLog(); Chain.BLL.MemCount bllMemCount = new Chain.BLL.MemCount(); string strMemToday = "CONVERT(varchar(10),MemCreateTime,120) = CONVERT(varchar(10),GETDATE(),120) AND MemID > 0"; string strMemYesterday = "CONVERT(varchar(10),MemCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120) AND MemID > 0"; string strMoneyToday = "CONVERT(varchar(10),RechargeCreateTime,120) = CONVERT(varchar(10),GETDATE(),120)"; string strMoneyYesterday = "CONVERT(varchar(10),RechargeCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120)"; string strGetMoneyToday = "CONVERT(varchar(10),OrderCreateTime,120) = CONVERT(varchar(10),GETDATE(),120)"; string strGetMoneyYesterday = "CONVERT(varchar(10),OrderCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120)"; string strGetCountMoneyToday = "CONVERT(varchar(10),CountCreateTime,120) = CONVERT(varchar(10),GETDATE(),120)"; string strGetCountMoneyYesterday = "CONVERT(varchar(10),CountCreateTime,120) = CONVERT(varchar(10), DATEADD(day,-1,GETDATE()),120)"; if (modelShop.ShopID > 1) { strMemToday += string.Format(" AND MemShopID = {0}", this.shopID); strMemYesterday += string.Format(" AND MemShopID = {0}", this.shopID); strMoneyToday += string.Format(" AND RechargeShopID = {0}", this.shopID); strMoneyYesterday += string.Format(" AND RechargeShopID = {0}", this.shopID); strGetMoneyToday += string.Format(" AND OrderShopID = {0}", this.shopID); strGetMoneyYesterday += string.Format(" AND OrderShopID = {0}", this.shopID); strGetCountMoneyToday += string.Format(" AND CountShopID = {0}", this.shopID); strGetCountMoneyYesterday += string.Format(" AND CountShopID = {0}", this.shopID); } this.ltlMemToday.Text = bllMem.GetRecordCount(strMemToday).ToString(); this.ltlMemYesterday.Text = bllMem.GetRecordCount(strMemYesterday).ToString(); this.lblrMoneyToday.Text = bllMemRecharge.GetRecMoney(strMoneyToday).ToString("F2"); this.lblrMoneyYesterday.Text = bllMemRecharge.GetRecMoney(strMoneyYesterday).ToString("F2"); this.lblGetMoneyToday.Text = (bllOrderLog.GetTotalCash(strGetMoneyToday) + bllMemCount.GetTotalCash(strGetCountMoneyToday) + Convert.ToDecimal(this.lblrMoneyToday.Text)).ToString("F2"); this.lblGetMoneyYesterday.Text = (bllOrderLog.GetTotalCash(strGetMoneyYesterday) + bllMemCount.GetTotalCash(strGetCountMoneyYesterday) + Convert.ToDecimal(this.lblrMoneyYesterday.Text)).ToString("F2"); this.GetSysRemind(); }