Ejemplo n.º 1
0
        private void BtnAddOrderItem_Click(object sender, System.EventArgs e)
        {
            var frm = new Form_CustomerDetail();

            frm.customerCode = txtCustomerCode.Text;
            frm.customerName = txtCustomerName.Text;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                Load_CustomerClass();
                gv.Refresh();
            }
        }
Ejemplo n.º 2
0
        private void Gv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridView senderGrid = (DataGridView)sender;

                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    switch (senderGrid.Columns[e.ColumnIndex].Name)
                    {
                    case "Edit":
                        var frm = new Form_CustomerDetail();

                        frm.customerCode = txtCustomerCode.Text;
                        frm.customerName = txtCustomerName.Text;
                        frm.classId      = Convert.ToInt32(dtCusClass.Rows[e.RowIndex][ConstColumns.CLASS_ID]);
                        frm.startDate    = (DateTime)dtCusClass.Rows[e.RowIndex][ConstColumns.START_DATE];

                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            Load_CustomerClass();
                            gv.Refresh();
                        }
                        break;

                    case "Del":
                        //dtCusClass.Rows[e.RowIndex].Delete();
                        //dtCusClass.AcceptChanges();
                        //gv.Refresh();
                        var frmD = new Form_CustomerDetail();

                        frmD.customerCode = txtCustomerCode.Text;
                        frmD.customerName = txtCustomerName.Text;
                        frmD.classId      = Convert.ToInt32(dtCusClass.Rows[e.RowIndex][ConstColumns.CLASS_ID]);
                        frmD.startDate    = (DateTime)dtCusClass.Rows[e.RowIndex][ConstColumns.START_DATE];
                        frmD.flagDelete   = true;
                        if (frmD.ShowDialog() == DialogResult.OK)
                        {
                            Load_CustomerClass();
                            gv.Refresh();
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }