//提交数据的代码 void btnSubmit_ServerClick(object sender, EventArgs e) { String error = String.Empty; Control con1 = bean1.CheckControls(out error); //进行数据验证 if (con1 != null) { UTools.Alert(error); } else { JUserBU bu1 = new JUserBU(); String olduserid = String.Empty; if (this.UserID.Enabled == false) { olduserid = this.UserID.Text; } int succ = bu1.SaveData(olduserid, this.Num.Text, this.UserID.Text, this.UserName.Text, this.Status.SelectedValue, this.AuthorityID.SelectedValue, ""); if (succ == 1) //submit succ { String js1 = "layer.alert('操作成功!',function(index){;"; js1 = js1 + " var index = parent.layer.getFrameIndex(window.name);"; js1 = js1 + " parent.$('#butSearch').click();"; js1 = js1 + " parent.layer.close(index);});"; JAjax.ExecuteJS(js1); } else { UTools.Alert("操作失败,请重试!"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { KORWeb.BUL.JUserBU bu1 = new JUserBU(); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("UserID", "admin", SearchOperator.NotEqual)); DataRow dr1 = bu1.GetFirstDataRow(condition, "max(Num) as num1"); if (dr1 != null) { int num1 = 1; int.TryParse(dr1[0].ToString(), out num1); this.Num.Text = (num1 + 1) + ""; } else { this.Num.Text = "1"; } } }
//submit data void but1_Click(object sender, EventArgs e) { String error = String.Empty; Control con1 = JControl.CheckControls(new Control[] { this.pass1, this.pass2, this.oldpass }, out error); if (con1 != null) { UTools.AlertAndFocusControl(error, con1.ClientID); } else { JUserBU bu1 = new JUserBU(); error = bu1.ChangeOldPassWord(this.oldpass.Text, this.pass1.Text); if (String.IsNullOrEmpty(error)) { UTools.Alert("提示:密码修改成功,下次登录生效!"); } else { UTools.Alert(error); } } }
//submit login void but1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.username.Value) == false) { if (String.IsNullOrEmpty(Request.Form["password"]) == false) { JUserBU bu1 = new JUserBU(); String userid = String.Empty; String departnum = String.Empty; int succ = bu1.Login(this.username.Value, Request.Form["password"], ref userid, ref departnum); if (succ == 0) { JAjax.AlertAndFocusControl("错误:用户名不存在!", this.username.ClientID); } else if (succ == 1) { JAjax.AlertAndFocusControl("错误:登录密码不正确!", "password"); } else if (succ == 2) { JAjax.AlertAndFocusControl("错误:用户名已停用,请联系管理员!", "password"); } else { //设置用户的登录 WebFrame.FrameLib.Login(userid); JCookie.SetCookieValue("login_userid", this.username.Value); JCookie.SetCookieValue("departnum", departnum); if (this.remember.Checked) { JCookie.SetCookieValue("login_password", Request.Form["password"]); JCookie.SetCookieValue("login_remember", "true"); } else { JCookie.SetCookieValue("login_password", ""); JCookie.SetCookieValue("login_remember", ""); } //设置登录后转向的URL String toUrl = "/SysManager/ManagerIndex.aspx"; if (String.IsNullOrEmpty(toUrl) == false) { Response.Redirect(toUrl, true); } } } else { JAjax.AlertAndFocusControl("错误:请输入登录的密码!", "password"); } } else { JAjax.AlertAndFocusControl("错误:请输入登录的用户名!", this.username.ClientID); } }