Example #1
0
        private void dgvHead_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1) { return; }
            if (dgvHead.Rows[e.RowIndex].Cells[20].Value.ToString() + "" != "-")
            {
                if (dgvHead.Rows[e.RowIndex].Cells[6].Value.ToString() + "" != "")
                {
                    receive.FrmNewReceive frm = new receive.FrmNewReceive(dgvHead.Rows[e.RowIndex].Cells[0].Value.ToString());
                    frm.ShowDialog();
                    if (frm.DialogResult == DialogResult.OK)
                    {
                        FindSearch();
                    }
                }
                else {
                    receive.FrmNewReceiveDep frm = new receive.FrmNewReceiveDep(dgvHead.Rows[e.RowIndex].Cells[0].Value.ToString());
                    frm.ShowDialog();
                    if (frm.DialogResult == DialogResult.OK)
                    {
                        dgvHead.DataSource = callHeadDep(FSearchDep());
                        formatDgvHead();
                        callGrid();
                    }
                }
            }
            else {
                if (dgvHead.Rows[e.RowIndex].Cells[6].Value.ToString() + "" != "")
                {
                    receive.frmReceivePrice frm = new frmReceivePrice();
                    frm.setReceiveId = dgvHead.Rows[e.RowIndex].Cells[0].Value.ToString();
                    frm.ShowDialog();
                }
                else {
                    StockAsiaDrink.frmPriceReceiveAsiaDrink frm = new StockAsiaDrink.frmPriceReceiveAsiaDrink();
                    frm.setEditId = dgvHead.Rows[e.RowIndex].Cells[0].Value.ToString();
                    frm.ShowDialog();
                }

            }
        }
Example #2
0
        private void txtreceive_KeyUp(object sender, KeyEventArgs e)
        {
            FindSearch2();
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    if (dgvHead.CurrentRow.Cells[20].Value.ToString() + "" != "-")
                    {
                        if (dgvHead.CurrentRow.Cells[6].Value.ToString() + "" != "")
                        {
                            receive.FrmNewReceive frm = new receive.FrmNewReceive(dgvHead.CurrentRow.Cells[0].Value.ToString());
                            frm.Show();
                        }
                        else
                        {
                            receive.FrmNewReceiveDep frm = new receive.FrmNewReceiveDep(dgvHead.CurrentRow.Cells[0].Value.ToString());
                            frm.Show();
                        }
                    }
                    else
                    {
                        if (dgvHead.CurrentRow.Cells[6].Value.ToString() + "" != "")
                        {
                            receive.frmReceivePrice frm = new frmReceivePrice();
                            frm.setReceiveId = dgvHead.CurrentRow.Cells[0].Value.ToString();
                            frm.ShowDialog();
                        }
                        else
                        {
                            StockAsiaDrink.frmPriceReceiveAsiaDrink frm = new StockAsiaDrink.frmPriceReceiveAsiaDrink();
                            frm.setEditId = dgvHead.CurrentRow.Cells[0].Value.ToString();
                            frm.ShowDialog();
                        }

                    }
                }
                catch { }
                dgvHead.Select();
            }
        }