예제 #1
0
        private void PopupAggiungiEccezione_AggiungiButtonClicked(object sender, UserControl.RagioniSocialiCorrelate.AggiungiEccezioneEventArgs e)
        {
            try
            {
                string err = proxyMtd.InsertDealerImport(e.Codice);

                if (err == "")
                {
                    DealerTable = proxyMtd.GetAllDealerImport();
                    eccImportGridView.DataSource = DealerTable;
                    eccImportGridView.DataBind();
                    importUpdatePanel.Update();

                    PopupAggiungiEccezione.Hide();
                }
                else
                {
                    PopupAggiungiEccezione.setErrorMessage("Codice esistente!");
                }
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #2
0
        private void PopupElimina_EliminaButtonClicked(object sender, UserControl.RagioniSocialiCorrelate.EliminaEventArgs e)
        {
            try
            {
                int IDRelazione  = Convert.ToInt32(e.IDObject);
                int IDTipoDealer = Convert.ToInt32(((Label)gvRelazioni.Rows[e.GridIndex].FindControl("IDTipoDealer")).Text);

                string error = proxyADS.DeleteRelazione(IDRelazione, IDTipoDealer);

                if (error != "")
                {
                    throw new Exception(error);
                }

                DataRow[] dr = RelazioniResults.Select("IDRelazione=" + IDRelazione);

                //RelazioniResults.Rows.RemoveAt(e.GridIndex);
                RelazioniResults.Rows.Remove(dr[0]);
                gvRelazioni.DataSource = RelazioniResults;
                gvRelazioni.DataBind();

                relazioniUpdatePanel.Update();
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #3
0
        protected void PopupAggiungiDealerBusiness_AggiungiButtonClicked(object sender, UserControl.RagioniSocialiCorrelate.AggiungiDealerBusinessEventArgs e)
        {
            try
            {
                bool esiste = proxyMtd.ExistsDealerBusiness(e.Codice);

                if (!esiste)
                {
                    AnagraficaDealerClassLib.DealerBusiness dealerBusiness = new AnagraficaDealerClassLib.DealerBusiness();

                    dealerBusiness.Codice    = e.Codice;
                    dealerBusiness.Nome      = e.RagioneSociale;
                    dealerBusiness.Indirizzo = e.Indirizzo;

                    proxyMtd.InsertDealerBusiness(dealerBusiness);
                    DealerTableBusiness = proxyMtd.GetAllDealerBusiness();

                    gvDealerBusiness.DataSource = DealerTableBusiness;
                    gvDealerBusiness.DataBind();


                    PopupAggiungiDealerBusiness.Hide();
                    dealerBusinessUpdatePanel.Update();
                }

                else
                {
                    PopupAggiungiDealerBusiness.setErrorMessage("Codice esistente!");
                }
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #4
0
        private void PopupElimina_EliminaButtonClicked(object sender, EventArgs e)
        {
            try
            {
                Boolean attivo = false;
                string  IDUtenteSelezionato = null;

                foreach (GridViewRow row in gvUtenti.Rows)
                {
                    CheckBox chkSelected = (CheckBox)row.FindControl("cbSelected");
                    if (chkSelected.Checked)
                    {
                        attivo = ((CheckBox)row.FindControl("Attivo")).Checked;
                        IDUtenteSelezionato = chkSelected.Attributes["key"];
                    }
                }

                int IDUtente = Convert.ToInt32(Session["IDUtente"].ToString());
                AnagraficaDealerService proxyMtd = new AnagraficaDealerService();
                proxyMtd.DeleteUtente(IDUtente);
                Session.Remove("IDUtente");
                GestioneUtentiSubMenuControl.enableBtnModifica(false);
                GestioneUtentiSubMenuControl.enableBtnElimina(false);

                PopupElimina.Hide();

                gvUtenti.DataSource = proxyMtd.GetAllUtenti();
                gvUtenti.DataBind();
                utenteUpdatePanel.Update();
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #5
0
        private void PopupEliminaProfilo_EliminaButtonClicked(object sender, EventArgs e)
        {
            try
            {
                int IDProfilo = Convert.ToInt32(Session["IDProfilo"].ToString());
                AnagraficaDealerService proxyMtd = new AnagraficaDealerService();
                // proxyMtd.DeleteProfilo(IDProfilo);
                string error = proxyMtd.DeleteProfilo(IDProfilo);
                if (error != string.Empty)
                {
                    PopupElimina.Hide();
                    throw new Exception(error);
                }

                Session.Remove("IDProfilo");
                GestioneProfiliSubMenuControl.enableBtnModifica(false);
                GestioneProfiliSubMenuControl.enableBtnElimina(false);

                PopupElimina.Hide();

                profiloGridView.DataSource = proxyMtd.GetAllProfili();
                profiloGridView.DataBind();
                profiliUpdatePanel.Update();
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #6
0
        protected void btnCercaUtente_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                //Utente utente = new Utente();
                if (!txtUsernameUtente.Text.Trim().Equals(""))
                {
                    DataTable utente = proxyMtd.getFromActiveDirectory(txtUsernameUtente.Text);

                    if (utente == null)
                    {
                        throw new Exception("Utente non esistente.");
                    }
                    else
                    {
                        txtUsernameUtente.Enabled = false;
                        txtNomeUtente.Text        = utente.Rows[0]["Nome"].ToString();
                        txtCognomeUtente.Text     = utente.Rows[0]["Cognome"].ToString();
                        txtEmailUtente.Text       = utente.Rows[0]["Email"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #7
0
        protected void ModicaUtenteButton_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    Utente utente = new Utente();

                    utente.IDUtente = Convert.ToInt32(IDUtenteHiddenField.Value);

                    utente.Nome      = txtNomeUtente.Text;
                    utente.Cognome   = txtCognomeUtente.Text;
                    utente.Email     = txtEmailUtente.Text;
                    utente.UserID    = txtUsernameUtente.Text;
                    utente.IDProfilo = Convert.ToInt32(ddlProfiloUtente.SelectedValue);

                    String error = proxyMtd.UpdateUtente(utente);

                    if (error != String.Empty)
                    {
                        PopupMessaggio.ShowMsgBox("Utente non modificato", false);
                    }
                    else
                    {
                        InitializeDatiUtente();
                        Response.Redirect("~/Utenti.aspx");
                    }
                }
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #8
0
        protected void SalvaRSButton_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                Relazioni rel = new Relazioni();
                rel.NomeRelazione    = txtNomeRelazione.Text;
                rel.IDDealerConsumer = Convert.ToInt32(IDDealerScelto1HF.Value);
                rel.IDDealer         = Convert.ToInt32(IDDealerScelto2HF.Value);
                rel.IDTipoDealer     = Convert.ToInt32(ddlTipoDealer2.SelectedValue);

                if ((rel.IDDealerConsumer != rel.IDDealer) || (rel.IDTipoDealer == 2))
                {
                    string err = proxyADS.InserRelazioneDealer(rel);
                    if (err == "")
                    {
                        PopupMessaggio.ShowMsgBox("Relazione creata correttamente.", false);
                        inizializzaPagina();
                    }
                    else
                    {
                        if (err.Contains("IX_RelazioneConsumer") || err.Contains("IX_RelazioneBusiness"))
                        {
                            throw new Exception("Relazione esistente.");
                        }
                        else
                        {
                            throw new Exception("Relazione non creata correttamente.");
                        }
                    }
                }
                else
                {
                    throw new Exception("Relazione non creata correttamente.");
                }
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }

            finally
            {
                resetDealer1();
                resetDealer2();
            }
        }
예제 #9
0
        private void PopupElimina_EliminaButtonClicked(object sender, UserControl.RagioniSocialiCorrelate.EliminaEventArgs e)
        {
            try
            {
                int idDealerBus = Convert.ToInt32(e.IDObject);

                proxyMtd.DeleteDealerBusiness(idDealerBus);
                DataRow[] dr = DealerTableBusiness.Select("IDDealerBusiness=" + idDealerBus);
                //DealerTableBusiness.Rows.RemoveAt(e.GridIndex);
                DealerTableBusiness.Rows.Remove(dr[0]);
                gvDealerBusiness.DataSource = DealerTableBusiness;
                gvDealerBusiness.DataBind();
                dealerBusinessUpdatePanel.Update();
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #10
0
        private void PopupElimina_EliminaButtonClicked(object sender, UserControl.RagioniSocialiCorrelate.EliminaEventArgs e)
        {
            try
            {
                //int idDealer = Convert.ToInt32(e.IDObject);

                proxyMtd.DeleteDealerImport(e.IDObject);

                DealerTable.Rows.RemoveAt(e.GridIndex);

                eccImportGridView.DataSource = DealerTable;
                eccImportGridView.DataBind();

                importUpdatePanel.Update();
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #11
0
        private void setProfilo()
        {
            try
            {
                int IDProfiloTmp = Convert.ToInt32(IDProfiloHF.Value.ToString());

                DataTable dt = proxyMtd.GetProfilo(IDProfiloTmp);

                txtNomeProfilo.Text                 = dt.Rows[0]["NomeProfilo"].ToString();
                cruscottoCheckBox.Checked           = Convert.ToBoolean(dt.Rows[0]["ArchivioCruscotto"]);
                databaseCheckBox.Checked            = Convert.ToBoolean(dt.Rows[0]["ArchivioDatabase"]);
                anomalieCheckBox.Checked            = Convert.ToBoolean(dt.Rows[0]["ReportAnomalie"]);
                scartiCheckBox.Checked              = Convert.ToBoolean(dt.Rows[0]["ReportScarti"]);
                amministrazioneCheckBox.Checked     = Convert.ToBoolean(dt.Rows[0]["Amministrazione"]);
                portafoglioCheckBox.Checked         = Convert.ToBoolean(dt.Rows[0]["Portafoglio"]);
                relazioniDropDownList.SelectedValue = Convert.ToString(dt.Rows[0]["RagioniSocialiCorrelate"]);
                eccezioniCheckBox.Checked           = Convert.ToBoolean(dt.Rows[0]["Eccezioni"]);
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #12
0
        protected void AggiungiUtenteButton_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    Utente utente = new Utente();
                    //Profilo profilo = new Profilo();

                    utente.Nome    = txtNomeUtente.Text;
                    utente.Cognome = txtCognomeUtente.Text;
                    utente.Email   = txtEmailUtente.Text;
                    utente.UserID  = txtUsernameUtente.Text;

                    utente.IDProfilo = Convert.ToInt32(ddlProfiloUtente.SelectedItem.Value);
                    //profilo.NomeProfilo = ddlProfiloUtente.SelectedItem.Text;

                    Boolean esiste = proxyMtd.InsertUtente(utente);



                    if (!esiste)
                    {
                        InitializeDatiUtente();
                        Response.Redirect("~/Utenti.aspx");
                    }
                    else
                    {
                        PopupMessaggio.ShowMsgBox("Utente gia presente.", false);
                    }
                }
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox("Errore :" + ex.Message, true);
            }
        }
예제 #13
0
        private void PopupModificheDealerBusiness_ModificaButtonClicked(object sender, UserControl.RagioniSocialiCorrelate.ModificheDealerBusinessEventArgs e)
        {
            try
            {
                AnagraficaDealerClassLib.DealerBusiness dealerBusiness = new AnagraficaDealerClassLib.DealerBusiness();

                dealerBusiness.IDDealerBusiness = Convert.ToInt32(e.IDDealerBusiness);
                dealerBusiness.Indirizzo        = e.Indirizzo;
                dealerBusiness.Nome             = e.RagioneSociale;
                dealerBusiness.Codice           = e.Codice;

                proxyMtd.UpdateDealerBusiness(dealerBusiness);

                DealerTableBusiness = proxyMtd.GetAllDealerBusiness();

                gvDealerBusiness.DataSource = DealerTableBusiness;
                gvDealerBusiness.DataBind();
                dealerBusinessUpdatePanel.Update();
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }
예제 #14
0
        protected void btnSalvaProfilo_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                Profilo myProfilo = new Profilo();
                myProfilo.IDProfilo               = Convert.ToInt32(IDProfiloHF.Value);
                myProfilo.NomeProfilo             = txtNomeProfilo.Text;
                myProfilo.ArchivioCruscotto       = cruscottoCheckBox.Checked;
                myProfilo.ArchivioDatabase        = databaseCheckBox.Checked;
                myProfilo.ReportAnomalie          = anomalieCheckBox.Checked;
                myProfilo.ReportScarti            = scartiCheckBox.Checked;
                myProfilo.Amministrazione         = amministrazioneCheckBox.Checked;
                myProfilo.Portafoglio             = portafoglioCheckBox.Checked;
                myProfilo.RagioniSocialiCorrelate = Convert.ToInt32(relazioniDropDownList.SelectedValue);
                myProfilo.Eccezioni               = eccezioniCheckBox.Checked;

                List <TipoDealer> myTipoDealerList = new List <TipoDealer>();
                foreach (DataRow dr in TipoDealerTable.Rows)
                {
                    TipoDealer myTipoDealer = new TipoDealer();
                    myTipoDealer.IDTipoDealer = Convert.ToInt32(dr["IDTipoDealer"]);
                    myTipoDealerList.Add(myTipoDealer);
                }

                List <AutorizzazioneCampi> myAutorizzazioneCampiList = new List <AutorizzazioneCampi>();
                foreach (GridViewRow myGridViewRow in autorizzazioneCampiGridView.Rows)
                {
                    if (myGridViewRow.RowType == DataControlRowType.DataRow)
                    {
                        AutorizzazioneCampi myAutorizzazioneCampi = new AutorizzazioneCampi();
                        Label        myIDAutorizzazioneCampiLabel = (Label)myGridViewRow.FindControl("IDAutorizzazioneCampiLabel");
                        DropDownList myAutorizzazioneLabel        = (DropDownList)myGridViewRow.FindControl("autorizzazioneDropDownList");
                        Label        myIDCampoDatiLabel           = (Label)myGridViewRow.FindControl("IDCampoDatiLabel");

                        myAutorizzazioneCampi.IDAutorizzazioneCampi = Convert.ToInt32(myIDAutorizzazioneCampiLabel.Text);
                        myAutorizzazioneCampi.Autorizzazione        = Convert.ToInt32(myAutorizzazioneLabel.SelectedValue);
                        myAutorizzazioneCampi.IDCampoDati           = Convert.ToInt32(myIDCampoDatiLabel.Text);

                        myAutorizzazioneCampiList.Add(myAutorizzazioneCampi);
                    }
                }


                if (myProfilo.IDProfilo == 0)
                {
                    string error = proxyMtd.InsertProfilo(myProfilo, myTipoDealerList, myAutorizzazioneCampiList);

                    if (error != string.Empty)
                    {
                        throw new Exception(error);
                    }
                }
                else
                {
                    string error = proxyMtd.UpdateProfilo(myProfilo, myTipoDealerList, myAutorizzazioneCampiList);

                    if (error != string.Empty)
                    {
                        throw new Exception(error);
                    }
                }

                Response.Redirect("~/Profili.aspx");
            }
            catch (Exception ex)
            {
                PopupMessaggio.ShowMsgBox(ex.Message, true);
            }
        }