/// <summary> /// 确认提交方法 /// </summary> public void button_ok() { if (this.TxtDiscount.Text != null) { string price_fixed = double.Parse(this.TxtDiscount.Text).ToString("0.00"); if (price_fixed != "0.00")//判断不能为0 { Discount ds = new Discount(); ds.type = "quota"; ds.amount = price_fixed; PassValue.discounts.Add(ds); PassValue.Infor_payment.discounts = new Discount[PassValue.discounts.Count]; } int i = 0; foreach (Discount ds in PassValue.discounts) { PassValue.Infor_payment.discounts[i++] = ds; } HttpResult httpResult = httpReq.HttpPatch(string.Format("consumptions/{0}", fixedConsumptionsid), PassValue.Infor_payment); if ((int)httpResult.StatusCode == 401) { LoginBusiness lg = new LoginBusiness(); lg.LoginAgain(); return; } else if ((int)httpResult.StatusCode == 0) { MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } Form_Esc(); } }
/// <summary> /// 确认提交方法 /// </summary> public void button_ok() { if (this.TxtDiscount.Text != null && this.TxtDiscount.Text != "") { PassValue.Percent = Int32.Parse(this.TxtDiscount.Text); if (PassValue.Percent != 0) { Discount ds = new Discount(); ds.type = "whole"; ds.percent = PassValue.Percent; PassValue.discounts.Add(ds); } PassValue.Infor_payment.discounts = new Discount[PassValue.discounts.Count]; int i = 0; foreach (Discount ds in PassValue.discounts) { PassValue.Infor_payment.discounts[i++] = ds; } HttpResult httpResult = httpReq.HttpPatch(string.Format("consumptions/{0}", orderConsumptionid), PassValue.Infor_payment); if ((int)httpResult.StatusCode == 401) { LoginBusiness lg = new LoginBusiness(); lg.LoginAgain(); return; } else if ((int)httpResult.StatusCode == 0) { MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } Form_Esc(); } }
/// <summary> /// 确认提交方法 /// </summary> public void button_ok() { foreach (Control ctl in this.flowLayoutPanel1.Controls) { if (ctl is CheckBox && ((CheckBox)ctl).Checked) { PassValue.Percent = Int32.Parse(ctl.Tag.ToString()); if (PassValue.Percent != 0) { Discount ds = new Discount(); ds.type = "scheme"; ds.scheme = new Scheme(); ds.scheme.id=ctl.Name; ds.scheme.percent=PassValue.Percent; PassValue.discounts.Add(ds); PassValue.Infor_payment.discounts = new Discount[PassValue.discounts.Count]; } int i = 0; foreach (Discount ds in PassValue.discounts) { PassValue.Infor_payment.discounts[i++] = ds; } } } HttpResult httpResult = httpReq.HttpPatch(string.Format("consumptions/{0}", planConsumptionid), PassValue.Infor_payment); if ((int)httpResult.StatusCode == 401) { LoginBusiness lg = new LoginBusiness(); lg.LoginAgain(); return; } else if ((int)httpResult.StatusCode == 0) { MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } Form_Esc(); }
/// <summary> /// 确认提交方法 /// </summary> public void button_ok() { if (this.TxtDiscount.Text != "") { Consumption personsConsumption = httpReq.HttpGet<Consumption>(string.Format("consumptions/{0}", freeConsumptionsid)); string price_fixed = double.Parse(this.TxtDiscount.Text).ToString("0.00"); if (price_fixed != "0.00")//判断不能为0 { if (personsConsumption.discounts != null) { PassValue.discounts = personsConsumption.discounts.ToList(); PassValue.discounts.Remove(PassValue.discounts.Where(d => d.type.ToLower() == "free").FirstOrDefault()); } Discount ds = new Discount(); ds.type = "free"; ds.amount = price_fixed; PassValue.discounts.Add(ds); PassValue.Infor_payment.discounts = PassValue.discounts.ToArray(); } HttpResult httpResult = httpReq.HttpPatch(string.Format("consumptions/{0}", freeConsumptionsid), PassValue.Infor_payment); if ((int)httpResult.StatusCode == 401) { LoginBusiness lg = new LoginBusiness(); lg.LoginAgain(); return; } else if ((int)httpResult.StatusCode == 0) { MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } Form_Esc(); } }
public void addorderclose_Click(object sender, EventArgs e) { SetUp(); var personsConsumption = httpReq.HttpGet<Consumption>(string.Format("consumptions/{0}", PassValue.consumptionid)); PassValue.discounts.Clear(); PassValue.Infor_payment = new PatchOrders(); if (personsConsumption.discounts != null) { PassValue.discounts = personsConsumption.discounts.ToList(); } Discount discount = new Discount(); Payment payment = new Payment(); LineControl.LineControl lclc = ((PictureBox)sender).Parent as LineControl.LineControl; switch (lclc.lbInformation.Text.Split(':')[0].Trim()) { case "整单打折": discount = personsConsumption.discounts.Where(persons => persons.type.Equals("whole")).FirstOrDefault(); PassValue.discounts.Remove(discount); this.Btn_Part.Enabled = this.Btn_Plan.Enabled = this.Btn_Part.Enabled = this.Btn_Fixed.Enabled = true; break; case "部分打折": discount = personsConsumption.discounts.Where(persons => persons.type.Equals("partial")).FirstOrDefault(); PassValue.discounts.Remove(discount); this.Btn_Part.Enabled = this.Btn_Plan.Enabled = this.Btn_Part.Enabled = this.Btn_Fixed.Enabled = true; PassValue.listItemID.Clear(); PassValue.listItemIDBefore.Clear(); PassValue.Percent = 0; break; case "方案打折": discount = personsConsumption.discounts.Where(persons => persons.type.Equals("scheme")).FirstOrDefault(); PassValue.discounts.Remove(discount); this.Btn_Part.Enabled = this.Btn_Plan.Enabled = this.Btn_Part.Enabled = this.Btn_Fixed.Enabled = true; break; case "定额打折": discount = personsConsumption.discounts.Where(persons => persons.type.Equals("quota")).FirstOrDefault(); PassValue.discounts.Remove(discount); this.Btn_Part.Enabled = this.Btn_Plan.Enabled = this.Btn_Part.Enabled = this.Btn_Fixed.Enabled = true; break; case "抹零": discount = personsConsumption.discounts.Where(persons => persons.type.Equals("round")).FirstOrDefault(); PassValue.discounts.Remove(discount); this.Btn_Part.Enabled = this.Btn_Plan.Enabled = this.Btn_Part.Enabled = this.Btn_Fixed.Enabled = true; break; case "免单": discount = personsConsumption.discounts.Where(persons => persons.type.Equals("free")).FirstOrDefault(); PassValue.discounts.Remove(discount); this.Btn_Part.Enabled = this.Btn_Plan.Enabled = this.Btn_Part.Enabled = this.Btn_Fixed.Enabled = true; break; case "银联卡": payment = PassValue.payments.Where(payments => payments.method.Equals("bankcard")).FirstOrDefault(); PassValue.payments.Remove(payment); PassValue.Price_Now = (double.Parse(this.lbTotal.Text) + double.Parse(payment.amount)).ToString("0.00"); //应付价格传递给全局变量 Price_Recive = Price_Recive - double.Parse(payment.amount); this.lbReceiveActual.Text = Price_Recive.ToString(); break; case "现金支付": payment = PassValue.payments.Where(payments => payments.method.Equals("cash")).FirstOrDefault(); PassValue.payments.Remove(payment); PassValue.Price_Now = (double.Parse(this.lbTotal.Text) + double.Parse(payment.amount)).ToString("0.00"); //应付价格传递给全局变量 Price_Recive = Price_Recive - double.Parse(payment.amount); this.lbReceiveActual.Text = Price_Recive.ToString(); break; case "会员卡": payment = PassValue.payments.Where(payments => payments.method.Equals("member")).FirstOrDefault(); PassValue.payments.Remove(payment); PassValue.Price_Now = (double.Parse(this.lbTotal.Text) + double.Parse(payment.amount)).ToString("0.00"); //应付价格传递给全局变量 Price_Recive = Price_Recive - double.Parse(payment.amount); this.lbReceiveActual.Text = Price_Recive.ToString(); break; case "签单": payment = PassValue.payments.Where(payments => payments.method.Equals("sign")).FirstOrDefault(); PassValue.payments.Remove(payment); PassValue.Price_Now = (double.Parse(this.lbTotal.Text) + double.Parse(payment.amount)).ToString("0.00"); //应付价格传递给全局变量 Price_Recive = Price_Recive - double.Parse(payment.amount); this.lbReceiveActual.Text = Price_Recive.ToString(); break; case "其他": payment = PassValue.payments.Where(payments => payments.method.Equals("other")).FirstOrDefault(); PassValue.payments.Remove(payment); PassValue.Price_Now = (double.Parse(this.lbTotal.Text) + double.Parse(payment.amount)).ToString("0.00"); //应付价格传递给全局变量 Price_Recive = Price_Recive - double.Parse(payment.amount); this.lbReceiveActual.Text = Price_Recive.ToString(); break; } if (PassValue.discounts != null) { PassValue.Infor_payment.discounts = PassValue.discounts.ToArray(); HttpResult httpResult = httpReq.HttpPatch(string.Format("consumptions/{0}", PassValue.consumptionid), PassValue.Infor_payment); if ((int)httpResult.StatusCode == 401) { LoginBusiness lg = new LoginBusiness(); lg.LoginAgain(); return; } else if ((int)httpResult.StatusCode == 0) { MessageBox.Show(string.Format("{0}{1}", httpResult.StatusDescription, httpResult.OtherDescription), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } } this.panelChildren.Controls.Clear(); AddInformation(); }