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(); } }