Esempio n. 1
0
 /// <summary>
 /// 添加用户处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     using (SinoSZClientBase.UserManagerService.UserManagerServiceClient _umsc = new SinoSZClientBase.UserManagerService.UserManagerServiceClient())
     {
         StringBuilder sb            = new StringBuilder();
         int           addCount      = 0;
         int           SelectedCount = 0;
         for (int i = 0; i < this.gridView1.RowCount; i++)
         {
             SelectPersonBaseInfoItem _item = this.gridView1.GetRow(i) as SelectPersonBaseInfoItem;
             if (_item.Selected)
             {
                 SelectedCount++;
                 PersonBaseInfo _personInfo = _item.PersonInfo;
                 if (_umsc.RegisterUser(_personInfo))
                 {
                     addCount++;
                 }
                 else
                 {
                     sb.AppendLine(string.Format("用户{0}已经注册或因其它错误注册失败!", _personInfo.Name));
                 }
             }
         }
         if (SelectedCount > 0)
         {
             sb.AppendLine(string.Format("成功注册了{0}个用户!", addCount));
             XtraMessageBox.Show(sb.ToString(), "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             registerCount += addCount;
         }
     }
 }
Esempio n. 2
0
 public bool RegisterUser(PersonBaseInfo _personBaseInfo)
 {
     try
     {
         bool _ret = UserManagerFactroy.RegisterUser(_personBaseInfo);
         if (_ret)
         {
             UserLogWriter.WriteLogByDefaultUser("注册用户", string.Format("注册用户{0}(姓名:{1})成功!", _personBaseInfo.LoginName, _personBaseInfo.Name), 1);
         }
         else
         {
             UserLogWriter.WriteLogByDefaultUser("注册用户", string.Format("注册用户{0}失败!失败原因:未知", _personBaseInfo.LoginName), 2);
         }
         return(_ret);
     }
     catch (Exception e)
     {
         UserLogWriter.WriteLogByDefaultUser("注册用户",
                                             string.Format("注册用户{1}失败!失败原因:{0}", _personBaseInfo.LoginName, e.Message), 2);
         return(false);
     }
 }
 public SelectPersonBaseInfoItem(PersonBaseInfo info)
 {
     personInfo = info;
 }