Exemplo n.º 1
0
        private void DisableRow()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                var row = this.dg_data.CurrentRow();
                if (row == null)
                {
                    return;
                }
                //
                if (row["enable"].ToString() == "0")
                {
                    throw new Exception("该行已经取消");
                }
                //

                if (Program.frmMsgYesNo("确认要取消该行?") == DialogResult.No)
                {
                    return;
                }
                //
                bll.DisableRow(this.ord.ord_id, row["row_index"].ToString());
                //
                row["enable"] = "0";
                this.dg_data.Refresh();

                //计算合计
                decimal amount = 0;
                foreach (DataRow line in this.dg_data.DataSource.Rows)
                {
                    if (line["enable"].ToString() == "1")
                    {
                        amount += Conv.ToDecimal(line["amount"]);
                    }
                }
                lbl合计.Text = "¥" + (amount - ord.discount_amt + ord.take_fee).ToString("0.##");
            }
            catch (Exception ex)
            {
                Program.frmMsg(ex.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
Exemplo n.º 2
0
 private void panel1_Click(object sender, EventArgs e)
 {
     try
     {
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
         //
         if (line.enable == "0")
         {
             throw new Exception("该行已经失效");
         }
         //
         if (Program.frmMsgYesNo("确认失效该行?") == DialogResult.No)
         {
             System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
             return;
         }
         //
         bll.DisableRow(line.ord_id, line.row_index);
         //
         line.enable = "0";
         this.panel1.BackgroundImage = pictureBox1.Image;
         this.panel1.Enabled         = false;
         this.panel2.BackgroundImage = pictureBox2.Image;
         this.lblindex.ForeColor     = Color.Gray;
         this.lblgoodsname.ForeColor = Color.Gray;
         this.lblremark.ForeColor    = Color.Gray;
         this.lblqty.ForeColor       = Color.Gray;
         this.lblamount.ForeColor    = Color.Gray;
         //
         if (Disable != null)
         {
             Disable.Invoke(this);
         }
     }
     catch (Exception ex)
     {
         Program.frmMsg(ex.Message);
     }
     finally
     {
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
     }
 }