⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addtermreduce.aspx.cs

📁 易想商城系统
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using YXShop.Common;
using Shop.Web.UI;

namespace YXShop.Web.Admin.Consumer
{
    public partial class AddTermReduce : System.Web.UI.Page
    {
        BasePage bp = new BasePage();
        YXShop.BLL.UserCommon datab = new YXShop.BLL.UserCommon();
        YXShop.BLL.MemberRand dataCAa = new YXShop.BLL.MemberRand();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ViewState["nx"] = "4";
                ViewState["M"] = "1";
                string StrId = Request.QueryString["strId"];
                if (StrId != null)
                {
                    string[] id = StrId.Split(',');
                    int ln = id.Length;
                    string str = "";
                    for (int i = 0; i < id.Length; i++)
                    {
                        if (!id[i].Trim().Equals(""))
                        {
                            try
                            {
                                List<YXShop.Model.UserCommon> datam = datab.GetListByColumn("UID", id[i]);
                                if (datam.Count > 0)
                                {
                                    str += datam[0].UserName + ",";
                                }

                            }
                            catch
                            {
                                continue;
                            }
                        }
                    }
                    //if (Session["strnmxx"] != null)
                    //{
                    try
                    {
                        TextBox1.Text = str.Substring(0, (str.Length - 1));
                    }
                    catch
                    {
 
                    }
                    RadioButton3.Checked = true;
                    ViewState["M"] = "3";
                }
                if (Request["hyname"] != null)
                {
                    TextBox1.Text = Request["hyname"].ToString();
                    RadioButton3.Checked = true;
                    ViewState["M"] = "3";
                }
                grid();
            }
        }
        protected void grid()
        {
            dg1.DataSource = dataCAa.GetAll();
            dg1.DataBind();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            YXShop.BLL.MemberInfo dataCAh = new YXShop.BLL.MemberInfo();
            YXShop.BLL.MemberInfo dataCAy = new YXShop.BLL.MemberInfo();
            YXShop.Model.MemberInfo datadd = new YXShop.Model.MemberInfo();
            YXShop.BLL.UserInfoNote ff = new YXShop.BLL.UserInfoNote();
            YXShop.Model.UserInfoNote mod = new YXShop.Model.UserInfoNote();

            YXShop.BLL.UserCommon ucBll = new YXShop.BLL.UserCommon();

            mod.BuckleOrAdd = 0;
            mod.NoteType = 2;
            mod.NoteName = "asd";
            mod.NoteDate = Convert.ToDateTime(DateTime.Now.ToLongDateString());
            mod.BosomNote = TextBox4.Text.Trim();
            mod.Causation = TextBox3.Text.Trim();

            if (ViewState["M"].ToString() == "1")
            {
                DataTable data = dataCAy.GetAll();
                for (int i = 0; i < data.Rows.Count;i++ )
                    {
                        if (ViewState["nx"].ToString() == "4")
                        {
                            if (Convert.ToDateTime(this.dpDate.Date) < Convert.ToDateTime(data.Rows[i]["PeriodOfValidity"].ToString()))
                            {
                                dataCAh.Amend(Convert.ToInt32(data.Rows[i]["UID"].ToString()), "PeriodOfValidity", Convert.ToDateTime(this.dpDate.Date));
                            }
                            else
                            {
                                Response.Redirect("../Succeed/Error.aspx?Key=有效期小于系统记录的有效期!");
                                return;
                            }
                        }
                        else
                        {
                            dataCAh.Amend(Convert.ToInt32(data.Rows[i]["UID"].ToString()), "PeriodOfValidity", Convert.ToDateTime(DateTime.Now.ToShortDateString()));
                        }
                        TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(data.Rows[i]["PeriodOfValidity"].ToString()).Ticks);
                        TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(this.dpDate.Date).Ticks);
                        TimeSpan ts = ts1.Subtract(ts2).Duration();
                        mod.TicketCount = Convert.ToDecimal(ts.Days);
                        mod.UserID = Convert.ToInt32(data.Rows[i]["UID"].ToString());
                        ff.Create(mod);
                    }
            }
            if (ViewState["M"].ToString() == "3")
            {

                string hym = TextBox1.Text.Trim();
                String[] sjrid = hym.Split(',');
                int con = sjrid.Length;
                string strdm;
                strdm = "";
                string strcg;
                strcg = "";
                List<YXShop.Model.UserCommon> ucList = null;
                for (int i = 0; i < con; i++)
                {
                    string bn = sjrid[i].ToString();
                    ucList = ucBll.GetListByColumn("UserName", bn);
                    //if (dataCAy.Getpd(bn).uUserId.ToString() != "")
                    if(ucList.Count>0)
                    {
                        List<YXShop.Model.MemberInfo> data = dataCAh.GetListByColumn("UID", ucList[0].UID);

                        if (ViewState["nx"].ToString() == "4")
                        {
                            if (Convert.ToDateTime(this.dpDate.Date) < Convert.ToDateTime(data[0].PeriodOfValidity))
                            {
                                dataCAh.Amend(Convert.ToInt32(ucList[0].UID), "PeriodOfValidity", Convert.ToDateTime(this.dpDate.Date));
                            }
                            else
                            {
                                Response.Redirect("../Succeed/Error.aspx?Key=有效期小于系统记录的有效期!");
                                return;
                            }
                        }
                        else
                        {
                            dataCAh.Amend(Convert.ToInt32(ucList[0].UID), "PeriodOfValidity", Convert.ToDateTime(DateTime.Now.ToShortDateString()));
                        }
                        TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(data[0].PeriodOfValidity).Ticks);
                        TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(this.dpDate.Date).Ticks);
                        TimeSpan ts = ts1.Subtract(ts2).Duration();
                        mod.TicketCount = Convert.ToDecimal(ts.Days);
                        mod.UserID = ucList[0].UID; //Convert.ToInt32(dataCAy.Getnm(bn).uUserId.ToString());
                        ff.Create(mod);

                        int j;
                        j = i - 1;
                        string cdm1 = sjrid[i].ToString();
                        string cdm2;
                        if (i > 0)
                        {
                            cdm2 = sjrid[i].ToString();
                        }
                        else
                        {
                            cdm2 = sjrid[i].ToString();
                        }
                        if (i == 0)
                        {
                            strcg = cdm1;
                        }
                        else
                        {
                            if (strcg == "")
                            {
                                strcg = cdm1;
                            }
                            else
                            {
                                strcg = strcg + "," + cdm1;
                            }
                        }
                    }
                    else
                    {
                        int j;
                        j = i - 1;
                        string cdm1 = sjrid[i].ToString();
                        string cdm2;
                        if (i > 0)
                        {
                            cdm2 = sjrid[i].ToString();
                        }
                        else
                        {
                            cdm2 = sjrid[i].ToString();
                        }

                        if (i == 0)
                        {
                            strdm = cdm1;
                        }
                        else
                        {
                            if (strdm == "")
                            {
                                strdm = cdm1;
                            }
                            else
                            {
                                strdm = strdm + "," + cdm1;
                            }
                        }
                    }
                }
                Session["strdm"] = strdm;
                Session["strcg"] = strcg;
            }
            if (ViewState["M"].ToString() == "2")
            {
                System.Web.UI.WebControls.CheckBox chkExport;
                string sID;
                int all = dg1.Items.Count;
                int i;
                try
                {
                    for (i = 0; i < all; i++)
                    {
                        chkExport = (CheckBox)dg1.Items[i].FindControl("chkItem");

                        if (chkExport.Checked == true)
                        {
                            sID = dg1.DataKeys[i].ToString();

                            List<YXShop.Model.MemberInfo> datahk = dataCAy.Gethy(Convert.ToInt32(sID));
                            foreach (YXShop.Model.MemberInfo dd in datahk)
                            {
                                if (ViewState["nx"].ToString() == "4")
                                {
                                    if (Convert.ToDateTime(this.dpDate.Date) < Convert.ToDateTime(dd.PeriodOfValidity))
                                    {
                                        dataCAh.Amend(Convert.ToInt32(dd.Uid.ToString()), "PeriodOfValidity", Convert.ToDateTime(this.dpDate.Date));
                                    }
                                    else
                                    {
                                        Response.Redirect("../Succeed/Error.aspx?Key=有效期小于系统记录的有效期!");
                                        return;
                                    }
                                }
                                else
                                {
                                    dataCAh.Amend(Convert.ToInt32(dd.Uid.ToString()), "PeriodOfValidity", Convert.ToDateTime(DateTime.Now.ToShortDateString()));
                                }
                                TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(dd.PeriodOfValidity).Ticks);
                                TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(this.dpDate.Date).Ticks);
                                TimeSpan ts = ts1.Subtract(ts2).Duration();
                                mod.TicketCount = Convert.ToDecimal(ts.Days);
                                mod.UserID = Convert.ToInt32(dd.Uid.ToString());
                                ff.Create(mod);
                            }
                        }
                    }
                }
                catch (Exception eFS)
                {
                    Response.Write(eFS.ToString());
                    Response.End();
                }
            }
            //Response.Redirect("MemberAllList.aspx");
            //Response.Redirect("../Succeed/Succeed.aspx?Key=介绍有效期&Url= MemberAllList.aspx");
            bp.PageRight("减少有效期", "MemberAllList.aspx");
        }
        protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
        {
            ViewState["M"] = "1";
        }

        protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
        {
            ViewState["M"] = "2";
        }

        protected void RadioButton3_CheckedChanged(object sender, EventArgs e)
        {
            ViewState["M"] = "3";
        }
        protected void RadioButton5_CheckedChanged(object sender, EventArgs e)
        {
            ViewState["nx"] = "4";
        }

        protected void RadioButton4_CheckedChanged(object sender, EventArgs e)
        {
            ViewState["nx"] = "5";
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -