protected void btnSave_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = initDatadic();
            userLogin ul        = new userLogin();
            int       intresult = 0;

            intresult = ul.update(dic, "userLogin", "username", username.Text.Trim());

            initinfo();

            Alert alert = new Alert();

            if (intresult == 1)
            {
                alert.Icon    = Icon.Information;
                alert.Message = "数据保存成功";
            }
            else
            {
                alert.MessageBoxIcon = MessageBoxIcon.Error;
                alert.Message        = "数据保存失败";
            }

            alert.Show();
        }
示例#2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> dic = initDatadic();
            string    strID     = editID.Text.ToString().Trim();
            userLogin ul        = new userLogin();
            int       intresult = 0;

            if (strID == "")
            {
                dic.Add("ID", Guid.NewGuid().ToString());

                string strusername = dic["username"].ToString().Trim();
                if (ul.isExistdata("userLogin", "username", strusername, "username").Trim() != "")
                {
                    Alert.Show(strusername + " 用户账号已经存在!");
                }
                else
                {
                    intresult = ul.add(dic, "userLogin");
                }
            }
            else
            {
                intresult = ul.update(dic, "userLogin", "ID", strID);
            }

            if (CurPage.Text.Trim() == "")
            {
                setPageContent(1);
            }
            else
            {
                setPageContent(5);
            }

            Alert alert = new Alert();

            if (intresult == 1)
            {
                alert.Icon    = Icon.Information;
                alert.Message = "数据保存成功";
            }
            else
            {
                alert.MessageBoxIcon = MessageBoxIcon.Error;
                alert.Message        = "数据保存失败";
            }

            alert.Show();
        }