private bool Check() { //校验老密码 if (phPwdCheck.Visible) { var oldUser = new SysUser(UserID); oldUser.Load(); if (oldUser.Password != tbxOldPassword.Text.MD5Encrypt()) { Warning("旧密码不正确,请重新输入!"); return(false); } } if (tbxRepeatPassword.Text.Length < 6) { Warning("密码至少输入6位!"); return(false); } if (tbxRepeatPassword.Text != tbxPassword.Text) { Warning("两次输入密码不一致,请重新输入!"); return(false); } return(true); }
private void LoadData() { if (UserID < 0) { return; } var user = new SysUser(UserID); user.Load(); phData.BindObjectToControls(user, "tbx"); }
private void LoadData() { if (UserID < 0) { return; } var user = new SysUser(UserID); user.Load(); phData.BindObjectToControls(user, "tbx"); tbxUserName.Attributes.Add("readonly", "readonly"); }
protected void rpList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = int.Parse(e.CommandArgument.ToString()); if (e.CommandName == "Delete") { var user = new SysUser(id); user.Load(); //删除操作,工号添加前缀"XXXX_DEL_" user.IsDeleted = true; user.UserName = (new Random()).Next(0, 9999).ToString("0000") + "_DEL_" + user.UserName; user.UpdateTime = DateTime.Now; user.Update(); LoadData(); } }
protected void btnSave_Click(object sender, EventArgs e) { if (!Check()) { return; } //修改 if (UserID > 0) { var user = new SysUser(UserID); user.Load(); SetData(user); user.Update(); } Success("保存成功"); }
private void LoadData() { if (UserID < 0) { return; } var user = new SysUser(UserID); user.Load(); phData.BindObjectToControls(user, "tbx"); BindDept(user.DepartmentType, user.RegYear); var li = tbxDepartmentID.Items.FindByValue(user.DepartmentID.ToString()); if (li != null) { li.Selected = true; } }
protected void rpList_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = int.Parse(e.CommandArgument.ToString()); if (e.CommandName == "Delete") { var user = new SysUser(id); user.Load(); //删除操作,工号添加前缀"XXXX_DEL_" user.IsDeleted = true; user.UserName = (new Random()).Next(0, 9999).ToString("0000") + "_DEL_" + user.UserName; user.UpdateTime = DateTime.Now; user.Update(); //删除作业 DataAccess.Delete(typeof(SysTask), string.Format("{0}='{1}'", SysTask.SQLCOL_STUDENTID, id)); //删除成绩 DataAccess.Delete(typeof(SysPerform), string.Format("{0}='{1}'", SysPerform.SQLCOL_STUDENTID, id)); LoadData(); } }
private void SaveData() { var teacher = new SysUser(TeacherID); teacher.Load(); #region 保存关系 DataAccess.Delete(typeof(SysCourseRel), string.Format("{0}='{1}' AND {2}='{3}'", SysCourseRel.SQLCOL_COURSEID, CourseID, SysCourseRel.SQLCOL_TEACHERID, TeacherID)); //从隐藏域中读取勾选的菜单值 var deptList = DataAccess.Select(typeof(SysDepartment), string.Format("IsDeleted=0 AND {0} IN ({1})", SysDepartment.SQLCOL_ID, SelectedDeptIds.TrimStart(',').TrimEnd(',')), true) as IList <SysDepartment>; foreach (var dept in deptList) { var rel = new SysCourseRel(CourseID, TeacherID, dept.ID); rel.TeacherName = tbxTeacher.SelectedItem.Text; rel.DepartmentName = dept.Name; rel.RegYear = tbxRegYear.SelectedValue.ToInt32(); rel.Save(); } #endregion }