Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.User.Identity.Name == null || Page.User.Identity.Name.Trim() == "")
     {
         Response.Redirect("../Login.aspx");
     }
     if (Request.QueryString["id"] != null && Request.QueryString["id"].Trim() != "")
     {
         //推广
         id = Convert.ToInt32(Request.QueryString["id"].Trim().ToString());
     }
     if (Request.QueryString["recId"] != null && Request.QueryString["recId"].Trim() != "")
     {
         //订单详情
         recId = Convert.ToInt32(Request.QueryString["recId"].Trim().ToString());
     }
     loginname = Page.User.Identity.Name;
     if (!Page.IsPostBack)
     {
         Tz888.BLL.SubscribeSet bll = new Tz888.BLL.SubscribeSet();
         ViewState["CurrPage"] = 1;
         bind();
         bll.Update(id, ViewState["SubType"].ToString());
         bool statu = bll.UpdateSmsConsumeRecTab(recId);
         if (statu)
         {
             Response.Write("<script>alert('恭喜您!推广成功!');location.href='myPromotion.aspx';</script>");
         }
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// 判断发送消息的类型
    /// </summary>
    /// <param name="dal">业务层</param>
    /// <param name="descript">发送内容</param>
    /// <param name="htmlFile">显示的地址</param>
    /// <param name="CurrPage">当前页</param>
    /// <param name="TotalCount">总记录数</param>
    /// <param name="Promotioncount">推广的数量</param>
    /// <param name="SubscribeType">推广的类型</param>
    /// <param name="strWhere">推广的条件</param>
    /// <param name="countTatol">推广提取的条数</param>
    private void SendSummey(Tz888.BLL.Conn dal, string descript, string htmlFile, ref long CurrPage, ref long TotalCount, string[] Promotioncount, string[] SubscribeType, ref string strWhere, ref int countTatol)
    {
        string type = "";

        Tz888.BLL.SubscribeSet bll = new Tz888.BLL.SubscribeSet();
        for (int j = 0; j < SubscribeType.Length - 1; j++)
        {
            if (SubscribeType[j].Equals("1") && SubscribeType[j] != "") //判断是属于哪个类型(站内短信)
            {
                if (Promotioncount[j] != "")
                {
                    countTatol = Convert.ToInt32(Promotioncount[j]);  //得到哪种类型下的推广数量
                    DataTable dt = dal.GetList("showLoginMember_getList", "loginID", "*", strWhere, "NEWID()", ref CurrPage, countTatol, ref TotalCount);
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            if (countTatol <= dt.Rows.Count)
                            {
                                SendLoginNameShort(descript, dt);
                                //执行成功之后更改推广类型,是为了避免下次再次发信息

                                site = true;
                                if (email && phone)//最后一次

                                {
                                    type = ",,,";
                                }
                                else if (email)//第二次

                                {
                                    type = ",,3,";
                                }
                                else if (phone)
                                {
                                    type = ",2,,";
                                }
                                else
                                {
                                    type = SubType.Substring(SubType.IndexOf(","));
                                }
                                bll.Update(id, type);
                                type = "";
                            }
                        }
                    }
                }
            }
            if (SubscribeType[j].Equals("2") && SubscribeType[j] != "") //判断是属于哪个类型(Email)
            {
                if (Promotioncount[j] != "")
                {
                    countTatol = Convert.ToInt32(Promotioncount[j]); //得到哪种类型下的推广数量
                    DataTable dt = dal.GetList("showLoginMember_getList", "loginID", "*", strWhere, "NEWID()", ref CurrPage, countTatol, ref TotalCount);
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            if (countTatol <= dt.Rows.Count)
                            {
                                SendEmailShort(descript, htmlFile, dt);
                                email = true;
                                if (site && phone) //最后一次

                                {
                                    type = ",,,";
                                }
                                else if (site)//如果是第二次
                                {
                                    type = ",,3,";
                                }
                                else if (phone)
                                {
                                    type = "1,,,";
                                }
                                else //第一次

                                {    //1,,3,
                                    type = SubType.Substring(0, SubType.IndexOf("2")) + SubType.Substring(SubType.IndexOf("2") + 1, 2);
                                }
                                bll.Update(id, type);
                                type = "";
                            }
                        }
                    }
                }
            }
            if (SubscribeType[j].Equals("3") && SubscribeType[j] != "") //判断是属于哪个类型(phone)
            {
                if (Promotioncount[j] != "")
                {
                    countTatol = Convert.ToInt32(Promotioncount[j]); //得到哪种类型下的推广数量
                    DataTable dt = dal.GetList("showLoginMember_getList", "loginID", "*", strWhere, "NEWID()", ref CurrPage, countTatol, ref TotalCount);
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            if (countTatol <= dt.Rows.Count)
                            {
                                SendPhoneShort(descript, dt);
                                phone = true;
                                if (site && email) //在本次循环中是最后一次执行

                                {
                                    type = ",,,";
                                }
                                else if (site)  //在本次循环中是第二次执行
                                {
                                    type = ",2,,";
                                }
                                else if (email)
                                {
                                    type = "1,,,";
                                }
                                else
                                {
                                    type = SubType.Substring(0, SubType.IndexOf("3")) + ",";
                                }
                                bll.Update(id, type);
                                type = "";
                            }
                        }
                    }
                }
            }
        }
        PromotionType();
        strWhere = "";
        strWhere = ViewState["strWhere"].ToString();
    }