Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
                    }
                }
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
                    }
                }

            }
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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();
        }