public Message MapMessage(UserMessages messageData) { return new Message { Text = messageData.FromMessage, Created = (DateTime) messageData.TimeStamp, FromMessage = messageData.FromMessage, FromUser = _userMapper.MapUser(messageData.User), ToUser = _userMapper.MapUser(messageData.User1) }; }
public void Should_Render_Succes_Info_Warning_And_Error_Message_Blocks() { UserMessages messages = new UserMessages(); messages.AddSuccess("Success test!"); messages.AddError("Error test 1!"); messages.AddError("Error test 2!"); Mock<CmsControllerBase> controller = new Mock<CmsControllerBase>(); controller .Setup(f => f.Messages) .Returns(messages); var context = new ViewContext(); context.Controller = controller.Object; IHtmlString box = new HtmlHelper(context, new ViewPage()).MessagesBox("bcms-test-id"); string html = box.ToHtmlString().Trim(); Assert.IsTrue(html.Contains("id=\"bcms-test-id\"")); Assert.IsTrue(html.Contains("Success test!")); Assert.IsTrue(html.Contains("Error test 1!")); Assert.IsTrue(html.Contains("Error test 2!")); }
/// <summary> /// 单次交接 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDYBG_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(支付单位ButtonEdit.Text)) { UserMessages.ShowInfoBox("请选要交接的客户名称!"); return; } if (string.IsNullOrEmpty(txt新会计.Text)) { UserMessages.ShowInfoBox("请选择交接会计!"); return; } if (string.IsNullOrEmpty(dateEdit交接起始月份.Text)) { UserMessages.ShowInfoBox("交接起始月份必须填写!"); return; } string clientName = 支付单位ButtonEdit.Text; string kuaiji = txt新会计.Text; DateTime JiaoJieDate = new DateTime(dateEdit交接起始月份.DateTime.Year, dateEdit交接起始月份.DateTime.Month, 1); try { proceedsDataSet1.JiaoJieOnce(kuaiji, NewKuaijiId, JiaoJieDate.ToString("yyyy-MM-dd"), clientName); UserMessages.ShowInfoBox("交接完成!"); } catch (Exception ex) { UserMessages.ShowInfoBox(ex.Message); } this.Close(); }
private void btnUpload_Click(object sender, EventArgs e) { try { FileDataSet dataset = this.fileDataSet; string fileType = "档案"; DataRowView rv = tW_BusinessRegBindingSource.Current as DataRowView; if (rv == null) { return; } bool wqSP = false; if (!string.IsNullOrEmpty(rv["外勤审批确认"].ToString())) { wqSP = bool.Parse(rv["外勤审批确认"].ToString()); } if (wqSP) { UserMessages.ShowInfoBox("审批完成不能修改文件!"); return; } string clientName = rv["公司预核名称"].ToString(); string fkID = businessDataSet.GetClientId(clientName); if (string.IsNullOrEmpty(fkID)) { UserMessages.ShowInfoBox("公司名称不存在客户信息中!"); return; } openFileDialog.DefaultExt = "图片文件 (*.jpg)|*.jpg;*.jpeg;*.png"; openFileDialog.Filter = "图片文件 (*.jpg)|*.jpg;*.jpeg;*.png"; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string[] fileNames = openFileDialog.FileNames; splash.ShowWaitForm(); foreach (string fileName in fileNames) { this.splash.SetWaitFormCaption("上传文件"); this.splash.SetWaitFormDescription("正在上传文件…"); FileStream fileStream = new FileStream(fileName, FileMode.Open); fileStream.Seek(0, SeekOrigin.Begin); Byte[] fileByte = new Byte[(int)fileStream.Length]; //转换字节流 fileStream.Read(fileByte, 0, fileByte.Length); dataset.AddImage(fileByte, fileName, fileType, fkID); dataset.SaveImage(); } } } catch (Exception ex) { UserMessages.ShowInfoBox(ex.Message); } finally { if (splash.IsSplashFormVisible) { splash.CloseWaitForm(); } } }
protected void btnSendMessage_Click(object source, EventArgs e) { string UserImageUrl; int UserCode = (int)Session["UserCode"]; UsersDataContext dc = new UsersDataContext(); UserMessages NewMessage = new UserMessages(); NewMessage.HCStatusCode = 2; NewMessage.Message = txtMessageContent.Text; NewMessage.FromUserCode = UserCode; NewMessage.SendDate = DateTime.Now; NewMessage.Title = txtMessageSubject.Text; NewMessage.ID = Tools.GetRandID(); NewMessage.ToUserCode = ToUserCode; dc.UserMessages.InsertOnSubmit(NewMessage); dc.SubmitChanges(); string jsScript = @"$('#divSendMessage').modal('hide');"; ScriptManager.RegisterStartupScript(_upanel, _upanel.GetType(), "divSendMessage", jsScript, true); #region Send Email UtilDataContext dcUtil = new UtilDataContext(); Users ToUser = dc.Users.SingleOrDefault(p => p.Code.Equals(ToUserCode)); EmailTemplates CurTemplate = dcUtil.EmailTemplates.SingleOrDefault(p => p.Title.Equals("SendMessage")); if (Tools.GetValue(ToUser.ISendMessage)) { if (CurTemplate != null) { string SiteDomain = ConfigurationSettings.AppSettings["SiteDomain"]; Users FromUser = dc.Users.SingleOrDefault(p => p.Code.Equals(UserCode)); Tools tools = new Tools(); string MsgBody = CurTemplate.Template; string MessageUrl = SiteDomain + "Users/Messages.aspx?ID=" + NewMessage.ID; if (FromUser.PicFile == null || FromUser.PicFile == "") { UserImageUrl = SiteDomain + "Files/Users/man_icon.gif"; } else { UserImageUrl = SiteDomain + "Files/Users/" + FromUser.PicFile; } string RemoveEmailUrl = SiteDomain + "Users/Setting.aspx"; MsgBody = MsgBody.Replace("[UserFullName]", Session["FirstName"].ToString() + " " + Session["LastName"].ToString()); MsgBody = MsgBody.Replace("[UserEmail]", FromUser.Email); MsgBody = MsgBody.Replace("[MessageUrl]", MessageUrl); MsgBody = MsgBody.Replace("[ImageUrl]", UserImageUrl); MsgBody = MsgBody.Replace("[RemoveEmailUrl]", RemoveEmailUrl); MsgBody = MsgBody.Replace("[RecFirstName]", ToUser.FirstName); MsgBody = MsgBody.Replace("[UserUrl]", SiteDomain + "Users/Profile.aspx?ID=" + FromUser.ID); MsgBody = MsgBody.Replace("[UserFirstName]", FromUser.FirstName); int FriendCount = dc.UserFriends.Where(p => p.UserCode.Equals(FromUser.Code)).Count(); int PhotoCount = dc.vUserAlbumPhotos.Where(p => p.UserCode.Equals(FromUser.Code)).Count(); MsgBody = MsgBody.Replace("[FriendCount]", FriendCount.ToString()); MsgBody = MsgBody.Replace("[PhotoCount]", PhotoCount.ToString()); string MsgSubject = Session["FirstName"].ToString() + " " + Session["LastName"].ToString() + " برای شما یک پیام در پارست ارسال کرده است"; bool SendResult = tools.SendEmail(MsgBody, MsgSubject, "<*****@*****.**>", ToUser.Email, "*****@*****.**", ""); } } #endregion pnlSendMessage.Visible = false; }
public bool CheckPayment() { DateTime beginDate = new DateTime(1900, 1, 1); if (string.IsNullOrEmpty(次到期月DateEdit.Text)) { UserMessages.ShowInfoBox("开始时间必须填写!"); return(false); } beginDate = 次到期月DateEdit.DateTime; DateTime endDate = new DateTime(1900, 1, 1); if (string.IsNullOrEmpty(本次到期月DateEdit.Text)) { UserMessages.ShowInfoBox("结束时间必须填写!"); return(false); } endDate = 本次到期月DateEdit.DateTime; //if ((beginDate < DateTime.Today && beginDate.Month != DateTime.Today.Month) && endDate>=DateTime.Today ) //{ // UserMessages.ShowInfoBox("补交款和预交款请分开收款!"); // return false ; //} if (beginDate.Year != endDate.Year) { UserMessages.ShowInfoBox("跨年费用请分开收款!"); return(false); } if (string.IsNullOrEmpty(支付单位ButtonEdit.Text.Trim())) { UserMessages.ShowInfoBox("支付单位不能为空!"); return(false); } //if (支付金额CalcEdit.Text == "" || 支付金额CalcEdit.Value <= 0) //{ // UserMessages.ShowInfoBox("支付金额必须大于0!"); // return false; //} decimal month = 0; if (!string.IsNullOrEmpty(缴费月数TextEdit.Text)) { month = decimal.Parse(缴费月数TextEdit.Text); } if (month == 0) { UserMessages.ShowInfoBox("缴费月数必须大于0"); return(false); } if (string.IsNullOrEmpty(支付方式ComboBoxEdit.Text)) { UserMessages.ShowInfoBox("支付方式必须填写!"); return(false); } //if (操作时间DateEdit.DateTime.Month == 本次到期月DateEdit.DateTime.Month && 操作时间DateEdit.DateTime.Month > 上次到期月DateEdit.DateTime.Month) //{ // MessageBox.Show("操作月份和补交款必须拆分成两笔收款!"); // return false; //} //decimal monthPrice = 0; //if (!string.IsNullOrEmpty(月平均费TextEdit.Text)) //{ // monthPrice = 月平均费TextEdit.Value; //} //if (monthPrice == 0) //{ // UserMessages.ShowInfoBox("月平均费必须大于0!"); // return false; //} return(true); }
void AddUserMessage(int ExtraLife, string Message, params object[] p) { var FormattedMessage = string.Format(Message, p); UserMessages.Add(new UserMessage(this, FormattedMessage, extra_life: ExtraLife)); }
public IActionResult Authenticate(string userName, string password) { var user = _dbAccessUser.GetUserByName(userName).ReturnedObject; if (user == null) { return(Content($"User {userName} is not registered")); } if (!_passwordValidationManager.UserLoginPasswordMatch(user, password)) { return(Content(UserMessages.InvalidPassword)); } return(View("GenericUserInformation", new GenericInformationModelView("Logged in!", UserMessages.LoginGreetings(userName)))); }
public override void executeUpdate(Object sender, EventArgs e) { switch (currentState) { case State.Wait: if (sender == theBoard.btnEndTurn) { //End turn. theBoard.addEventText(UserMessages.PlayerEndedTurn(theBoard.currentPlayer)); endExecution(); return; } else if (sender is Settlement) { Settlement location = (Settlement)sender; try { //Try to build the settlement/upgrade city. ((Settlement)sender).buildSettlement(theBoard.currentPlayer, true, true); //Take resources if (location.city()) { //take city resources Board.TheBank.takePayment(theBoard.currentPlayer, Bank.CITY_COST); theBoard.addEventText(UserMessages.PlayerBuiltACity(theBoard.currentPlayer)); theBoard.checkForWinner(); } else { //take settlement resources Board.TheBank.takePayment(theBoard.currentPlayer, Bank.SETTLEMENT_COST); theBoard.addEventText(UserMessages.PlayerPlacedASettlement(theBoard.currentPlayer)); theBoard.checkForWinner(); } } catch (BuildError be) { theBoard.addEventText(be.Message); } } else if (sender is Road) { //Try to build the road try { ((Road)sender).buildRoad(theBoard.currentPlayer, true); //Take the resources. Board.TheBank.takePayment(theBoard.currentPlayer, Bank.ROAD_COST); theBoard.addEventText(UserMessages.PlayerPlacedARoad(theBoard.currentPlayer)); //RUN LONGEST ROAD CHECK theBoard.checkForWinner(); } catch (BuildError be) { theBoard.addEventText(be.Message); } } else if (sender == theBoard.pbBuildDevelopmentCard) { //We want to give the player a development card. try { DevelopmentCard devC = Board.TheBank.purchaseDevelopmentCard(theBoard.currentPlayer); devC.setPlayable(false); theBoard.currentPlayer.giveDevelopmentCard(devC); Board.TheBank.takePayment(theBoard.currentPlayer, Bank.DEV_CARD_COST); theBoard.addEventText(UserMessages.PlayerPurchasedADevCard(theBoard.currentPlayer)); theBoard.checkForWinner(); } catch (BuildError be) { theBoard.addEventText(be.Message); } } else if (sender is DevelopmentCard) { DevelopmentCard card = (DevelopmentCard)sender; if (card.isPlayable()) { switch (card.getType()) { case DevelopmentCard.DevCardType.Road: //Player is allowed to place two roads for no cost RoadBuildingEvt evt = new RoadBuildingEvt(); evt.beginExecution(theBoard, this); disableEventObjects(); //Remove this card from the player's hand. theBoard.currentPlayer.takeDevelopmentCard(card.getType()); break; case DevelopmentCard.DevCardType.Plenty: //Player is allowed to take any two resources from the bank YearOfPlentyEvt yr = new YearOfPlentyEvt(); yr.beginExecution(theBoard, this); disableEventObjects(); //Remove this card from the player's hand. They DO NOT go back to the bank theBoard.currentPlayer.takeDevelopmentCard(card.getType()); break; case DevelopmentCard.DevCardType.Knight: //Launch the thief event if (!card.used) { ThiefEvt thevt = new ThiefEvt(); thevt.beginExecution(theBoard, this); disableEventObjects(); card.used = true; theBoard.checkForWinner(); } break; case DevelopmentCard.DevCardType.Monopoly: //Player names a resource, all players give this player that resource they carry MonopolyEvt monEvt = new MonopolyEvt(); monEvt.beginExecution(theBoard, this); disableEventObjects(); //Remove this card from the player's hand. They DO NOT go back to the bank theBoard.currentPlayer.takeDevelopmentCard(card.getType()); break; } } else { if (card.getType() != DevelopmentCard.DevCardType.Victory) { theBoard.addEventText("You must wait until the next turn to play that card."); } } } else if (sender is Harbor) { Harbor hb = (Harbor)sender; if (hb.playerHasValidSettlement(theBoard.currentPlayer)) { if (TradeWindow.canPlayerTradeWithHarbor(hb, theBoard.currentPlayer)) { disableEventObjects(); tradeWindow = new TradeWindow(); tradeWindow.loadHarborTrade(hb, theBoard.currentPlayer); tradeWindow.Closing += onTradeEnded; currentState = State.Trade; tradeWindow.Show(); } else { theBoard.addEventText(BuildError.NOT_ENOUGH_RESOURCES); } } else { theBoard.addEventText(UserMessages.PlayerDoesNotHaveAdjascentSettlement); } } else if (sender is TradeProposition) { var proposition = (TradeProposition)sender; Board.TheBank.tradeWithBank( theBoard.currentPlayer, proposition, theBoard.getPlayerBankCosts(theBoard.currentPlayer) ); theBoard.addEventText($"{theBoard.currentPlayer.getName()} traded {proposition.selledResource} for {proposition.boughtResource}"); } break; case State.Trade: //Should not be able to reach this statement. break; } //if (theBoard.currentPlayer.isAI) //{ // var move = theBoard.currentPlayer.agent.makeMove(theBoard.getBoardState()); // executeUpdate(move, null); //} }
public override void executeUpdate(Object sender, EventArgs e) { //Determines if this is only the first pass or the second pass. bool firstPass = !(playerNum + 1 > theBoard.playerPanels.Count()); //Determine what player is placing the settlement || road. Player p = theBoard.playerOrder[playerTurnOrder[playerNum]]; //Determine what the player is trying to do. if (sender is Settlement) { //Check if the player has any more settlements they are allowed to build. if ((firstPass && p.getSettlementCount() < 1) || (!firstPass && p.getSettlementCount() < 2)) { try { ((Settlement)sender).buildSettlement(p, false, false); theBoard.addEventText(UserMessages.PlayerPlacedASettlement(p)); theBoard.checkForWinner(); } catch (BuildError be) { theBoard.addEventText(be.Message); } } else { theBoard.addEventText("You may not place any more settlements."); } if (theBoard.currentPlayer.isAI) { disableEventObjects(); Road road = theBoard.currentPlayer.agent.placeFreeRoad(theBoard.getBoardState()); executeUpdate(road, null); return; } else { enableEventObjects(); } } else if (sender is Road) { //Check if the player is allowed to build another road. if ((firstPass && p.getRoadCount() < 1) || (!firstPass && p.getRoadCount() < 2)) { try { ((Road)sender).buildRoad(p, false); theBoard.addEventText(UserMessages.PlayerPlacedARoad(p)); theBoard.checkForWinner(); } catch (BuildError be) { theBoard.addEventText(be.Message); } } else { theBoard.addEventText("You may not place any more roads."); } } //Move to the next player in the turn order only when the previous player has both the settlement and road built. if (firstPass && p.getSettlementCount() == 1 && p.getRoadCount() == 1 || !firstPass && p.getSettlementCount() == 2 && p.getRoadCount() == 2) { playerNum++; if (playerNum >= playerTurnOrder.Count) { theBoard.addEventText("All players have placed their settlements and roads!"); endExecution(); } else { firstPass = !(playerNum + 1 > theBoard.playerPanels.Count()); theBoard.addEventText("Player " + theBoard.playerOrder[playerTurnOrder[playerNum]].getName() + " please place your " + (firstPass? "first" : "second") + " settlement and road."); theBoard.currentPlayer = theBoard.playerOrder[playerTurnOrder[playerNum]]; if (theBoard.currentPlayer.isAI) { disableEventObjects(); Settlement settlement = theBoard.currentPlayer.agent.placeFreeSettlement(theBoard.getBoardState()); executeUpdate(settlement, null); return; } else { enableEventObjects(); } } } }
private void btnQuery_Click(object sender, EventArgs e) { splash.ShowWaitForm(); splash.SetWaitFormCaption("查询"); splash.SetWaitFormDescription("正在查询……"); this.Cursor = Cursors.WaitCursor; try { salaryDataSet.DBHelper.WangDaSer.UpdateUserID(); int year = int.Parse(YearComboBoxEdit.Text); int month = int.Parse(monthComboBoxEdit.Text); if (Security.UserBusiness.Contains("总经理") || Security.UserBusiness.Contains("主管")) { salaryDataSet.GetRegSum(year, month, ""); salaryDataSetYW.GetAllBusinessSumZC2021(year, month, "", ""); foreach (DataRow row in salaryDataSetYW.VW_AllBusinessSalary.Rows) { string userName = row["员工"].ToString(); decimal sumPrice = decimal.Parse(row["提成汇总"].ToString()); decimal czb = decimal.Parse(row["成长版"].ToString()); decimal czbtc = decimal.Parse(row["成长版提成"].ToString()); decimal ycx = decimal.Parse(row["其他一次性业务"].ToString()); decimal ycxtc = decimal.Parse(row["其他一次性业务提成"].ToString()); decimal jx = 0; DataRow[] selRows = salaryDataSet.VW_AllBusinessSalary.Select(string.Format("员工='{0}'", userName)); foreach (DataRow selRow in selRows) { selRow.BeginEdit(); selRow["业务提成"] = sumPrice; selRow["成长版"] = czb; selRow["成长版提成"] = czbtc; selRow["其他一次性业务"] = ycx; selRow["其他一次性业务提成"] = ycxtc; selRow["绩效"] = jx; selRow.EndEdit(); selRow.AcceptChanges(); } } } else { salaryDataSet.GetRegSum(year, month, Security.UserName); salaryDataSetYW.GetAllBusinessSumZC2021(year, month, Security.UserID, Security.UserName); DataRow vRow = salaryDataSetYW.VW_AllBusinessSalary.Rows[0]; decimal sumPrice = decimal.Parse(vRow["提成汇总"].ToString()); decimal czb = decimal.Parse(vRow["成长版"].ToString()); decimal czbtc = decimal.Parse(vRow["成长版提成"].ToString()); decimal ycx = decimal.Parse(vRow["其他一次性业务"].ToString()); decimal ycxtc = decimal.Parse(vRow["其他一次性业务提成"].ToString()); decimal jx = 0; if (sumPrice > 0 && salaryDataSet.VW_AllBusinessSalary.Rows.Count > 0) { DataRow row = salaryDataSet.VW_AllBusinessSalary.Rows[0]; row.BeginEdit(); row["业务提成"] = sumPrice; row["成长版"] = czb; row["成长版提成"] = czbtc; row["其他一次性业务"] = ycx; row["其他一次性业务提成"] = ycxtc; row["绩效"] = jx; row.EndEdit(); row.AcceptChanges(); } } } catch (Exception ex) { UserMessages.ShowInfoBox(ex.Message); } finally { this.Cursor = Cursors.Default; if (splash.IsSplashFormVisible) { splash.CloseWaitForm(); } } }
public void Add(UserMessages message) { _entities.UserMessages.AddObject(message); }
public void Delete(UserMessages entity) { throw new NotImplementedException(); }
/* * A bit of an odd workaround for the issue of having no way to handle exceptions from buttons firing these * methods. */ public void exec(object sender, EventArgs e) { //Check switch (state) { case 0: if (sender is NumberChip) { NumberChip nc = (NumberChip)sender; //Check if the player has selected the desert if (Board.THIEF_MUST_MOVE && nc.isBlocked()) { throw new ThiefException(ThiefException.THIEF_CANNOT_STAY); } if (Board.THIEF_CANNOT_GO_HOME && nc.getNumber() == 0) { throw new ThiefException(ThiefException.THIEF_CANNOT_GO_DESERT); } theBoard.addEventText(UserMessages.RobberHasMoved(theBoard.currentPlayer)); oldThiefLocation.removeThief(); nc.placeThief(); oldThiefLocation = nc; if (chitHasPlayers()) { state++; theBoard.addEventText(UserMessages.PLAYER_STEAL_RESOURCES); } else { endExecution(); } } break; case 1: if (!(sender is Settlement)) { //We only run this check in case something did not clean up properly from a previous event. return; } //We check if the settlement is actually adjascent to the thief. if (!terrainTileWithThief.hasSettlement((Settlement)sender)) { throw new ThiefException(ThiefException.CANT_STEAL_FROM_PLAYER); } //Get the player at the chosen location (sender is that location) Player playerToStealFrom = ((Settlement)sender).getOwningPlayer(); //Check if there is a player at the location. if (playerToStealFrom == null) { throw new ThiefException(ThiefException.NO_PLAYER); } //Check if the player is not the current player. if (playerToStealFrom == theBoard.currentPlayer) { throw new ThiefException(ThiefException.YOU_OWN_THIS_SETTLEMENT); } //At this point we can safely assume a card can be taken. ResourceCard rCard = playerToStealFrom.takeRandomResource(); //We check if the card is null because if the player has no cards to give takeRandomResource() returns null. if (rCard != null) { //What happens if there were cards to steal theBoard.currentPlayer.giveResource(playerToStealFrom.takeRandomResource()); theBoard.addEventText(UserMessages.PlayerGotResourceFromPlayer(theBoard.currentPlayer, playerToStealFrom, rCard.getResourceType())); state++; endExecution(); } else { //What happens if there were no cards to steal. theBoard.addEventText(UserMessages.PlayerGoNoResourceFromPlayer(theBoard.currentPlayer, playerToStealFrom)); state++; endExecution(); } break; } }
public DisplayMessageViewModel(UserMessages userMessages) { InitFields(userMessages); }
public static DisplayMessageViewModel FormMessageToDisplay(UserMessages userMessages) { var model = new DisplayMessageViewModel(userMessages); return(model); }
public bool CheckPayment() { DateTime beginDate = new DateTime(1900, 1, 1); if (string.IsNullOrEmpty(次到期月DateEdit.Text)) { UserMessages.ShowInfoBox("开始时间必须填写!"); return(false); } beginDate = 次到期月DateEdit.DateTime; DateTime endDate = new DateTime(1900, 1, 1); if (string.IsNullOrEmpty(本次到期月DateEdit.Text)) { UserMessages.ShowInfoBox("结束时间必须填写!"); return(false); } endDate = 本次到期月DateEdit.DateTime; //if ((beginDate < DateTime.Today && beginDate.Month != DateTime.Today.Month) && endDate>=DateTime.Today ) //{ // UserMessages.ShowInfoBox("补交款和预交款请分开收款!"); // return false ; //} if (beginDate.Year != endDate.Year) { UserMessages.ShowInfoBox("跨年费用请分开收款!"); return(false); } if (!string.IsNullOrEmpty(endPayDate)) { DateTime pDate = DateTime.Parse(endPayDate); if (endDate > pDate && pDate > beginDate) { UserMessages.ShowInfoBox(string.Format("首年业务提成期是{0},请将收款已这个时间分开!", pDate)); return(false); } } if (string.IsNullOrEmpty(支付单位ButtonEdit.Text.Trim())) { UserMessages.ShowInfoBox("支付单位不能为空!"); return(false); } //if (支付金额CalcEdit.Text == "" || 支付金额CalcEdit.Value <= 0) //{ // UserMessages.ShowInfoBox("支付金额必须大于0!"); // return false; //} decimal month = 0; if (!string.IsNullOrEmpty(缴费月数TextEdit.Text)) { month = decimal.Parse(缴费月数TextEdit.Text); } if (month == 0) { UserMessages.ShowInfoBox("缴费月数必须大于0"); return(false); } if (string.IsNullOrEmpty(支付方式ComboBoxEdit.Text)) { UserMessages.ShowInfoBox("支付方式必须填写!"); return(false); } decimal monthPrice = 0; if (!string.IsNullOrEmpty(月平均费TextEdit.Text)) { monthPrice = 月平均费TextEdit.Value; } //if (monthPrice == 0) //{ // UserMessages.ShowInfoBox("月平均费必须大于0!"); // return false; //} return(true); }
public async Task RunCore() { _mutantDetailsController.Initialize(); _currentSession = new MutationTestingSession { Filter = _choices.Filter, Choices = _choices, }; if (_choices.TestAssemblies.All(n => n.IsIncluded == false)) //if (_choices.TestAssemblies.Select(a => a.TestsLoadContext.SelectedTests.TestIds.Count).Sum() == 0) { throw new NoTestsSelectedException(); } _log.Info("Initializing test environment..."); _log.Info("Creating pure mutant for initial checks..."); AssemblyNode assemblyNode; Mutant changelessMutant = _mutantsContainer.CreateEquivalentMutant(out assemblyNode); _sessionEventsSubject.OnNext(new MutationFinishedEventArgs(OperationsState.MutationFinished) { MutantsGrouped = assemblyNode.InList(), }); var verifiEvents = _sessionEventsSubject .OfType <MutantVerifiedEvent>() .Subscribe(e => { if (e.Mutant == changelessMutant && !e.VerificationResult) { _svc.Logging.ShowWarning(UserMessages.ErrorPretest_VerificationFailure( changelessMutant.MutantTestSession.Exception.Message)); } }); IObjectRoot <TestingMutant> testingMutant = _testingMutantFactory .CreateWithParams(_sessionEventsSubject, changelessMutant); var result = await testingMutant.Get.RunAsync(); verifiEvents.Dispose(); _choices.MutantsTestingOptions.TestingTimeoutSeconds = (int)((3 * changelessMutant.MutantTestSession.TestingTimeMiliseconds) / 1000 + 1); bool canContinue = CheckForTestingErrors(changelessMutant); if (!canContinue) { throw new TestingErrorsException(); } await Task.Run(() => { CreateMutants(); RunTests(); }); }
public void EnqueueFirst(Actor.Envelope envelope) { UserMessages.EnqueueFirst(envelope); }
public void PostUserMessage(object msg) { UserMessages.Add(msg); _invoker?.InvokeUserMessageAsync(msg).Wait(); }
public async Task <ServiceResultModel <UserModifyPostModel> > ModifyUser(UserModifyPostModel model, string id, IFormFile file) { var result = new ServiceResultModel <UserModifyPostModel>(); var user = await userManager.FindByIdAsync(id); if (user != null && !user.Deleted) { var errorMessage = ValidateUserData(model.Email, model.Username, user.UserName); if (errorMessage != null) { result.Error = true; result.ErrorMessage = errorMessage; } else { if (model.Password != null && model.Password.Length >= passwordMinimumLenght) { var isPasswordValid = await userManager.CheckPasswordAsync(user, model.Password); if (!isPasswordValid) { var token = await userManager.GeneratePasswordResetTokenAsync(user); await userManager.ResetPasswordAsync(user, token, model.Password); } } user.UpdatedAt = DateTime.Now; user.UserName = model.Username; user.Email = model.Email; user.FullName = model.FullName; user.Phone = model.Phone; user.Address = model.Address; user.Avatar = model.AvatarFile != null ? model.Avatar : await fileService.GenerateFileSource(file, userAvatarsFolderName, model.Username.ToLower()); user.City = model.City; user.Country = model.Country; user.PostalCode = model.PostalCode; var updateResult = await userManager.UpdateAsync(user); if (updateResult.Succeeded) { result.DataResult = model; } else { result.Error = true; result.ErrorMessage = UserMessages.ModifyUserError(); } } } else { result.Error = true; result.ErrorMessage = UserMessages.UserNotExist(); } return(result); }
private void FrmRePassWord_FormClosing(object sender, FormClosingEventArgs e) { try { if (this.DialogResult == DialogResult.Cancel) { e.Cancel = false; return; } if (txtNewPassWord.Text != txtReNewPassWord.Text || (txtNewPassWord.Text == "" || txtReNewPassWord.Text == "")) { if (UserMessages.ShowQuestionBox("新密码不一致,需要重新输入吗?")) { e.Cancel = true; } else { e.Cancel = false; } return; } if (txtOldPassWord.Text != "") { //SysLogin LoginSer = new SysLogin(); DataSet ds = SysTools.config.GetUserInfo(Security.UserID); if (ds.Tables[0].Rows.Count > 0) { DataRow row = ds.Tables[0].Rows[0]; if (row["LogPassword"].ToString() == EnDecrypt.Encrypt(txtOldPassWord.Text)) { //更新密码 row.BeginEdit(); row["LogPassword"] = EnDecrypt.Encrypt(txtNewPassWord.Text); row.EndEdit(); SysTools.config.SaveTable(ds, "TCOM_USER"); } } else { UserMessages.ShowErrorBox("用户信息无效,请于系统管理员联系!"); e.Cancel = true; } } else { if (UserMessages.ShowQuestionBox("没有输入旧密码,需要重新输入吗?")) { e.Cancel = true; } else { e.Cancel = false; } return; } } catch (Exception ex) { UserMessages.ShowErrorBox(ex.Message); } }
public override void executeUpdate(Object sender, EventArgs e) { switch (state) { case 0: Player p = playersToRoll[rollPosition]; int roll = theBoard.dice.getRollValue(); theBoard.addEventText(UserMessages.PlayerRolledANumber(p, roll)); playerRolls.Add(roll); rollPosition++; if (rollPosition >= playersToRoll.Count) { state++; executeUpdate(sender, e); } else { p = playersToRoll[rollPosition]; theBoard.addEventText(UserMessages.PlayerDiceRollPrompt(p)); theBoard.currentPlayer = p; if (p.isAI) { theBoard.dice.roll(); executeUpdate(sender, e); } else { enableEventObjects(); } } break; case 1: //Tie prevention int max = 0; int playerInd = 0; bool tieDetected = false; for (int ind = 0; ind < playersToRoll.Count; ind++) { if (playerRolls[ind] > max) { tieDetected = false; playerInd = ind; max = playerRolls[ind]; } else if (playerRolls[ind] == max) { tieDetected = true; } } if (tieDetected) { theBoard.addEventText(UserMessages.THERE_WAS_A_TIE); //There was a tie. Reset all things for another roll... List <Player> newPlayers = new List <Player>(); for (int ind = 0; ind < playersToRoll.Count; ind++) { if (playerRolls[ind] == max) { newPlayers.Add(playersToRoll[ind]); theBoard.addEventText(playersToRoll[ind].getName()); } } rollPosition = 0; playerRolls.Clear(); playersToRoll.Clear(); playersToRoll = newPlayers; state = 0; theBoard.addEventText(UserMessages.PlayerDiceRollPrompt(playersToRoll[0])); if (playersToRoll[0].isAI) { theBoard.dice.roll(); executeUpdate(sender, e); } else { enableEventObjects(); } } else { //All was good the first player is *drumroll* theBoard.firstPlayer = playersToRoll[playerInd]; theBoard.addEventText(UserMessages.PlayerWinsDiceRoll(theBoard.firstPlayer)); endExecution(); } break; } }
public IHttpActionResult create([FromBody] _Message _message) { #region User Validation int user_id = Users.GetUserId(User); // get User Users user = db.users.Find(user_id); if (user == null) { return(NotFound()); } //Check user exist if (!db.users.Any(u => u.id == _message.user_id)) { return(NotFound()); } #endregion if (user_id == _message.user_id) { ExceptionThrow.Throw("Geçersiz mesaj istediği.", System.Net.HttpStatusCode.Forbidden); } List <_MessageDetail> msgList = new List <_MessageDetail>(); _MessageDetail msgDetail = new _MessageDetail() { date = DateTime.Now, fullname = user.name + " " + user.lastname, message = _message.message }; msgList.Add(msgDetail); //Create Message Messages message = new Messages() { last_message = new JavaScriptSerializer().Serialize(msgDetail), messages = new JavaScriptSerializer().Serialize(msgList), last_message_on = DateTime.Now }; db.messages.Add(message); db.SaveChanges(); //create User Messages UserMessages userMessage_Sender = new UserMessages() { is_owner = true, user_id = user_id, message_id = message.id, last_view = DateTime.Now }; UserMessages userMessage_Recipient = new UserMessages() { user_id = _message.user_id, message_id = message.id }; db.user_messages.Add(userMessage_Sender); db.user_messages.Add(userMessage_Recipient); db.SaveChanges(); Socket.Emit(_message.user_id, "message", new { id = message.id, message = msgDetail, last_view = DBNull.Value, user = new { fullname = user.name + " " + user.lastname, photo = user?.getPhotosUrl() } }); return(Ok(message)); }
private void deleteUserToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show(UserMessages.ARE_YOU_SURE("Delete , This can't be undo"), UserMessages.CONFIRMION("Delete"), MessageBoxButtons.YesNo) == DialogResult.Yes) { AuthForm authForm = new AuthForm(); userDTO.delete(user.getId()); AuthenticationDTOImplementation.getInstance().delete(user.getUsername()); authForm.Show(); authForm.Activate(); authForm.Shown += (o, ev) => this.Close(); } }
private void btnQuery_Click(object sender, EventArgs e) { splash.ShowWaitForm(); splash.SetWaitFormCaption("查询"); splash.SetWaitFormDescription("正在查询……"); this.Cursor = Cursors.WaitCursor; try { salaryDataSet1.DBHelper.WangDaSer.UpdateUserID(); int year = int.Parse(yearSpinEdit.Text); int month = int.Parse(monthComboBoxEdit.Text); if (Security.UserBusiness.Contains("总经理") || Security.UserBusiness.Contains("主管")) { salaryDataSet1.GetAccountantSum(year, month, "", ""); salaryDataSet2.GetAllBusinessSumOther2021(year, month, "", "", ""); salaryDataSet1.GetGongbenKaipiao(year, "", ""); foreach (DataRow row in salaryDataSet2.VW_AllBusinessSalary.Rows) { string userName = row["员工"].ToString(); decimal sumPrice = decimal.Parse(row["做账提成"].ToString()); decimal zcdsumPrice = decimal.Parse(row["注册提成"].ToString()); decimal czb = decimal.Parse(row["成长版"].ToString()); decimal czbtc = decimal.Parse(row["成长版提成"].ToString()); decimal ycx = decimal.Parse(row["其他一次性业务"].ToString()); decimal ycxtc = decimal.Parse(row["其他一次性业务提成"].ToString()); decimal jx = 0; DataRow[] selRows = salaryDataSet1.VW_AllAccountantSalary.Select(string.Format("员工='{0}'", userName)); foreach (DataRow selRow in selRows) { selRow.BeginEdit(); // selRow["业务提成"] = sumPrice + zcdsumPrice; 算注册提成 selRow["业务提成"] = sumPrice; //纯业务提成 selRow["成长版"] = czb; selRow["成长版提成"] = czbtc; selRow["其他一次性业务"] = ycx; selRow["其他一次性业务提成"] = ycxtc; selRow["绩效"] = jx; selRow.EndEdit(); selRow.AcceptChanges(); } } } else if (Security.UserBusiness.Contains("二级部门经理")) { salaryDataSet1.GetGongbenKaipiao(year, "", Security.DeptName); salaryDataSet1.GetAccountantSum(year, month, "", Security.DeptID); //获取做账提层 salaryDataSet2.GetAllBusinessSumOther2021(year, month, "", "", Security.DeptID); //获取业务提成 //合并计算提层 foreach (DataRow row in salaryDataSet2.VW_AllBusinessSalary.Rows) { string userName = row["员工"].ToString(); decimal sumPrice = decimal.Parse(row["做账提成"].ToString()); decimal zcdsumPrice = decimal.Parse(row["注册提成"].ToString()); decimal czb = decimal.Parse(row["成长版"].ToString()); decimal czbtc = decimal.Parse(row["成长版提成"].ToString()); decimal ycx = decimal.Parse(row["其他一次性业务"].ToString()); decimal ycxtc = decimal.Parse(row["其他一次性业务提成"].ToString()); decimal jx = 0; DataRow[] selRows = salaryDataSet1.VW_AllAccountantSalary.Select(string.Format("员工='{0}'", userName)); foreach (DataRow selRow in selRows) { selRow.BeginEdit(); //selRow["业务提成"] = sumPrice + zcdsumPrice; 业务+注册 selRow["业务提成"] = sumPrice; //纯业务提成 selRow["成长版"] = czb; selRow["成长版提成"] = czbtc; selRow["其他一次性业务"] = ycx; selRow["其他一次性业务提成"] = ycxtc; selRow["绩效"] = jx; selRow.EndEdit(); selRow.AcceptChanges(); } } } else { salaryDataSet1.GetGongbenKaipiao(year, Security.UserID, ""); salaryDataSet1.GetAccountantSum(year, month, Security.UserName, ""); salaryDataSet2.GetAllBusinessSumOther2021(year, month, Security.UserID, Security.UserName, ""); DataRow arow = salaryDataSet2.VW_AllBusinessSalary.Rows[0]; decimal sumPrice = decimal.Parse(arow["做账提成"].ToString()); decimal zcdsumPrice = decimal.Parse(arow["注册提成"].ToString()); decimal czb = decimal.Parse(arow["成长版"].ToString()); decimal czbtc = decimal.Parse(arow["成长版提成"].ToString()); decimal ycx = decimal.Parse(arow["其他一次性业务"].ToString()); decimal ycxtc = decimal.Parse(arow["其他一次性业务提成"].ToString()); decimal jx = 0; if (sumPrice > 0 && salaryDataSet1.VW_AllAccountantSalary.Rows.Count > 0) { DataRow row = salaryDataSet1.VW_AllAccountantSalary.Rows[0]; row.BeginEdit(); // row["业务提成"] = sumPrice+zcdsumPrice; 业务+注册 row["业务提成"] = sumPrice; //纯业务 row["成长版"] = czb; row["成长版提成"] = czbtc; row["其他一次性业务"] = ycx; row["其他一次性业务提成"] = ycxtc; row["绩效"] = jx; row.EndEdit(); row.AcceptChanges(); } } //if (Security.UserBusiness.Contains("二级部门经理")) //{ //获取会计经理团队提成 DataSet tddst = salaryDataSet1.GetAllBusinessGroupTC2021(year, month, Security.UserID, Security.UserName, ""); foreach (DataRow row in tddst.Tables["TW_SalarySumAll"].Rows) { string tdtc = row["经理提成"].ToString(); //业务团队提成 decimal tdywtc = decimal.Parse(tdtc); string groupdeptId = row["DEPTID"].ToString(); string jlUserid = row["USERID"].ToString(); DataRow[] selRows = salaryDataSet1.VW_AllAccountantSalary.Select(string.Format("DEPTID='{0}' and 员工ID='{1}' ", groupdeptId, jlUserid)); foreach (DataRow selRow in selRows) { //if (selRow["员工"].ToString() == Security.UserName) //{ selRow.BeginEdit(); selRow["业务团队提成"] = tdywtc; decimal zztdtc = decimal.Parse(selRow["团队提成"].ToString()); //做账总提成 //selRow["团队总提成"] = tdywtc + zztdtc; //做账+业务提成 selRow.EndEdit(); selRow.AcceptChanges(); //} } } //} } catch (Exception ex) { UserMessages.ShowInfoBox(ex.Message); } finally { this.Cursor = Cursors.Default; if (splash.IsSplashFormVisible) { splash.CloseWaitForm(); } } }
void AddUserMessage(string Message, params object[] p) { var FormattedMessage = string.Format(Message, p); UserMessages.Add(new UserMessage(this, FormattedMessage)); }
public UserService(IUnitOfWork unitOfWork, UserMessages messages) { this.unitOfWork = unitOfWork; Messages = messages; }
public async Task <MutationSessionChoices> Run(MethodIdentifier singleMethodToMutate = null, List <string> testAssemblies = null, bool auto = false) { _sessionCreationWindowShowTime = DateTime.Now; SessionCreator sessionCreator = _sessionCreatorFactory.Create(); Task <List <CciModuleSource> > assembliesTask = _sessionConfiguration.LoadAssemblies(); // Task<List<MethodIdentifier>> coveringTask = sessionCreator.FindCoveringTests(assembliesTask, matcher); Task <TestsRootNode> testsTask = _sessionConfiguration.LoadTests(); ITestsSelectStrategy testsSelector; bool constrainedMutation = false; ICodePartsMatcher matcher; if (singleMethodToMutate != null) { matcher = new CciMethodMatcher(singleMethodToMutate); testsSelector = new CoveringTestsSelectStrategy(assembliesTask, matcher, testsTask); constrainedMutation = true; } else { testsSelector = new AllTestsSelectStrategy(testsTask); matcher = new AllMatcher(); } _log.Info("Selecting tests in assemblies: " + testAssemblies.MakeString()); var testsSelecting = testsSelector.SelectTests(testAssemblies); var t1 = sessionCreator.GetOperators(); var t2 = sessionCreator.BuildAssemblyTree(assembliesTask, constrainedMutation, matcher); var t11 = t1.ContinueWith(task => { _viewModel.MutationsTree.MutationPackages = new ReadOnlyCollection <PackageNode>(task.Result.Packages); }, CancellationToken.None, TaskContinuationOptions.NotOnFaulted, _execute.GuiScheduler); var t22 = t2.ContinueWith(task => { if (_typesManager.IsAssemblyLoadError) { _svc.Logging.ShowWarning(UserMessages.WarningAssemblyNotLoaded()); } var assembliesToMutate = task.Result.Where(a => !testAssemblies.ToEmptyIfNull().Contains(a.AssemblyPath.Path)).ToList(); //assembliesToMutate = ClassCoverage.UnmarkNotCovered(assembliesToMutate,testAssemblies); _viewModel.TypesTreeMutate.Assemblies = new ReadOnlyCollection <AssemblyNode>(assembliesToMutate); _whiteSource = assembliesTask.Result; }, CancellationToken.None, TaskContinuationOptions.NotOnFaulted, _execute.GuiScheduler); var t33 = testsSelecting.ContinueWith(task => { _viewModel.TypesTreeToTest.TestAssemblies = new ReadOnlyCollection <TestNodeAssembly>(task.Result); if (_options.UseCodeCoverage) { ClassCoverage.UnmarkNotCovered(_viewModel.TypesTreeMutate.Assemblies, _viewModel.TypesTreeToTest.TestAssemblies); } }, CancellationToken.None, TaskContinuationOptions.NotOnFaulted, _execute.GuiScheduler); try { var mainTask = Task.WhenAll(t1, t2, testsSelecting, t11, t22, t33).ContinueWith(t => { if (t.Exception != null) { ShowError(t.Exception); _viewModel.Close(); tcs.TrySetCanceled(); } }, _execute.GuiScheduler); var wrappedTask = Task.WhenAll(tcs.Task, mainTask); if (_sessionConfiguration.AssemblyLoadProblem) { new TaskFactory(_dispatcher.GuiScheduler) .StartNew(() => _svc.Logging.ShowWarning(UserMessages.WarningAssemblyNotLoaded())); } return(await WaitForResult(auto, wrappedTask)); } catch (Exception e) { _log.Error(e); throw; } }
public int SaveUserMessage(UserMessages message) { _context.UserMessages.Add(message); _context.SaveChanges(); return(message.MessageId); }
internal static string FormatMessage(AsyncValidator source) { return(UserMessages.AsyncValidationFault_FormatMessage(source.DisplayName, source.Exception.Message)); }
//UPDATE LOGIC public override void Update(GameTime gametime) { SnowShower.Update(gametime); if (GameRelated.GameOver == false) { //START THE GAME if (keyboard.space()) { Pause = false; } } if (Pause == false) { UserMessages message; //USED TO TELL THE USER WHEN THEY HAVE SAVED OR LOADED SnowTrailL.Update(gametime); SnowTrailR.Update(gametime); //SAVING if (keyboard.s()) { mainGame.Save(); mainGame.Reset(); mainGame.Pause = true; message = new UserMessages(true); } //LOADING if (keyboard.r()) { mainGame.Reset(); mainGame.Load(); mainGame.Pause = true; message = new UserMessages(false); } Function.time.update(gametime); GameRelated.speedUp(); //SPEEDS UP THE GAME OVER TIME } //NEW GAME if (keyboard.n()) { userPrompts.Active = true; Pause = true; //RESET Reset(); Res.Reset(this); ResetParticles(); } //QUIT GAME if (keyboard.q()) { Pause = true; mainGame.Active = false; menu.Active = true; //RESET Reset(); Res.Reset(this); ResetParticles(); userPrompts.Active = false; } base.Update(gametime); }
public UserMessages SaveUserMessages(UserMessages userMessages) { DataContext.Set <UserMessages>().Add(userMessages); return(userMessages); }
/// <summary> /// 选择收款单位 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSelectUnit_Click(object sender, EventArgs e) { if (frmclientDlg.ShowDialog() == DialogResult.OK) { var dst = frmclientDlg.selCsDataSet; var row = dst.TW_Client.Rows[0]; paymentRow.BeginEdit(); paymentRow.客户名称ID = row["客户名称ID"].ToString(); paymentRow.支付单位 = row["客户名称"].ToString(); paymentRow.业务员 = row["业务员"].ToString(); paymentRow.业务员ID = row["业务员ID"].ToString(); paymentRow.注册员 = row["注册员"].ToString(); paymentRow.注册员ID = row["注册员ID"].ToString(); if (paymentRow.Is做账会计Null()) { paymentRow.做账会计 = row["做账会计"].ToString(); paymentRow.做账会计ID = row["做账会计ID"].ToString(); } else { if (paymentRow.做账会计ID != row["做账会计ID"].ToString()) { if (UserMessages.ShowQuestionBox("做账会计要变更为:" + row["做账会计"].ToString() + "么?")) { paymentRow.做账会计 = row["做账会计"].ToString(); paymentRow.做账会计ID = row["做账会计ID"].ToString(); } } } paymentRow.注册提成月 = 0; paymentRow.业务提成月 = 0; paymentRow.做账提成月 = 0; paymentRow.做账团队提成 = 0; paymentRow.业务团队提成 = 0; paymentRow.做账主管提成 = 0; paymentRow.注册团队提成 = 0; paymentRow.注册年提成 = 0; paymentRow.业务年提成 = 0; paymentRow.工本开票提成 = 0; paymentRow.做账业务团队提成 = 0; paymentRow.零申报 = false; if (!string.IsNullOrEmpty(row["费用到期月份"].ToString())) { // paymentRow.上次到期月份 = DateTime.Parse(row["费用到期月份"].ToString()); DateTime scDate = DateTime.Parse(row["费用到期月份"].ToString()); if (scDate.Day == 28 || scDate.Day == 29 || scDate.Day == 30 || scDate.Day == 31) { DateTime startDate = scDate.AddMonths(1); startDate = new DateTime(startDate.Year, startDate.Month, 1); paymentRow.次到期月份 = startDate; } } string endPay = row["首年提成结束期"].ToString(); if (!string.IsNullOrEmpty(endPay)) { endPayDate = endPay; paymentRow.首年提成结束期 = DateTime.Parse(endPayDate); } paymentRow.EndEdit(); } }