private void gvLocationList_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            try
            {
                if (e.Column.Caption == "Edit")
                {
                    Int64 nPartyID = 0;
                    var   row      = gvLocationList.GetFocusedDataRow();

                    nPartyID = Convert.ToInt64(row[1]);
                    frmMasterAddLocation frmLocation = new frmMasterAddLocation(nPartyID);
                    frmLocation.ShowDialog();
                    FillLocationMasterList();
                }
                if (e.Column.Caption == "Delete")
                {
                    var row = gvLocationList.GetFocusedDataRow();
                    int n   = Convert.ToString(gvLocationList.GetRowCellValue(e.RowHandle, "IsUsed")) == "" || Convert.ToString(gvLocationList.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.Location.GetHashCode(), Convert.ToInt64(row[1])) > 0)
                    {
                        MessageBox.Show("Location 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();
                    FillLocationMasterList();
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #2
0
        private void btnAddLocationMaster_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmMasterAddLocation ofrmMasterAddLocation = new frmMasterAddLocation();

            ofrmMasterAddLocation.ShowDialog();
        }