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("新增开奖信息失败"); } } }
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 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 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("失败"); } }
private void btnOK_Click(object sender, EventArgs e) { var v = 0; var childtype = 0; var pl = 0M; if (radioButton5.Checked) { v = 3; childtype = (int)ChildType.中三; pl = Convert.ToDecimal(lbSZS.Text); } if (radioButton6.Checked) { v = 3; childtype = (int)ChildType.全中; pl = Convert.ToDecimal(lbSQZ.Text); } if (radioButton7.Checked) { v = 2; childtype = (int)ChildType.二全中; pl = Convert.ToDecimal(lbEZE.Text); } if (radioButton8.Checked) { v = 2; childtype = (int)ChildType.特碰; pl = Convert.ToDecimal(lbTP.Text); } //需要组合的号码 List <string> InCombinationList = new List <string>(); #region 获取输入 var controls = this.groupBox3.Controls.Find("CK", false); var r = 0; foreach (var control in controls) { if (control is CheckBox) { var ck = control as CheckBox; if (ck.Checked) { r += 1; var sd = this.groupBox3.Controls.Find("Code", false); var lb = sd.FirstOrDefault(x => x.Tag == ck.Tag); if (lb != null) { var lbCode = lb as Label; InCombinationList.Add(lbCode.Text); } } } } #endregion #region 检测输入 if (!radioButton5.Checked && !radioButton6.Checked && !radioButton7.Checked && !radioButton8.Checked) { MessageEx.ShowWarning("请选择连码类型"); return; } if (cbox.SelectedIndex == 0) { MessageEx.ShowWarning("请选择客户"); return; } if (string.IsNullOrWhiteSpace(txtMoney.Text)) { MessageEx.ShowWarning("请输入金额"); return; } if (r < v) { MessageEx.ShowWarning("内容不正确,请重新选择"); return; } #endregion Frm.fmConfirmLX fm = new Frm.fmConfirmLX(); #region 创建订单对象 string OrderId = Guid.NewGuid().ToString("n"); //订单主体 var order = new Order <OrderLXLM>() { 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 = childtype, Update_Time = "", Update_User_Id = "" }; //生成号码组合 List <string[]> ListCombination = PermutationAndCombination <string> .GetCombination(InCombinationList.ToArray(), v); //求全部的3-3组合 //根据号码组合创建订单明细 int index = 1; foreach (string[] arr in ListCombination) { OrderLXLM detail = new OrderLXLM(); int childIndex = 0; var str = ""; foreach (string item in arr) { switch (childIndex) { case 0: detail.Code1 = item.ToString(); break; case 1: detail.Code2 = item.ToString(); break; case 2: detail.Code3 = item.ToString(); break; case 3: detail.Code4 = item.ToString(); break; } str += item + "、"; childIndex = childIndex + 1; } detail.Id = Guid.NewGuid().ToString("n"); detail.Sort = index; detail.Remarks = str.Remove(str.Length - 1, 1); detail.OrderId = OrderId; detail.Odds = pl; detail.ChildType = childtype; detail.InMoney = Convert.ToDecimal(txtMoney.Text); detail.OutMoney = detail.InMoney * detail.Odds; if (childtype == (int)ChildType.中三) { detail.MinOdds = Convert.ToDecimal(lbSZE.Text); detail.MinOutMoney = detail.InMoney * detail.MinOdds; detail.MaxOdds = pl; detail.MaxOutMoney = detail.InMoney * detail.MaxOdds; } detail.Status = (int)ResultStatus.Wait; detail.Flag = 1; order.OrderDetails.Add(detail); index = index + 1; } order.Total_In_Money = order.OrderDetails.Sum(x => x.InMoney); order.Total_Out_Money = 0.00M; #endregion fm.InitForm(order); if (fm.ShowDialog() == DialogResult.OK) { OrderImpl service = new OrderImpl(); if (service.AddOrderLXLM(order).Code == 0) { MessageEx.Show("下单成功"); } else { MessageEx.Show("下单失败"); } } }
public void btnOK_Click(object sender, EventArgs e) { #region 检测输入 if (this.cbox.SelectedIndex == 0) { MessageEx.ShowWarning("请选择客户"); return; } if (string.IsNullOrWhiteSpace(this.txtMoney.Text)) { MessageEx.ShowWarning("请输入单注金额"); return; } if (string.IsNullOrWhiteSpace(txtIssue.Text)) { MessageEx.ShowWarning("请输入期号"); return; } if (txtIssue.Text.Trim().Length != 7) { MessageEx.ShowWarning("请输入正确的期号"); return; } #endregion #region 获取输入 Dictionary <int, decimal> list = new Dictionary <int, decimal>(); foreach (var control in this.groupBox2.Controls) { if (control is CheckBox) { var ck = control as CheckBox; if (ck.Checked) { var sdsdsdsd = this.groupBox2.Controls.Find("PL", false); var lb = this.groupBox2.Controls.Find("PL", false).FirstOrDefault(x => x.Tag == ck.Tag); if (lb != null) { var l = lb as Label; list.Add(ck.Tag.ToTryInt(), Convert.ToDecimal(l.Text)); } } } } #endregion if (list.Count < MinCount) { MessageEx.ShowWarning("内容不正确,请重新下注"); } else { Frm.fmConfirmLX fm = new Frm.fmConfirmLX(); #region 创建订单对象 string OrderId = Guid.NewGuid().ToString("n"); //订单主体 var order = new Order <OrderLXLM>() { 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 = OrderType, Child_Type = ChildType, Update_Time = "", Update_User_Id = "" }; //需要组合的号码 List <int> InCombinationList = new List <int>(); foreach (var item in list) { InCombinationList.Add(item.Key); } //生成号码组合 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 = index; detail.ChildType = ChildType; detail.Remarks = str.Remove(str.Length - 1, 1); detail.OrderId = OrderId; detail.Odds = GetMinOdds(list, arr.ToList()); detail.InMoney = Convert.ToDecimal(txtMoney.Text); detail.OutMoney = detail.InMoney * detail.Odds; detail.Status = (int)ResultStatus.Wait; detail.Flag = 1; order.OrderDetails.Add(detail); index = index + 1; } order.Total_In_Money = order.OrderDetails.Sum(x => x.InMoney); order.Total_Out_Money = 0.00M; #endregion fm.InitForm(order); if (fm.ShowDialog() == DialogResult.OK) { OrderImpl service = new OrderImpl(); if (service.AddOrderLXLM(order).Code == 0) { MessageEx.Show("下单成功"); btnReset_Click(null, null); } else { MessageEx.Show("下单失败"); } } } }