コード例 #1
0
        private void cmdEDIT_Click(object sender, EventArgs e)
        {
            Guid rowID;

            try
            {
                ISA.Bengkel.BaseForm ifrmChild;
                switch (selectedGrid)
                {
                case enumSelectedGrid.HeaderSelected:
                    if (dgvHeader.Rows.Count > 0)
                    {
                        if (_rowIDdetail == Guid.Empty)
                        {
                            _rowIDdetail = (Guid)dgvDetail1.SelectedCells[0].OwningRow.Cells["RowID2"].Value;
                        }

                        rowID     = (Guid)dgvHeader.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        ifrmChild = new frmCustomerUpdate(this, rowID, _rowIDdetail, FormTools.enumFormMode.Update);
                        //ifrmChild = new frmCustomerUpdate(this, rowID, _rowIDdetail);
                        ifrmChild.ShowDialog();
                    }
                    break;

                case enumSelectedGrid.Detail1Selected:
                    if (dgvDetail1.Rows.Count > 0)
                    {
                        rowID        = (Guid)dgvHeader.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                        _rowIDdetail = (Guid)dgvDetail1.SelectedCells[0].OwningRow.Cells["RowID2"].Value;
                        ifrmChild    = new frmCustMotorUpdate(this, rowID, _rowIDdetail, FormTools.enumFormMode.Update);
                        //ifrmChild = new frmCustomerUpdate(this, rowID, _rowIDdetail);
                        //ifrmChild = new frmCustMotorUpdate(this, rowID);
                        ifrmChild.ShowDialog();
                    }
                    break;

                case enumSelectedGrid.Detail2Selected:
                    if (dgvDetail2.Rows.Count > 0)
                    {
                        rowID     = (Guid)dgvDetail2.SelectedCells[0].OwningRow.Cells["RowID3"].Value;
                        ifrmChild = new frmCustMemberUpdate(this, rowID, FormTools.enumFormMode.Update);
                        ifrmChild.ShowDialog();
                    }
                    break;
                }
            }
            catch (System.Exception ex)
            {
                Error.LogError(ex);
            }
        }
コード例 #2
0
        private void cmdADD_Click(object sender, EventArgs e)
        {
            Guid headerID;

            try
            {
                ISA.Bengkel.BaseForm ifrmChild;
                switch (selectedGrid)
                {
                case enumSelectedGrid.HeaderSelected:
                    ifrmChild = new frmCustomerUpdate(this);
                    ifrmChild.ShowDialog();
                    break;

                case enumSelectedGrid.Detail1Selected:
                    //ifrmChild = new frmCustomerUpdate(this);
                    //ifrmChild.ShowDialog();
                    //break;
                    if (!FormTools.IsRowSelected(dgvHeader))
                    {
                        return;
                    }
                    headerID  = (Guid)dgvHeader.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    ifrmChild = new frmCustMotorUpdate(this, headerID, FormTools.enumFormMode.New);
                    ifrmChild.ShowDialog();
                    break;
                    //case enumSelectedGrid.Detail2Selected:
                    //    if (!FormTools.IsRowSelected(dgvHeader))
                    //    {
                    //        return;
                    //    }
                    //    headerID = (Guid)dgvHeader.SelectedCells[0].OwningRow.Cells["RowID"].Value;
                    //    ifrmChild = new frmCustMemberUpdate(this, headerID, FormTools.enumFormMode.New);
                    //    ifrmChild.ShowDialog();
                    //    break;
                }
            }
            catch (System.Exception ex)
            {
                Error.LogError(ex);
            }
        }