Beispiel #1
0
        private void mbtnGenerate_Click(object sender, EventArgs e)
        {
            var msg_succ   = "Generating Successful!";
            var msg_failed = "No Data Generated!";

            if (MessageHelpers.ShowQuestion("Generate Report?") == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    FormHelpers.CursorWait(true);
                    rptdetails.SP_GeneratePriceList(UserSettings.LogInYear, BPSolutionsTools.BPSUtilitiesV1.NZ(mcboCategory.SelectedValue, "").ToString());
                    tmp_SCsummlist = tmp_SCsummbal.GetAll();
                    if (tmp_SCsummlist.Count > 0)
                    {
                        MessageHelpers.ShowInfo(msg_succ);
                    }
                    else
                    {
                        throw new Exception(msg_failed);
                    }
                }
                catch (Exception ex)
                {
                    MessageHelpers.ShowError(ex.Message);
                }
                finally
                {
                    FormHelpers.CursorWait(false);
                }
            }
        }
Beispiel #2
0
        private void mbtnSave_Click(object sender, EventArgs e)
        {
            string msg = "";

            switch (MyState)
            {
            case FormState.Add:
            case FormState.Edit:
            case FormState.Delete:
                msg = "save";
                if (MyState == FormState.Edit)
                {
                    msg = "update";
                }
                if (MessageHelpers.ShowQuestion("Are you sure you want to " + msg + " record?") == System.Windows.Forms.DialogResult.Yes)
                {
                    SaveRecord();
                }
                break;

            case FormState.View:
                MyState  = FormState.Edit;
                yearused = pi.YEARUSED;
                moldno   = pi.MoldNo;
                pibal    = new PlasticInjectionBAL();
                Init_Form();
                break;
            }
        }
        private void mbtnGenerate_Click(object sender, EventArgs e)
        {
            var msg_succ   = "Generating Successful!";
            var msg_failed = "No Data Generated!";

            if (MessageHelpers.ShowQuestion("Generate Report?") == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    FormHelpers.CursorWait(true);
                    if (rptdetails.SP_GeneratePriceListComparison(Convert.ToInt32(mcbofrstYear.SelectedValue), Convert.ToInt32(mcboscndYear.SelectedValue), BPSUtilitiesV1.NZ(mcboCategory.SelectedValue, "").ToString()).Rows.Count == 0)
                    {
                        throw new Exception(msg_failed);
                    }
                    else
                    {
                        MessageHelpers.ShowInfo(msg_succ);
                    }
                }
                catch (Exception ex)
                {
                    MessageHelpers.ShowError(ex.Message);
                }
                finally
                {
                    FormHelpers.CursorWait(false);
                }
            }
        }
Beispiel #4
0
 private void mbtnAdd_Click(object sender, EventArgs e)
 {
     if (MessageHelpers.ShowQuestion("Are you sure you want to add this record?") == DialogResult.Yes)
     {
         SaveRecord();
     }
 }
Beispiel #5
0
        private void mbtnSave_Click(object sender, EventArgs e)
        {
            string msg = "";

            switch (MyState)
            {
            case FormState.Add:
            case FormState.Edit:
                msg = "save";
                if (MyState == FormState.Edit)
                {
                    msg = "update";
                }
                if (MessageHelpers.ShowQuestion("Are you sure you want to " + msg + " record?") == System.Windows.Forms.DialogResult.Yes)
                {
                    SaveRecord();
                }
                break;

            case FormState.View:
                MyState = FormState.Edit;
                RecType = fxsp.RecType;
                fxspbal = new FXSPBAL();
                Init_Form();
                break;
            }
        }
        private void mbtnSave_Click(object sender, EventArgs e)
        {
            string msg = "";

            switch (MyState)
            {
            case FormState.Add:
            case FormState.Edit:
                msg = "save";
                if (MyState == FormState.Edit)
                {
                    msg = "update";
                }
                if (MessageHelpers.ShowQuestion("Are you sure you want to " + msg + " record?") == System.Windows.Forms.DialogResult.Yes)
                {
                    SaveRecord();
                }
                break;

            case FormState.View:
                MyState  = FormState.Edit;
                partno   = com.PartNo;
                yearused = com.YEARUSED;
                combal   = new ComponentBAL();
                Init_Form();
                break;
            }
        }
