protected void rptAdminUserList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int result = 0;

            int.TryParse(e.CommandArgument.ToString(), out result);
            MsgList myList = new MsgList();
            TextBox box    = e.Item.FindControl("txtUserOpenId") as TextBox;

            myList.UserOpenId = box.Text.Trim();
            TextBox box2 = e.Item.FindControl("txtRoleName") as TextBox;

            myList.RoleName = box2.Text.Trim();
            TextBox box3 = e.Item.FindControl("txtRealName") as TextBox;

            myList.RealName = box3.Text.Trim();
            myList.Msg1     = Convert.ToInt32((e.Item.FindControl("cbMsg1") as CheckBox).Checked);
            myList.Msg2     = Convert.ToInt32((e.Item.FindControl("cbMsg2") as CheckBox).Checked);
            myList.Msg3     = Convert.ToInt32((e.Item.FindControl("cbMsg3") as CheckBox).Checked);
            myList.Msg4     = Convert.ToInt32((e.Item.FindControl("cbMsg4") as CheckBox).Checked);
            myList.Msg5     = Convert.ToInt32((e.Item.FindControl("cbMsg5") as CheckBox).Checked);
            myList.Msg6     = Convert.ToInt32((e.Item.FindControl("cbMsg6") as CheckBox).Checked);
            string retInfo     = "";
            bool   success     = false;
            string commandName = e.CommandName;

            if (commandName != null)
            {
                if (!(commandName == "Save"))
                {
                    if (!(commandName == "Delete"))
                    {
                        return;
                    }
                }
                else
                {
                    if ((((((myList.Msg1 + myList.Msg2) + myList.Msg3) + myList.Msg4) + myList.Msg5) + myList.Msg6) == 0)
                    {
                        this.ShowMsg("当前用户未选择任何消息提醒,无法保存。", false);
                        return;
                    }
                    success = VShopHelper.SaveAdminUserMsgList(false, myList, myList.UserOpenId, out retInfo);
                    this.BindData();
                    this.ShowMsg(retInfo, success);
                    return;
                }
                success = VShopHelper.DeleteAdminUserMsgList(myList, out retInfo);
                if (success)
                {
                    this.rptAdminUserList.Items[0].Visible = false;
                }
                this.ShowMsg(retInfo, success);
            }
        }
Esempio n. 2
0
        protected void rptAdminUserList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            int num = 0;

            int.TryParse(e.CommandArgument.ToString(), out num);
            MsgList myList = default(MsgList);

            System.Web.UI.WebControls.TextBox textBox = e.Item.FindControl("txtUserOpenId") as System.Web.UI.WebControls.TextBox;
            myList.UserOpenId = textBox.Text.Trim();
            System.Web.UI.WebControls.TextBox textBox2 = e.Item.FindControl("txtRoleName") as System.Web.UI.WebControls.TextBox;
            myList.RoleName = textBox2.Text.Trim();
            System.Web.UI.WebControls.TextBox textBox3 = e.Item.FindControl("txtRealName") as System.Web.UI.WebControls.TextBox;
            myList.RealName = textBox3.Text.Trim();
            myList.Msg1     = System.Convert.ToInt32((e.Item.FindControl("cbMsg1") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg2     = System.Convert.ToInt32((e.Item.FindControl("cbMsg2") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg3     = System.Convert.ToInt32((e.Item.FindControl("cbMsg3") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg4     = System.Convert.ToInt32((e.Item.FindControl("cbMsg4") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg5     = System.Convert.ToInt32((e.Item.FindControl("cbMsg5") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg6     = System.Convert.ToInt32((e.Item.FindControl("cbMsg6") as System.Web.UI.WebControls.CheckBox).Checked);
            string msg = "";
            string commandName;

            if ((commandName = e.CommandName) != null)
            {
                if (!(commandName == "Save"))
                {
                    if (!(commandName == "Delete"))
                    {
                        return;
                    }
                    bool flag = VShopHelper.DeleteAdminUserMsgList(myList, out msg);
                    if (flag)
                    {
                        this.rptAdminUserList.Items[0].Visible = false;
                    }
                    this.ShowMsg(msg, flag);
                }
                else
                {
                    if (myList.Msg1 + myList.Msg2 + myList.Msg3 + myList.Msg4 + myList.Msg5 + myList.Msg6 == 0)
                    {
                        this.ShowMsg("当前用户未选择任何消息提醒,无法保存。", false);
                        return;
                    }
                    bool flag = VShopHelper.SaveAdminUserMsgList(false, myList, myList.UserOpenId, out msg);
                    this.BindData();
                    this.ShowMsg(msg, flag);
                    return;
                }
            }
        }