Example #1
0
        private void butDeletesite_Click(object sender, EventArgs e)
        {
            if (lsvGroups.SelectedItems.Count > 0 && _error == false) //b
            {
                ForlabSite site = this.GetSelectedSite();
                if (site != null &&
                    MessageBox.Show("Are you sure you want to delete this site?", "Delete Site", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        DataRepository.DeleteSite(site);
                        DataRepository.CloseSession();                          //b
                        _region = DataRepository.GetRegionById(site.Region.Id); //b
                    }
                    catch (Exception ex)
                    {
                        _error = true;
                        FrmShowError frm = new FrmShowError(new ExceptionStatus()
                        {
                            message = "Site could not be deleted.", ex = ex
                        });
                        frm.ShowDialog();
                        LQTUserMessage msg = SaveOrUpdateObject();//added b
                        this.Close();
                    }
                }

                DisplaySites();
            }
        }
Example #2
0
 private void butDeletepro_Click(object sender, EventArgs e)
 {
     if (lsvGroups.SelectedItems.Count > 0 && _error == false)//b
     {
         MasterProduct pro = this.GetSelectedProduct();
         if (pro != null && MessageBox.Show("Are you sure you want to delete this Product?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             try
             {
                 //_proType.Products.Remove(pro);
                 DataRepository.DeleteProduct(pro);
                 DataRepository.CloseSession();                                    //b
                 _proType = DataRepository.GetProductTypeById(pro.ProductType.Id); //b
             }
             catch (Exception ex)
             {
                 _error = true;
                 // throw new LQTUserException(ex.Message);
                 FrmShowError frm = new FrmShowError(new ExceptionStatus()
                 {
                     message = "Product could not be deleted.", ex = ex
                 });
                 frm.ShowDialog();
                 LQTUserMessage msg = SaveOrUpdateObject();//added b
                 this.Close();
             }
         }
         DisplayProducts();
     }
 }
Example #3
0
        private void butDeletepanel_Click(object sender, EventArgs e)
        {
            ProtocolPanel p = this.GetSelectedProtocol();

            if (p != null &&
                MessageBox.Show("Are you sure you want to delete this Panel?", "Delete Panel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    DataRepository.DeleteProtocolPanel(p);
                }
                catch (Exception ex)
                {
                    FrmShowError frm = new FrmShowError(new ExceptionStatus()
                    {
                        message = "Panel could not be deleted.", ex = ex
                    });
                    frm.ShowDialog();
                }
            }

            DisplayPanel();
        }
Example #4
0
        private void butDeletesite_Click(object sender, EventArgs e)
        {
            ForlabSite site = this.GetSelectedSite();

            if (site != null &&
                MessageBox.Show("Are you sure you want to delete this site?", "Delete Site", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    DataRepository.DeleteSite(site);
                }
                catch (Exception ex)
                {
                    FrmShowError frm = new FrmShowError(new ExceptionStatus()
                    {
                        message = "Site could not be deleted.", ex = ex
                    });
                    frm.ShowDialog();
                }
            }

            DisplaySites();
        }
Example #5
0
        private void butDeletepanel_Click(object sender, EventArgs e)
        {
            ProtocolPanel panel = GetSelectedProtocol();

            if (panel != null)
            {
                if (MessageBox.Show("Are you sure you want to delete this Panel?", "Delete Panel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        _protocol.ProtocolPanels.Remove(panel);
                        DataRepository.SaveOrUpdateProtocol(_protocol);
                    }
                    catch (Exception ex)
                    {
                        FrmShowError frm = new FrmShowError(new ExceptionStatus()
                        {
                            message = "Panel could not be deleted.", ex = ex
                        });
                        frm.ShowDialog();
                    }
                }
            }
        }
Example #6
0
        private void butDeletesite_Click(object sender, EventArgs e)
        {
            if (lsvGroups.SelectedItems.Count > 0&& _error == false) //b
            {
                ForlabSite site = this.GetSelectedSite();
                if (site != null &&
                    MessageBox.Show("Are you sure you want to delete this site?", "Delete Site", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        DataRepository.DeleteSite(site);
                        DataRepository.CloseSession();//b
                        _region = DataRepository.GetRegionById(site.Region.Id);//b
                    }
                    catch (Exception ex)
                    {
                        _error = true;
                        FrmShowError frm = new FrmShowError(new ExceptionStatus() { message = "Site could not be deleted.", ex = ex });
                        frm.ShowDialog();
                        LQTUserMessage msg = SaveOrUpdateObject();//added b
                        this.Close();
                    }
                }

                DisplaySites();
            }
        }
Example #7
0
        private void butDeletepanel_Click(object sender, EventArgs e)
        {
            ProtocolPanel panel = GetSelectedProtocol();
            if (panel != null)
            {
                if (MessageBox.Show("Are you sure you want to delete this Panel?", "Delete Panel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        _protocol.ProtocolPanels.Remove(panel);
                        DataRepository.SaveOrUpdateProtocol(_protocol);
                    }
                    catch (Exception ex)
                    {
                        FrmShowError frm = new FrmShowError(new ExceptionStatus() { message = "Panel could not be deleted.", ex = ex });
                        frm.ShowDialog();
                    }
                }

            }
        }
Example #8
0
        private void butDeletesite_Click(object sender, EventArgs e)
        {
            ForlabSite site = this.GetSelectedSite();
            if (site != null &&
                MessageBox.Show("Are you sure you want to delete this site?", "Delete Site", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes )
            {
                try
                {
                    DataRepository.DeleteSite(site);
                }
                catch (Exception ex)
                {
                    FrmShowError frm = new FrmShowError(new ExceptionStatus() { message = "Site could not be deleted.", ex = ex });
                    frm.ShowDialog();
                }
            }

            DisplaySites();
        }
Example #9
0
        private void butDeletepro_Click(object sender, EventArgs e)
        {
            if (lsvGroups.SelectedItems.Count > 0 && _error == false)//b
            {
                MasterProduct pro = this.GetSelectedProduct();
                if (pro != null && MessageBox.Show("Are you sure you want to delete this Product?", "Delete Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {

                        //_proType.Products.Remove(pro);
                        DataRepository.DeleteProduct(pro);
                        DataRepository.CloseSession();//b
                        _proType = DataRepository.GetProductTypeById(pro.ProductType.Id);//b
                    }
                    catch (Exception ex)
                    {
                        _error = true;
                        // throw new LQTUserException(ex.Message);
                        FrmShowError frm = new FrmShowError(new ExceptionStatus() { message = "Product could not be deleted.", ex = ex });
                        frm.ShowDialog();
                        LQTUserMessage msg = SaveOrUpdateObject();//added b
                        this.Close();
                    }
                }
                DisplayProducts();
            }
        }
Example #10
0
        private void butDeletepanel_Click(object sender, EventArgs e)
        {
            ProtocolPanel p = this.GetSelectedProtocol();
            if (p != null &&
                MessageBox.Show("Are you sure you want to delete this Panel?", "Delete Panel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    DataRepository.DeleteProtocolPanel(p);
                }
                catch (Exception ex)
                {
                    FrmShowError frm = new FrmShowError(new ExceptionStatus() { message = "Panel could not be deleted.", ex = ex });
                    frm.ShowDialog();
                }
            }

            DisplayPanel();
        }