Beispiel #7
0
 private void mbtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         FormHelpers.CursorWait(true);
         if (MyState == FormState.Edit)
         {
             if (mgridList.RowCount > 1)
             {
                 CheckGridCell(mgridList);
                 if (MessageHelpers.ShowQuestion("Are you sure you want to update list?") == System.Windows.Forms.DialogResult.Yes)
                 {
                     SaveRecord();
                 }
             }
             else
             {
                 throw new Exception("No record(s) to be saved!");
             }
         }
         else
         {
             MyState = FormState.Edit;
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
     StateController();
 }
        private void mbtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                FormHelpers.CursorWait(true);
                string msg = "";
                switch (MyState)
                {
                case FormState.Add:
                case FormState.Edit:
                    msg = "save";
                    if (MyState == FormState.Edit)
                    {
                        msg = "update";
                    }
                    if (MessageHelpers.ShowQuestion("Are you sure you want to " + msg + " record?") == System.Windows.Forms.DialogResult.Yes)
                    {
                        SaveRecord();
                    }
                    break;

                case FormState.View:
                    MyState = FormState.Edit;
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
Beispiel #9
0
        private void mbtnSave_Click(object sender, EventArgs e)
        {
            SetControlValidation();
            string msg = "";

            switch (MyState)
            {
            case FormState.Add:
            case FormState.Edit:
            case FormState.Delete:
                msg = "save";
                if (MyState == FormState.Edit)
                {
                    msg = "update";
                }
                if (MessageHelpers.ShowQuestion("Are you sure you want to " + msg + " record?") == System.Windows.Forms.DialogResult.Yes)
                {
                    SaveRecord();
                }
                break;

            case FormState.View:
                MyState = FormState.Edit;
                mrcode  = modrc.SectionCode;
                mrbal   = new MODRCBAL();
                Init_Form();
                break;
            }
        }
Beispiel #10
0
 private void mbtnCancel_Click(object sender, EventArgs e)
 {
     if (MessageHelpers.ShowQuestion("Are you sure you want to exit the application?") == System.Windows.Forms.DialogResult.Yes)
     {
         Application.Exit();
     }
 }
Beispiel #11
0
        private void Delete()
        {
            try
            {
                FormHelpers.CursorWait(true);
                var msg = "Deleting";
                if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
                {
                    var yearused = UserSettings.LogInYear;
                    var partno   = mgridListVP.Rows[mgridListVP.SelectedCells[0].RowIndex].Cells["colPartNoVP"].Value.ToString();

                    vp = vpbal.GetByID(Convert.ToInt32(yearused), partno.ToString());;
                    if (vpbal.Delete(vp))
                    {
                        MessageHelpers.ShowInfo(msg + " Successful!");
                        RefreshGrid();
                        PageManager(1);
                    }
                    else
                    {
                        MessageHelpers.ShowWarning(msg + " Failed!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
Beispiel #12
0
 private void Import()
 {
     try
     {
         FormHelpers.CursorWait(true);
         GetExclData(mtxtFilePath.Text);
         var chk_itm = itmbal.GetByID(UserSettings.LogInYear, dttemp.Rows[0][1].ToString());
         if (!mcbOverWrite.Checked)
         {
             msg = "This process will import components to the current logged in year. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (chk_itm == null)
                 {
                     if (itmbal.Save(ItemToSave()))
                     {
                         tmpcombal.DistributeCompo(UserSettings.LogInYear, dttemp.Rows[0][1].ToString(), UserSettings.Username);
                         MessageHelpers.ShowInfo(msgval_success);
                         this.Close();
                     }
                 }
                 else
                 {
                     MessageHelpers.ShowInfo(msgval_nochanges);
                     this.Close();
                 }
             }
         }
         else
         {
             msg = "This process will remove the existing components and replace it. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (chk_itm != null)
                 {
                     if (itmbal.Delete(chk_itm))
                     {
                         DeleteSub(chk_itm.ItemNo);
                     }
                 }
                 if (itmbal.Save(ItemToSave()))
                 {
                     tmpcombal.DistributeCompo(UserSettings.LogInYear, dttemp.Rows[0][1].ToString(), UserSettings.Username);
                     MessageHelpers.ShowInfo(msgval_success);
                     this.Close();
                 }
             }
         }
         MyCaller_itm.RefreshGrid();
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #13
0
        private void listTS_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var itemno = "";
            var strtag = e.ClickedItem.Tag;

            if (strtag != null)
            {
                if (strtag.ToString() != "")
                {
                    switch (strtag.ToString().ToLower())
                    {
                    case "new":
                        ShowEntryForm(FormState.Add);
                        break;

                    case "edit":
                        ShowEntryForm(FormState.Edit);
                        break;

                    case "delete":
                        DeleteRecord();
                        break;

                    case "view":
                        ShowEntryForm(FormState.View);
                        break;

                    case "refresh":
                        RefreshGrid();
                        PageManager(1);
                        break;

                    case "copy":
                        var frm = new frm_Copier();
                        frm.Text         = "Copy Previous Items";
                        frm.MyCaller_itm = this;
                        FormHelpers.ShowDialog(frm);
                        break;

                    case "import":
                        var frm2 = new frm_ImporterByItem();
                        frm2.Text         = "Import Items";
                        frm2.MyCaller_itm = this;
                        FormHelpers.ShowDialog(frm2);
                        break;

                    case "quote":
                        itemno = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colItemNo"].Value.ToString();
                        if (MessageHelpers.ShowQuestion("Quote item " + itemno + "?") == System.Windows.Forms.DialogResult.Yes)
                        {
                            QuoteItem(itemno);
                        }
                        break;
                    }
                }
            }
        }
Beispiel #14
0
 private void SignOff(object sender, EventArgs e)
 {
     if (MessageHelpers.ShowQuestion("Logging Off?") == System.Windows.Forms.DialogResult.Yes)
     {
         UserSettings.IsAuthenticated = false;
         FormHelpers.CloseForms(this, true);
         this.AuthenticateUser();
     }
 }
Beispiel #15
0
 private void frmSQLConfiguration_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (AppSettings.AppConnected == false)
     {
         if (MessageHelpers.ShowQuestion("Would you like to exit the application?") == System.Windows.Forms.DialogResult.Yes)
         {
             Application.ExitThread();
             Application.Exit();
         }
     }
 }
Beispiel #16
0
 private void ChangePass()
 {
     current_user = userbal.GetByUsername(UserSettings.Username);
     err.Clear();
     if (current_user.Password == mtxtOldPass.Text)
     {
         if (mtxtNewPass.Text != "" && mtxtConPass.Text != "")
         {
             if (mtxtNewPass.Text == mtxtConPass.Text)
             {
                 current_user.Password = mtxtConPass.Text;
                 if (MessageHelpers.ShowQuestion("Are you sure want to change your password?") == DialogResult.Yes)
                 {
                     if (userbal.Update(current_user))
                     {
                         MessageHelpers.ShowInfo("Password successfully changed.");
                         this.Close();
                     }
                     else
                     {
                         throw new Exception("Error occured!");
                     }
                 }
             }
             else
             {
                 err.SetError(mtxtConPass, "Passwords entered does not match!");
             }
         }
         else
         {
             if (mtxtNewPass.Text == "")
             {
                 err.SetError(mtxtNewPass, "Required");
             }
             else if (mtxtNewPass.Text == "")
             {
                 err.SetError(mtxtConPass, "Required");
             }
             else
             {
                 err.SetError(mtxtNewPass, "Required");
                 err.SetError(mtxtConPass, "Required");
             }
         }
     }
     else
     {
         err.SetError(mtxtOldPass, "Please enter your old password!");
     }
     err.CheckAndShowSummaryErrorMessage();
 }
 private void CopyCategory()
 {
     try
     {
         FormHelpers.CursorWait(true);
         if (!mcbOverWrite.Checked)
         {
             msg = "This process will copy previous category from the selected year to the current logged in year. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (metroRadioButton2.Checked)
                 {
                     CopyByCat(false);
                 }
                 else
                 {
                     CopyCatByYear(false);
                 }
                 MyCaller_cat.RefreshGrid();
                 this.Close();
             }
         }
         else
         {
             msg = "This process will remove the existing categories and replace it. Do you want to continue?";
             if (MessageHelpers.ShowQuestion(msg) == DialogResult.Yes)
             {
                 if (metroRadioButton2.Checked)
                 {
                     CopyByCat(true);
                 }
                 else
                 {
                     CopyCatByYear(true);
                 }
                 MyCaller_cat.RefreshGrid();
                 this.Close();
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #18
0
 private void mbtnSave_Click(object sender, EventArgs e)
 {
     if (MyState == FormState.Edit)
     {
         if (MessageHelpers.ShowQuestion("Are you sure you want to update record?") == System.Windows.Forms.DialogResult.Yes)
         {
             SaveRecord();
         }
     }
     else
     {
         MyState = FormState.Edit;
         Init_Form();
     }
 }
 private void mbtnSave_Click(object sender, EventArgs e)
 {
     if (MyState != FormState.View)
     {
         if (MessageHelpers.ShowQuestion("Proceed with saving?") == System.Windows.Forms.DialogResult.Yes)
         {
             SaveRecord();
         }                
     }
     else
     {
         MyState = FormState.Edit;
         Init_Form();
     }
 }
Beispiel #20
0
 private void metroRadioButton1_CheckedChanged(object sender, EventArgs e)
 {
     if (metroRadioButton1.Checked)
     {
         if (MessageHelpers.ShowQuestion("This operation is crucial, do you want to continue?") == System.Windows.Forms.DialogResult.Yes)
         {
             forRDO(metroRadioButton1);
         }
         else
         {
             metroRadioButton1.Checked = false;
             forRDO(metroRadioButton2);
             metroRadioButton2.Checked = true;
         }
     }
 }
        public void DeleteRecord()
        {
            var fxsptype    = "";
            var fxspeffdate = "";

            try
            {
                if (mgridList1.SelectedRows != null)
                {
                    fxsptype    = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colRecType1"].Value.ToString();
                    fxspeffdate = mgridList1.Rows[mgridList1.SelectedCells[0].RowIndex].Cells["colEffectiveDate1"].Value.ToString();
                }
            }
            catch
            {
                if (mgridList2.SelectedRows != null)
                {
                    fxsptype    = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colRecType2"].Value.ToString();
                    fxspeffdate = mgridList2.Rows[mgridList2.SelectedCells[0].RowIndex].Cells["colEffectiveDate2"].Value.ToString();
                }
            }
            string rectype       = fxsptype;
            string effectivedate = fxspeffdate;

            if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
            {
                var isSuccess = false;
                var msg       = "Deleting";
                fxsp = FXSPbal.GetByID(rectype, Convert.ToDateTime(effectivedate));
                if (FXSPbal.Delete(fxsp))
                {
                    isSuccess = true;
                }
                if (isSuccess)
                {
                    MessageHelpers.ShowInfo(msg + " Successful!");
                    RefreshGrid();
                }
                else
                {
                    MessageHelpers.ShowWarning(msg + " Failed!");
                }
            }
        }
Beispiel #22
0
 public void Lock()
 {
     if (MessageHelpers.ShowQuestion("Are you sure want to lock this year?") == DialogResult.Yes)
     {
         var LockingisSuccess = false;
         var msg = "Locking";
         AssignforLocking(true);
         if (yearbal.Lock(year))
         {
             LockingisSuccess = true;
         }
         if (LockingisSuccess)
         {
             MessageHelpers.ShowInfo(msg + " Successful!");
             RefreshGrid();
         }
         else
         {
             MessageHelpers.ShowInfo(msg + " Failed!");
         }
     }
 }
Beispiel #23
0
 public void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var    year     = UserSettings.LogInYear;
         int    yearused = year;
         var    no       = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colPartNo"].Value.ToString();
         string partno   = no;
         if (MessageHelpers.ShowQuestion("Are you sure want to delete record?") == DialogResult.Yes)
         {
             var isSuccess = false;
             var msg       = "Deleting";
             com = combal.GetByID(yearused, partno);
             if (combal.Delete(com))
             {
                 isSuccess = true;
             }
             if (isSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #24
0
 public void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var    ino    = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colItemNo"].Value.ToString();
         string itemno = ino;
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var DeletingisSuccess = false;
             var msg = "Deleting";
             item = itembal.GetByID(yused, itemno);
             if (itembal.Delete(item))
             {
                 DeleteSub(itemno);
                 DeletingisSuccess = true;
             }
             if (DeletingisSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #25
0
 public void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var categorycode = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colCATCODE"].Value.ToString();
         var cyearused    = UserSettings.LogInYear;
         int yearused     = Convert.ToInt32(cyearused);
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var isSuccess = false;
             var msg       = "Deleting";
             cat = Categorybal.GetByID(categorycode, yearused);
             if (Categorybal.Delete(cat))
             {
                 isSuccess = true;
             }
             if (isSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #26
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageHelpers.ShowQuestion("Are you sure you want to save settings?") == System.Windows.Forms.DialogResult.Yes)
         {
             FormHelpers.CursorWait(true);
             TestConnection();
             PWCOSTINGV1.Properties.Settings.Default.Save();
             MessageHelpers.ShowInfo("Connection Settings updated successfully.");
             AppSettings.AppConnected = true;
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
 private void DeleteRecord()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var ino = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colItemNo"].Value.ToString();
         var pno = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colPartNo"].Value.ToString();
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var isSuccess = false;
             var msg       = "Deleting";
             wip = wipbal.GetByID(UserSettings.LogInYear, ino, pno);
             if (wipbal.Delete(wip))
             {
                 isSuccess = true;
             }
             if (isSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #28
0
 private void DeleteEntry()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var    selgrp     = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colUserGroupDesc"].Value;
         string selgrpcode = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colUserGroupCode"].Value.ToString();
         if (MessageHelpers.ShowQuestion("Do want to delete " + selgrp + " group?") == System.Windows.Forms.DialogResult.Yes)
         {
             if (usergroupbal.Delete(selgrpcode))
             {
                 MessageHelpers.ShowInfo(selgrp + " group deleted successfully!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #29
0
 public void RemoveYear()
 {
     try
     {
         FormHelpers.CursorWait(true);
         var recyear = mgridYearList.SelectedRows[0].Cells["colYear"].Value.ToString();
         if (MessageHelpers.ShowQuestion("Are you sure you want to remove this year?") == DialogResult.Yes)
         {
             var RemovingisSuccess = false;
             var msg = "Removing";
             fxsp = yearbal.CheckFXSPYear(Convert.ToInt32(recyear));
             cat  = yearbal.CheckCatYear(Convert.ToInt32(recyear));
             if (yearbal.Remove(Convert.ToInt32(recyear)))
             {
                 RemovingisSuccess = true;
             }
             if (RemovingisSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }
Beispiel #30
0
 public void DeleteRecord()
 {
     try
     {
         var    sectioncode = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colMODRCCode"].Value.ToString();
         string scode       = sectioncode;
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var DeletingisSuccess = false;
             var msg = "Deleting";
             modrc = mrbal.GetByID(sectioncode);
             if (mrbal.Delete(modrc))
             {
                 DeletingisSuccess = true;
             }
             if (DeletingisSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }