public int AddUserToMachine(UserInfo UserInfo) { if(Machine!=null) { EnrollUserEventArgs arg = new EnrollUserEventArgs(); arg.UserId = System.Convert.ToInt32(UserInfo.UserId); arg.UserName = UserInfo.UserName; arg.UserType = UserInfo.Type; arg.CardNo = UserInfo.CardNo == string.Empty ? "0000000000" : UserInfo.CardNo; arg.DeptId = System.Convert.ToInt32(UserInfo.DeptId); arg.lPhotoType = 0; arg.lPhotoLen=0; arg.strBase64PhotoData=string.Empty; return Machine.ModifyUser(arg); } return 0; }
private void btnSearch_Click(object sender, EventArgs e) { BakDataTable = null; if (string.IsNullOrEmpty(this.mTxtUserName.Text.Trim()) & string.IsNullOrEmpty(this.mTextUserId.Text.Trim())) { MessageBox.Show(this, "请输入用户名或工号,然后点击查询。", "提示消息", MessageBoxButtons.OK); return; } if (BL != null) { DataTable dt = null; if (!string.IsNullOrEmpty(this.mTextUserId.Text.Trim())) dt = BL.GetUserInfoById(this.mTextUserId.Text.Trim()); else dt = BL.GetUserInfoByName(this.mTxtUserName.Text.Trim()); if (dt != null && dt.Rows.Count > 0) { BakDataTable = dt; this.mTxtUserName.Text = dt.Rows[0]["userName"].ToString().Trim(); this.mTextUserId.Text = dt.Rows[0]["userId"].ToString().Trim(); string deptId = dt.Rows[0]["deptId"].ToString().Trim(); this.mCombDept.SelectedValue = deptId; string rankId = dt.Rows[0]["rankId"].ToString().Trim(); this.mCombRank.SelectedValue = rankId; this.mTxtCardNum.Text = dt.Rows[0]["cardNo"] == null ? string.Empty : dt.Rows[0]["cardNo"].ToString().Trim(); this.mCombCopyType.SelectedValue = dt.Rows[0]["copyType"].ToString().Trim(); UserInfo = new UserInfo(); UserInfo.UserId = dt.Rows[0]["userId"].ToString().Trim(); UserInfo.UserName = dt.Rows[0]["userName"].ToString().Trim(); UserInfo.DeptId = dt.Rows[0]["deptId"].ToString().Trim(); UserInfo.RankId = dt.Rows[0]["rankId"].ToString().Trim(); UserInfo.CopyType = System.Convert.ToInt32(dt.Rows[0]["copyType"].ToString().Trim()); UserInfo.Type = System.Convert.ToInt32(dt.Rows[0]["type"].ToString().Trim()); } else { MessageBox.Show(this, "没有查询到该用户,请确认用户名是否输入正确。", "错误消息", MessageBoxButtons.OK); } } }
private void CompleteHandler(bool restult, string msg) { if (!restult) { MessageBox.Show(this, "模板录入失败,请重新录入。", "提示消息", MessageBoxButtons.OK); } else { MessageBox.Show(this, "模板录入成功。", "提示消息", MessageBoxButtons.OK); ClearFields(); UserInfo = null; } SetPageState(true); }
public static void CopyUserData() { try { KQInfo DAccess = new KQInfo(Common.GetDataConnection(DataCollection.Config.FRASConnectionString, SND.DA.DataAccessHelper.DataSourceType.SqlClient)); object lockObj = new object(); // 获取用户信息 System.Data.DataTable dtUser = DAccess.GetUserInfo(); if (dtUser != null) { foreach (System.Data.DataRow row in dtUser.Rows) { if (!DataCollection.DevInfos.ContainsKey(row["userId"].ToString().Trim())) { UserInfo userInfo = new UserInfo(); userInfo.UserId = row["userId"].ToString().Trim(); userInfo.UserName = row["userName"].ToString(); userInfo.DeptId = row["deptId"].ToString(); userInfo.FeatureId = row["featureId"].ToString(); userInfo.RankId = row["rankId"].ToString(); userInfo.SenderId = row["senderId"] == null ? string.Empty : row["senderId"].ToString(); userInfo.CopyType = row["copyType"] is DBNull ? 0 : System.Convert.ToInt32(row["copyType"].ToString()); userInfo.CardNo = row["cardNo"] == null ? string.Empty : row["cardNo"].ToString(); userInfo.FeatureId = row["featureId"].ToString(); userInfo.FeaPath = row["featurePath"].ToString(); userInfo.PhtPath = row["photoPath"].ToString(); lock (lockObj) { if (!DataCollection.UserInfos.ContainsKey(row["userId"].ToString().Trim())) { DataCollection.UserInfos.Add(userInfo.UserId, userInfo); } } } } } } catch (Exception ex) { LogManager.LogSys("==CopyUserData==" + ex.Message); } }