Example #1
0
 /// <summary>
 /// 得到初始化时用户的账号串
 /// </summary>
 protected void GetUserID()
 {
     string uid = ChangeHope.WebPage.PageRequest.GetQueryString("strId");
     string userId = string.Empty;
     ShowShop.BLL.Member.MemberAccount bll = new ShowShop.BLL.Member.MemberAccount();
     List<ShowShop.Model.Member.MemberAccount> model = bll.GetAll(" UID in(" + uid + ")");
     for (int i = 0; i <model.Count; i++)
     {
         userId += model[i].UserId + ",";
     }
     userId = userId.Substring(0, userId.LastIndexOf(','));
     this.txtUserName.Text = userId;
 }
Example #2
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            ShowShop.BLL.Member.MemberAccount bll = new ShowShop.BLL.Member.MemberAccount();
            List<ShowShop.Model.Member.MemberAccount> model = new List<ShowShop.Model.Member.MemberAccount>();
            //发送给全体
            if (rabtnAllUser.Checked)
            {
                model = bll.GetAll(" 1=1");
                for (int i = 0; i < model.Count; i++)
                {
                    SendByType(model[i].Email);
                }
                this.ltlMsg.Text = "操作成功,已向所有用户发送该邮件!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            //发送会员组
            else if (rabtnMemberGroup.Checked)
            {
                string rankID = string.Empty;
                for (int i = 0; i < cbxlMemberRank.Items.Count; i++)
                {
                    if (cbxlMemberRank.Items[i].Selected)
                    {
                        rankID += cbxlMemberRank.Items[i].Value + ",";
                    }
                }
                if (rankID == string.Empty)
                {
                    this.ltlMsg.Text = "请选择要发送到的会员组";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                rankID = rankID.Substring(0, rankID.LastIndexOf(','));
                model = bll.GetAll(" UserGroup in(" + rankID + ")");
                for (int i = 0; i < model.Count; i++)
                {
                    SendByType(model[i].Email);
                }
                this.ltlMsg.Text = "操作成功,已向指定用户组发送该邮件!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            //指定用户名
            else if (rabtnCheckUser.Checked)
            {
                string uid = this.txtUserName.Text.Trim();
                if (uid.Length == 0)
                {
                    this.ltlMsg.Text = "请输入要发送到的会员";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                if (uid.EndsWith(","))
                {
                    uid = uid.Substring(0, uid.LastIndexOf(','));
                }
                //进行拆分 给每个字段加上单引号
                string[] arrUid = uid.Split(',');
                uid = string.Empty;
                for (int i = 0; i < arrUid.Length; i++)
                {
                    uid += "'" + arrUid[i] + "'" + ",";
                }
                if (uid.EndsWith(","))
                {
                    uid = uid.Substring(0, uid.LastIndexOf(','));
                }

                model = bll.GetAll(" UserId in(" + uid + ")");
                for (int i = 0; i < model.Count; i++)
                {
                    SendByType(model[i].Email);
                }
                this.ltlMsg.Text = "操作成功,已向指定用户发送该邮件!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
            //指定邮箱
            else if (rabtnCheckEmail.Checked)
            {
                string email = this.txtEmail.Text.Trim();
                if (email.Length == 0)
                {
                    this.ltlMsg.Text = "请输入要发送到的邮箱";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                SendByType(email);
                this.ltlMsg.Text = "操作成功,已向所有用户发送该邮件!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
        }
Example #3
0
        protected void BtnWork_Click(object sender, EventArgs e)
        {
            ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
            ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount();
            ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote();
            ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote();
            if (ViewState["Opreate"].ToString().Equals("add"))
            {
                noteModel.BuckleOrAdd = 0;  //添加
            }
            else
            {
                noteModel.BuckleOrAdd = 1;  //减
            }
            noteModel.NoteName = adminInfo.AdminName;
            noteModel.NoteType = 0;//点卷
            noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now);
            noteModel.Causation = this.txtWhy.Text.Trim().ToString();
            noteModel.BosomNote = this.txtLog.Text.Trim().ToString();
            //全部用户
            if (ViewState["M"].ToString() == "1")
            {
                List<ShowShop.Model.Member.MemberAccount> accountList = memberBll.GetAll("");
                foreach (ShowShop.Model.Member.MemberAccount item in accountList)
                {
                    switch (ViewState["Opreate"].ToString())
                    {
                        case "add":
                            item.Coupons = Convert.ToDecimal(item.Coupons) + Convert.ToDecimal(this.txtWrap.Text.Trim());
                            break;
                        case "allay":
                            if (Convert.ToDecimal(this.txtWrap.Text.Trim())<Convert.ToDecimal(item.Coupons) )
                            {
                                item.Coupons = Convert.ToDecimal(item.Coupons)-Convert.ToDecimal(this.txtWrap.Text.Trim());
                            }
                            else
                            {
                                this.ltlMsg.Text = "减少的点卷数量大于系统记录的数量!";
                                this.pnlMsg.Visible = true;
                                this.pnlMsg.CssClass = "actionErr";
                                return;
                            }
                            break;
                        default:
                            break;
                    }
                    memberBll.Update(item);
                    noteModel.UserID = Convert.ToInt32(item.UID);
                    noteModel.Username = item.UserId;
                    noteModel.TicketCount = Convert.ToDecimal(this.txtWrap.Text.Trim());
                    noteBll.Add(noteModel);
                }
            }
            //指定用户组
            if (ViewState["M"].ToString() == "2")
            {
                    //获取会员类型
                string typeId = this.cbxlMemberRank.SelectedValue;
                List<ShowShop.Model.Member.MemberAccount> accountList = merberBll.GetAll("UserGroup=" + typeId);
                foreach (ShowShop.Model.Member.MemberAccount item in accountList)
                {
                        switch (ViewState["Opreate"].ToString())
                        {
                                    case "add":
                                        item.Coupons = Convert.ToDecimal(item.Coupons) + Convert.ToDecimal(this.txtWrap.Text.Trim());
                                        break;
                                    case "allay":
                                        if (Convert.ToDecimal(this.txtWrap.Text.Trim()) < Convert.ToDecimal(item.Coupons))
                                        {
                                            item.Coupons = Convert.ToDecimal(item.Coupons) - Convert.ToDecimal(this.txtWrap.Text.Trim());
                                        }
                                        else
                                        {
                                            this.ltlMsg.Text = "减少的点卷数量大于系统记录的数量!";
                                            this.pnlMsg.Visible = true;
                                            this.pnlMsg.CssClass = "actionErr";
                                            return;
                                        }
                                        break;
                                    default:
                                        break;
                         }
                                memberBll.Update(item);
                                noteModel.UserID = Convert.ToInt32(item.UID);
                                noteModel.Username = item.UserId;
                                noteModel.TicketCount = Convert.ToDecimal(this.txtWrap.Text.Trim());
                                noteBll.Add(noteModel);
                 }

            }
            //指定用户
            if (ViewState["M"].ToString() == "3")
            {
                string assigner= this.txtName.Text.Trim();
                String[] name = assigner.Split(',');
                int con = name.Length;
                for (int i = 0; i < con; i++)
                {
                    string userName = name[i].ToString();
                    List<ShowShop.Model.Member.MemberAccount> accountList = memberBll.GetAll("UserId = '" + userName + "'");
                    foreach (ShowShop.Model.Member.MemberAccount item in accountList)
                    {
                         switch (ViewState["Opreate"].ToString())
                                {
                                    case "add":
                                        item.Coupons = Convert.ToDecimal(item.Coupons) + Convert.ToDecimal(this.txtWrap.Text.Trim());
                                        break;
                                    case "allay":
                                        if (Convert.ToDecimal(this.txtWrap.Text.Trim()) < Convert.ToDecimal(item.Coupons))
                                        {
                                            item.Coupons = Convert.ToDecimal(item.Coupons) - Convert.ToDecimal(this.txtWrap.Text.Trim());
                                        }
                                        else
                                        {
                                            this.ltlMsg.Text = "减少的点卷数量大于系统记录的数量!";
                                            this.pnlMsg.Visible = true;
                                            this.pnlMsg.CssClass = "actionErr";
                                            return;
                                        }
                                        break;
                                    default:
                                        break;
                                }
                                memberBll.Update(item);
                                noteModel.UserID = Convert.ToInt32(item.UID);
                                noteModel.Username = item.UserId;
                                noteModel.TicketCount = Convert.ToDecimal(this.txtWrap.Text.Trim());
                                noteBll.Add(noteModel);
                    }
                }
            }
            this.ltlMsg.Text = "编辑点卷成功!";
            this.pnlMsg.Visible = true;
            this.pnlMsg.CssClass = "actionOk";
        }
Example #4
0
        //批量事件(添加与减少)
        protected void BtnWork_Click(object sender, EventArgs e)
        {
            ShowShop.Model.Admin.AdminInfo adminInfo = (ShowShop.Model.Admin.AdminInfo)ShowShop.Common.AdministrorManager.Get();
            ShowShop.BLL.Member.MemberAccount memberBll = new ShowShop.BLL.Member.MemberAccount();
            ShowShop.BLL.Member.UserInfoNote noteBll = new ShowShop.BLL.Member.UserInfoNote();
            ShowShop.Model.Member.UserInfoNote noteModel = new ShowShop.Model.Member.UserInfoNote();
            if (ViewState["Opreate"].ToString().Equals("add"))
            {
                noteModel.BuckleOrAdd = 0;  //添加
            }
            else
            {
                noteModel.BuckleOrAdd = 1;  //减少
            }
            noteModel.NoteName = adminInfo.AdminName;
            noteModel.NoteType = 2;
            noteModel.NoteDate = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
            noteModel.Causation = this.txtWhy.Text.Trim().ToString();
            noteModel.BosomNote = this.txtLog.Text.Trim().ToString();
            //所有会员
            if (ViewState["M"].ToString() == "1")
            {
                List <ShowShop.Model.Member.MemberAccount> accountList= memberBll.GetAll("");
                foreach (ShowShop.Model.Member.MemberAccount item in accountList)
                {
                    TimeSpan oldtime = new TimeSpan(Convert.ToDateTime(item.PeriodOfValidity).Ticks);
                    if (ViewState["time"].ToString() == "4")
                    {
                        switch (ViewState["Opreate"].ToString())
                        {
                            case "add":
                                if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(item.PeriodOfValidity))
                                {
                                    item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text);
                                }
                                else
                                {
                                    this.ltlMsg.Text = "添加的有效期小于系统记录的有效期!";
                                    this.pnlMsg.Visible = true;
                                    this.pnlMsg.CssClass = "actionErr";
                                    return;
                                }
                                break;
                            case "allay":
                                if (Convert.ToDateTime(this.txtManageTime.Text) < Convert.ToDateTime(item.PeriodOfValidity))
                                {
                                    item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text);
                                }
                                else
                                {
                                    this.ltlMsg.Text = "减少的有效期大于系统记录的有效期!";
                                    this.pnlMsg.Visible = true;
                                    this.pnlMsg.CssClass = "actionErr";
                                    return;
                                }
                                break;
                            default:
                                break;
                        }

                    }
                    else
                    {   //归0
                        item.PeriodOfValidity = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
                    }
                    memberBll.Update(item);
                    TimeSpan newtime=new TimeSpan(Convert.ToDateTime(this.txtManageTime.Text).Ticks);
                    TimeSpan gap=oldtime.Subtract(newtime).Duration();
                    noteModel.TicketCount=Convert.ToDecimal(gap.Days);
                    noteModel.UserID = Convert.ToInt32(item.UID);
                    noteModel.Username = item.UserId;
                    noteBll.Add(noteModel);
                }

            }
            //指定会员组
            if (ViewState["M"].ToString() == "2")
            {   //获取会员类型
                string typeId = this.cbxlMemberRank.SelectedValue;
                List<ShowShop.Model.Member.MemberAccount> accountList = merberBll.GetAll("UserGroup="+typeId);
                foreach (ShowShop.Model.Member.MemberAccount item in accountList)
                {
                                TimeSpan oldtime = new TimeSpan(Convert.ToDateTime(item.PeriodOfValidity).Ticks);
                                if (ViewState["time"].ToString() == "4")
                                {

                                    switch (ViewState["Opreate"].ToString())
                                    {
                                        case "add":
                                            if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(item.PeriodOfValidity))
                                            {
                                                item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text);
                                            }
                                            else
                                            {
                                                this.ltlMsg.Text = "添加的有效期小于系统记录的有效期!";
                                                this.pnlMsg.Visible = true;
                                                this.pnlMsg.CssClass = "actionErr";
                                                return;
                                            }
                                            break;
                                        case "allay":
                                            if (Convert.ToDateTime(this.txtManageTime.Text) < Convert.ToDateTime(item.PeriodOfValidity))
                                            {
                                                item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text);
                                            }
                                            else
                                            {
                                                this.ltlMsg.Text = "减少的有效期大于系统记录的有效期!";
                                                this.pnlMsg.Visible = true;
                                                this.pnlMsg.CssClass = "actionErr";
                                                return;
                                            }
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                else
                                {   //归0
                                    item.PeriodOfValidity = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
                                }
                                memberBll.Update(item);
                                TimeSpan newtime = new TimeSpan(Convert.ToDateTime(this.txtManageTime.Text).Ticks);
                                TimeSpan gap = oldtime.Subtract(newtime).Duration();
                                noteModel.TicketCount = Convert.ToDecimal(gap.Days);
                                noteModel.UserID = Convert.ToInt32(item.UID);
                                noteModel.Username = item.UserId;
                                noteBll.Add(noteModel);
                 }
            }
            //指定用户
            if(ViewState["M"].ToString() =="3")
            {
                string assigner= this.txtName.Text.Trim();
                String[] name = assigner.Split(',');
                int con = name.Length;
                for (int i = 0; i < con; i++)
                {
                    string userName = name[i].ToString();
                    List<ShowShop.Model.Member.MemberAccount> accountList = memberBll.GetAll("UserId = '" + userName + "'");
                    foreach (ShowShop.Model.Member.MemberAccount item in accountList)
                    {
                        TimeSpan oldtime = new TimeSpan(Convert.ToDateTime(item.PeriodOfValidity).Ticks);
                        if (ViewState["time"].ToString() == "4")
                        {
                            switch (ViewState["Opreate"].ToString())
                            {
                                case "add":
                                    if (Convert.ToDateTime(this.txtManageTime.Text) > Convert.ToDateTime(item.PeriodOfValidity))
                                    {
                                        item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text);
                                    }
                                    else
                                    {
                                        this.ltlMsg.Text = "添加的有效期小于系统记录的有效期!";
                                        this.pnlMsg.Visible = true;
                                        this.pnlMsg.CssClass = "actionErr";
                                        return;
                                    }
                                    break;
                                case "allay":
                                    if (Convert.ToDateTime(this.txtManageTime.Text) < Convert.ToDateTime(item.PeriodOfValidity))
                                    {
                                        item.PeriodOfValidity = Convert.ToDateTime(this.txtManageTime.Text);
                                    }
                                    else
                                    {
                                        this.ltlMsg.Text = "减少的有效期大于系统记录的有效期!";
                                        this.pnlMsg.Visible = true;
                                        this.pnlMsg.CssClass = "actionErr";
                                        return;
                                    }
                                    break;
                                default:
                                    break;
                            }
                        }
                        else
                        {   //归0
                            item.PeriodOfValidity = Convert.ToDateTime(System.DateTime.Now.ToShortDateString());
                        }
                        memberBll.Update(item);
                        TimeSpan newtime = new TimeSpan(Convert.ToDateTime(this.txtManageTime.Text).Ticks);
                        TimeSpan gap = oldtime.Subtract(newtime).Duration();
                        noteModel.TicketCount = Convert.ToDecimal(gap.Days);
                        noteModel.UserID = Convert.ToInt32(item.UID);
                        noteModel.Username = item.UserId;
                        noteBll.Add(noteModel);
                    }
                }
            }
            this.ltlMsg.Text = "编辑有效期成功!";
            this.pnlMsg.Visible = true;
            this.pnlMsg.CssClass = "actionOk";
        }
