private void SetMyInfo(MyCompany _myInfo) { try { ICMD cmd = null; MyCompanyProxyVO preMyInfo = this._myInfo; if (this._myInfo != null) { cmd = new libHitpan5.Controller.CommandController.MyCompany.Update(SetMyInfo(), preMyInfo); } else { cmd = new libHitpan5.Controller.CommandController.MyCompany.Insert(SetMyInfo()); } frmMain.htpClientLib.Do(cmd); frmMain.htpClientLib.myInfo = SetMyInfo(); } catch (NotAuthException) { MessageBox.Show("나의 정보를 입력하거나 수정할 권한이 없습니다"); } catch (NotLoginException) { MessageBox.Show("로그인을 하지 않았습니다"); } catch (Exception) { throw; } }
public void Do_ref형_파라미터_없는_메서드가_로그인_안한_상태에서_Exception을_발생_시키는지() { ICMD stubCMD = mocks.Stub <ICMD>(); this.cmdManager.userInfo = null; this.cmdManager.Do(stubCMD); }
public void ReDo() { ICMD cmd = CalcleQueue.Dequeue(); cmd.Do(); CommandQueue.Enqueue(cmd); }
private void btnSetting_Click(object sender, EventArgs e) { foreach (ComboBox ddl in ddlList) { string enumName = ddl.Name.Replace("ddl", ""); foreach (var pi in typeof(CommonSettings).GetProperties()) { if (enumName == pi.Name) { this.commonSettings[pi.Name] = (Enum)Enum.Parse(this.commonSettings.EnumTypeDic[pi.Name], ddl.Text); break; } } } ICMD cmd = null; if (this.commonSettings != null) { cmd = new libHitpan5.Controller.CommandController.CommonSetting.Update(this.commonSettings, frmMain.htpClientLib.settingInfo); } else { cmd = new libHitpan5.Controller.CommandController.CommonSetting.Insert(this.commonSettings); } frmMain.htpClientLib.Do(cmd); frmMain.htpClientLib.settingInfo = this.commonSettings; }
public void UnDo() { if (CalcleQueue == null) { CalcleQueue = new Queue <ICMD>(); } ICMD cmd = CommandQueue.Dequeue(); cmd.UnDo(); CalcleQueue.Enqueue(cmd); }
public void Do_ref형_파라미터_없는_메서드가_권한_없는_상태에서_Exception을_발생_시키는지() { //Arrange UserAuthController stubUserInfoWorker = mocks.Stub <UserAuthController>(); UserAuth ua = mocks.Stub <UserAuth>(); ICMD stubCMD = mocks.Stub <ICMD>(); stubCMD.userAuth = ua; this.cmdManager.userInfo = mocks.Stub <UserInfo>(); this.cmdManager.Do(stubCMD); }
private void btnInsertUpdate_Click(object sender, EventArgs e) { //[1] 사용자정보 VO객체 생성 UserInfoProxyVO ui = GetUserInfo(); //[2] 업데이트 인지 인서트 인지 구분하여 명령어 객체 생성 ICMD cmd = null; if (!txtID.Enabled) { //업데이트 하는 경우 cmd = new libHitpan5.Controller.CommandController.User.Update((UserInfoProxyVO)(new SelectUser(txtID.Text).GetData()), ui, string.Format("{0} 유저의 정보를 업데이트", ui.UsersVO.UserID)); linkInsertMode.Visible = true; } else { //인서트 하는 경우 //[1] id겹치는지 점검 bool isDuplicated = false; foreach (UserInfoProxyVO uv in this.userList) { if (uv.UsersVO.UserID == ui.UsersVO.UserID) { isDuplicated = true; break; } } //[2] id안겹치면 인서트 if (isDuplicated) { MessageBox.Show("입력하고자 하는 아이디가 이미 존재합니다"); txtID.Text = string.Empty; return; } else { cmd = new libHitpan5.Controller.CommandController.User.Insert(ui); } } try { frmMain.htpClientLib.Do(cmd); } catch (Exception ex) { MessageBox.Show(ex.Message); } SetView(); }
public void Do(ICMD cmd) { if (this.userInfo == null) { throw new NotLoginException(); } if (!(new UserValidator(this.userInfo).CheckAuth(cmd.RequiredAuth))) { throw new NotAuthException(); } if (CommandQueue == null) { CommandQueue = new Queue <ICMD>(); } CommandQueue.Enqueue(cmd); cmd.Do(); }
public void Do_ref형_파라미터_없는_메서드가_정상적인_상태에서_정상적으로_작동을_하는지_검증() { //Arrange //[3] ICMD 구성 ICMD stubCMD = mocks.Stub <ICMD>(); this.Loger = mocks.DynamicMock <LogController>(); Loger.DB = this.dataModel; Loger.SQLQueryHouse = this.queryHouse; UserInfo ui = new UserInfo(); ui.id = "id"; this.cmdManager.userInfo = ui; using (mocks.Record()) { string log = string.Format("{0} 성공", stubCMD.description); this.Loger.WriteLog(stubCMD.logType, ui.id, log); } this.cmdManager.Do(stubCMD); mocks.Verify(this.Loger); }
public void CommandHandler(string cmd, Socket client) { try { if (cmd.StartsWith("/")) { ICMD command = GetCommand(cmd.Split(' ')[0].Remove(0, 1)); if (command != null) { myStopwatch = new System.Diagnostics.Stopwatch(); myStopwatch.Start(); ArgsControl.CommandDist(cmd); if (!client.Connected) { return; } Task execute = new Task(() => { command.C_Execute(this, ArgsControl, client); }); AEvents.InvokeAction("before"); Parallel.Invoke(execute.Start, () => { Task.Factory.StartNew(() => { while (execute.Status == TaskStatus.Running && client.Connected) { if (myStopwatch.ElapsedMilliseconds > COMMANDTIMEOUT) { AEvents.InvokeAction("sleep", execute); break; } } }); }); execute.ContinueWith((task) => { myStopwatch.Stop(); AEvents.InvokeAction("ended", client); if (GarbageCollect) { GC.Collect(); } }); } else { AEvents.OutputAction($"Command '{cmd}' not found!", AEvents.OutTypes.Error); } } else { AEvents.OutputAction($"Invalid command!", AEvents.OutTypes.Error); } } catch (Exception ex) { AEvents.OutputAction($"{ex.Message}\n{ex.StackTrace}", AEvents.OutTypes.Error); } }