private void Handle(MessageEx message) { _needToAbort = false; _messageId = string.Empty; try { if (IsTransactional) { new TransactionWrapper().RunInTransaction(() => ReceiveFromQueue(message, ProcessMessage), IsolationLevel, TransactionTimeout); ClearFailuresForMessage(_messageId); } else { ReceiveFromQueue(message, ProcessMessage); } } catch (AbortHandlingCurrentMessageException) { //in case AbortHandlingCurrentMessage was called return; } catch (Exception e) { Logger.Warn(LoggerContext.New(message.MessageOrigin.Name), "Failed to process message.", e); if (IsTransactional) { IncrementFailuresForMessage(_messageId); } OnFailedMessageProcessing(message); } }
public bool Unserialize(JsonReader reader) { while (reader.Read()) { switch (reader.TokenType) { case JsonToken.PropertyName: if (reader.Value.Equals("conversation")) { conversation = (Conversation)JsonTools.getNextObject(reader, false, typeof(Conversation)); } else if (reader.Value.Equals("marchedMessage")) { marchedMessage = (MessageEx)JsonTools.getNextObject(reader, false, typeof(MessageEx)); } else if (reader.Value.Equals("timestamp")) { timestamp = JsonTools.getNextBigInt(reader); } else if (reader.Value.Equals("marchedCount")) { marchedCount = JsonTools.getNextInt(reader); } break; case JsonToken.EndObject: return(true); } } return(false); }
private void fmFastTM_Load(object sender, EventArgs e) { WinNumberImpl winService = new WinNumberImpl(); txtIssue.Text = winService.GetNewIssue().Body; this.txtMoney.KeyPress += new KeyPressEventHandler(Common.TextBox_FilterString_KeyPress); Common.BindCustomers(cbxCustomer, (sender1, e1) => { if (cbxCustomer.SelectedIndex != 0) { OrderImpl orderservice = new OrderImpl(); textBox1.Text = orderservice.GetMaxIndex(cbxCustomer.SelectedValue.ToString(), txtIssue.Text.Trim()).Body.ToString(); } OddsImpl oddservice = new OddsImpl(); var r = oddservice.GetList(cbxCustomer.SelectedValue.ToTryInt()); tm = r.Body.FirstOrDefault(x => x.ChildType == childType); if (tm == null) { MessageEx.ShowWarning("未设置客户赔率"); tm = new OddsData(); tm.CustomerId = cbxCustomer.SelectedValue.ToTryInt(); tm.PL = 00.00M; tm.FS = 0M; } Common.CustomerId = cbxCustomer.SelectedValue.ToTryInt(); }); listView1.GridLines = true; listView1.FullRowSelect = true; listView1.View = View.Details; listView1.Scrollable = true; listView1.MultiSelect = false; }
private void ProcessMessage(MessageEx message) { var m = message.Message; _messageId = m.Id; if (IsTransactional) { if (HandledMaxRetries(m.Id)) { Logger.Error(LoggerContext.New(message.MessageOrigin.Name), string.Format("Message has failed the maximum number of times allowed, ID={0}.", m.Id)); MoveToErrorQueue(message); return; } } //exceptions here will cause a rollback - which is what we want. if (StartedMessageProcessing != null) { StartedMessageProcessing(this, null); } TransportMessage result = Convert(m); if (SkipDeserialization) { result.BodyStream = m.BodyStream; } else { try { result.Body = Extract(m); } catch (Exception e) { Logger.Error(LoggerContext.New(message.MessageOrigin.Name, result), "Could not extract message data.", e); MoveToErrorQueue(message); OnFinishedMessageProcessing(message); // don't care about failures here return; } } //care about failures here var exceptionNotThrown = OnTransportMessageReceived(result, message); //and here var otherExNotThrown = OnFinishedMessageProcessing(message); //but need to abort takes precedence - failures aren't counted here, //so messages aren't moved to the error queue. if (_needToAbort) { throw new AbortHandlingCurrentMessageException(); } if (!(exceptionNotThrown && otherExNotThrown)) //cause rollback { throw new ApplicationException("Exception occured while processing message."); } }
public bool NeedToHandleMessage(MessageEx message) { if (_accountCollection.GetOrCreate(message.AccountTag).Profiles.Any()) { return(true); } var conditionalMessageRouter = ObjectFactory.TryGetInstance <ITargetProcessConditionalMessageRouter>(); return(conditionalMessageRouter != null && conditionalMessageRouter.Handle(message)); }
/// <summary> /// Moves the given message to the configured error queue. /// </summary> /// <param name="message"></param> protected void MoveToErrorQueue(MessageEx message) { var m = message.Message; m.Label = m.Label + string.Format("<{0}>{1}</{0}><{2}>{3}<{2}>", FAILEDQUEUE, message.MessageOrigin.Name, ORIGINALID, m.Id); if (_errorQueue != null) { _errorQueue.Send(m, MessageQueueTransactionType.Single); } }
private void btnOK_Click(object sender, EventArgs e) { if (!IsValid()) { MessageEx.ShowWarning("输入的数据格式不正确,请重新输入"); return; } CurrentModel.Issue = txtIssue.Text.Trim(); CurrentModel.Num1_Code = txtCode1.Text.Trim(); CurrentModel.Num1_Zodiac = list.FirstOrDefault(x => x.Value == CurrentModel.Num1_Code).Zodiac; CurrentModel.Num2_Code = txtCode2.Text.Trim(); CurrentModel.Num2_Zodiac = list.FirstOrDefault(x => x.Value == CurrentModel.Num2_Code).Zodiac; CurrentModel.Num3_Code = txtCode3.Text.Trim(); CurrentModel.Num3_Zodiac = list.FirstOrDefault(x => x.Value == CurrentModel.Num3_Code).Zodiac; CurrentModel.Num4_Code = txtCode4.Text.Trim(); CurrentModel.Num4_Zodiac = list.FirstOrDefault(x => x.Value == CurrentModel.Num4_Code).Zodiac; CurrentModel.Num5_Code = txtCode5.Text.Trim(); CurrentModel.Num5_Zodiac = list.FirstOrDefault(x => x.Value == CurrentModel.Num5_Code).Zodiac; CurrentModel.Num6_Code = txtCode6.Text.Trim(); CurrentModel.Num6_Zodiac = list.FirstOrDefault(x => x.Value == CurrentModel.Num6_Code).Zodiac; CurrentModel.Num7_Code = txtCode7.Text.Trim(); CurrentModel.Num7_Zodiac = list.FirstOrDefault(x => x.Value == CurrentModel.Num7_Code).Zodiac; if (CurrentModel.Id != 0) { CurrentModel.Update_User_Id = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); CurrentModel.Update_Time = "0"; if (service.Update(CurrentModel).Code == 0) { MessageEx.Show("更新开奖信息成功"); this.DialogResult = DialogResult.OK; } else { MessageEx.ShowWarning("更新开奖信息失败"); } } else { CurrentModel.Create_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); CurrentModel.Create_User_Id = "0"; if (service.Add(CurrentModel).Code == 0) { MessageEx.Show("新增开奖信息成功"); this.DialogResult = DialogResult.OK; } else { MessageEx.ShowWarning("新增开奖信息失败"); } } }
public bool Unserialize(JsonReader reader) { conversation = new Conversation(); while (reader.Read()) { switch (reader.TokenType) { case JsonToken.PropertyName: if (reader.Value.Equals("conversationType")) { conversation.type = (ConversationType)JsonTools.getNextInt(reader); } else if (reader.Value.Equals("target")) { conversation.target = JsonTools.getNextString(reader); } else if (reader.Value.Equals("line")) { conversation.line = JsonTools.getNextInt(reader); } else if (reader.Value.Equals("lastMessage")) { lastMessage = (MessageEx)JsonTools.getNextObject(reader, false, typeof(MessageEx)); } else if (reader.Value.Equals("timestamp")) { timestamp = JsonTools.getNextBigInt(reader); } else if (reader.Value.Equals("draft")) { draft = JsonTools.getNextString(reader); } else if (reader.Value.Equals("unreadCount")) { unreadCount = (UnreadCount)JsonTools.getNextObject(reader, false, typeof(UnreadCount)); } else if (reader.Value.Equals("isTop")) { isTop = JsonTools.getNextBoolean(reader); } else if (reader.Value.Equals("isSilent")) { isSilent = JsonTools.getNextBoolean(reader); } break; case JsonToken.EndObject: return(true); } } return(false); }
private void ReceiveFromQueue(MessageEx message, Action <MessageEx> processMessageAction) { var m = message.Message; if (m == null) { Logger.Info(LoggerContext.New(message.MessageOrigin.Name), string.Format("Peek returned null message.")); return; } message.DoReceive(); processMessageAction(message); }
private void HandleAsync(MessageEx message) { _messageId = string.Empty; ReceiveFromQueue(message, m => ThreadPool.QueueUserWorkItem(state => { try { ProcessMessage(m); } catch { OnFailedMessageProcessing(message); } })); }
private void btnRun_Click(object sender, EventArgs e) { Well.Data.WinNumberImpl service = new Data.WinNumberImpl(); MessageEx.Show("開獎開始"); var issue = dataGridView1.CurrentRow.Cells[1].Value.ToString(); if (service.Run(issue).Code != 0) { } service.UpdateOrderMainOutMoney(issue); Well.Data.TotalImpl total = new Data.TotalImpl(); total.Add(issue); MessageEx.Show("開獎完成"); }
private bool OnFailedMessageProcessing(MessageEx message) { try { if (FailedMessageProcessing != null) { FailedMessageProcessing(this, null); } } catch (Exception e) { Logger.Warn(LoggerContext.New(message.MessageOrigin.Name), "Failed raising 'failed message processing' event.", e); return(false); } return(true); }
private void HandleAsync(MessageEx message) { _messageId = string.Empty; ReceiveFromQueue(message, m => ThreadPool.QueueUserWorkItem(state => { try { ProcessMessage(m); } catch (Exception e) { Logger.Warn(LoggerContext.New(message.MessageOrigin.Name), "Failed to process message.", e); OnFailedMessageProcessing(message); } })); }
private bool OnTransportMessageReceived(TransportMessage msg, MessageEx origin) { try { if (TransportMessageReceived != null) { TransportMessageReceived(this, new TransportMessageReceivedEventArgs(msg)); } Logger.Debug(LoggerContext.New(origin.MessageOrigin.Name, msg), "Transport message received"); } catch (Exception e) { Logger.Warn(LoggerContext.New(origin.MessageOrigin.Name, msg), "Failed raising 'transport message received' event for message with ID=" + msg.Id, e); return(false); } return(true); }
private void btnOK_Click(object sender, EventArgs e) { string OrderId = Guid.NewGuid().ToString("n"); Order <OrderTM> order = new Order <OrderTM>() { Create_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Create_User_Id = "0", Customer_Id = cbxCustomer.SelectedValue.ToString().ToTryInt(), Id = OrderId, IsDel = 0, Sort = textBox1.Text.ToTryInt(), Issue = txtIssue.Text.Trim(), Order_No = ServiceNum.GetOrderNo(), Order_Type = orderType, Child_Type = childType, Total_In_Money = orderDetails.Sum(x => x.InMoney), Total_Out_Money = 0, Update_Time = "", Update_User_Id = "", OrderDetails = orderDetails }; order.OrderDetails.ForEach(x => { x.OrderId = OrderId; }); OrderImpl services = new OrderImpl(); if (services.AddOrderTM(order).Code == 0) { MessageEx.Show("投注成功"); textBox1.Text = (textBox1.Text.Trim().ToTryInt() + 1).ToString(); listView1.Items.Clear(); txtMoney.Text = ""; txtCode.Text = ""; orderDetails.Clear(); } else { MessageEx.ShowError("投注失敗"); } }
private void btnAdd_Click(object sender, EventArgs e) { #region 检测输入 if (cbxCustomer.SelectedIndex == 0) { MessageEx.ShowWarning("请选择客户"); return; } if (comboBox1.SelectedIndex == 0) { MessageEx.ShowWarning("请选择连肖类型"); return; } if (string.IsNullOrWhiteSpace(txtCode.Text)) { MessageEx.ShowWarning("请输入组合代码"); txtCode.Text = ""; txtCode.Focus(); return; } else { if (comboBox1.SelectedIndex == 1) { MinCount = 1; if (txtCode.Text.Trim().Length != 1 && checkBox1.Checked == false) { MessageEx.ShowWarning("您输入的组合代码不符合规则,请重新输入"); txtCode.Focus(); return; } } if (comboBox1.SelectedIndex == 2) { MinCount = 2; if (txtCode.Text.Trim().Length != 2 && checkBox1.Checked == false) { MessageEx.ShowWarning("您输入的组合代码不符合规则,请重新输入"); txtCode.Focus(); return; } } if (comboBox1.SelectedIndex == 3) { MinCount = 3; if (txtCode.Text.Trim().Length != 3 && checkBox1.Checked == false) { MessageEx.ShowWarning("您输入的组合代码不符合规则,请重新输入"); txtCode.Focus(); return; } } if (comboBox1.SelectedIndex == 4) { MinCount = 4; if (txtCode.Text.Trim().Length != 4 && checkBox1.Checked == false) { MessageEx.ShowWarning("您输入的组合代码不符合规则,请重新输入"); txtCode.Focus(); return; } } if (comboBox1.SelectedIndex == 5) { MinCount = 5; if (txtCode.Text.Trim().Length != 5 && checkBox1.Checked == false) { MessageEx.ShowWarning("您输入的组合代码不符合规则,请重新输入"); txtCode.Focus(); return; } } bool flag = true; foreach (var itemss in txtCode.Text.Trim()) { if (!charList.Contains(itemss.ToString())) { flag = false; break; } } if (!flag) { MessageEx.ShowWarning("您输入的组合代码不符合规则,请重新输入"); txtCode.Focus(); return; } } if (string.IsNullOrWhiteSpace(txtMoney.Text)) { MessageEx.ShowWarning("請輸入金額!"); txtMoney.Focus(); return; } #endregion if (checkBox1.Checked == false) { #region 非复试 var detail = new OrderLXLM(); detail.Id = Guid.NewGuid().ToString("n"); detail.Status = (int)ResultStatus.Wait; detail.Sort = listView1.Items.Count + 1; detail.InMoney = Convert.ToDecimal(txtMoney.Text); var item = new ListViewItem(); item.UseItemStyleForSubItems = false; item.SubItems[0].Text = (listView1.Items.Count + 1).ToString(); string str = ""; int charIndex = 0; foreach (var itemss in txtCode.Text.Trim()) { string sd = itemss.ToString().Replace("1", "鼠").Replace("2", "牛").Replace("3", "虎") .Replace("Q", "兔").Replace("q", "兔") .Replace("W", "龙").Replace("w", "龙") .Replace("E", "蛇").Replace("e", "蛇") .Replace("A", "马").Replace("a", "马") .Replace("S", "羊").Replace("s", "羊") .Replace("D", "猴").Replace("d", "猴") .Replace("Z", "鸡").Replace("z", "鸡") .Replace("X", "狗").Replace("x", "狗") .Replace("C", "猪").Replace("c", "猪"); var code = zodiacArray.First(x => x.Value == sd).Key; tempList.Add(code); str += sd + "、"; switch (charIndex) { case 0: detail.Code1 = code.ToString(); detail.Zodiac1 = sd; break; case 1: detail.Code2 = code.ToString(); detail.Zodiac2 = sd; break; case 2: detail.Code3 = code.ToString(); detail.Zodiac3 = sd; break; case 3: detail.Code4 = code.ToString(); detail.Zodiac4 = sd; break; case 4: detail.Code5 = code.ToString(); detail.Zodiac5 = sd; break; } charIndex = charIndex + 1; } detail.ChildType = comboBox1.SelectedValue.ToTryInt(); detail.Odds = GetMinOdds(odds.List, tempList); detail.OutMoney = detail.InMoney * detail.Odds; str = str.Substring(0, str.Length - 1); detail.Remarks = str; orderDetails.Add(detail); item.SubItems.Add(str); item.SubItems.Add(detail.Odds.ToMoney()); item.SubItems.Add(txtMoney.Text.Trim()); listView1.Items.Insert(0, item); tempList.Clear(); txtCode.Text = ""; txtCode.Focus(); #endregion } else { var ttt = new List <OrderLXLM>(); foreach (var itemss in txtCode.Text.Trim()) { string sd = itemss.ToString().Replace("1", "鼠").Replace("2", "牛").Replace("3", "虎") .Replace("Q", "兔").Replace("q", "兔") .Replace("W", "龙").Replace("w", "龙") .Replace("E", "蛇").Replace("e", "蛇") .Replace("A", "马").Replace("a", "马") .Replace("S", "羊").Replace("s", "羊") .Replace("D", "猴").Replace("d", "猴") .Replace("Z", "鸡").Replace("z", "鸡") .Replace("X", "狗").Replace("x", "狗") .Replace("C", "猪").Replace("c", "猪"); var code = zodiacArray.First(x => x.Value == sd).Key; tempList.Add(code); } //需要组合的号码 List <int> InCombinationList = new List <int>(); foreach (var item in tempList) { InCombinationList.Add(item); } //生成号码组合 List <int[]> ListCombination = PermutationAndCombination <int> .GetCombination(InCombinationList.ToArray(), MinCount); //求全部的3-3组合 //根据号码组合创建订单明细 int index = 1; foreach (int[] arr in ListCombination) { OrderLXLM detail = new OrderLXLM(); int childIndex = 0; var str = ""; foreach (int item in arr) { switch (childIndex) { case 0: detail.Code1 = item.ToString(); detail.Zodiac1 = ServiceNum.GetNumZodiac(item); break; case 1: detail.Code2 = item.ToString(); detail.Zodiac2 = ServiceNum.GetNumZodiac(item); break; case 2: detail.Code3 = item.ToString(); detail.Zodiac3 = ServiceNum.GetNumZodiac(item); break; case 3: detail.Code4 = item.ToString(); detail.Zodiac4 = ServiceNum.GetNumZodiac(item); break; case 4: detail.Code5 = item.ToString(); detail.Zodiac5 = ServiceNum.GetNumZodiac(item); break; } str += ServiceNum.GetNumZodiac(item) + "、"; childIndex = childIndex + 1; } detail.Id = Guid.NewGuid().ToString("n"); detail.Sort = listView1.Items.Count + index; detail.ChildType = comboBox1.SelectedValue.ToTryInt(); detail.Remarks = str.Remove(str.Length - 1, 1); detail.Odds = GetMinOdds(odds.List, arr.ToList()); detail.InMoney = Convert.ToDecimal(txtMoney.Text); detail.OutMoney = detail.InMoney * detail.Odds; detail.Status = (int)ResultStatus.Wait; detail.Flag = 1; ttt.Add(detail); index = index + 1; } ttt.ForEach(x => { orderDetails.Add(x); var lvitem = new ListViewItem(); lvitem.UseItemStyleForSubItems = false; lvitem.SubItems[0].Text = (listView1.Items.Count + 1).ToString(); lvitem.SubItems.Add(x.Remarks); lvitem.SubItems.Add(x.Odds.ToMoney()); lvitem.SubItems.Add(txtMoney.Text.Trim()); listView1.Items.Insert(0, lvitem); }); tempList.Clear(); txtCode.Text = ""; txtCode.Focus(); } }
private void btnOK_ws_Click(object sender, EventArgs e) { var container = this.tabControl1.TabPages[tabControl1.SelectedIndex]; var controls_txt = container.Controls.Find("TXT", false); #region 检测输入 if (this.cbox.SelectedIndex == 0) { MessageEx.ShowWarning("请选择客户"); return; } if (string.IsNullOrWhiteSpace(txtIssue.Text)) { MessageEx.ShowWarning("请输入期号"); return; } if (txtIssue.Text.Trim().Length != 7) { MessageEx.ShowWarning("请输入正确的期号"); return; } var flag = false; foreach (var control in controls_txt) { if (control is TextBox) { var c = control as TextBox; if (!string.IsNullOrWhiteSpace(c.Text)) { flag = true; } } } if (flag == false) { MessageEx.ShowWarning("请输入内容,内容不能为空"); return; } #endregion var OrderId = Guid.NewGuid().ToString("n"); var list = new List <OrderTM>(); var index = 1; foreach (var control in controls_txt) { if (control is TextBox) { var c = control as TextBox; if (!string.IsNullOrWhiteSpace(c.Text)) { OrderTM O = new OrderTM(); O.Id = Guid.NewGuid().ToString("N"); O.OrderId = OrderId; O.InMoney = Convert.ToDecimal(c.Text); O.Status = (int)ResultStatus.Wait; O.ChildType = (int)ChildType.尾数; O.Sort = index; var Code = container.Controls.Find("Code", false).FirstOrDefault(x => x.Tag == c.Tag); if (Code != null) { var lbCode = Code as Label; O.Code = lbCode.Tag.ToString(); O.Remarks = O.Code; } else { continue; } var PL = container.Controls.Find("PL", false).FirstOrDefault(x => x.Tag == c.Tag); if (PL != null) { var lbPL = PL as Label; O.Odds = Convert.ToDecimal(lbPL.Text); } else { continue; } O.OutMoney = O.Odds * O.InMoney; list.Add(O); index = index + 1; } } } var order = new Order <OrderTM>() { Create_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Create_User_Id = "0", Customer_Id = cbox.SelectedValue.ToString().ToTryInt(), Id = OrderId, IsDel = 0, Issue = txtIssue.Text.Trim(), Order_No = ServiceNum.GetOrderNo(), Order_Type = (int)OrderType.尾数, Child_Type = (int)ChildType.尾数, Total_In_Money = list.Sum(x => x.InMoney), Total_Out_Money = 0, Update_Time = "", Update_User_Id = "", OrderDetails = list }; OrderImpl services = new OrderImpl(); if (services.AddOrderTM(order).Code == 0) { MessageEx.Show("成功"); btnReset_Click(sender, e); } else { MessageEx.ShowWarning("失败"); } }
public override string Digest(MessageEx message) { return("Mute group members"); }
public override string Digest(MessageEx message) { return("Group set group managers"); }
private string GetQueueNameToRouteMessageIn(MessageEx m) { string accountName = m.AccountTag; return(string.IsNullOrEmpty(accountName) ? null : GetQueueName(accountName)); }
public override string Digest(MessageEx message) { return("Recall message"); }
public bool Handle(MessageEx message) { return(message.AccountTag != AccountName.Empty); }
public override string Digest(MessageEx message) { return("Dismiss group"); }
public override string digest(MessageEx message) { throw new NotImplementedException(); }
private void btnOK_Click(object sender, EventArgs e) { #region 检测输入 if (this.cbox.SelectedIndex == 0) { MessageEx.ShowWarning("请选择客户"); return; } if (string.IsNullOrWhiteSpace(txtIssue.Text)) { MessageEx.ShowWarning("请输入期号"); return; } if (txtIssue.Text.Trim().Length != 7) { MessageEx.ShowWarning("请输入正确的期号"); return; } if (GetRadioChecked() <= 1) { MessageEx.ShowWarning("请选择合肖类型"); return; } if (string.IsNullOrWhiteSpace(txtMoney.Text.Trim())) { MessageEx.ShowWarning("请输入金额"); return; } if (string.IsNullOrWhiteSpace(txt.Text.Trim())) { MessageEx.ShowWarning("请输入生肖"); return; } else { var str = txt.Text.Trim(); var l = ServiceNum.GetZodiacArray(); var flag = false; var tmpList = new List <string>(); var tmpr = false; foreach (var s in str) { var ss = s.ToString(); if (l.Count(x => x.Value == ss) == 0) { flag = true; break; } if (tmpList.Contains(ss.ToString())) { tmpr = true; break; } else { tmpList.Add(ss.ToString()); } } if (flag) { MessageEx.ShowWarning("输入的生肖不正确,请输入正确的生肖"); return; } if (tmpr) { MessageEx.ShowWarning("生肖存在重复"); return; } if (radioButton1.Checked && txt.Text.Trim().Length != 6) { MessageEx.ShowWarning("生肖个数不正确"); return; } if (radioButton2.Checked && txt.Text.Trim().Length != 5) { MessageEx.ShowWarning("生肖个数不正确"); return; } if (radioButton3.Checked && txt.Text.Trim().Length != 4) { MessageEx.ShowWarning("生肖个数不正确"); return; } if (radioButton4.Checked && txt.Text.Trim().Length != 3) { MessageEx.ShowWarning("生肖个数不正确"); return; } if (radioButton5.Checked && txt.Text.Trim().Length != 2) { MessageEx.ShowWarning("生肖个数不正确"); return; } } var vv = GetRadioChecked(); var odds = oddsList.FirstOrDefault(x => x.ChildType == vv); if (odds == null) { MessageEx.ShowWarning("未设置赔率"); return; } #endregion string OrderId = Guid.NewGuid().ToString("n"); List <OrderTM> list = new List <OrderTM>(); var detail = new OrderTM(); detail.ChildType = GetRadioChecked(); detail.Code = txt.Text.Trim(); detail.Flag = 1; detail.Id = Guid.NewGuid().ToString("n"); detail.InMoney = Convert.ToDecimal(txtMoney.Text.Trim()); detail.Odds = odds.PL; detail.OrderId = OrderId; detail.OutMoney = detail.Odds * detail.InMoney; detail.Remarks = detail.Code; detail.Sort = 1; detail.Status = (int)ResultStatus.Wait; list.Add(detail); Order <OrderTM> order = new Order <OrderTM>() { Create_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Create_User_Id = "0", Customer_Id = cbox.SelectedValue.ToString().ToTryInt(), Id = OrderId, IsDel = 0, Issue = txtIssue.Text.Trim(), Order_No = ServiceNum.GetOrderNo(), Order_Type = (int)OrderType.合肖, Total_In_Money = list.Sum(x => x.InMoney), Total_Out_Money = 0, Update_Time = "", Update_User_Id = "", OrderDetails = list }; OrderImpl services = new OrderImpl(); if (services.AddOrderTM(order).Code == 0) { MessageBox.Show("成功", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.None); btnCancel_Click(null, null); } else { MessageBox.Show("失败", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.None); } }
private void btnAdd_Click(object sender, EventArgs e) { if (this.cbxCustomer.SelectedIndex == 0) { MessageEx.ShowWarning("请选择客户"); return; } if (string.IsNullOrWhiteSpace(txtCode.Text) || (list.Count(x => x.Value == txtCode.Text.Trim()) == 0 && list.Count(x => x.Zodiac == txtCode.Text.Trim()) == 0)) { MessageEx.ShowWarning("号码不符合規則,請重新輸入"); txtCode.Text = ""; txtCode.Focus(); return; } if (string.IsNullOrWhiteSpace(txtMoney.Text)) { MessageEx.ShowWarning("請輸入金額!"); txtMoney.Focus(); return; } if (isUpdate) { updateModel.Code = txtCode.Text.Trim(); updateModel.InMoney = Convert.ToDecimal(txtMoney.Text.Trim()); updateModel.Odds = tm.PL; updateModel.OutMoney = tm.PL * updateModel.InMoney; listView1.SelectedItems[0].SubItems[1].Text = updateModel.Code; listView1.SelectedItems[0].SubItems[2].Text = updateModel.Odds.ToMoney(); listView1.SelectedItems[0].SubItems[3].Text = updateModel.InMoney.ToString(); } else { var count = list.Count(x => x.Zodiac == txtCode.Text.Trim()); if (count != 0) { var totalinmoney = Convert.ToDecimal(txtMoney.Text.Trim()); var inmoney = totalinmoney / count; list.Where(x => x.Zodiac == txtCode.Text.Trim()).ToList().ForEach(x => { var item = new ListViewItem(); item.UseItemStyleForSubItems = true; item.Font = new Font("宋体", 14); item.SubItems[0].Text = (listView1.Items.Count + 1).ToString(); item.SubItems.Add(x.Value); item.SubItems.Add(tm.PL.ToMoney()); item.SubItems.Add(inmoney.ToMoney()); listView1.Items.Insert(0, item); orderDetails.Add(new OrderTM() { Code = x.Value, Id = Guid.NewGuid().ToString("n"), Sort = listView1.Items.Count, ChildType = childType, InMoney = inmoney, Odds = tm.PL, OutMoney = tm.PL * inmoney, Remarks = "", Status = (int)ResultStatus.Wait, Flag = 1 }); }); } else { var item = new ListViewItem(); item.UseItemStyleForSubItems = true; item.Font = new Font("宋体", 14); item.SubItems[0].Text = (listView1.Items.Count + 1).ToString(); item.SubItems.Add(txtCode.Text.Trim()); item.SubItems.Add(tm.PL.ToMoney()); item.SubItems.Add(txtMoney.Text.Trim()); listView1.Items.Insert(0, item); orderDetails.Add(new OrderTM() { Code = txtCode.Text.Trim(), Id = Guid.NewGuid().ToString("n"), Sort = listView1.Items.Count, ChildType = childType, InMoney = Convert.ToDecimal(txtMoney.Text.Trim()), Odds = tm.PL, OutMoney = tm.PL * Convert.ToDecimal(txtMoney.Text.Trim()), Remarks = "", Status = (int)ResultStatus.Wait, Flag = 1 }); } } txtCode.Text = ""; txtCode.Focus(); }
public override string Digest(MessageEx message) { return("Modify group name"); }
public override string Digest(MessageEx message) { return("Group private chat type changed"); }
public override string formatNotification(MessageEx message) { return(digest(message)); }
public override string Digest(MessageEx message) { return(Content); }