Example #5
0
        protected void lbSave_Click(object sender, EventArgs e)
        {
            if (ViewState["to"] == null)
            {
                this.ltlMsg.Text = "请选择您要移动到的目标会员组";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            ShowShop.BLL.Member.MemberAccount bll = new ShowShop.BLL.Member.MemberAccount();
            List<ShowShop.Model.Member.MemberAccount> model = new List<ShowShop.Model.Member.MemberAccount>();
            if (rabtnUser.Checked)
            {
                if (txtUserName.Text.Trim().Length != 0)
                {
                    string uid = this.txtUserName.Text.Trim();
                    if (uid.EndsWith(","))
                    {
                        uid = uid.Substring(0, uid.LastIndexOf(','));
                    }
                    //进行拆分 给每个字段加上单引号
                    string[] arrUid = uid.Split(',');
                    uid = string.Empty;
                    for (int i = 0; i < arrUid.Length; i++)
                    {
                        uid += "'" + arrUid[i] + "'" + ",";
                    }
                    if (uid.EndsWith(","))
                    {
                        uid = uid.Substring(0, uid.LastIndexOf(','));
                    }

                    model = bll.GetAll(" UserId in(" + uid + ")");
                    for (int i = 0; i < model.Count; i++)
                    {
                        bll.Amend(Convert.ToInt32(model[i].UID), "UserGroup", this.lbxTo.SelectedValue);
                    }
                    this.ltlMsg.Text = "操作成功!";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
                else
                {
                    this.ltlMsg.Text = "请输入您要移动的用户";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
            }
            //按会员组 批量移动
            else if (rabtnGroup.Checked)
            {
                if (ViewState["from"] == null)
                {
                    this.ltlMsg.Text = "请选择您要移动的会员组";
                    this.pnlMsg.Visible = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                bll.UpdateGroup(this.lbxFrom.SelectedValue, this.lbxTo.SelectedValue);
                this.ltlMsg.Text = "操作成功!";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
        }