예제 #1
0
 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") + "%";
     }
 }
예제 #2
0
 public int Add(Chain.Model.SysGroup model)
 {
     return(this.dal.Add(model));
 }
예제 #3
0
        protected void btnAuthority_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.txtGroupName.Value.Trim() != "" & this.txtGroupRemark.Value.Trim() != "")
                {
                    Chain.Model.SysLog modelLog = new Chain.Model.SysLog();
                    modelLog.LogShopID       = this._UserShopID;
                    modelLog.LogUserID       = this._UserID;
                    modelLog.LogCreateTime   = DateTime.Now;
                    modelLog.LogActionID     = 11;
                    modelLog.LogType         = "系统角色";
                    this.group.GroupType     = Convert.ToInt32(this.txtGroupType.Value);
                    this.group.GroupName     = this.txtGroupName.Value.Trim();
                    this.group.ParentGroupID = int.Parse(this.sltParentGroup.Value);
                    this.group.IsPublic      = this.chkIsPublic.Checked;
                    if (this.group.ParentGroupID == 0)
                    {
                        this.group.ParentGroupID = 0;
                        this.group.ParentIDStr   = "";
                    }
                    else
                    {
                        Chain.Model.SysGroup parentGroup = this.bllGroup.GetModel(this.group.ParentGroupID);
                        if (parentGroup != null)
                        {
                            if (string.IsNullOrEmpty(parentGroup.ParentIDStr))
                            {
                                parentGroup.ParentIDStr = "/";
                            }
                            this.group.ParentIDStr = parentGroup.ParentIDStr + parentGroup.GroupID + "/";
                        }
                    }
                    this.group.GroupRemark = this.txtGroupRemark.Value.Trim();
                    if (int.Parse(this.HidGid.Value) > 0)
                    {
                        switch (PubFunction.curParameter.istry)
                        {
                        case 0:
                            if (int.Parse(this.txtGroupID.Value) != 1)
                            {
                                this.group.GroupID      = int.Parse(this.txtGroupID.Value);
                                this.group.CreateUserID = this._UserID;
                                modelLog.LogDetail      = "修改角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                                this.bllGroup.Update(this.group);
                                this.add = int.Parse(this.HidGid.Value);
                                new Chain.BLL.SysLog().Add(modelLog);
                            }
                            break;

                        case 1:
                            this.group.GroupID      = int.Parse(this.txtGroupID.Value);
                            this.group.CreateUserID = this._UserID;
                            modelLog.LogDetail      = "修改角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                            this.bllGroup.Update(this.group);
                            this.add = int.Parse(this.HidGid.Value);
                            new Chain.BLL.SysLog().Add(modelLog);
                            break;

                        case 2:
                            if (int.Parse(this.txtGroupID.Value) != 1)
                            {
                                this.group.GroupID      = int.Parse(this.txtGroupID.Value);
                                this.group.CreateUserID = this._UserID;
                                modelLog.LogDetail      = "修改角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                                this.bllGroup.Update(this.group);
                                this.add = int.Parse(this.HidGid.Value);
                                new Chain.BLL.SysLog().Add(modelLog);
                            }
                            break;
                        }
                    }
                    else if (this.txtGroupID.Value == "")
                    {
                        this.group.CreateUserID = this._UserID;
                        modelLog.LogDetail      = "新增角色成功,角色名称:" + this.group.GroupName + ",说明:" + this.group.GroupRemark;
                        this.add = this.bllGroup.Add(this.group);
                        new Chain.BLL.SysLog().Add(modelLog);
                    }
                    switch (PubFunction.curParameter.istry)
                    {
                    case 0:
                        if (this.txtGroupID.Value == "1")
                        {
                            base.OutputWarn("此版本为试用版,不可更改超级管理员。");
                        }
                        else if (this.SetGroupAuthority(this.add))
                        {
                            base.OutputWarn("保存成功!");
                        }
                        break;

                    case 1:
                        if (this.SetGroupAuthority(this.add))
                        {
                            base.OutputWarn("保存成功!");
                        }
                        break;

                    case 2:
                        if (this.txtGroupID.Value == "1")
                        {
                            base.OutputWarn("此版本为试用版,不可更改超级管理员。");
                        }
                        else if (this.SetGroupAuthority(this.add))
                        {
                            base.OutputWarn("保存成功!");
                        }
                        break;
                    }
                    List <Chain.Model.SysGroup> list = new Chain.BLL.SysGroup().GetModelList("");
                    foreach (Chain.Model.SysGroup item in list)
                    {
                        PubFunction.UpdateGroupAuthority(item.GroupID);
                    }
                }
                else
                {
                    base.OutputWarn("数据不完整,请重新输入!");
                }
            }
            catch
            {
                base.OutputWarn("系统错误,请与系统管理员联系!");
            }
        }