Example #1
0
        protected void bttnSave_Click(object sender, EventArgs e)
        {
            string name = txtLoginName.Text.Trim();
            string pwd  = txtPassword.Text.Trim();

            if (String.IsNullOrEmpty(name) || String.IsNullOrEmpty(name.Trim()))
            {
                Messages.ShowError("会员名不能为空");
                return;
            }
            if (String.IsNullOrEmpty(pwd) || String.IsNullOrEmpty(pwd.Trim()))
            {
                Messages.ShowError("密码不能为空");
                return;
            }

            try
            {
                string[] result = ShopService.RegisteSite(name, pwd, SiteInfo.SiteUrl, SiteInfo.SiteName);
                if (result != null && result.Length >= 1)
                {
                    if (result[0] == "1")
                    {
                        SiteInfo.ShopLoginName = name;
                        SiteInfo.ShopPassword  = ShopService.EncryptPassword(name, pwd);
                        SiteConfigs.SaveConfig(SiteInfo);
                        ShowRegistePanl(false);
                    }
                    else
                    {
                        Messages.ShowError(result.Length > 1 ? result[1] : "注册失败!");
                    }
                }
                else
                {
                    throw new Exception("应用程序执行结果有误!");
                }
            }
            catch (Exception ex)
            {
                Messages.ShowError("应用程序程序!错误原因:" + ex.Message);
            }
        }