Exemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (id != "")
        {
            string list = string.Empty;
            foreach (ListItem item in catelist.Items)
            {
                if (item.Selected)
                {
                    list += item.Value + ",";
                }
            }

            if (list == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('请选择任务分类!');</script>");
            }
            else
            {
                BllShopUser bUer  = new BllShopUser();
                ModShopUser mUser = bUer.GetModel(id);
                mUser.CategoryId = list.TrimEnd(',');
                int i = bUer.Update(mUser);
                if (i > 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('修改成功!');layer_close();</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "alert", "<script>alert('修改失败!');</script>");
                }
            }
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 保存操作
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.id != "")
        {
            if (ViewState["OldUserName"].ToString() != this.txtUserName.Text.Trim())
            {
                if (CheckHasUserName(this.txtUserName.Text.Trim()) == true)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('该帐号已经存在,请使用其他账号!');</script>");
                    return;
                }
            }


            user           = userbll.GetModel(this.id);
            user.ShopMoney = DataConvert.DecimalC(txtBZJ.Value);
            user.isOpen    = DataConvert.IntC(rbOpen.SelectedValue);
            user.orderby   = DataConvert.IntC(txtOrder.Text);

            user.UserName = txtUserName.Text.Trim();
            user.Email    = this.email.Text.Trim();
            user.QQ       = this.qq.Text.Trim();

            user.AccoutsState = rbAccountsState.SelectedValue;
            if (userbll.Update(user) > 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('保存成功!');layer_close_flesh();</script>");
            }

            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('保存失败!');</script>");
            }
        }

        else
        {
            ClientScript.RegisterStartupScript(this.GetType(), "ok", "<script>alert('未传递参数!');</script>");
        }
    }