/// <summary> /// Changes the active state of the statemanager. /// </summary> /// <param name="nextState">The next active state.</param> private void StateChangeRequestHandler(ApplicationState nextState) { switch (nextState) { case ApplicationState.Undefined: // Should only happen when an uninitialized enum has been passed. throw new ArgumentException("Undefined gamestate requested"); case ApplicationState.Menu: currentState = menuState; break; case ApplicationState.Play: if (playState == null) { CreatePlayState(); } currentState = playState; break; case ApplicationState.Exit: // Exit the game. game.Exit(); break; default: throw new ArgumentException("Unhandled gamestate change request"); } }
public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (confirm == true) { switch(quitScreen.Update(input, controllingPlayer)) { case 1: appState = ApplicationState.InitaliseApp; break; case 0: confirm = false; menuIndex = 1; return; } } if (selectedIndex == 0 || (input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { menuIndex = 0; appState = ApplicationState.Playing; } else if(selectedIndex == 1) { confirm = true; quitScreen.Reset(); } }
public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (gameOptions.IsTrial == false) { appState = ApplicationState.LevelComplete; } if ((input.IsNewButtonPress(ButtonMappings.Pad_XBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_XBtn, controllingPlayer[0], out controllingPlayer[1]))) { if (gameOptions.IsTrial == true) { if (controllingPlayer[0].CanBuyGame()) { Guide.ShowMarketplace(controllingPlayer[0]); } } } if ((input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { appState = ApplicationState.Quit; } }
public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if (gameOptions.IsTrial == true && addBuyOption == false) { options.Add("Unlock Full Game"); addBuyOption = true; } if (gameOptions.IsTrial == false && addBuyOption == true) { options.Remove("Unlock Full Game"); } switch (selectedIndex) { case 0: SetTransitionOut(ApplicationState.InitaliseGame); break; case 1: SetTransitionOut(ApplicationState.Options); break; case 2: SetTransitionOut(ApplicationState.Quit); break; case 3: if (controllingPlayer[0].CanBuyGame()) { Guide.ShowMarketplace(controllingPlayer[0]); } break; } appState = ReturnState(ApplicationState.Home); }
private void browser_DocumentCompleted( object sender, WebBrowserDocumentCompletedEventArgs e ) { if ( application_state == ApplicationState.PreLogon ) { browser.Document.GetElementByName( "azon" ).InnerText = config.User; browser.Document.GetElementByName( "pswd" ).InnerText = config.Password; browser.Document.GetElementsByTagName( "button" )[0].InvokeMember( "Click" ); application_state = ApplicationState.Auth; } else if ( application_state == ApplicationState.Auth ) { if ( browser.Document.Body.InnerText.Contains( "Pámer Bálint" ) ) { application_state = ApplicationState.Query; browser.Navigate( "http://zz.hu/web/online.php?menu=egyenleg" ); } } else if ( application_state == ApplicationState.Query ) { using ( StreamWriter writer = new StreamWriter( "egyenleg_" + DateTime.Now.ToString( "yyyy.MM.dd___HH_mm_ss" ) + ".html" ) ) { writer.Write( browser.Document.Body.InnerHtml ); if ( config.OneShot ) { Close(); } } //browser.Document.InvokeScript( "down", new object[] { 1 } ); } }
private void SetMode(ApplicationState mode) { switch (mode) { case ApplicationState.DesignMode: this.diagram.IsEditable = true; this.diagram.IsResizingEnabled = true; this.diagram.IsDraggingEnabled = true; this.diagram.IsRotationEnabled = true; this.diagram.AllowCopy = true; this.diagram.AllowDelete = true; this.diagram.AllowPaste = true; this.diagram.AllowDrop = true; this.Toolbox.Visibility = Visibility.Visible; this.diagram.SelectionMode = Telerik.Windows.Diagrams.Core.SelectionMode.Extended; break; case ApplicationState.RunMode: this.diagram.IsEditable = false; this.diagram.IsResizingEnabled = false; this.diagram.IsDraggingEnabled = false; this.Toolbox.Visibility = Visibility.Collapsed; this.diagram.IsRotationEnabled = false; this.diagram.AllowDrop = false; this.diagram.AllowCopy = false; this.diagram.AllowDelete = false; this.diagram.AllowPaste = false; this.diagram.SelectionMode = Telerik.Windows.Diagrams.Core.SelectionMode.None; break; default: throw new ArgumentOutOfRangeException(); } this.diagram.SnapX = this.diagram.SnapY = 5; }
public void Update(int _finalLevel, int _finalScore, ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { if (firstCall == true) { MediaPlayer.IsRepeating = true; MediaPlayer.Volume = gameOptions.MusicVolumeAtPlay; MediaPlayer.Play(mySong); firstCall = false; } finalLevel = _finalLevel; finalScore = _finalScore; if (drawState <= 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { appState = ApplicationState.InitaliseApp; } drawState--; if (drawState > 0 && (input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1]))) { drawState = 0; } base.Update(input, controllingPlayer); if (appState == ApplicationState.InitaliseApp) { MediaPlayer.Stop(); Reset(); } }
public ApplicationEvaluatedResponse FromState(ApplicationState state) { ApplicationStatus = state.ApplicationStatus.Status; APR = state.Offer.APR; CreditLimit = state.Offer.CreditLimit; return this; }
public static ApplicationState ReduceApplicationState(ApplicationState state, IAction action) { return new ApplicationState { Repositories = ReduceRepositories(state.Repositories, action), IsSearching = ReduceIsSearching(state.IsSearching, action) }; }
public void can_put_and_get_state_with_default_key() { var state = "test"; var appState = new ApplicationState(); appState.Put(state); var returned = appState.Get<string>(); Assert.That(returned, Is.Not.Null); Assert.That(returned, Is.EqualTo(state)); }
public void can_remove_state_with_default_key() { var state = "test"; var appState = new ApplicationState(); appState.Put(state); Assert.That(appState.Get<string>(), Is.EqualTo(state)); appState.Remove<string>(); Assert.That(appState.Get<string>(), Is.Null); }
public void can_remove_state() { var state = "test"; var appState = new ApplicationState(); appState.Put("test_state", state); Assert.That(appState.Get<string>("test_state"), Is.EqualTo(state)); appState.Remove<string>("test_state"); Assert.That(appState.Get<string>("test_state"), Is.Null); }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; Components.Add(new GamerServicesComponent(this)); appState = ApplicationState.Splash; gameState = new GameState(); }
public void Update(ref ApplicationState appState, InputState input, PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); if ((input.IsNewButtonPress(ButtonMappings.Pad_ABtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_ABtn, controllingPlayer[0], out controllingPlayer[1])) || (input.IsNewButtonPress(ButtonMappings.Pad_BBtn, controllingPlayer[0], out controllingPlayer[1]) || input.IsNewKeyPress(ButtonMappings.Keyboard_BBtn, controllingPlayer[0], out controllingPlayer[1]))) { SetTransitionOut(ApplicationState.Home); } appState = ReturnState(ApplicationState.Options); }
public void ChangeState( ApplicationState newState ) { if( IsCurrentState(newState) ) return; nextState = newState; SendMessage( "OnTeardownState", currentState ); currentState = newState; SendMessage( "OnSetupState", currentState ); }
public void can_clear_state() { var state = new ApplicationState(); state.Put("DefaultState"); state.Put("test_key", "KeyedState"); Assert.That(state.Get<string>(), Is.EqualTo("DefaultState")); Assert.That(state.Get<string>("test_key"), Is.EqualTo("KeyedState")); state.Clear(); Assert.That(state.Get<string>(), Is.Null); Assert.That(state.Get<string>("test_key"), Is.Null); }
public void AddApplicationStatesToRemoveTestAddingFromArray() { StorageMaintenanceParameters maintanenceParameters = new StorageMaintenanceParameters(); ApplicationState[] states = new ApplicationState[2]; states[0] = ApplicationState.Ready; states[1] = ApplicationState.Stopped; maintanenceParameters.AddApplicationStatesToRemove(states); Assert.AreEqual(2, maintanenceParameters.ApplicationStatesToRemove.Length); Assert.AreEqual(ApplicationState.Ready, maintanenceParameters.ApplicationStatesToRemove[0]); Assert.AreEqual(ApplicationState.Stopped, maintanenceParameters.ApplicationStatesToRemove[1]); }
/// <summary> /// ApplicationStorageView constructor. /// </summary> /// <param name="applicationId"></param> /// <param name="state"></param> /// <param name="timeCreated"></param> /// <param name="primary"></param> /// <param name="username"></param> public ApplicationStorageView( string applicationId, ApplicationState state, DateTime timeCreated, bool primary, string username ) { _applicationId = applicationId; _state = state; _timeCreated = timeCreated; _primary = primary; _username = username; }
private void browser_DocumentCompleted( object sender, WebBrowserDocumentCompletedEventArgs e ) { if ( browser.ReadyState != WebBrowserReadyState.Complete ) return; if ( application_state == ApplicationState.PreLogon ) { browser.Document.GetElementById( "username" ).InnerText = config.User; browser.Document.GetElementById( "password" ).InnerText = config.Password; browser.Document.GetElementByName( "Login" ).InvokeMember( "Click" ); application_state = ApplicationState.LoggedOn; } else if ( application_state == ApplicationState.LoggedOn ) { if ( !browser.Document.Body.InnerText.Contains( "Logged in as" ) ) { MessageBox.Show( "Couldn't find \"Logged in as\" on page. Login was probably incorrect!" ); return; } if ( browser.Document.Body.InnerText.Contains( "Time Journal for" ) ) { application_state = ApplicationState.OnTimeJournal; browser_DocumentCompleted( sender, e ); } else { browser.Navigate( "https://pmcbud.epam.com/pmc/timejournal/list.do" ); } } else if ( application_state == ApplicationState.OnTimeJournal ) { string cell_name = "formTimeJournal" + ( Convert.ToInt32( DateTime.Now.DayOfWeek ) + 1 ).ToString(); HtmlElement current_cell = browser.Document.GetElementByName( cell_name ); if ( current_cell != null ) { current_cell.InnerText = "8"; current_cell.InvokeMember( "onChange" ); foreach ( HtmlElement element in browser.Document.GetElementsByTagName( "input" ) ) { if ( element.OuterHtml.Contains( "Save Changes" ) ) { element.InvokeMember( "Click" ); application_state = ApplicationState.Finished; app_close_timer.Start(); break; } } } } }
public void Draw(GameTime gameTime, ApplicationState appState, SpriteBatch spriteBatch) { game.GraphicsDevice.BlendState = BlendState.Opaque; game.GraphicsDevice.DepthStencilState = DepthStencilState.Default; game.GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise; game.GraphicsDevice.SamplerStates[1] = SamplerState.PointClamp; level.Draw(gameTime, spriteBatch); game.GraphicsDevice.RasterizerState = RasterizerState.CullNone; game.GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap; //draw overlays switch (appState) { case ApplicationState.Paused: pauseScreen.Draw(spriteBatch); break; case ApplicationState.LevelComplete: levelCompleteScreen.Draw(spriteBatch); break; } }
public void Update(ref ApplicationState appState, InputState input, ref PlayerIndex[] controllingPlayer) { base.Update(input, controllingPlayer); for (PlayerIndex index = PlayerIndex.One; index <= PlayerIndex.Four; index++) { if (GamePad.GetState(index).Buttons.Start == ButtonState.Pressed || GamePad.GetState(index).Buttons.A == ButtonState.Pressed) { controllingPlayer[0] = index; SetTransitionOut(ApplicationState.InitaliseApp); } if (Keyboard.GetState().IsKeyDown(ButtonMappings.Keyboard_Start) || Keyboard.GetState().IsKeyDown(ButtonMappings.Keyboard_ABtn)) { controllingPlayer[0] = PlayerIndex.One; SetTransitionOut(ApplicationState.InitaliseApp); } } appState = ReturnState(ApplicationState.Splash); }
public void LoadScene(ApplicationState.LevelNames sceneName) { if (Player.instance != null) { #if !UNITY_WEBPLAYER int incompleteInteraction = MainDatabase.Instance.getIDs("select ifnull(max(interactionId),-1) from interaction where completed <> 'True';"); if (incompleteInteraction != -1) { MainDatabase.Instance.UpdateSql("Delete from Answer where interactionID = " + incompleteInteraction + ";"); MainDatabase.Instance.UpdateSql("Delete from InteractionTime where interactionID = " + incompleteInteraction + ";"); MainDatabase.Instance.UpdateSql("Delete from Interaction where interactionID = " + incompleteInteraction + ";"); } #endif AudioManager.Instance.StopSoundFX(); AudioManager.Instance.StopVoiceOver(); GameManager.DestroyGameLevel(); GameManager.DestroyInstance(); } ApplicationState.Instance.LoadLevelWithLoading(sceneName); }
public CodePointRepository(ApplicationState applicationState, HttpClient httpClient, BlockRepository blockRepository, BlockCodePointRepository blockCodePointRepository) : base(applicationState, httpClient) { _blockRepository = blockRepository; _blockCodePointRepository = blockCodePointRepository; }
/// <summary> /// 根据商品码变更列表和来源单据创建库存变更记录资料(回退) /// </summary> /// <param name="baseDataCommodityCode"></param> /// <returns></returns> public BasePostData <CommodityInventoryChange> CreateCommodityInventoryChange(BaseData <CommodityCode> baseDataCommodityCode) { if (null == baseDataCommodityCode) { return(new BasePostData <CommodityInventoryChange>() { code = (int)ResultCode.Parameter_Exception, message = ResultCode.Parameter_Exception.ToString() }); } List <CommodityInventoryChange> changes = new List <CommodityInventoryChange>(); var count = baseDataCommodityCode.body.objects.Where(it => it.operate_type == 0).Count(); //创建领用单实体用于后面更新操作 ConsumingOrder order = null; if (count > 0)//当出库数量大于0说明在领用需要创建领用单 { var consumingOrder = ConsumingBll.GetInstance().CreateConsumingOrder(new ConsumingOrder() { Status = ConsumingOrderStatus.领用中.ToString(), StoreHouseId = ApplicationState.GetValue <String>((int)ApplicationKey.HouseId), Type = ConsumingOrderType.一般领用.ToString() }); //校验数据是否正常 HttpHelper.GetInstance().ResultCheck(consumingOrder, out bool isSuccess); if (isSuccess) { //创建商品库存变更记录资料【出库::领用】 baseDataCommodityCode.body.objects.Where(it => it.operate_type == 0).ToList().ForEach(commodityCode => { var temp = new CommodityInventoryChange() { CommodityCodeId = commodityCode.id, //出库变更更后库房、变更更后设备、变更更后货位 value 值都为null。 SourceBill = new SourceBill() { object_name = "ConsumingOrder", object_id = consumingOrder.body[0].id }, ChangeStatus = CommodityInventoryChangeStatus.已消耗.ToString() }; changes.Add(temp); }); order = consumingOrder.body[0]; } } ////创建商品库存变更记录资料【入库::回退】 baseDataCommodityCode.body.objects.Where(it => it.operate_type == 1).ToList().ForEach(commodityCode => { var temp = new CommodityInventoryChange() { CommodityCodeId = commodityCode.id, SourceBill = new SourceBill() { object_name = "ConsumingReturnOrder", }, ChangeStatus = CommodityInventoryChangeStatus.正常.ToString(), EquipmentId = commodityCode.EquipmentId, GoodsLocationId = commodityCode.GoodsLocationId, StoreHouseId = commodityCode.StoreHouseId, }; changes.Add(temp); }); var result = CreateCommodityInventoryChange(changes); //校验数据是否正常 HttpHelper.GetInstance().ResultCheck(result, out bool isSuccess2); //添加变更记录成功时,且有出库记录(即创建过领用单) if (isSuccess2 && count > 0) { if (baseDataCommodityCode.body.objects.Where(item => (item.QualityStatus == QualityStatusType.过期.ToString() || item.InventoryStatus == CommodityInventoryChangeStatus.待回收.ToString()) && item.operate_type == 0).Count() > 0) { order.Status = ConsumingOrderStatus.异常.ToString(); } else { order.Status = ConsumingOrderStatus.已完成.ToString(); } var temp = ConsumingBll.GetInstance().UpdateConsumingOrderStatus(order); if (temp.code != 0) { LogUtils.Error("ConsummingOrder " + temp.message); } } return(result); }
/// <summary> /// 来源单据解析为【⼿手术单管理理】(ConsumingOrder.SourceBill.object_name=‘OperationOrder’ ): /// 通过【领⽤单id】(ConsumingGoodsDetail.ConsumingOrderId =ConsumingOrder.Id)从表格 【领⽤单商品明细】中查询获取领⽤商品的列表信息 /// </summary> /// <param name="baseDataConsumingOrder"></param> /// <returns></returns> public BaseData <ConsumingGoodsDetail> GetOperationOrderGoodsDetail(BaseData <ConsumingOrder> baseDataConsumingOrder) { //校验是否含有数据,如果含有数据,拼接具体字段 HttpHelper.GetInstance().ResultCheck(baseDataConsumingOrder, out bool isSuccess); if (!isSuccess) { return(new BaseData <ConsumingGoodsDetail>() { code = (int)ResultCode.Parameter_Exception, message = ResultCode.Parameter_Exception.ToString() }); } if (!"OperationOrder".Equals(baseDataConsumingOrder.body.objects[0].SourceBill.object_name)) { return(new BaseData <ConsumingGoodsDetail>() { code = (Int32)ResultCode.Business_Exception, message = ResultCode.Business_Exception.ToString() }); } //根据领用单ID获取领用上列表信息 BaseData <ConsumingGoodsDetail> baseOperationOrderGoodsDetail = HttpHelper.GetInstance().ResultCheck((HttpHelper hh) => { return(hh.Get <ConsumingGoodsDetail>(new QueryParam { view_filter = { filter = { logical_relation = "1 AND 2", expressions = { new QueryParam.Expressions { field = "ConsumingOrderId", @operator = "==", operands ={ $"'{ HttpUtility.UrlEncode(baseDataConsumingOrder.body.objects[0].id) }'" } }, new QueryParam.Expressions { field = "EquipmentId", @operator = "==", operands ={ $"'{ HttpUtility.UrlEncode(ApplicationState.GetEquipId()) }'" } } } } } })); }, baseDataConsumingOrder); //校验是否含有数据,如果含有数据,拼接具体字段 HttpHelper.GetInstance().ResultCheck(baseOperationOrderGoodsDetail, out bool isSuccess2); if (isSuccess2) { baseOperationOrderGoodsDetail.body.objects.ForEach(it => { //拼接商品码名称 if (!string.IsNullOrEmpty(it.CommodityId)) { it.CommodityName = GetNameById <Commodity>(it.CommodityId); } ; }); } return(baseOperationOrderGoodsDetail); }
/// <summary> /// 无单领用提交接口 /// (2019-08-27 18:08)变更流程为:领用中->创建子表->变更主表状态[异常,已完成] /// 当领用过程中放进商品则主单状态异常,领用物品主单状态正常 /// </summary> /// <param name="baseDataCommodityCode"></param> /// <returns></returns> public BasePostData <CommodityInventoryChange> SubmitConsumingChangeWithoutOrder(BaseData <CommodityCode> baseDataCommodityCode, ConsumingOrderType type, SourceBill sourceBill = null) { var normalList = new List <CommodityCode>(); //回退商品列表 var lossList = new List <CommodityCode>(); //领用商品列表 var changeList = new List <CommodityInventoryChange>(); //商品库存变更记录列表 baseDataCommodityCode.body.objects.ForEach(commodityCode => { //为0标识为出库 if (commodityCode.operate_type == 0) { lossList.Add(commodityCode); } else { normalList.Add(commodityCode); }; }); ConsumingOrder consumingOrder = new ConsumingOrder() { FinishDate = GetDateTimeNow(),//完成时间 ////当入库数量大于0说明在领用的时候进行了入库操作,变更领用单状态为异常 //Status = normalList.Count > 0 ? ConsumingOrderStatus.异常.ToString() : ConsumingOrderStatus.已完成.ToString(), // Status = ConsumingOrderStatus.领用中.ToString(), StoreHouseId = ApplicationState.GetValue <String>((int)ApplicationKey.HouseId), //领用库房 Type = type.ToString(), //领用类型 SourceBill = type == ConsumingOrderType.医嘱处方领用 ? sourceBill : null // 需要填写医嘱处方SourceBill }; //创建领用单 var order = CreateConsumingOrder(consumingOrder); //校验数据是否正常 HttpHelper.GetInstance().ResultCheck(order, out bool isSuccess); if (!isSuccess) { LogUtils.Warn("CreateConsumingOrder 1:" + ResultCode.Result_Exception.ToString()); return(new BasePostData <CommodityInventoryChange>() { code = (int)ResultCode.Result_Exception, message = ResultCode.Result_Exception.ToString() }); } //当正常数量大于0说明向智能柜中存放商品,需要创建商品变更记录 if (normalList.Count > 0) { normalList.ForEach(normal => { changeList.Add(new CommodityInventoryChange() { CommodityCodeId = normal.id, SourceBill = new SourceBill() { object_name = "ConsumingReturnOrder" }, ChangeStatus = CommodityInventoryChangeStatus.正常.ToString(), EquipmentId = normal.EquipmentId, StoreHouseId = normal.StoreHouseId, GoodsLocationId = normal.GoodsLocationId }); }); } //当消耗数量大于0说明向智能柜中取出商品,需要创建商品变更记录 if (lossList.Count > 0) { lossList.ForEach(loss => { changeList.Add(new CommodityInventoryChange() { CommodityCodeId = loss.id, SourceBill = new SourceBill() { object_name = "ConsumingOrder", object_id = order.body[0].id }, ChangeStatus = CommodityInventoryChangeStatus.已消耗.ToString() }); }); } var changes = CommodityInventoryChangeBll.GetInstance().CreateCommodityInventoryChange(changeList); //校验数据是否正常 HttpHelper.GetInstance().ResultCheck(changes, out bool isSuccess2); if (!isSuccess2) { LogUtils.Warn("CreateConsumingOrder 2:" + ResultCode.Result_Exception.ToString()); } ////当入库数量大于0说明在领用的时候进行了入库操作, 或者领用商品中有过期商品, 变更领用单状态为异常 if (normalList.Count > 0 || lossList.Where(item => item.QualityStatus == QualityStatusType.过期.ToString() || item.InventoryStatus == CommodityInventoryChangeStatus.待回收.ToString()).Count() > 0) { order.body[0].Status = ConsumingOrderStatus.异常.ToString(); } else { order.body[0].Status = ConsumingOrderStatus.已完成.ToString(); } //更新主表状态 var orderResult = UpdateConsumingOrderStatus(order.body[0]); //校验数据是否正常,并记录日志 HttpHelper.GetInstance().ResultCheck(orderResult, out bool isSuccess3); if (!isSuccess3) { LogUtils.Warn("CreateConsumingOrder 3:" + ResultCode.Result_Exception.ToString()); } return(changes); }
private void LoginMethod(object parameter) { InProgress = true; var dbDataSource = ApplicationState.GetValue <string>("DbDataSource"); var dbInitialCatalog = ApplicationState.GetValue <string>("DbInitialCatalog"); var dbUserId = ApplicationState.GetValue <string>("DbUserId"); var dbPassword = ApplicationState.GetValue <string>("DbPassword"); var integratedSecurity = ApplicationState.GetValue <bool>("IntegratedSecurity"); NHibernateHelper.Configure(dbDataSource, dbInitialCatalog, dbUserId, dbPassword, integratedSecurity); var passwordBox = parameter as PasswordBox; if (passwordBox == null) { return; } if (!CheckConnection()) { ErrorMessage = "Ошибка подключения к БД."; ShowError = true; InProgress = false; return; } var accountRepository = new AccountRepository(); var account = accountRepository.GetByLogin(LoginText); if (!account.IsNew) { byte[] hash = GenerateSaltedHash(GetBytes(passwordBox.Password), GetBytes(account.Salt)); string hashStr = Convert.ToBase64String(hash); if (string.Equals(hashStr, account.HashedPassword)) { var userAccRepository = new Repository <UserAcc>(); User = userAccRepository.GetById(account.Id); ApplicationState.SetValue("User", User); InProgress = false; if (RememberCreditentials) { ApplicationState.SetValue("RememberCreditentials", RememberCreditentials); ApplicationState.SetValue("LdapAuth", LdapAuth); ApplicationState.SetValue("UserId", LoginText); ApplicationState.SetValue("UserPassword", passwordBox.Password); } else { ApplicationState.SetValue("RememberCreditentials", false); ApplicationState.SetValue("LdapAuth", false); ApplicationState.SetValue("UserId", String.Empty); ApplicationState.SetValue("UserPassword", String.Empty); } ApplicationState.SaveUserCreditentials(); return; } } ErrorMessage = "Ошибка. Неверный логин/пароль."; ShowError = true; InProgress = false; }
private static ApplicationState TimeFormatReducer(ApplicationState previousState, TimeFormatAction action) { var nextStates = previousState.States.SetItem(DisplayFormat, action.Format); return(new ApplicationState(nextStates, previousState.TimerScheduler)); }
void OnPauseState( ApplicationState state ) { if( enabled && this.state == state ) Pause(); }
public GameState(Game game, ApplicationState thisState) { Game = game; }
private void ChangeApplicationState(ApplicationState newState) { ChangeGui(newState); switch (_currentApplicationState) { case ApplicationState.NotRecording: switch (newState) { case ApplicationState.NotRecording: break; case ApplicationState.WaitingForRecording: break; case ApplicationState.Recording: StartRecording((MMDevice)deviceListBox.SelectedItem, songLabel.Text); break; case ApplicationState.Closing: break; } break; case ApplicationState.WaitingForRecording: switch (newState) { case ApplicationState.NotRecording: break; case ApplicationState.WaitingForRecording: throw new Exception(string.Format("NY {0} - {1}",_currentApplicationState,newState)); case ApplicationState.Recording: StartRecording((MMDevice)deviceListBox.SelectedItem, songLabel.Text); break; case ApplicationState.Closing: Close(); break; } break; case ApplicationState.Recording: switch (newState) { case ApplicationState.NotRecording: StopRecording(); break; case ApplicationState.Recording: //file changed StopRecording(); StartRecording((MMDevice)deviceListBox.SelectedItem, songLabel.Text); break; case ApplicationState.WaitingForRecording: //file changed StopRecording(); break; } break; } _currentApplicationState = newState; }
public void Save() { try { dbRepository dbrep = new dbRepository(); dbOriginalRepository dbrepOriginal = new dbOriginalRepository(); Vakman vakman = dbrep.GetVakman(ApplicationState.GetValue <int>(ApplicationVariables.intVakmanId)); MDRpersoon persoon = dbrepOriginal.GetContact(vakman.ContactIdOrigineel); // alleen saven als het ingevuld is if (Tools.IsValidBsn(txtBsn.Text)) { if (txtBsn.Text.Length == 8) { vakman.Bsn = "0" + txtBsn.Text; } else { vakman.Bsn = txtBsn.Text; } } else { vakman.Bsn = txtBsn.Text; } persoon.zaemail = txtEmail.Text; try { int iDag = -1; int iMaand = -1; int iJaar = -1; if (!string.IsNullOrWhiteSpace(txtDag.Text)) { try { iDag = Convert.ToInt32(txtDag.Text); } catch { } } if (!string.IsNullOrWhiteSpace(txtMaand.Text)) { try { iMaand = Convert.ToInt32(txtMaand.Text); } catch { } } if (!string.IsNullOrWhiteSpace(txtJaar.Text)) { try { iJaar = Convert.ToInt32(txtJaar.Text); } catch { } } if (iJaar > 1900 && iMaand > 0 && iDag > 0) { try { DateTime gebdat = new DateTime(iJaar, iMaand, iDag); persoon.geboortedatum = gebdat; } catch { } } } catch {} dbrepOriginal.datacontext.SubmitChanges(); vakman.Postcode = txtPostcode.Text; vakman.Huisnummer = txtHuisnummer.Text; vakman.Adres = txtAdres.Text; vakman.Plaats = txtPlaats.Text; vakman.Land = txtLand.Text; //vakman.Ophaalpostcode = listTextboxes[3].Text; //vakman.Ophaalhuisnummer = listTextboxes[4].Text; //vakman.Ophaaladres = listTextboxes[5].Text; vakman.Ma = Convert.ToDecimal(cbMaUur.SelectedValue.ToString().HourToTimeDouble() + cbMaMin.SelectedValue.ToString().MinuteToTimeDouble()); vakman.Di = Convert.ToDecimal(cbDiUur.SelectedValue.ToString().HourToTimeDouble() + cbDiMin.SelectedValue.ToString().MinuteToTimeDouble()); vakman.Wo = Convert.ToDecimal(cbWoUur.SelectedValue.ToString().HourToTimeDouble() + cbWoMin.SelectedValue.ToString().MinuteToTimeDouble()); vakman.Do = Convert.ToDecimal(cbDoUur.SelectedValue.ToString().HourToTimeDouble() + cbDoMin.SelectedValue.ToString().MinuteToTimeDouble()); vakman.Vr = Convert.ToDecimal(cbVrUur.SelectedValue.ToString().HourToTimeDouble() + cbVrMin.SelectedValue.ToString().MinuteToTimeDouble()); vakman.Za = Convert.ToDecimal(cbZaUur.SelectedValue.ToString().HourToTimeDouble() + cbZaMin.SelectedValue.ToString().MinuteToTimeDouble()); vakman.Zo = Convert.ToDecimal(cbZoUur.SelectedValue.ToString().HourToTimeDouble() + cbZoMin.SelectedValue.ToString().MinuteToTimeDouble()); vakman.Werkweek = vakman.Ma + vakman.Di + vakman.Wo + vakman.Do + vakman.Vr + vakman.Za + vakman.Zo; vakman.IsChauffeurMa = cbChauffeurMa.IsChecked == true && cbChauffeur.IsChecked == true; vakman.IsChauffeurDi = cbChauffeurDi.IsChecked == true && cbChauffeur.IsChecked == true; vakman.IsChauffeurWo = cbChauffeurWo.IsChecked == true && cbChauffeur.IsChecked == true; vakman.IsChauffeurDo = cbChauffeurDo.IsChecked == true && cbChauffeur.IsChecked == true; vakman.IsChauffeurVr = cbChauffeurVr.IsChecked == true && cbChauffeur.IsChecked == true; vakman.IsChauffeurZa = cbChauffeurZa.IsChecked == true && cbChauffeur.IsChecked == true; vakman.IsChauffeurZo = cbChauffeurZo.IsChecked == true && cbChauffeur.IsChecked == true; vakman.IsChauffeur = (bool)cbChauffeur.IsChecked; vakman.IsBijrijderMa = cbBijrijderMa.IsChecked == true && cbBijrijdersregistratie.IsChecked == true; vakman.IsBijrijderDi = cbBijrijderDi.IsChecked == true && cbBijrijdersregistratie.IsChecked == true; vakman.IsBijrijderWo = cbBijrijderWo.IsChecked == true && cbBijrijdersregistratie.IsChecked == true; vakman.IsBijrijderDo = cbBijrijderDo.IsChecked == true && cbBijrijdersregistratie.IsChecked == true; vakman.IsBijrijderVr = cbBijrijderVr.IsChecked == true && cbBijrijdersregistratie.IsChecked == true; vakman.IsBijrijderZa = cbBijrijderZa.IsChecked == true && cbBijrijdersregistratie.IsChecked == true; vakman.IsBijrijderZo = cbBijrijderZo.IsChecked == true && cbBijrijdersregistratie.IsChecked == true; vakman.IsBijrijder = (bool)cbBijrijdersregistratie.IsChecked; vakman.ZZP = cbWerkrelatie.SelectedIndex == 1; //string strUur = ddlDefaultBeginuur.Text; //vakman.DefaultBeginuur = strUur.ToInt(); //string strMinuut = ddlDefaultBeginminuut.Text; //vakman.DefaultBeginminuut = strMinuut.ToInt(); dbrep.datacontext.SubmitChanges(); //ApplicationState.SetValue(ApplicationVariables.objVakman, vakman); ApplicationState.SetValue(ApplicationVariables.intVakmanId, vakman.VakmanId); // na het saven terug in history PageGoBack(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// /// </summary> public void Load() { Mouse.OverrideCursor = Cursors.Wait; dbRepository dbrep = new dbRepository(); Vakman vm = dbrep.GetVakman(ApplicationState.GetValue <int>(ApplicationVariables.intVakmanId)); dbOriginalRepository dbrepOriginal = new dbOriginalRepository(); MDRpersoon persoon = dbrepOriginal.GetContact(vm.ContactIdOrigineel); txtPostcode.Text = vm.Postcode; txtAdres.Text = vm.Adres; txtPlaats.Text = vm.Plaats; txtLand.Text = vm.Land; txtHuisnummer.Text = vm.Huisnummer; if (persoon != null) { if (vm.ZZP == true) { lbWerkrelatie.Content = "Bedrijfsnaam:"; cbWerkrelatie.SelectedIndex = 1; } else { lbWerkrelatie.Content = "Werkgever:"; cbWerkrelatie.SelectedIndex = 0; } if (persoon.bedrijf_nr != null) { MDRbedrijf b = dbrepOriginal.GetBedrijf((int)persoon.bedrijf_nr); if (b != null) { lblWerkgever.Content = b.naam; } } lblVakmanId.Content = persoon.persoon_nr == null ? "" : persoon.persoon_nr.ToString(); lblVakmanNaam.Content = ToonNaam(persoon); txtBsn.Text = vm.Bsn; //txtPostcode.Text = vm.Postcode; //txtHuisnummer.Text = vm.Huisnummer; //txtAdres.Text = vm.Adres; AdresLookup = vm.Adres.Substring(0, vm.Adres.Length - vm.Huisnummer.Length).Trim(); cbMaUur.SelectedValue = vm.Ma.ToString().ToHour(); cbDiUur.SelectedValue = vm.Di.ToString().ToHour(); cbWoUur.SelectedValue = vm.Wo.ToString().ToHour(); cbDoUur.SelectedValue = vm.Do.ToString().ToHour(); cbVrUur.SelectedValue = vm.Vr.ToString().ToHour(); cbZaUur.SelectedValue = vm.Za.ToString().ToHour(); cbZoUur.SelectedValue = vm.Zo.ToString().ToHour(); cbMaMin.SelectedValue = vm.Ma.ToString().ToMinute(); cbDiMin.SelectedValue = vm.Di.ToString().ToMinute(); cbWoMin.SelectedValue = vm.Wo.ToString().ToMinute(); cbDoMin.SelectedValue = vm.Do.ToString().ToMinute(); cbVrMin.SelectedValue = vm.Vr.ToString().ToMinute(); cbZaMin.SelectedValue = vm.Za.ToString().ToMinute(); cbZoMin.SelectedValue = vm.Zo.ToString().ToMinute(); //ddlDefaultBeginuur.Text = ((int)vm.DefaultBeginuur).ToString("D2"); //ddlDefaultBeginminuut.Text = ((int)vm.DefaultBeginminuut).ToString("D2"); WerkweekUrenBerekenen(null, null); if (persoon.geboortedatum != null) { txtDag.Text = ((DateTime)persoon.geboortedatum).ToString("dd"); txtMaand.Text = ((DateTime)persoon.geboortedatum).ToString("MM"); txtJaar.Text = ((DateTime)persoon.geboortedatum).ToString("yyyy"); dpGebdatum.SelectedDate = persoon.geboortedatum; } if (string.IsNullOrWhiteSpace(persoon.telefoon_nr_1)) { lblTelefoonPrive1.Visibility = System.Windows.Visibility.Collapsed; txtTelefoonPrive1.Visibility = System.Windows.Visibility.Collapsed; } else { lblTelefoonPrive1.Visibility = System.Windows.Visibility.Visible; txtTelefoonPrive1.Visibility = System.Windows.Visibility.Visible; } if (string.IsNullOrWhiteSpace(persoon.telefoon_nr_2)) { lblTelefoonPrive2.Visibility = System.Windows.Visibility.Collapsed; txtTelefoonPrive2.Visibility = System.Windows.Visibility.Collapsed; } else { lblTelefoonPrive2.Visibility = System.Windows.Visibility.Visible; txtTelefoonPrive2.Visibility = System.Windows.Visibility.Visible; } if (string.IsNullOrWhiteSpace(persoon.telefoon_nr_3)) { lblTelefoonPrive3.Visibility = System.Windows.Visibility.Collapsed; txtTelefoonPrive3.Visibility = System.Windows.Visibility.Collapsed; } else { lblTelefoonPrive3.Visibility = System.Windows.Visibility.Visible; txtTelefoonPrive3.Visibility = System.Windows.Visibility.Visible; } txtTelefoonPrive1.Content = persoon.telefoon_nr_1; txtTelefoonPrive2.Content = persoon.telefoon_nr_2; txtTelefoonPrive3.Content = persoon.telefoon_nr_3; txtEmail.Text = persoon.zaemail; cbChauffeur.IsChecked = vm.IsChauffeur; cbBijrijdersregistratie.IsChecked = vm.IsBijrijder; cbChauffeurMa.IsChecked = vm.IsChauffeurMa; cbChauffeurDi.IsChecked = vm.IsChauffeurDi; cbChauffeurWo.IsChecked = vm.IsChauffeurWo; cbChauffeurDo.IsChecked = vm.IsChauffeurDo; cbChauffeurVr.IsChecked = vm.IsChauffeurVr; cbChauffeurZa.IsChecked = vm.IsChauffeurZa; cbChauffeurZo.IsChecked = vm.IsChauffeurZo; cbBijrijderMa.IsChecked = vm.IsBijrijderMa; cbBijrijderDi.IsChecked = vm.IsBijrijderDi; cbBijrijderWo.IsChecked = vm.IsBijrijderWo; cbBijrijderDo.IsChecked = vm.IsBijrijderDo; cbBijrijderVr.IsChecked = vm.IsBijrijderVr; cbBijrijderZa.IsChecked = vm.IsBijrijderZa; cbBijrijderZo.IsChecked = vm.IsBijrijderZo; if (!vm.IsChauffeur) { wpChauffeur.Visibility = System.Windows.Visibility.Collapsed; } if (!vm.IsBijrijder) { wpBijrijder.Visibility = System.Windows.Visibility.Collapsed; } } Mouse.OverrideCursor = null; }
public virtual void SetState(ApplicationState state) { this.appState = state; }
public PainterStart() { InitializeComponent(); BLL.User oCurrentUser = (ApplicationState.GetValue <object>("user") as BLL.User); tblLoginName.Text = oCurrentUser.Name; }
/// <summary> /// Goes to a new application state /// Метод устанавливающий новое состояние приложения /// </summary> /// <param name="state"> /// An instance of <see cref="ApplicationState" /> that represent new application state enumeration /// </param> public void GotToNewState(ApplicationState state) { lock (this._syncObject) this.UpdateApplicationState(state); }
public static ApplicationState ReduceApplication(ApplicationState previousState, IAction action) { return(StopwatchReducer(previousState, action)); }
// methods executed from base void OnSetupState( ApplicationState state ) { if( enabled && this.state == state ) Setup(); }
public LoginViewModel(Action <string> fillPass) : this() { var userPassword = ApplicationState.GetValue <string>("UserPassword"); fillPass(userPassword); }
/// <summary> /// Initializes a new instance of the <see cref="MesApplicationControlBase"/> class. /// </summary> protected ApplicationControlBase() { // don't use the property as that results in a virtual call and makes CA unhappy... // plus it is not needed to raise the event in the c'tor this._applicationState = ApplicationState.Loaded; }
/// <summary> /// 检测并变更手术类【有单领用】领用状态,和商品变动状态明细 /// </summary> /// <param name="baseDataCommodityCode"></param> /// <param name="order"></param> /// <param name="operationDetail"></param> /// <returns></returns> public void GetOperationOrderChangeWithOrder(BaseData <CommodityCode> baseDataCommodityCode, ConsumingOrder order, BaseData <ConsumingGoodsDetail> consumingGoodsDetail) { HttpHelper.GetInstance().ResultCheck(consumingGoodsDetail, out bool isSuccess); HttpHelper.GetInstance().ResultCheck(baseDataCommodityCode, out bool isSuccess1); if (isSuccess && isSuccess1) { //手术待领用商品明细 var operationDetails = consumingGoodsDetail.body.objects.Where(item => Convert.ToInt32(item.unusedAmount) != 0); //获取待领用商品CommodityId列表(去重后) var detailCommodityIds = operationDetails.Select(it => it.CommodityId).Distinct().ToList(); //变更后的Id列表 var commodityCodes = baseDataCommodityCode.body.objects; //是否主单异常 var IsException = false; commodityCodes.ForEach(it => { if (it.operate_type == (int)OperateType.入库) { it.AbnormalDisplay = AbnormalDisplay.异常.ToString(); IsException = true; } else { if (detailCommodityIds.Contains(it.CommodityId)) { if (it.QualityStatus == QualityStatusType.过期.ToString() || it.InventoryStatus == CommodityInventoryChangeStatus.待回收.ToString()) { it.AbnormalDisplay = AbnormalDisplay.异常.ToString(); IsException = true; } else { it.AbnormalDisplay = AbnormalDisplay.正常.ToString(); } } else { it.AbnormalDisplay = AbnormalDisplay.异常.ToString(); IsException = true; } } }); if (IsException) { order.Status = ConsumingOrderStatus.异常.ToString(); } else { //变动商品明细CommodityId列表(去重后) var baseDataCommodityIds = commodityCodes.Select(it => it.CommodityId).Distinct().ToList(); //是否名称全部一致 bool isAllContains = detailCommodityIds.All(baseDataCommodityIds.Contains) && baseDataCommodityIds.Count == detailCommodityIds.Count; bool isAllNormal = true; bool isAllSame = true; // foreach (ConsumingGoodsDetail ccd in operationDetails) { //详情对应的Commodity领用数量 var tempCount = commodityCodes.Where(cit => cit.CommodityId == ccd.CommodityId).Count(); //任何一种商品的数量不一致 if (ccd.unusedAmount != null) { if (Convert.ToInt32(ccd.unusedAmount) < tempCount) { isAllNormal = false; break; } if (Convert.ToInt32(ccd.unusedAmount) != tempCount) { isAllSame = false; } } } //只有种类和数量完全一致的情况下,才会修改领用单状态 if (isAllContains && isAllNormal) { if (isAllSame) { BaseData <ConsumingGoodsDetail> bdConsumingGoodsDetail = GetAllOperationOrderGoodsDetail(order); HttpHelper.GetInstance().ResultCheck(bdConsumingGoodsDetail, out bool isSuccess2); if (isSuccess2) { if (bdConsumingGoodsDetail.body.objects.Where(item => Convert.ToInt32(item.unusedAmount) != 0 && item.EquipmentId != ApplicationState.GetEquipId()).Count() == 0) { order.Status = ConsumingOrderStatus.已完成.ToString(); } else { order.Status = ConsumingOrderStatus.领用中.ToString(); } } else { LogUtils.Error("GetOperationOrderChangeWithOrder: GetAllOperationOrderGoodsDetail" + bdConsumingGoodsDetail.message); } } else { order.Status = ConsumingOrderStatus.领用中.ToString(); } } else { order.Status = ConsumingOrderStatus.异常.ToString(); } } } }
private void cbVakmanSelected_Checked(object sender, RoutedEventArgs e) { if (((CheckBox)sender).IsChecked == true) { if (ApplicationState.GetValue <int>(ApplicationVariables.intDefaultMode) == 1) // adding { if (ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding) == null) { ApplicationState.SetValue(ApplicationVariables.listSelectedVakmanIdsAdding, new List <int>()); } // voorkom duplicate entries if (!ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding).Contains(this.Vakman.VakmanId)) { ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding).Add(this.Vakman.VakmanId); } } else // deleting { if (ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsDeleting) == null) { ApplicationState.SetValue(ApplicationVariables.listSelectedVakmanIdsDeleting, new List <int>()); } // voorkom duplicate entries if (!ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsDeleting).Contains(this.Vakman.VakmanId)) { ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsDeleting).Add(this.Vakman.VakmanId); } } } else { if (ApplicationState.GetValue <int>(ApplicationVariables.intDefaultMode) == 1) // adding { if (ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding) == null) { ApplicationState.SetValue(ApplicationVariables.listSelectedVakmanIdsAdding, new List <int>()); } else { ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding).Remove(this.Vakman.VakmanId); } } else // deleting { if (ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsDeleting) == null) { ApplicationState.SetValue(ApplicationVariables.listSelectedVakmanIdsDeleting, new List <int>()); } else { ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsDeleting).Remove(this.Vakman.VakmanId); } } } ProjectDagView pdv = Tools.FindVisualParent <ProjectDagView>(this); if (pdv != null) { foreach (UIElement control in pdv.canvasWrapper.Children) { if (control.GetType() == typeof(Border)) { Border rectDefault = (Border)control; // als het vierkantje bij deze checkbox hoort if (rectDefault.Tag == this) { if (((CheckBox)sender).IsChecked == true) { rectDefault.Visibility = System.Windows.Visibility.Visible; } else { rectDefault.Visibility = System.Windows.Visibility.Hidden; } } } } // als geen enkele checkbox geselecteerd is, dan knop weghalen, anders tonen if (ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding).Count == 0) { //pdv } } dbRepository dbrep = new dbRepository(); Setting setting = dbrep.datacontext.Settings.Where(s => s.GebruikerId == ApplicationState.GetValue <int>(ApplicationVariables.intGebruikerId) && s.SettingsNaam == ApplicationVariables.strVakmanIdsAdding).FirstOrDefault(); if (setting == null) { Setting addSetting = new Setting(); addSetting.GebruikerId = ApplicationState.GetValue <int>(ApplicationVariables.intGebruikerId); addSetting.SettingsNaam = ApplicationVariables.strVakmanIdsAdding; addSetting.SettingsValue = ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding).FromListToString(); dbrep.datacontext.Settings.InsertOnSubmit(addSetting); dbrep.datacontext.SubmitChanges(); } else { setting.SettingsValue = ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsAdding).FromListToString(); dbrep.datacontext.SubmitChanges(); } Setting setting2 = dbrep.datacontext.Settings.Where(s => s.GebruikerId == ApplicationState.GetValue <int>(ApplicationVariables.intGebruikerId) && s.SettingsNaam == ApplicationVariables.strVakmanIdsDeleting).FirstOrDefault(); if (setting2 == null) { Setting addSetting2 = new Setting(); addSetting2.GebruikerId = ApplicationState.GetValue <int>(ApplicationVariables.intGebruikerId); addSetting2.SettingsNaam = ApplicationVariables.strVakmanIdsDeleting; addSetting2.SettingsValue = ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsDeleting).FromListToString(); dbrep.datacontext.Settings.InsertOnSubmit(addSetting2); dbrep.datacontext.SubmitChanges(); } else { setting2.SettingsValue = ApplicationState.GetValue <List <int> >(ApplicationVariables.listSelectedVakmanIdsDeleting).FromListToString(); dbrep.datacontext.SubmitChanges(); } SetBullit(); }
/// <summary> /// 根据领用单码查询领用单信息(领用回退不需要操作人,需要根据库房去筛选) /// </summary> /// <param name="consumingOrderName"></param> /// <returns></returns> public BaseData <ConsumingOrder> GetConsumingOrder(string consumingOrderName) { if (null == consumingOrderName) { return(new BaseData <ConsumingOrder>() { code = (int)ResultCode.Parameter_Exception, message = ResultCode.Parameter_Exception.ToString() }); } //获取待完成上架工单 BaseData <ConsumingOrder> bdConsumingOrder; bdConsumingOrder = HttpHelper.GetInstance().Get <ConsumingOrder>(new QueryParam { view_filter = { filter = { logical_relation = "1 AND 2", expressions = { new QueryParam.Expressions { field = "name", @operator = "==", operands = { $"'{ HttpUtility.UrlEncode(consumingOrderName) }'" } }, new QueryParam.Expressions { field = "StoreHouseId", @operator = "==", operands = { $"'{ HttpUtility.UrlEncode(ApplicationState.GetValue<string>((int)ApplicationKey.HouseId)) }'" } } } } } }); //校验是否含有数据,如果含有数据,拼接具体字段 bdConsumingOrder = HttpHelper.GetInstance().ResultCheck(bdConsumingOrder, out bool isSuccess); if (isSuccess) { bdConsumingOrder.body.objects.ForEach(it => { //拼接库房名称 if (!string.IsNullOrEmpty(it.StoreHouseId)) { it.StoreHouseName = GetNameById <StoreHouse>(it.StoreHouseId); } }); } if (bdConsumingOrder.body.objects == null) { bdConsumingOrder.code = (int)ResultCode.Result_Exception; bdConsumingOrder.message = ResultCode.Result_Exception.ToString(); } else { //如果领⽤单作废标识为【是】则弹窗提醒手术单作废,跳转回前⻚ if ("是".Equals(bdConsumingOrder.body.objects[0].markId) || "已完成".Equals(bdConsumingOrder.body.objects[0].Status) || "已撤销".Equals(bdConsumingOrder.body.objects[0].Status)) { bdConsumingOrder.code = (int)ResultCode.Result_Exception; bdConsumingOrder.message = ResultCode.Result_Exception.ToString(); } } return(bdConsumingOrder); }
protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } switch (propertyName) { case "Project": dbRepository dbrep = new dbRepository(); DateTime dtSelectedDay = ApplicationState.GetValue <DateTime>(ApplicationVariables.dtSelectedDay); DbTools dbtools = new DbTools(); StackPanel strTooltip = new StackPanel(); StackPanel strTooltipAanvraag = new StackPanel(); dbOriginalRepository dbreporiginal = new dbOriginalRepository(); MDRpersoon pp = dbreporiginal.GetContact(dbrep.GetProjectleider(project.ProjectleiderId, project.ProjectId, dtSelectedDay).ContactIdOrigineel); lblHeader.Content = ToonNaam(pp); lblHeader.VerticalAlignment = System.Windows.VerticalAlignment.Top; //lblHeader.BorderThickness = new Thickness(1); //lblHeader.BorderBrush = new SolidColorBrush(Colors.Black); btnHeader.Style = this.FindResource("LinkButton") as Style; MDRproject pr = dbreporiginal.GetProject((int)project.ProjectNr); double ww = 400; if (btnHeader.Width > 0) { ww = btnHeader.Width; } if (btnHeader.FontSize > 11) { ww = ww * 0.8; } // TOOLTIP // TOOLTIP // TOOLTIP DateTime dtdag = ApplicationState.GetValue <DateTime>(ApplicationVariables.dtSelectedDay); Vakman vakman = dbrep.GetVakman(ApplicationState.GetValue <int>(ApplicationVariables.intVakmanId)); strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(vakman, project, dtdag, true, true)); if (pr != null) { btnHeader.Content = pr.project_NR.ToString(5) + " " + pr.naam_project.ToString(ww); // de naam van het project ook tonen in de tooltip bovenaan //strTooltip.AddText(pr.naam_project.ToString() + " (Project " + pr.project_NR + ")"); } else { btnHeader.Content = " " + project.Naam.ToString(ww); // de naam van het project ook tonen in de tooltip bovenaan //strTooltip.AddText(project.Naam.ToString() + " (Project --)"); } //List<Mandagen> listMandagenTotal = dbrep.datacontext.Mandagens.Where(m => m.Begintijd != m.Eindtijd && m.Begintijd >= ApplicationState.GetValue<DateTime>(ApplicationVariables.dtSelectedDay) && m.Eindtijd <= ApplicationState.GetValue<DateTime>(ApplicationVariables.dtSelectedDay).AddDays(1)).ToList(); //List<Mandagen> listMandagen = listMandagenTotal.Where(m => m.ProjectId == project.ProjectId).ToList(); //// als in deze pool van mandagen een aanvraag zit: //// vandaag, ander project, geen projectleider, niet bevestigd (dus aanvraag) //List<Mandagen> listAanvragen = listMandagenTotal.Where(m => m.ProjectleiderId != ApplicationState.GetValue<Gebruiker>(ApplicationVariables.objGebruiker).ProjectleiderId && m.ProjectId != project.ProjectId && m.Begintijd >= ApplicationState.GetValue<DateTime>(ApplicationVariables.dtSelectedDay) && m.Eindtijd <= ApplicationState.GetValue<DateTime>(ApplicationVariables.dtSelectedDay).AddDays(1) && !m.Status).ToList(); //// als in deze pool van mandagen een aanvraag zit: //// vandaag, ander project, geen projectleider, wel bevestigd (dus waar dit de aanvraag van is) //List<Mandagen> listMandagenWaarDitDeAanvraagVanIs = listMandagenTotal.Where(m => m.ProjectId != project.ProjectId && m.ProjectleiderId != ApplicationState.GetValue<Gebruiker>(ApplicationVariables.objGebruiker).ProjectleiderId && m.ProjectId != project.ProjectId && m.Begintijd >= dtSelectedDay && m.Eindtijd <= dtSelectedDay.AddDays(1) && m.Status).ToList(); //int previousVakmanId = -1; //foreach (Mandagen mandag in listMandagen) //{ // if (mandag.Status) // { // bool isBold = mandag.VakmanId == ApplicationState.GetValue<int>(ApplicationVariables.intVakmanId); // //strTooltip.AddText("(" + ToonTijd(mandag) + ")" + " " + ToonNaam(dbreporiginal.GetContact(mandag.Vakman.ContactIdOrigineel, true)), isBold); // // OF we hebben te maken met externe aanvragen // Mandagen aanvraag = listAanvragen.FirstOrDefault(m => m.Begintijd < mandag.Eindtijd && m.Eindtijd > mandag.Begintijd && m.VakmanId == mandag.VakmanId); // if (aanvraag != null) // { // List<Mandagen> listIngeplandeMandagen = new List<Mandagen>(); // listIngeplandeMandagen.Add(mandag); // if (previousVakmanId == mandag.VakmanId) // { // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagMinOnly(listIngeplandeMandagen, aanvraag, false)); // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(mandag.Vakman, mandag.Project, dbtools.GetHeleDag(mandag.Begintijd))); // } // else // { // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraag(listIngeplandeMandagen, aanvraag, false)); // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(mandag.Vakman, mandag.Project, dbtools.GetHeleDag(mandag.Begintijd))); // } // previousVakmanId = mandag.VakmanId; // } // } // else // { // if (previousVakmanId == mandag.VakmanId) // { // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagMinOnly(listMandagenWaarDitDeAanvraagVanIs, mandag, true)); // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(mandag.Vakman, mandag.Project, dbtools.GetHeleDag(mandag.Begintijd), true, false)); // } // else // { // // OF het is zelf de aanvraag // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraag(listMandagenWaarDitDeAanvraagVanIs, mandag, true)); // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(mandag.Vakman, mandag.Project, dbtools.GetHeleDag(mandag.Begintijd), true, false)); // } // previousVakmanId = mandag.VakmanId; // } //} //foreach (Mandagen mandag in listAanvragen) //{ // if (!mandag.Status) // { // // OF dit project heeft een andere aanvraag lopen die de vakman VAN het project af wil halen // listMandagenWaarDitDeAanvraagVanIs = listMandagenTotal.Where(m => m.VakmanId == mandag.VakmanId && m.ProjectId != mandag.ProjectId && m.ProjectleiderId != ApplicationState.GetValue<Gebruiker>(ApplicationVariables.objGebruiker).ProjectleiderId && m.Begintijd >= dtSelectedDay && m.Eindtijd <= dtSelectedDay.AddDays(1) && m.Status).ToList(); // strTooltipAanvraag += AddTooltipAanvraag(listMandagenWaarDitDeAanvraagVanIs, mandag, false); // } //} ToolTipService.SetShowDuration(btnHeader, 20000); strTooltip.Children.Add(strTooltipAanvraag); btnHeader.ToolTip = strTooltip; btnHeader.Margin = new Thickness(0, 0, 0, -8); if (ApplicationState.GetValue <int>("intProjectId") == project.ProjectId) { // make bold //btnHeader.FontWeight = FontWeights.ExtraBold; } break; default: break; } }
public MainPageViewModel() { _applicationState = DependencyService.Get <ApplicationState>(); _applicationState.WorkStartChanged += UpdateButtonText; }
public ApplicationStateEventArgs(ApplicationState newApplicationState) { NewApplicationState = newApplicationState; }
protected HashControllerBase(HashAlgorithmAdapter hashAlgorithm, ApplicationState applicationState) { _hashAlgorithm = hashAlgorithm; _applicationState = applicationState; }
/// <summary> /// 处理输入事件 /// </summary> /// <returns></returns> private bool HandleEnterDetail() { var inputStr = tbInputCode.Text; if (string.IsNullOrWhiteSpace(inputStr)) { MessageBox.Show("单号不可以为空!", "温馨提示", MessageBoxButton.OK); return(false); } TaskOrder taskOrder; string name; try { taskOrder = JsonConvert.DeserializeObject <TaskOrder>(inputStr); name = taskOrder.name; } catch { name = inputStr; } if (consumingOrderType != ConsumingOrderType.医嘱处方领用) { FetchParam fetchParam = new FetchParam(); LoadingDataEvent(this, true); fetchParam.bdConsumingOrder = ConsumingBll.GetInstance().GetConsumingOrder(name.ToUpper()); LoadingDataEvent(this, false); //校验是否含有数据 HttpHelper.GetInstance().ResultCheck(fetchParam.bdConsumingOrder, out bool isSuccess); if (!isSuccess) { MessageBox.Show("无法获取领用单详情!" + fetchParam.bdConsumingOrder.message, "温馨提示", MessageBoxButton.OK); return(false); } LoadingDataEvent(this, true); fetchParam.bdOperationOrderGoodsDetail = ConsumingBll.GetInstance().GetOperationOrderGoodsDetail(fetchParam.bdConsumingOrder); LoadingDataEvent(this, false); //校验是否含有数据 HttpHelper.GetInstance().ResultCheck(fetchParam.bdOperationOrderGoodsDetail, out bool isSuccess1); if (!isSuccess1) { MessageBox.Show("无法获取手术单物品详情!" + fetchParam.bdOperationOrderGoodsDetail.message, "温馨提示", MessageBoxButton.OK); return(false); } HashSet <CommodityEps> hs = ApplicationState.GetGoodsInfo(); BaseData <CommodityCode> bdCommodityCode = CommodityCodeBll.GetInstance().GetCommodityCode(ApplicationState.GetGoodsInfo()); ConsumingBll.GetInstance().CombinationStockNum(fetchParam.bdOperationOrderGoodsDetail, bdCommodityCode); EnterSurgeryDetailEvent(this, fetchParam); } else { LoadingDataEvent(this, true); BaseData <PrescriptionBill> baseData = ConsumingBll.GetInstance().GetPrescriptionBill(name); LoadingDataEvent(this, false); //校验是否含有数据 HttpHelper.GetInstance().ResultCheck(baseData, out bool isSuccess); if (!isSuccess) { MessageBox.Show("无法获取处方单!" + baseData.message, "温馨提示", MessageBoxButton.OK); return(false); } EnterPrescriptionOpenEvent(this, new ConsumingOrder { SourceBill = new SourceBill { object_name = "PrescriptionBill", object_id = baseData.body.objects[0].id } }); } return(true); }
private void ButtonCancelPendingAlarms_Click(object sender, EventArgs e) { ApplicationState.GetInstance(this).ResetAlarms(); syncAlarmTimeView(); }
private static ApplicationState ChangeModeReducer(ApplicationState previousState, ChangeModeAction action) { var previousMode = previousState.GetState <StopwatchMode>(Mode); var timerScheduler = previousState.TimerScheduler; string buttonLabel; StopwatchMode nextMode; DateTime startTime; var lapTimeList = previousState.GetState <ObservableCollection <LapTime> >(LapTimeList); var now = previousState.GetState <DateTime>(Now); var l = new Dictionary <string, object>(); TimeSpan max, min; switch (previousMode) { case StopwatchMode.Init: nextMode = StopwatchMode.Start; buttonLabel = Constants.StopLabel; startTime = timerScheduler.Now.DateTime.ToLocalTime(); //Debug.WriteLine($"startTime:{startTime}"); l.Add(Mode, nextMode); l.Add(ButtonLabel, buttonLabel); l.Add(StartTime, startTime); break; case StopwatchMode.Start: //Debug.WriteLine($"ChangeModeAction Now:{ now}"); nextMode = StopwatchMode.Stop; buttonLabel = Constants.ResetLabel; startTime = previousState.GetState <DateTime>(StartTime); var prevLap = lapTimeList.Any() ? lapTimeList.Last().Time : startTime; //Debug.WriteLine($"ChangeModeAction prevLap:{ prevLap}"); lapTimeList.Add(new LapTime(time: now, span: timerScheduler.Now.DateTime.ToLocalTime() - prevLap)); max = lapTimeList.Max(s => s.Span); min = lapTimeList.Min(s => s.Span); l.Add(LapTimeList, lapTimeList); l.Add(Mode, nextMode); l.Add(ButtonLabel, buttonLabel); l.Add(MaxLapTime, max); l.Add(MinLapTime, min); break; case StopwatchMode.Stop: nextMode = StopwatchMode.Init; buttonLabel = Constants.StartLabel; startTime = timerScheduler.Now.DateTime.ToLocalTime(); lapTimeList.Clear(); max = TimeSpan.Zero; min = TimeSpan.Zero; l.Add(Mode, nextMode); l.Add(ButtonLabel, buttonLabel); l.Add(StartTime, startTime); l.Add(NowSpan, TimeSpan.Zero); l.Add(LapTimeList, lapTimeList); l.Add(MaxLapTime, max); l.Add(MinLapTime, min); break; default: throw new InvalidOperationException(); } var nextStates = previousState.States.SetItems(l); return(new ApplicationState(nextStates, previousState.TimerScheduler)); }
public BaseController(IStoreService storeService, ApplicationState applicationState) { this.storeService = storeService; this.applicationState = applicationState; }
protected void Page_Load(object sender, EventArgs e) { //Master.SetTitle("WebEasy - Accesso Servizi Dipartimento "); lblMessaggio.Text = ""; labExtMessage.Text = ""; if (!Page.IsPostBack || Page.Session.IsNewSession) { Session["utente"] = ""; Session["Responsabile"] = ""; Session["Fornitore"] = ""; Session["CodiceResponsabile"] = null; Session["CodiceFornitore"] = null; } if (Request != null) { if (Request.Params["x"] != null && Request.Params["x"].ToString() != "") { Session["DepCode"] = Request.Params["x"]; } } if (Session["DepCode"] == null || Session["DepCode"].ToString() == "") { lblMessaggio.Text = "E' necessario chiamare la pagina magazzino_in.aspx con il parametro dep=codice dipartimento"; WebLog.Log(this, "Parametro dep non fornito."); return; } //if (Session["DoLogon"] == null || !((bool)Session["DoLogon"])) { // lblMessaggio.Text = "Applicazione non inizializzata correttamente."; // WebLog.Log(this, "Applicazione non inizializzata correttamente."); // return; //} DataSet Cfg = GetVars.GetConfigDataSet(this); if (Cfg.Tables[0].Rows.Count == 0) { lblMessaggio.Text = "Servizio non installato correttamente. Manca il file di configurazione."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } MetaMaster MM = Master as MetaMaster; //if (MM != null) MM.ShowClientMessage("NINO", false); string error; DataAccess Conn = GetVars.GetSystemDataAccess(this, out error); if (Conn == null) { //lblMessaggio.Text = "Connessione al DB di sistema non riuscita." + error; //Attenzione qui l'errore contiene la password del Database ! lblMessaggio.Text = "Connessione al DB di sistema non riuscita."; WebLog.Log(this, "Connessione al db di sistema non riuscita."); return; } lblMessaggio.Text = "Il servizio Web è attivo"; GetVars.ClearUserConn(this); MetaMaster master = Page.Master as MetaMaster; master?.setUniversita(Session["system_config_nome_universita"] as string); if (!Page.IsPostBack) { ldapauth ldpauth = new ldapauth(Conn); if (!ldpauth.getconfig()) { rbTipuUtente.Items.RemoveAt(3); } } //WebLog.Log(this, "Visualizza Login_Servizi"); DateTime D = DateTime.Now; if (IsPostBack) { if (txtNomeUtente.Text == "") { lblMessaggio.Text = "Il nome utente è un campo obbligatorio."; //MM.ShowClientMessage("Il nome utente è un campo obbligatorio.", "Errore", // System.Windows.Forms.MessageBoxButtons.OK); return; } if (txtPassword.Text == "") { lblMessaggio.Text = "La password è un campo obbligatorio."; //MM.ShowClientMessage("La password è un campo obbligatorio.", "Errore", // System.Windows.Forms.MessageBoxButtons.OK); return; } } if (IsPostBack && Request != null) { //Cerco prima nella tabella contatto e poi nella tabella responsabile. string NomeUtente = txtNomeUtente.Text; string Password = txtPassword.Text; // Request.Form["txtPassword"].ToString(); if (rbTipuUtente.SelectedValue == "1" || rbTipuUtente.SelectedValue == "2") { //Responsabile o Fornitore ConnectToDepartment(Session["DepCode"].ToString(), null, null, D); } if (rbTipuUtente.SelectedValue == "3") //Utente dell'applicazione { ConnectToDepartment(Session["DepCode"].ToString(), NomeUtente, txtPassword.Text, D); } bool ldapauthok = false; if (rbTipuUtente.SelectedValue == "4") // Utente LDAP { ldapauth lauth = new ldapauth(Conn); if (!lauth.getconfig()) { // Nessuna configurazione LDAP lblMessaggio.Text = lauth.ErrorMsg; return; } else { if (!lauth.Authenticate(NomeUtente, txtPassword.Text)) { // autenticazione fallita lblMessaggio.Text = lauth.ErrorMsg; return; } else { // autenticazione LDAP riuscita NomeUtente = lauth.user_decoded; ConnectToDepartment(Session["DepCode"].ToString(), null, null, D); ldapauthok = true; } } } //Connessione al Server.Database privato del software. Easy_DataAccess UsrConn = GetVars.GetUserConn(this); if (UsrConn == null) { return; //Messaggio già viualizzato da ConnectToDepartment() } QueryHelper QHS = UsrConn.GetQueryHelper(); string user = null; string forename = null; string lastname = null; string cf = null; string email = null; if (rbTipuUtente.SelectedValue == "3") { if (!CambioDataConsentita(UsrConn, D)) { UsrConn.Close(); labExtMessage.Text = "Accesso non consentito in tale data \rin base alla gestione della sicurezza."; // MM.ShowClientMessage("Accesso non consentito in tale data in base alla gestione della sicurezza.", "Errore", // System.Windows.Forms.MessageBoxButtons.OK); lblMessaggio.Text = "Accesso negato"; return; } } if (UsrConn.Open() == false) { //Il Server del Dipartimento non è in rete. //Il servizio non è disponibile in quanto il computer potrebbe essere spento. labExtMessage.Text = "Il Server del Dipartimento non risponde.\r" + "Potrebbe essere spento o momentaneamente fuori rete. \r" + "Provi in seguito"; txtNomeUtente.ReadOnly = true; WebLog.Log(this, "Il Server del dipartimento non risponde."); return; } UsrConn.Close(); Meta_EasyDispatcher Disp = new Meta_EasyDispatcher(UsrConn); ApplicationState APS = new ApplicationState(Disp, UsrConn); string path = this.MapPath("."); string filename = Path.Combine(path, "proxyserver.html"); if (File.Exists(filename)) { StreamReader SR = new StreamReader(filename); string webauth = SR.ReadToEnd(); webauth = webauth.Replace("\n", "").Replace("\r", "").Trim(); APS.webautorithy = webauth; SR.Close(); } APS.SaveApplicationState(this); labExtMessage.Text = "Connessione al server effettuata."; if (rbTipuUtente.SelectedValue == "1") { int countresp = UsrConn.RUN_SELECT_COUNT("manager", QHS.CmpEq("userweb", NomeUtente), false); if (countresp > 1) { lblMessaggioPass.Text = "Chiedere al Segreterio Amministrativo l'assegnazione di una nuova login"; WebLog.Log(this, "Attenzione !!! Login assegnata a piu responsabili"); return; } DataTable Responsabile = UsrConn.RUN_SELECT("manager", "*", null, QHS.AppAnd(QHS.CmpEq("userweb", NomeUtente), QHS.CmpEq("passwordweb", Password)), null, false); if (Responsabile.Rows.Count == 0) { //Dati non corretti labExtMessage.Text = "Nome utente o password non sono corretti."; WebLog.Log(this, "Nome Resp:" + NomeUtente + " e password:"******" non corretti"); return; } Session["LoginResponsabile"] = NomeUtente; Session["PasswordResponsabile"] = Password; Session["Responsabile"] = Responsabile.Rows[0]["title"].ToString(); Session["CodiceResponsabile"] = Responsabile.Rows[0]["idman"]; Session["TipoUtente"] = "responsabile"; WebLog.Log(this, "Riconosciuto responsabile: " + Session["Responsabile"].ToString()); } if (rbTipuUtente.SelectedValue == "2") { int countforn = UsrConn.RUN_SELECT_COUNT("registryreferenceview", QHS.CmpEq("userweb", NomeUtente), false); if (countforn > 1) { lblMessaggioPass.Text = "Chiedere al Segreterio Amministrativo l'assegnazione di una nuova login"; WebLog.Log(this, "Attenzione !!! Login assegnata a piu fornitori"); return; } DataTable Contatto = UsrConn.RUN_SELECT("registryreferenceview", "*", null, QHS.AppAnd(QHS.CmpEq("userweb", NomeUtente), QHS.CmpEq("passwordweb", Password)), null, false); if (Contatto.Rows.Count == 0) { //Dati non corretti labExtMessage.Text = "Nome utente o password non sono corretti."; WebLog.Log(this, "Nome Fornitore:" + NomeUtente + " e password:"******" non corretti"); return; } Session["LoginFornitore"] = NomeUtente; Session["Fornitore"] = Contatto.Rows[0]["registry"]; Session["CodiceFornitore"] = Contatto.Rows[0]["idreg"]; Session["PasswordFornitore"] = Password; Session["TipoUtente"] = "fornitore"; WebLog.Log(this, "Riconosciuto fornitore: " + Session["Fornitore"].ToString()); } if (rbTipuUtente.SelectedValue == "3") { Session["TipoUtente"] = "utente"; Session["Utente"] = NomeUtente; Session["PasswordUtente"] = Password; } if (ldapauthok || (rbTipuUtente.SelectedValue == "1") || (rbTipuUtente.SelectedValue == "2") || (rbTipuUtente.SelectedValue == "3")) { int userkind = Convert.ToInt32(rbTipuUtente.SelectedValue); string filter = QHS.AppAnd(QHS.CmpEq("username", NomeUtente), QHS.CmpEq("codicedipartimento", Session["DepCode"].ToString()), QHS.CmpEq("userkind", userkind) ); // prelevare l'idflowchart e poi fare la connecttodepartment DataTable virtualuser = Conn.RUN_SELECT("virtualuser", "*", null, filter, null, false); if (virtualuser != null && virtualuser.Rows.Count != 0) { user = virtualuser.Rows[0]["sys_user"].ToString(); forename = virtualuser.Rows[0]["forename"].ToString(); lastname = virtualuser.Rows[0]["surname"].ToString(); email = virtualuser.Rows[0]["email"].ToString(); cf = virtualuser.Rows[0]["cf"].ToString(); UsrConn.SetUsr("HasVirtualUser", "S"); // Controllare se è anche un responsabile // Vediamo se esiste un manager il cui login="******" // se si, assegnamo le due variabili di responsabile come // nel caso "2" filter = QHS.CmpEq("userweb", virtualuser.Rows[0]["username"].ToString()); DataTable manager = UsrConn.RUN_SELECT("manager", "*", null, filter, null, false); if (manager != null && manager.Rows.Count != 0) { Session["Responsabile"] = manager.Rows[0]["title"].ToString(); Session["CodiceResponsabile"] = manager.Rows[0]["idman"]; } EasySecurity sec = UsrConn.Security as EasySecurity; UsrConn.externalUser = NomeUtente; sec.SetSys("user", user); sec.SetUsr("usergrouplist", null); sec.CalculateGroupList(); sec.RecalcUserEnvironment(); sec.ReadAllGroupOperations(); sec.SetUsr("forename", forename); sec.SetUsr("surname", lastname); sec.SetUsr("email", email); sec.SetUsr("cf", cf); if (!CambioDataConsentita(UsrConn, D)) { labExtMessage.Text = "Accesso non consentito in tale data \rin base alla gestione della sicurezza."; lblMessaggio.Text = "Accesso negato"; return; } } else { if (ldapauthok) { lblMessaggio.Text = "Utente non valido."; return; } } } if (rbTipuUtente.SelectedValue == "4") { Session["TipoUtente"] = "Utente LDAP"; Session["Utente"] = forename + " " + lastname; Session["PasswordUtente"] = Password; } StampaReport(UsrConn, cf); //Response.Redirect("IndiceReport.aspx"); } }
private void ChangeGui(ApplicationState state) { switch (state) { case ApplicationState.NotRecording: browseButton.Enabled = true; buttonStartRecording.Enabled = true; buttonStopRecording.Enabled = false; bitrateComboBox.Enabled = true; deviceListBox.Enabled = true; thresholdCheckBox.Enabled = true; thresholdTextBox.Enabled = true; break; case ApplicationState.WaitingForRecording: browseButton.Enabled = false; buttonStartRecording.Enabled = false; buttonStopRecording.Enabled = true; bitrateComboBox.Enabled = false; deviceListBox.Enabled = false; thresholdCheckBox.Enabled = false; thresholdTextBox.Enabled = false; break; case ApplicationState.Recording: browseButton.Enabled = false; buttonStartRecording.Enabled = false; buttonStopRecording.Enabled = true; bitrateComboBox.Enabled = false; deviceListBox.Enabled = false; thresholdCheckBox.Enabled = false; thresholdTextBox.Enabled = false; break; } }
private void Button_Click(object sender, RoutedEventArgs e) { var uc = new UserController(); var currentTime = DateTime.Now; using (var context = new CarContext()) { var userInfo = ApplicationState.GetValue <UserMetadata>("Metadata"); var asset = uc.GetAssetInfo(context, userInfo.Barcode); var user = uc.GetUserInfo(context, userInfo.BadgeNumber); var isNewAsset = false; if (asset == null) { asset = new ASSET() { CREATED = DateTime.Now }; isNewAsset = true; } uc.MapMetadataToAsset(asset, userInfo); //asset.APO_PCO_PIV_BADGE_NUM = 1; asset.DATETIME_RECEIVED = currentTime; if (isNewAsset) { context.Assets.Add(asset); } if (user == null) { user = uc.MapMetadataToUser(userInfo); user.APO_PCO_PIV_BADGE_NUM = asset?.APO_PCO_PIV_BADGE_NUM; user.BARCODE = asset?.BARCODE ?? userInfo.Barcode;// : asset.BARCODE; user.DATETIME_ACCEPTED = currentTime; if (asset?.STATE == "ASSIGNED") { user.OUTSTANDING_ASSET = false; } else if (asset?.STATE == "ASSIGNED_PENDING_RETURN") { user.OUTSTANDING_ASSET = true; user.LAST_REMINDER = currentTime.AddDays(5); } context.Users.Add(user); } else { user.PREVIOUS_BARCODE = user.BARCODE; user.DATETIME_ACCEPTED = currentTime; user.BARCODE = asset?.BARCODE; user.APO_PCO_PIV_BADGE_NUM = asset?.APO_PCO_PIV_BADGE_NUM; user.LAST_UPDATED = currentTime; if (asset.STATE == "ASSIGNED") { user.OUTSTANDING_ASSET = false; } else if (asset.STATE == "ASSIGNED_PENDING_RETURN") { user.OUTSTANDING_ASSET = true; user.LAST_REMINDER = currentTime.AddDays(5); } if (user.PREVIOUS_BARCODE.HasValue) { var oldAsset = uc.GetAssetInfo(context, user.PREVIOUS_BARCODE.Value); oldAsset.STATE = "AWAITING_RETURNED"; oldAsset.LAST_UPDATED = currentTime; } } asset.STATE = "ACCEPTED"; try { context.SaveChanges(); } catch (DbEntityValidationException ex) { foreach (var eve in ex.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } this.Close(); } }
void OnTeardownState( ApplicationState state ) { if( enabled && this.state == state ) Teardown(); }
public ItemsController(ApplicationState state, IPOSInterfaceProvider provider, IEcommerceDatabase database) { _state = state; _ecommerceDatabase = database; _posProvider = provider; }
void OnResumeState( ApplicationState state ) { if( enabled && this.state == state ) Resume(); }
public void SetBullit() { if (ApplicationState.GetValue <int>(ApplicationVariables.intDefaultMode) == 1) { // deleting onzichtbaar borderDeleting.Visibility = System.Windows.Visibility.Hidden; if (IsOwner && IsEnabled) { // groen borderAdding.Fill = new SolidColorBrush(Colors.Green); borderAdding.Stroke = new SolidColorBrush(Colors.Black); } else { // wit borderAdding.Fill = new SolidColorBrush(Colors.White); borderAdding.Stroke = new SolidColorBrush(Colors.Gray); } if (IsOwner && (bool)cbVakmanSelected.IsChecked) { // zichtbaar borderAdding.Visibility = System.Windows.Visibility.Visible; } else { // onzichtbaar borderAdding.Visibility = System.Windows.Visibility.Hidden; } } else // deleting { // adding onzichtbaar borderAdding.Visibility = System.Windows.Visibility.Hidden; if (IsOwner && IsEnabledForDeleting) { // groen borderDeleting.Fill = new SolidColorBrush(Colors.Red); borderDeleting.Stroke = new SolidColorBrush(Colors.Black); } else { // wit borderDeleting.Fill = new SolidColorBrush(Colors.White); borderDeleting.Stroke = new SolidColorBrush(Colors.Gray); } if (IsOwner && (bool)cbVakmanSelected.IsChecked) { // zichtbaar borderDeleting.Visibility = System.Windows.Visibility.Visible; } else { // onzichtbaar borderDeleting.Visibility = System.Windows.Visibility.Hidden; } } }
internal ApplicationStateDisposition SetApplicationState(ApplicationState s) { uint num; if (this._form == ContextForm.Loose) { return ApplicationStateDisposition.Undefined; } this._actContext.SetApplicationRunningState(0, (uint) s, out num); this._appRunState = (ApplicationStateDisposition) num; return this._appRunState; }
protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } switch (propertyName) { case "Vakman": try { StackPanel strTooltip = new StackPanel(); StackPanel strTooltipAanvraag = new StackPanel(); btnHeader.Style = this.FindResource("LinkButton") as Style; //btnHeader.Style = Tools.FindVisualParent<PageContainer>(this).FindResource("LinkButton") as Style; dbOriginalRepository dbRepOriginal = new dbOriginalRepository(); dbRepository dbrep = new dbRepository(); DbTools dbtools = new DbTools(); MDRpersoon p = dbRepOriginal.GetContact(vakman.ContactIdOrigineel); // TOOLTIP // TOOLTIP // TOOLTIP DateTime dtdag = ApplicationState.GetValue <DateTime>(ApplicationVariables.dtSelectedDay); Project project = dbrep.GetProject(ApplicationState.GetValue <int>(ApplicationVariables.intProjectId)); Vakman objVakman = dbrep.GetVakman(vakman.VakmanId); strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(objVakman, project, dtdag, false, false)); if (p != null) { btnHeader.Content = (p.voornaam + " " + (p.tussenvoegsel == null ? "" : p.tussenvoegsel) + " " + p.achternaam).ToStringTrimmed(); bool isBold = vakman.VakmanId == ApplicationState.GetValue <int>(ApplicationVariables.intVakmanId); //strTooltip.AddText((p.voornaam + " " + (p.tussenvoegsel == null ? "" : p.tussenvoegsel) + " " + p.achternaam).ToStringTrimmed(), isBold); } //List<Mandagen> listMandagenTotal = dbrep.GetMandagen(vakman.VakmanId, ApplicationState.GetValue<DateTime>(ApplicationVariables.dtSelectedDay)).Where(m => m.Begintijd != m.Eindtijd).OrderBy(m => m.Status).ToList(); //int previousVakmanId = -1; //foreach (Mandagen mandag in listMandagenTotal) //{ // // als in deze pool van mandagen een aanvraag zit: // // vandaag, ander project, geen projectleider, wel bevestigd (dus waar dit de aanvraag van is) // List<Mandagen> listMandagenWaarDitDeAanvraagVanIs = listMandagenTotal.Where(m => m.ProjectId != mandag.ProjectId && m.ProjectleiderId != ApplicationState.GetValue<Gebruiker>(ApplicationVariables.objGebruiker).ProjectleiderId && m.ProjectId != mandag.ProjectId && m.Begintijd >= ApplicationState.GetValue<DateTime>(ApplicationVariables.dtSelectedDay) && m.Eindtijd <= ApplicationState.GetValue<DateTime>(ApplicationVariables.dtSelectedDay).AddDays(1) && m.Status).ToList(); // if (mandag.Status) // { // bool isBold = (ApplicationState.GetValue<int>(ApplicationVariables.intProjectId) == mandag.ProjectId); // strTooltip.AddText("(" + ToonTijd(mandag) + ")" + " " + dbRepOriginal.GetProject((int)mandag.Project.ProjectNr).naam_project, isBold); // } // if (!mandag.Status) // { // bool reverse = false; // if (ApplicationState.GetValue<int>(ApplicationVariables.intProjectId) == mandag.ProjectId) // { // reverse = true; // } // if (previousVakmanId == mandag.VakmanId) // { // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagMinOnly(listMandagenWaarDitDeAanvraagVanIs, mandag, reverse)); // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(mandag.Vakman, mandag.Project, dbtools.GetHeleDag(mandag.Begintijd))); // } // else // { // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraag(listMandagenWaarDitDeAanvraagVanIs, mandag, reverse)); // //strTooltipAanvraag.Children.Add(dbtools.AddTooltipAanvraagAll(mandag.Vakman, mandag.Project, dbtools.GetHeleDag(mandag.Begintijd))); // } // } // previousVakmanId = mandag.VakmanId; //} ToolTipService.SetShowDuration(btnHeader, 20000); strTooltip.Children.Add(strTooltipAanvraag); btnHeader.ToolTip = strTooltip; if (ApplicationState.GetValue <int>(ApplicationVariables.intVakmanId) == vakman.VakmanId) { // make bold //btnHeader.FontWeight = FontWeights.ExtraBold; } } catch (Exception ex) { MessageBox.Show(ex.Message); } break; default: break; } }