Ejemplo n.º 1
0
        private void gvCompanyList_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            try
            {
                if (e.Column.Caption == "Edit")
                {
                    Int64 nCompanyID = 0;
                    var   row        = gvCrewList.GetFocusedDataRow();

                    nCompanyID = Convert.ToInt64(row[1]);
                    frmMasterAddCrew frmMaster = new frmMasterAddCrew(nCompanyID);
                    frmMaster.ShowDialog();
                    FillCrewMasterList();
                }
                if (e.Column.Caption == "Delete")
                {
                    var row = gvCrewList.GetFocusedDataRow();
                    int n   = Convert.ToString(gvCrewList.GetRowCellValue(e.RowHandle, "IsUsed")) == "" || Convert.ToString(gvCrewList.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;
                    }
                    clsGeneral oclsGeneral = new clsGeneral();
                    if (oclsGeneral.GetDeleteMasterType(MainMasterType.Crew.GetHashCode(), Convert.ToInt64(row[1])) > 0)
                    {
                        MessageBox.Show("Crew member details deleted successfully.", clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    if (oclsGeneral != null)
                    {
                        oclsGeneral.Dispose();
                        oclsGeneral = null;
                    }
                    //clsMasters oclsMaster = new clsMasters();
                    //oclsMaster.nMasterID = Convert.ToInt64(row[1]);
                    //oclsMaster.MasterType = this.MasterType;
                    //oclsMaster.DeleteMaster();
                    FillCrewMasterList();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.ToString(), clsGlobal._sMessageboxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 2
0
        private void btnAddCrewMaster_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmMasterAddCrew frmAddCrew = new frmMasterAddCrew();

            frmAddCrew.ShowDialog();
        }