Example #1
0
        private void btnAddKit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmAddKit frmAddKit = new frmAddKit();

            frmAddKit.ShowDialog();
            //MessageBox.Show("Work is Progrss...");
        }
        private void gvKitList_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            try
            {
                if (e.Column.Caption == "Edit")
                {
                    Int64 nKitID = 0;
                    var   row    = gvKitList.GetFocusedDataRow();

                    nKitID = Convert.ToInt64(row[1]);
                    frmAddKit frmKit = new frmAddKit(nKitID);
                    frmKit.ShowDialog();
                    FillKitList();
                }
                if (e.Column.Caption == "Delete")
                {
                    var row = gvKitList.GetFocusedDataRow();
                    int n   = Convert.ToString(gvKitList.GetRowCellValue(e.RowHandle, "IsUsed")) == "" || Convert.ToString(gvKitList.GetRowCellValue(e.RowHandle, "IsUsed")) == "0" ? 0 : 1;

                    if (n == 1)
                    {
                        return;
                    }
                    if (MessageBox.Show("Do you want to delete?", clsGlobal._sMessageboxCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                    KitMaster oKitMaster = new KitMaster();
                    oKitMaster.nKitID = Convert.ToInt64(row[1]);
                    if (oKitMaster.DeleteKit() > 0)
                    {
                        MessageBox.Show("Kit details deleted successfully.", clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    if (oKitMaster != null)
                    {
                        oKitMaster.Dispose();
                        oKitMaster = null;
                    }
                    //clsMasters oclsMaster = new clsMasters();
                    //oclsMaster.nMasterID = Convert.ToInt64(row[1]);
                    //oclsMaster.MasterType = this.MasterType;
                    //oclsMaster.DeleteMaster();
                    FillKitList();
                }
                if (e.Column.Caption == "Show Asset")
                {
                    Int64 nKitID = 0;
                    var   row    = gvKitList.GetFocusedDataRow();

                    nKitID = Convert.ToInt64(row[1]);
                    frmMainKitAssetList oFrmAssetCodeList = new frmMainKitAssetList(nKitID);
                    oFrmAssetCodeList.ShowDialog();
                    FillKitList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex, clsGlobal.MessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }