Exemplo n.º 1
0
    protected void btnSubMit_Click(object sender, EventArgs e)
    {
        string name = tbUserName.Text.Trim();

        if (name == "")
        {
            Shove._Web.JavaScript.Alert(this.Page, "请输入合买活跃明星!");

            return;
        }

        name = name.Replace(",", ",");

        string[] n = name.Split(',');

        name = "";
        foreach (string s in n)
        {
            Users u = new Users(_Site.ID)[_Site.ID, s.Trim()];

            if (u == null)
            {
                Shove._Web.JavaScript.Alert(this.Page, "对不起,您输入的"+s+"不存在!");

                return;
            }

            name += u.Name + "|" + u.ID.ToString() + ",";
        }

        if (name.EndsWith(","))
        {
            name = name.Substring(0, name.Length - 1);
        }

        DAL.Tables.T_ActiveAllBuyStar t = new DAL.Tables.T_ActiveAllBuyStar();

        t.LotterieID.Value = ddlLottery.SelectedValue;
        t.UserList.Value = name;
        t.Order.Value = Shove._Convert.StrToInt(tbOrder.Text, 1);

        if (t.GetCount("LotterieID=" + ddlLottery.SelectedValue + "") > 0)
        {
            t.Update("LotterieID=" + ddlLottery.SelectedValue + "");
        }
        else
        {
            t.Insert();
        }

        Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindActiveMembers");
        Shove._Web.JavaScript.Alert(this.Page, "操作成功!");
    }
 protected void btnSubMit_Click(object sender, EventArgs e)
 {
     string str = this.tbUserName.Text.Trim();
     if (str == "")
     {
         JavaScript.Alert(this.Page, "请输入合买活跃明星!");
     }
     else
     {
         string[] strArray = str.Replace(",", ",").Split(new char[] { ',' });
         str = "";
         foreach (string str2 in strArray)
         {
             Users users = new Users(base._Site.ID)[base._Site.ID, str2.Trim()];
             if (users == null)
             {
                 JavaScript.Alert(this.Page, "对不起,您输入的" + str2 + "不存在!");
                 return;
             }
             string str3 = str;
             str = str3 + users.Name + "|" + users.ID.ToString() + ",";
         }
         if (str.EndsWith(","))
         {
             str = str.Substring(0, str.Length - 1);
         }
         Tables.T_ActiveAllBuyStar star = new Tables.T_ActiveAllBuyStar
         {
             LotterieID = { Value = this.ddlLottery.SelectedValue },
             UserList = { Value = str },
             Order = { Value = _Convert.StrToInt(this.tbOrder.Text, 1) }
         };
         if (star.GetCount("LotterieID=" + this.ddlLottery.SelectedValue) > 0L)
         {
             star.Update("LotterieID=" + this.ddlLottery.SelectedValue);
         }
         else
         {
             star.Insert();
         }
         Shove._Web.Cache.ClearCache("Home_Room_JoinAllBuy_BindActiveMembers");
         JavaScript.Alert(this.Page, "操作成功!");
     }
 }
 protected void ddlLottery_SelectedIndexChanged(object sender, EventArgs e)
 {
     DataTable table = new Tables.T_ActiveAllBuyStar().Open("LotterieID,UserList,[Order]", "LotterieID = " + this.ddlLottery.SelectedValue, "");
     if ((table == null) || (table.Rows.Count < 1))
     {
         this.tbUserName.Text = "";
     }
     else
     {
         this.tbUserName.Text = table.Rows[0]["UserList"].ToString();
         string[] strArray = this.tbUserName.Text.Trim().Split(new char[] { ',' });
         this.tbUserName.Text = "";
         foreach (string str in strArray)
         {
             this.tbUserName.Text = this.tbUserName.Text + str.Split(new char[] { '|' })[0] + ",";
         }
         if (this.tbUserName.Text.EndsWith(","))
         {
             this.tbUserName.Text = this.tbUserName.Text.Substring(0, this.tbUserName.Text.Length - 1);
         }
         this.tbOrder.Text = table.Rows[0]["Order"].ToString();
     }
 }
Exemplo n.º 4
0
    protected void ddlLottery_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataTable dt = new DAL.Tables.T_ActiveAllBuyStar().Open("LotterieID,UserList,[Order]", "LotterieID = "+ddlLottery.SelectedValue+"","");

        if (dt == null || dt.Rows.Count < 1)
        {
            tbUserName.Text = "";
        }
        else
        {
            tbUserName.Text = dt.Rows[0]["UserList"].ToString();

            string[] userlist = tbUserName.Text.Trim().Split(',');
            tbUserName.Text = "";
            foreach (string s in userlist)
            {
                tbUserName.Text += s.Split('|')[0] + ",";
            }

            if (tbUserName.Text.EndsWith(","))
            {
                tbUserName.Text = tbUserName.Text.Substring(0, tbUserName.Text.Length-1);
            }

            tbOrder.Text = dt.Rows[0]["Order"].ToString();
        }
    }