Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text;
            int port =12345;//使用12345作为监听端口
            UdpClient client = new UdpClient(new IPEndPoint(IPAddress.Any, 0));
            IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse("255.255.255.255"), port);//使用广播,告诉对方自己登陆信息
            IPHostEntry ipe = Dns.GetHostEntry(Dns.GetHostName());
            IPAddress ipa = null;
            foreach (IPAddress ip in ipe.AddressList)
            {
                if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6)
                    continue;
                ipa = ip;
                break;
            }
            string ip1 = ipa.ToString();
            string users = username + ";" + ip1 + ":" + port.ToString();
            byte[] buf = Encoding.Default.GetBytes("login:"******";" + ip1);//登陆信息格式,login命令+用户名+自己的IP
            client.Send(buf, buf.Length, endpoint);  // 发送登陆消息到自己的广

            Member main = new Member();
            main.Username = username;
            main.Users = users;
            main.Port = port;
            main.ThisIP = ip1;
            this.Hide();
            main.ShowDialog();
        }
Exemple #2
0
        // <summary>
        /// 确认提交方法
        /// </summary>
        public void button_ok()
        {
            if (this.TxtDiscount.Text != null)
            {
                string price_fixed = double.Parse(this.TxtDiscount.Text).ToString("0.00");
                Member mb = new Member();
                mb = (Member)this.Owner;
                mb.KeyPreview = true;
                mb.panelChildren.Controls.Remove(this);
                mb.panelInfor.Visible = true;
                mb.lbTitle.Text = "支付信息";

                if (PassValue.payments.Count != 0 && PassValue.payments.Where(payment => payment.method == "other").FirstOrDefault() != null)
                {
                    mb.lbReceiveActual.Text = (mb.Price_Recive + double.Parse(price_fixed) - double.Parse(PassValue.payments.Where(payment => payment.method == "other").FirstOrDefault().amount)).ToString("0.00");
                    PassValue.payments.Remove(PassValue.payments.Where(payment => payment.method == "other").FirstOrDefault());
                }
                else
                {
                    mb.lbReceiveActual.Text = (mb.Price_Recive + double.Parse(price_fixed)).ToString("0.00");
                }

                //银联卡支付
                Payment pm = new Payment();
                pm.amount = double.Parse(this.TxtDiscount.Text).ToString("0.00");
                pm.method = "other";
                Reasons rs = new Reasons();
                rs.description = this.lbReasons.Text;
                rs.id = reasonid[0];
                pm.reason = rs;
                PassValue.payments.Add(pm);
                mb.panelChildren.Visible = true;
                Form_Esc();
            }
        }
Exemple #3
0
        // <summary>
        /// 确认提交方法
        /// </summary>
        public void button_ok()
        {
            if (!string.IsNullOrEmpty(this.TxtDiscount.Text))
            {
                string price_fixed = double.Parse(this.TxtDiscount.Text).ToString("0.00");
                Member mb = new Member();
                mb = (Member)this.Owner;
                mb.KeyPreview = true;
                mb.panelChildren.Controls.Remove(this);
                mb.panelInfor.Visible = true;
                mb.lbTitle.Text = "支付信息";
                if (PassValue.payments.Count != 0 && PassValue.payments.Where(payment => payment.method == "cash").FirstOrDefault() != null)
                {
                    mb.lbReceiveActual.Text = (mb.Price_Recive - double.Parse(PassValue.payments.Where(payment => payment.method == "cash").FirstOrDefault().amount) + double.Parse(price_fixed)).ToString("0.00");
                    PassValue.payments.Remove(PassValue.payments.Where(payment => payment.method == "cash").FirstOrDefault());
                }
                //现金支付
                Payment pm = new Payment();
                if (double.Parse(this.TxtDiscount.Text) <= double.Parse(this.lbReceiveShould.Text))
                {
                    pm.amount = this.TxtDiscount.Text;
                }
                else
                {
                    pm.amount = this.lbReceiveShould.Text;
                }
                pm.method = "cash";
                PassValue.payments.Add(pm);

                mb.lbReceiveActual.Text = (mb.Price_Recive + double.Parse(pm.amount)).ToString("0.00");
                mb.panelChildren.Visible = true;
                Form_Esc();
            }
        }
