private void btnSave_Click(object sender, RoutedEventArgs e) { Guid operatorId = CommonHelper.GetOperatorId(); if (IsInsert) { Operator op = new Operator(); op.UserName = txtUserName.Text; op.RealName = txtRealName.Text; op.Password = pdxPassword.Password; OperatorDAL.Insert(op); T_OperationLogDAL.Insert(operatorId, "插入操作员" + op.UserName); } else { string password = pdxPassword.Password; string userName = txtUserName.Text; if (password.Length <= 0) { OperatorDAL.Update(EditId, txtUserName.Text, txtRealName.Text); //OperatorDAL.Update(EditId, null, txtRealName.Text); } else { //OperatorDAL.Update(EditId, txtUserName.Text, txtRealName.Text, pdxPassword.Password); OperatorDAL.Update(EditId, null, txtRealName.Text, pdxPassword.Password); } T_OperationLogDAL.Insert(operatorId, "修改操作员" + userName); } DialogResult = true; }
//编辑用户信息,修改密码 public int EditOperator(Guid operatorId, string password) { OperatorDAL dal = new OperatorDAL(); string md5password = CommonHelper.GetMD5(password + CommonHelper.GetPasswordSalt()); int i = dal.Update(operatorId, md5password); return(i); }