public override bool DeleteSelectedItem()
        {
            if (MessageBox.Show("Are you sure you want to delete this Forecasting Methodology?", "Delete Forecasting Methodology", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    if (GetSelectedConsumption().Status != ForecastStatusEnum.CLOSED.ToString())//b
                    {
                        DataRepository.DeleteForecastInfo(GetSelectedConsumption());
                        MdiParentForm.ShowStatusBarInfo("Forecasting Methodology was deleted successfully.");
                        _selectedForcastId = 0;
                        PopConsumptions();
                        return(true);
                    }
                    else//b
                    {
                        MessageBox.Show("You Can't Delete This Forecast.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                }
            }

            return(false);
        }
        public override bool DeleteSelectedItem()
        {
            if (MessageBox.Show("Are you sure you want to delete this Testing Group?", "Delete Testing Group", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    DataRepository.DeleteTestingGroup(GetSelectedTestingGroup());
                    MdiParentForm.ShowStatusBarInfo("Testing Group was deleted successfully.");
                    DataRepository.CloseSession();
                    _selectedTestgroupId = 0;
                    PopTestingGroups();
                    MdiParentForm.BuildNavigationMenu();
                    return(true);
                }
                catch (Exception ex)
                {
                    new FrmShowError(new ExceptionStatus()
                    {
                        ex = ex, message = "Sorry, you could not Delete this Testing Group."
                    }).ShowDialog();
                }
            }

            return(false);
        }
Beispiel #3
0
        public override bool DeleteSelectedItem()
        {
            int delRegionCount = 0;

            if (MessageBox.Show("Are you sure you want to delete this Region/District/Province?", "Delete Region/District/Province", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //DataRepository.DeleteRegion(GetSelectedRegion());
                for (int i = 0; i < listView1.SelectedItems.Count; i++)
                {
                    try
                    {
                        DataRepository.DeleteRegion(GetSelectedRegion(int.Parse(listView1.SelectedItems[i].Tag.ToString())));
                        delRegionCount++;
                    }
                    catch (Exception ex)
                    {
                        DataRepository.CloseSession();
                        new FrmShowError(new ExceptionStatus()
                        {
                            ex = ex, message = "Sorry you could not delete Region/District/Province  " + GetSelectedRegion(int.Parse(listView1.SelectedItems[i].Tag.ToString())).RegionName
                        }).ShowDialog();
                    }
                }
                MdiParentForm.ShowStatusBarInfo(delRegionCount + " Region/District/Province deleted successfully.");
                _selectedRegionId = 0;
                DataRepository.CloseSession();
                PopRegions();
                MdiParentForm.BuildNavigationMenu();
                return(true);
            }
            return(false);
        }
Beispiel #4
0
        public override bool DeleteSelectedItem()
        {
            int delSiteCount = 0;

            if (MessageBox.Show("Are you sure you want to delete this Site?", "Delete Site", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                for (int i = 0; i < listView1.SelectedItems.Count; i++)
                {
                    try
                    {
                        DataRepository.DeleteSite(GetSelectedSite(int.Parse(listView1.SelectedItems[i].Tag.ToString())));
                        delSiteCount++;
                    }
                    catch (Exception ex)
                    {
                        DataRepository.CloseSession();
                        new FrmShowError(new ExceptionStatus()
                        {
                            ex = ex, message = "Sorry you could not delete Site. " + GetSelectedSite(int.Parse(listView1.SelectedItems[i].Tag.ToString())).SiteName
                        }).ShowDialog();
                    }
                    //finally
                    //{
                    //    DataRepository.CloseSession();
                    //}
                }
                MdiParentForm.ShowStatusBarInfo(delSiteCount + " Site/s deleted successfully.");
                _selectedSiteId = 0;
                PopSites();
                return(true);
            }

            return(false);
        }
Beispiel #5
0
 public override bool DeleteSelectedItem()
 {
     if (_selectedTestId > 0)
     {
         if (MessageBox.Show("Are you sure you want to delete this Test?", "Delete Test", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             try
             {
                 DataRepository.DeleteMorbidityTest(GetSelectedTest());
                 MdiParentForm.ShowStatusBarInfo("Test was deleted successfully.");
                 return(true);
             }
             catch (Exception ex)
             {
                 new FrmShowError(new ExceptionStatus()
                 {
                     ex = ex, message = "Sorry, you could not delete this test."
                 }).ShowDialog();
             }
             finally
             {
                 DataRepository.CloseSession();
             }
         }
     }
     return(false);
 }
Beispiel #6
0
        private void lbtRemove_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            QuantificationMetric qmetric = GetSelectedGeneralQM();

            if (qmetric != null)
            {
                if (MessageBox.Show("Are you sure you want to delete this Quantification Metric?", "Delete Quantification Metric", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        QuantifyMenu qm = qmetric.QuantifyMenu;
                        qm.QuantificationMetrics.Remove(qmetric);
                        DataRepository.SaveOrUpdateQuantifyMenu(qm);
                        PopGeneralQM();
                        lbtRemove.Enabled = false;
                        MdiParentForm.ShowStatusBarInfo("Quantification Metric was deleted successfully.");
                    }
                    catch (Exception ex)
                    {
                        new FrmShowError(new ExceptionStatus()
                        {
                            ex = ex, message = "Sorry, there are an error to delete this Quantification Metric."
                        }).ShowDialog();
                    }
                }
            }
        }
Beispiel #7
0
        public override bool DeleteSelectedItem()
        {
            if (MessageBox.Show("Are you sure you want to delete this Instrument?", "Delete Instrument", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    DataRepository.DeleteInstrument(GetSelectedInstrument());
                    MdiParentForm.ShowStatusBarInfo("Instrument was deleted successfully.");
                    _selectedInsId = 0;
                    PopInstruments();
                    return(true);
                }
                catch (Exception ex)
                {
                    new FrmShowError(new ExceptionStatus()
                    {
                        ex = ex, message = "Sorry, you could not delete Instrument it been added as Site Instrument."
                    }).ShowDialog();
                }
                finally
                {
                    DataRepository.CloseSession();
                }
            }

            return(false);
        }
Beispiel #8
0
        public override bool DeleteSelectedItem()
        {
            if (MessageBox.Show("Are you sure you want to delete this Product Type?", "Delete Product type", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    DataRepository.DeleteProductType(GetSelectedProductType());
                    MdiParentForm.ShowStatusBarInfo("Product Type was deleted successfully.");
                    _selectedTypeId = 0;
                    PopProductType();
                    MdiParentForm.BuildNavigationMenu();
                    return(true);
                }
                catch (Exception ex)
                {
                    //DataRepository.CloseSession();
                    new FrmShowError(new ExceptionStatus()
                    {
                        ex = ex, message = "Sorry, you could not delete Product Type."
                    }).ShowDialog();
                }
                finally
                {
                    DataRepository.CloseSession();
                }
            }

            return(false);
        }
Beispiel #9
0
        public override bool DeleteSelectedItem()
        {
            int    delProCount = 0;
            string productName = null;

            if (MessageBox.Show("Are you sure you want to delete selected Product/s ?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                for (int i = 0; i < listView1.SelectedItems.Count; i++)
                {
                    try
                    {
                        DataRepository.DeleteProduct((MasterProduct)listView1.SelectedItems[i].Tag);
                        delProCount++;
                    }
                    catch
                    {
                        if (productName == null)
                        {
                            productName = ((MasterProduct)listView1.SelectedItems[i].Tag).ProductName + Environment.NewLine;
                        }
                        else
                        {
                            productName += ", " + ((MasterProduct)listView1.SelectedItems[i].Tag).ProductName + Environment.NewLine;
                        }
                    }
                }

                if (productName != null)
                {
                    MessageBox.Show("Some of Products listed below could not delete. " + Environment.NewLine + productName, "Delete selected Product(s)", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (delProCount > 0)
                {
                    MdiParentForm.ShowStatusBarInfo(delProCount + " Product/s deleted successfully.");
                }

                _selectedProId = null;
                //DataRepository.CloseSession();
                PopProduct();
                return(true);
            }

            return(false);
        }
Beispiel #10
0
        public override bool DeleteSelectedItem()
        {
            if (MessageBox.Show("Are you sure you want to delete this Forecast?", "Delete Forecasting", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    DataRepository.DeleteMorbidityForecast(GetSelectedForecast());
                    MdiParentForm.ShowStatusBarInfo("The Forecast was deleted successfully.");
                    _selectedForcastId = 0;
                    BindForecasts();
                    return(true);
                }
                catch (Exception ex)
                {
                    new FrmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
                }
            }

            return(false);
        }
Beispiel #11
0
 private void DisplayForm(T form)
 {
     MdiParentForm.SetForm(form);
 }