Exemple #4
0
 /// <summary>
 /// 退出后的刷新
 /// </summary>
 public void Form_Esc()
 {
     Member mb = new Member();
     mb = (Member)this.Owner;
     mb.KeyPreview = true;
     mb.panelChildren.Controls.Remove(this);
     mb.panelInfor.Visible = true;
     mb.lbTitle.Text = "支付信息";
     mb.Btn_BankCard.Image = Properties.Resources.其他;
     mb.AddInformation();//重新加载打折信息
     this.Close();
 }
Exemple #5
0
 /// <summary>
 /// 退出后的刷新
 /// </summary>
 public void Form_Esc()
 {
     Member mb = new Member();
     mb = (Member)this.Owner;
     mb.KeyPreview = true;
     mb.panelChildren.Controls.Remove(this);
     mb.panelInfor.Visible = true;
     mb.lbTitle.Text = "支付信息";
     mb.SetUp();
     PassValue.discounts.Clear();
     mb.AddInformation();//重新加载打折信息
     this.Close();
 }
Exemple #6
0
 /// <summary>
 /// 取消
 /// </summary>
 private void Btn_Canel_Click(object sender, EventArgs e)
 {
     Member mb = new Member();
     mb = (Member)this.Owner;
     mb.panelChildren.Controls.Remove(this);
     mb.panelInfor.Visible = true;
     mb.lbTitle.Text = "支付信息";
     mb.Btn_BankCard.Image = Properties.Resources.银联卡;
     mb.panelChildren.Visible = true;
     mb.AddInformation();
 }
Exemple #7
0
 /// <summary>
 /// 选择原因
 /// </summary>
 private void panelChoose_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.TxtDiscount.Text))
     {
         Member mb = new Member();
         mb = (Member)this.Owner;
         this.Visible = false;
         PaymentReasons pr = new PaymentReasons();
         pr.Owner = this;
         this.Visible = false;
         pr.TopLevel = false;
         mb.panelChildren.Controls.Add(pr);
         pr.Show();
     }
     else
     {
         Messagebox mb = new Messagebox();
         PassValue.MessageInfor = "其他支付金额不能为空!";
         mb.ShowDialog();
     }
 }
Exemple #8
0
 /// <summary>
 /// 取消
 /// </summary>
 private void Btn_Canel_Click(object sender, EventArgs e)
 {
     Member mb = new Member();
     mb = (Member)this.Owner;
     mb.panelChildren.Controls.Remove(this);
     mb.panelInfor.Visible = true;
     mb.lbTitle.Text = "支付信息";
     mb.SetUp();
     mb.Btn_Part.Enabled = mb.Btn_Plan.Enabled = mb.Btn_Fixed.Enabled = true;
     mb.AddInformation();//重新加载打折信息
 }
Exemple #9
0
 /// <summary>
 /// 结账按钮
 /// </summary>
 private void BtnCheckout_Click(object sender, EventArgs e)
 {
     bool choosedesk = false;
     foreach (Control ctl in this.panelDesk.Controls)
     {
         if (ctl is DeskControl.DeskControl)
         {
             DeskControl.DeskControl dcdc = (DeskControl.DeskControl)ctl;
             if (dcdc.lbStatus.Text == "dining" && dcdc.picCheck.Visible == true)
             {
                 choosedesk = true;
             }
         }
     }
     if (choosedesk)
     {
         Member mb = new Member(PassValue.consumptionid);
         mb.Owner = this;
         mb.ShowDialog();
     }
 }
Exemple #10
0
 private void Checkout()
 {
     ConsumptionObj obj = cqControl.GetlvConsumption().GetCurrentObj();
      if (obj != null)
      {
          Member mb = new Member(obj.Consumption.id, this);
          mb.ShowDialog();
      }
 }
Exemple #11
0
 /// <summary>
 /// 结账按钮
 /// </summary>
 private void BtnCheckout_Click(object sender, EventArgs e)
 {
     if (PassValue.consumptionid != "")
     {
         Member mb = new Member();
         mb.Owner = this;
         mb.Show();
     }
 }