Example #1
0
 public CommandResult Delete(Role info)
 {
     if (!info.CanDelete)
     {
         return new CommandResult(ResultCode.Fail, string.Format(Resource1.RoleBll_CannotDelete, info.Name));
     }
     else
     {
         OperatorBll bll = new OperatorBll(_RepoUri);
         QueryResultList<Operator> result = bll.GetAllOperators();
         if (result.Result == ResultCode.Successful && result.QueryObjects.Exists(opt => opt.RoleID == info.ID))
         {
             return new CommandResult(ResultCode.Fail, string.Format(Resource1.RoleBll_RoleBeUsed, info.ID, info.ID));
         }
     }
     return provider.Delete(info);
 }
Example #2
0
 public CommandResult Delete(Role info)
 {
     if (!info.CanDelete)
     {
         return(new CommandResult(ResultCode.Fail, string.Format(Resource1.RoleBll_CannotDelete, info.Name)));
     }
     else
     {
         OperatorBll bll = new OperatorBll(_RepoUri);
         QueryResultList <Operator> result = bll.GetAllOperators();
         if (result.Result == ResultCode.Successful && result.QueryObjects.Exists(opt => opt.RoleID == info.ID))
         {
             return(new CommandResult(ResultCode.Fail, string.Format(Resource1.RoleBll_RoleBeUsed, info.ID, info.ID)));
         }
     }
     return(provider.Delete(info));
 }
Example #3
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (CheckInput())
     {
         OperatorBll bll = new OperatorBll(AppSettings.CurrentSetting.ConnectUri );
         Operator.Password = txtNewPwd.Text;
         CommandResult result = bll.Update(Operator);
         if (result.Result == ResultCode.Successful)
         {
             this.Close();
         }
         else
         {
             Operator.Password = txtOldPwd.Text;
             MessageBox.Show(result.Message);
         }
     }
 }
Example #4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string logName = this.txtLogName.Text.Trim();
            string pwd = this.txtPassword.Text.Trim();

            if (string.IsNullOrEmpty(logName))
            {
                MessageBox.Show(LJH.Attendance.UI.Properties.Resources.FrmLogin_InvalidUserName);
                return;
            }

            if (string.IsNullOrEmpty(pwd))
            {
                MessageBox.Show(LJH.Attendance.UI.Properties.Resources.FrmLogin_InvalidPwd);
                return;
            }
            SaveConnectString();

            OperatorBll authen = new OperatorBll(AppSettings.CurrentSetting.ConnectUri);
            if (authen.Authentication(logName, pwd))
            {
                this.DialogResult = DialogResult.OK;
                if (AppSettings.CurrentSetting.RememberLogID) SaveHistoryOperators();
                this.Close();
            }
            else
            {
                MessageBox.Show(LJH.Attendance.UI.Properties.Resources.FrmLogin_AuthenFail);
            }
        }