protected void btnSubmit_Click(object sender, ImageClickEventArgs e) { string scheckcode = chkcode.Text.Trim(); if (!Session["CheckCode"].Equals(scheckcode)) { JSMsg.ShowRegisterMsg(this, "验证码输入错误"); chkcode.Focus(); return; } BLLAdminUser bll = new BLLAdminUser(); string sPassword = WebCommon.Md5Enctry(txtPwd.Text.Trim()); try { if (txtAccount.Text.Trim() == "root" && sPassword == WebCommon.Md5Enctry("root")) { AdminUser adminbestop = new AdminUser(); adminbestop.ID = 999; adminbestop.Account = "root"; adminbestop.PassWord = WebCommon.Md5Enctry("root"); Session["admin"] = adminbestop; Response.Redirect("index.aspx"); } AdminUser admin = bll.GetSingle(AdminUser.Account_FieldName, txtAccount.Text.Trim()); if (admin == null) { JSMsg.ShowRegisterMsg(this, "该用户不存在!"); return; } if (admin.PassWord != sPassword) { JSMsg.ShowRegisterMsg(this, "用户名或密码错误"); txtAccount.Focus(); return; } bll.Update( new string[] { AdminUser.LoginCounts_FieldName, AdminUser.LastLoginDate_FieldName, AdminUser.LoginIP_FieldName }, new object[] { ++admin.LoginCounts, DateTime.Now, StringPlus.GetIPAddress() }, admin.ID); Session["admin"] = admin; Response.Redirect("index.aspx"); } catch (System.Exception ex) { JSMsg.ShowRegisterMsg(this, "登录失败!"); Log.Error(ex.Message, ex); } }
protected void Unnamed1_Click(object sender, EventArgs e) { if (contactor.Value.Trim() == "") { JSMsg.ShowRegisterMsg(this, "请输入联系人!"); contactor.Focus(); return; } if (phonenumber.Value.Trim() == "") { JSMsg.ShowRegisterMsg(this, "请输入联系电话!"); phonenumber.Focus(); return; } if (lblAddress.Value.Trim() == "") { JSMsg.ShowRegisterMsg(this, "请输入联系地址!"); lblAddress.Focus(); return; } using (BLLMessages bll = new BLLMessages()) { Messages obj = new Messages(); obj.MesAddress = lblAddress.Value.Trim(); obj.MesName = contactor.Value.Trim();; obj.MesTelphone = phonenumber.Value.Trim(); obj.MesDate = DateTime.Now; obj.IsReply = 0; obj.MesEmail = email.Value.Trim(); obj.MesContent = messageContent.Value.Trim(); bll.Save(obj); if (bll.IsFail) { ExceptionManager.ShowErrorMsg(this, bll.DevNetException); } else { JSMsg.ShowWinRedirect(this, "保存成功", "index.aspx"); } } }
/// <summary> /// 显示提示信息 /// </summary> /// <param name="msg"></param> protected void ShowMsg(string msg) { JSMsg.ShowRegisterMsg(this, msg); }
/// <summary> /// 处理异常并向页面显示错误信息 /// </summary> /// <param name="page"></param> /// <param name="ex"></param> public static void ShowErrorMsg(Page page, Exception ex) { WriteLog(ex.Message); JSMsg.ShowRegisterMsg(page, ErrorText); }
/// <summary> /// 处理异常并向页面显示错误信息 /// </summary> /// <param name="page"></param> /// <param name="ex"></param> public static void ShowErrorMsg(Page page, DevNetException ex) { JSMsg.ShowRegisterMsg(page, GetErrorMsg(ex)); }