Exemplo n.º 1
0
        private void toolStripButtonCancel_Click(object sender, EventArgs e)
        {
            if (dgvBillList.SelectedRows.Count > 0)
            {
                _tagBillList data = new _tagBillList();

                data.BillID      = m_Bill.BillID;
                data.GoodsID     = Convert.ToInt32(dgvBillList.SelectedRows[0].Cells["ColumnGoodsID2"].Value);
                data.GoodsName   = dgvBillList.SelectedRows[0].Cells["ColumnGoodsName2"].Value.ToString();
                data.GoodsNumber = -Convert.ToInt32(dgvBillList.SelectedRows[0].Cells["ColumnGoodsNumber"].Value);
                data.Unit        = dgvBillList.SelectedRows[0].Cells["ColumnUnit2"].Value.ToString();
                data.UnitPrice   = Convert.ToDouble(dgvBillList.SelectedRows[0].Cells["ColumnUnitPrice2"].Value);
                int Type = Convert.ToInt32(dgvBillList.SelectedRows[0].Cells["ColumnType"].Value);
                if (Type == 1 || Type == 3)
                {
                    //已经是退,不能再退
                    return;
                }
                data.Type = Type + 1;
                if (CGlobalInstance.Instance.DbAdaHelper.AddBillList(data) == true)
                {
                    ShowBillList();
                    dgvBillList.Rows[dgvBillList.RowCount - 1].Selected = true;
                    dgvBillList.CurrentCell = dgvBillList.Rows[dgvBillList.RowCount - 1].Cells["ColumnGoodsName2"];
                }
            }
        }
Exemplo n.º 2
0
        void AddCurrent()
        {
            if (dgvGoods.CurrentRow != null)
            {
                _tagBillList data = new _tagBillList();
                data.BillID      = m_Bill.BillID;
                data.GoodsID     = Convert.ToInt32(dgvGoods.CurrentRow.Cells["ColumnGoodsID"].Value);
                data.GoodsName   = dgvGoods.CurrentRow.Cells["ColumnGoodsName"].Value.ToString();
                data.GoodsNumber = 1;
                data.Unit        = dgvGoods.CurrentRow.Cells["ColumnUnit"].Value.ToString();
                data.UnitPrice   = Convert.ToDouble(dgvGoods.CurrentRow.Cells["ColumnUnitPrice"].Value);

                if (CGlobalInstance.Instance.DbAdaHelper.AddBillList(data) == true)
                {
                    ShowBillList();
                    dgvBillList.Rows[dgvBillList.RowCount - 1].Selected = true;
                    dgvBillList.CurrentCell = dgvBillList.Rows[dgvBillList.RowCount - 1].Cells["ColumnGoodsName2"];
                }
            }
        }