private void BindComuni() { this.cmbsComune.Enabled = true; this.cmbsComune.Items.Clear(); TheSite.Classi.ClassiAnagrafiche.Enti _Enti = new TheSite.Classi.ClassiAnagrafiche.Enti(); S_ControlsCollection _SColl = new S_ControlsCollection(); S_Controls.Collections.S_Object s_Provid = new S_Object(); s_Provid.ParameterName = "pIdProvincia"; s_Provid.DbType = ApplicationDataLayer.DBType.CustomDBType.Integer; s_Provid.Direction = ParameterDirection.Input; s_Provid.Index = 0; s_Provid.Value = cmbsProvincia.SelectedValue; _SColl.Add(s_Provid); DataSet _MyDs = _Enti.GetComuni(_SColl).Copy(); if (_MyDs.Tables[0].Rows.Count > 0) { this.cmbsComune.DataSource = _MyDs; this.cmbsComune.DataTextField = "Testo"; this.cmbsComune.DataValueField = "Valore"; this.cmbsComune.DataBind(); } else { string s_Messagggio = "- Nessun Comune -"; this.cmbsComune.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, "-1")); } }
private void BindEnte() { TheSite.Classi.ClassiAnagrafiche.Enti _Enti = new TheSite.Classi.ClassiAnagrafiche.Enti(); this.cmbsDescrizione.Items.Clear(); DataSet _myDS = _Enti.GetData().Copy(); if (_myDS.Tables[0].Rows.Count > 0) { this.cmbsDescrizione.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(_myDS.Tables[0], "testo", "valore", "- Selezionare Ente -", ""); this.cmbsDescrizione.DataTextField = "testo"; this.cmbsDescrizione.DataValueField = "valore"; this.cmbsDescrizione.DataBind(); } }
private void BindProvince() { this.cmbsProvincia.Items.Clear(); TheSite.Classi.ClassiAnagrafiche.Enti _Enti = new TheSite.Classi.ClassiAnagrafiche.Enti(); DataSet _MyDs = _Enti.GetProvince().Copy(); if (_MyDs.Tables[0].Rows.Count > 0) { this.cmbsProvincia.DataSource = _MyDs; this.cmbsProvincia.DataTextField = "Testo"; this.cmbsProvincia.DataValueField = "Valore"; this.cmbsProvincia.DataBind(); } }
private void btnsElimina_Click(object sender, System.EventArgs e) { try { Classi.ClassiAnagrafiche.Enti _Enti = new TheSite.Classi.ClassiAnagrafiche.Enti(); int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); i_RowsAffected = _Enti.Delete(_SCollection, itemId); //if ( i_RowsAffected == 1 ) //Response.Redirect((String) ViewState["UrlReferrer"]); //Response.Redirect("Ditte.aspx?FunID="+FunId+"&Ricarica=yes"); Server.Transfer("Enti.aspx"); } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } }
private void Ricerca() { //Classi.ClassiAnagrafiche.Ditte _Ditte = new TheSite.Classi.ClassiAnagrafiche.Ditte(); TheSite.Classi.ClassiAnagrafiche.Enti _Enti = new TheSite.Classi.ClassiAnagrafiche.Enti(); this.txtsProvincia.DBDefaultValue = "%"; this.txtsComune.DBDefaultValue = "%"; this.txtsReferente.DBDefaultValue = "%"; this.txtsEmail.DBDefaultValue = "%"; this.txtsTelefono.DBDefaultValue = "%"; this.txtsIndirizzo.DBDefaultValue = "%"; this.txtsRagioneSociale.DBDefaultValue = "%"; this.txtsPartitaIva.DBDefaultValue = "%"; S_ControlsCollection _SCollection = new S_ControlsCollection(); S_Controls.Collections.S_Object s_p_Descrizione = new S_Controls.Collections.S_Object(); s_p_Descrizione.ParameterName = "pDescrizione"; s_p_Descrizione.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_p_Descrizione.Direction = ParameterDirection.Input; s_p_Descrizione.Index = 0; s_p_Descrizione.Size = 255; s_p_Descrizione.Value = this.cmbsDescrizione.SelectedValue.ToString(); _SCollection.Add(s_p_Descrizione); S_Controls.Collections.S_Object s_pProvincia = new S_Controls.Collections.S_Object(); s_pProvincia.ParameterName = "pProvincia"; s_pProvincia.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pProvincia.Direction = ParameterDirection.Input; s_pProvincia.Size = 255; s_pProvincia.Index = 1; s_pProvincia.Value = this.txtsProvincia.Text.Trim(); _SCollection.Add(s_pProvincia); S_Controls.Collections.S_Object s_pComune = new S_Controls.Collections.S_Object(); s_pComune.ParameterName = "pComune"; s_pComune.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pComune.Direction = ParameterDirection.Input; s_pComune.Index = 2; s_pComune.Size = 255; s_pComune.Value = this.txtsComune.Text.Trim(); _SCollection.Add(s_pComune); S_Controls.Collections.S_Object s_pIndirizzo = new S_Controls.Collections.S_Object(); s_pIndirizzo.ParameterName = "pIndirizzo"; s_pIndirizzo.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pIndirizzo.Direction = ParameterDirection.Input; s_pIndirizzo.Index = 3; s_pIndirizzo.Size = 255; s_pIndirizzo.Value = this.txtsIndirizzo.Text.Trim(); _SCollection.Add(s_pIndirizzo); S_Controls.Collections.S_Object s_pRagioneSociale = new S_Controls.Collections.S_Object(); s_pRagioneSociale.ParameterName = "pRagioneSociale"; s_pRagioneSociale.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pRagioneSociale.Direction = ParameterDirection.Input; s_pRagioneSociale.Index = 4; s_pRagioneSociale.Size = 255; s_pRagioneSociale.Value = this.txtsRagioneSociale.Text.Trim(); _SCollection.Add(s_pRagioneSociale); S_Controls.Collections.S_Object s_pPiva = new S_Controls.Collections.S_Object(); s_pPiva.ParameterName = "pPiva"; s_pPiva.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pPiva.Direction = ParameterDirection.Input; s_pPiva.Index = 5; s_pPiva.Size = 255; s_pPiva.Value = this.txtsPartitaIva.Text.Trim(); _SCollection.Add(s_pPiva); S_Controls.Collections.S_Object s_pTelefono = new S_Controls.Collections.S_Object(); s_pTelefono.ParameterName = "pTelefono"; s_pTelefono.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pTelefono.Direction = ParameterDirection.Input; s_pTelefono.Index = 6; s_pTelefono.Size = 255; s_pTelefono.Value = this.txtsTelefono.Text.Trim(); _SCollection.Add(s_pTelefono); S_Controls.Collections.S_Object s_pEmail = new S_Controls.Collections.S_Object(); s_pEmail.ParameterName = "pEmail"; s_pEmail.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pEmail.Direction = ParameterDirection.Input; s_pEmail.Index = 7; s_pEmail.Size = 255; s_pEmail.Value = this.txtsEmail.Text.Trim(); _SCollection.Add(s_pEmail); S_Controls.Collections.S_Object s_pReferente = new S_Controls.Collections.S_Object(); s_pReferente.ParameterName = "pReferente"; s_pReferente.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pReferente.Direction = ParameterDirection.Input; s_pReferente.Index = 8; s_pReferente.Size = 255; s_pReferente.Value = this.txtsReferente.Text.Trim(); _SCollection.Add(s_pReferente); S_Controls.Collections.S_Object s_pTelefonoReferente = new S_Controls.Collections.S_Object(); s_pTelefonoReferente.ParameterName = "pTelefonoReferente"; s_pTelefonoReferente.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pTelefonoReferente.Direction = ParameterDirection.Input; s_pTelefonoReferente.Index = 9; s_pTelefonoReferente.Size = 255; s_pTelefonoReferente.Value = this.txtsTelefonoRef.Text.Trim(); _SCollection.Add(s_pTelefonoReferente); S_Controls.Collections.S_Object s_pDataInizioContratto = new S_Controls.Collections.S_Object(); s_pDataInizioContratto.ParameterName = "PDataInizioContratto"; s_pDataInizioContratto.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pDataInizioContratto.Direction = ParameterDirection.Input; s_pDataInizioContratto.Index = 10; s_pDataInizioContratto.Size = 255; s_pDataInizioContratto.Value = CalendarPicker1.Datazione.Text; _SCollection.Add(s_pDataInizioContratto); S_Controls.Collections.S_Object s_pDataFineContratto = new S_Controls.Collections.S_Object(); s_pDataFineContratto.ParameterName = "pDataFineContratto"; s_pDataFineContratto.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pDataFineContratto.Direction = ParameterDirection.Input; s_pDataFineContratto.Index = 11; s_pDataFineContratto.Size = 255; s_pDataFineContratto.Value = CalendarPicker2.Datazione.Text; _SCollection.Add(s_pDataFineContratto); S_Controls.Collections.S_Object s_pCap = new S_Controls.Collections.S_Object(); s_pCap.ParameterName = "pCap"; s_pCap.DbType = ApplicationDataLayer.DBType.CustomDBType.VarChar; s_pCap.Direction = ParameterDirection.Input; s_pCap.Index = 12; s_pCap.Size = 255; s_pCap.Value = this.txtsCap.Text.Trim(); _SCollection.Add(s_pCap); S_Controls.Collections.S_Object s_Cursor = new S_Object(); s_Cursor.ParameterName = "io_cursor"; s_Cursor.DbType = CustomDBType.Cursor; s_Cursor.Direction = ParameterDirection.Output; s_Cursor.Index = 13; _SCollection.Add(s_Cursor); DataSet _MyDs = _Enti.GetData(_SCollection).Copy(); this.DataGridRicerca.DataSource = _MyDs.Tables[0]; if (_MyDs.Tables[0].Rows.Count == 0) { DataGridRicerca.CurrentPageIndex = 0; } else { int Pagina = 0; if ((_MyDs.Tables[0].Rows.Count % DataGridRicerca.PageSize) > 0) { Pagina++; } if (DataGridRicerca.PageCount != Convert.ToInt16((_MyDs.Tables[0].Rows.Count / DataGridRicerca.PageSize) + Pagina)) { DataGridRicerca.CurrentPageIndex = 0; } } this.DataGridRicerca.DataBind(); this.GridTitle1.NumeroRecords = _MyDs.Tables[0].Rows.Count.ToString(); }
private void Page_Load(object sender, System.EventArgs e) { FunId = Int32.Parse(Request["FunId"]); if (Request["ItemID"] != null) { itemId = Int32.Parse(Request["ItemID"]); } //Disabilito le combo prima del postback System.Text.StringBuilder sbValid = new System.Text.StringBuilder(); sbValid.Append("document.getElementById('" + this.cmbsComune.ClientID + "').disabled = true;"); this.cmbsProvincia.Attributes.Add("onchange", sbValid.ToString()); sbValid = new System.Text.StringBuilder(); sbValid.Append("document.getElementById('" + this.cmbsComune.ClientID + "').disabled = true;"); sbValid.Append("document.getElementById('" + this.cmbsProvincia.ClientID + "').disabled = true;"); if (!Page.IsPostBack) { InizializzaControlliClient(); BindProvince(); if (itemId != 0) { //Classi.ClassiAnagrafiche.Ditte _Ditte = new TheSite.Classi.ClassiAnagrafiche.Ditte(); Classi.ClassiAnagrafiche.Enti _Enti = new TheSite.Classi.ClassiAnagrafiche.Enti(); DataSet _MyDs = _Enti.GetSingleData(itemId).Copy(); if (_MyDs.Tables[0].Rows.Count == 1) { DataRow _Dr = _MyDs.Tables[0].Rows[0]; //ente descrizione this.txtsDescrizione.Text = (string)_Dr["Descrizione"]; //provincia if (_Dr["IdProvincia"] != DBNull.Value) { this.cmbsProvincia.SelectedValue = _Dr["IdProvincia"].ToString(); } BindComuni(); //comune if (_Dr["IdComune"] != DBNull.Value) { this.cmbsComune.SelectedValue = _Dr["IdComune"].ToString(); } //indirizzo if (_Dr["Indirizzo"] != DBNull.Value) { this.txtsIndirizzo.Text = (string)_Dr["Indirizzo"]; } //Ragione Sociale if (_Dr["RAGIONESOCIALE"] != DBNull.Value) { this.txtsRagioneSociale.Text = (string)_Dr["RAGIONESOCIALE"]; } //Partita Iva if (_Dr["PARTITAIVA"] != DBNull.Value) { this.txtsPartitaIva.Text = (string)_Dr["PARTITAIVA"]; } //Telefono if (_Dr["Telefono"] != DBNull.Value) { this.txtsTelefono.Text = (string)_Dr["Telefono"]; } //Mail if (_Dr["Mail"] != DBNull.Value) { this.txtsEmail.Text = (string)_Dr["Mail"]; } //Referente if (_Dr["REFERENTE"] != DBNull.Value) { this.txtsReferente.Text = (string)_Dr["REFERENTE"]; } // Telefono Referente if (_Dr["TELEFONOREFERENTE"] != DBNull.Value) { this.txtsTelefonoRef.Text = (string)_Dr["TELEFONOREFERENTE"]; } //Data Inizio Contratto if (_Dr["DATAINIZIOCONTRATTO"] != DBNull.Value) { CalendarPicker1.Datazione.Text = _Dr["DATAINIZIOCONTRATTO"].ToString().Substring(0, 10); } //Data Fine Contratto if (_Dr["DATAFINECONTRATTO"] != DBNull.Value) { CalendarPicker2.Datazione.Text = _Dr["DATAFINECONTRATTO"].ToString().Substring(0, 10); } //CAP if (_Dr["Cap"] != DBNull.Value) { this.txtsCap.Text = (string)_Dr["Cap"]; } lblFirstAndLast.Text = _Enti.GetFirstAndLastUser(_Dr); this.lblOperazione.Text = "Modifica Ente: " + this.txtsDescrizione.Text; this.lblFirstAndLast.Visible = true; this.btnsElimina.Visible = true; this.btnsElimina.Attributes.Add("onclick", "return confirm('Si vuole effettuare la cancellazione?')"); //controllo per le liste dei fornitori //ControllaListeFornitori(); } } else { this.lblOperazione.Text = "Inserimento Ente"; this.lblFirstAndLast.Visible = false; this.btnsElimina.Visible = false; BindComuni(); ImpostaProvinciaDefault("CT", "CATANIA"); } AggiornaListBox(); if (Request["TipoOper"] == "read") { AbilitaControlli(false); this.lblOperazione.Text = "Visualizzazione Ente: " + this.txtsDescrizione.Text; } ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); if (Context.Handler is TheSite.Gestione.Enti) { _fp = (TheSite.Gestione.Enti)Context.Handler; this.ViewState.Add("mioContenitore", _fp._Contenitore); } } }
private void btnsSalva_Click(object sender, System.EventArgs e) { Classi.ClassiAnagrafiche.Enti _Enti = new TheSite.Classi.ClassiAnagrafiche.Enti(); int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); //_SCollection.AddItems(this.PanelEdit.Controls); int cntParametri = 0; S_Object pDescrizione = new S_Object(); pDescrizione.ParameterName = "pDescrizione"; pDescrizione.DbType = CustomDBType.VarChar; pDescrizione.Direction = ParameterDirection.Input; pDescrizione.Index = cntParametri++; pDescrizione.Size = 255; pDescrizione.Value = txtsDescrizione.Text; _SCollection.Add(pDescrizione); S_Object pIdProvincia = new S_Object(); pIdProvincia.ParameterName = "pIdProvincia"; pIdProvincia.DbType = CustomDBType.Integer; pIdProvincia.Direction = ParameterDirection.Input; pIdProvincia.Index = cntParametri++; pIdProvincia.Size = 32; pIdProvincia.Value = Convert.ToInt32(cmbsProvincia.SelectedValue); _SCollection.Add(pIdProvincia); S_Object pIdComune = new S_Object(); pIdComune.ParameterName = "pIdComune"; pIdComune.DbType = CustomDBType.Integer; pIdComune.Direction = ParameterDirection.Input; pIdComune.Index = cntParametri++; pIdComune.Size = 32; pIdComune.Value = Convert.ToInt32(cmbsComune.SelectedValue); _SCollection.Add(pIdComune); S_Object pIndirizzo = new S_Object(); pIndirizzo.ParameterName = "pIndirizzo"; pIndirizzo.DbType = CustomDBType.VarChar; pIndirizzo.Direction = ParameterDirection.Input; pIndirizzo.Index = cntParametri++; pIndirizzo.Size = 255; pIndirizzo.Value = txtsIndirizzo.Text; _SCollection.Add(pIndirizzo); S_Object pRagioneSociale = new S_Object(); pRagioneSociale.ParameterName = "pRagioneSociale"; pRagioneSociale.DbType = CustomDBType.VarChar; pRagioneSociale.Direction = ParameterDirection.Input; pRagioneSociale.Index = cntParametri++; pRagioneSociale.Size = 255; pRagioneSociale.Value = txtsRagioneSociale.Text; _SCollection.Add(pRagioneSociale); S_Object pPiva = new S_Object(); pPiva.ParameterName = "pPiva"; pPiva.DbType = CustomDBType.VarChar; pPiva.Direction = ParameterDirection.Input; pPiva.Index = cntParametri++; pPiva.Size = 255; pPiva.Value = txtsPartitaIva.Text; _SCollection.Add(pPiva); S_Object pTelefono = new S_Object(); pTelefono.ParameterName = "pTelefono"; pTelefono.DbType = CustomDBType.VarChar; pTelefono.Direction = ParameterDirection.Input; pTelefono.Index = cntParametri++; pTelefono.Size = 255; pTelefono.Value = txtsTelefono.Text; _SCollection.Add(pTelefono); S_Object pEmail = new S_Object(); pEmail.ParameterName = "pEmail"; pEmail.DbType = CustomDBType.VarChar; pEmail.Direction = ParameterDirection.Input; pEmail.Index = cntParametri++; pEmail.Size = 255; pEmail.Value = txtsEmail.Text; _SCollection.Add(pEmail); S_Object pReferente = new S_Object(); pReferente.ParameterName = "pReferente"; pReferente.DbType = CustomDBType.VarChar; pReferente.Direction = ParameterDirection.Input; pReferente.Index = cntParametri++; pReferente.Size = 255; pReferente.Value = txtsReferente.Text; _SCollection.Add(pReferente); S_Object pTelefonoReferente = new S_Object(); pTelefonoReferente.ParameterName = "pTelefonoReferente"; pTelefonoReferente.DbType = CustomDBType.VarChar; pTelefonoReferente.Direction = ParameterDirection.Input; pTelefonoReferente.Index = cntParametri++; pTelefonoReferente.Size = 255; pTelefonoReferente.Value = txtsTelefonoRef.Text; _SCollection.Add(pTelefonoReferente); S_Object PDataInizioContratto = new S_Object(); PDataInizioContratto.ParameterName = "PDataInizioContratto"; PDataInizioContratto.DbType = CustomDBType.VarChar; PDataInizioContratto.Direction = ParameterDirection.Input; PDataInizioContratto.Index = cntParametri++; PDataInizioContratto.Size = 255; PDataInizioContratto.Value = CalendarPicker1.Datazione.Text; _SCollection.Add(PDataInizioContratto); S_Object pDataFineContratto = new S_Object(); pDataFineContratto.ParameterName = "pDataFineContratto"; pDataFineContratto.DbType = CustomDBType.VarChar; pDataFineContratto.Direction = ParameterDirection.Input; pDataFineContratto.Index = cntParametri++; pDataFineContratto.Size = 255; pDataFineContratto.Value = CalendarPicker2.Datazione.Text; _SCollection.Add(pDataFineContratto); S_Object pCap = new S_Object(); pCap.ParameterName = "pCap"; pCap.DbType = CustomDBType.VarChar; pCap.Direction = ParameterDirection.Input; pCap.Index = cntParametri++; pCap.Size = 255; pCap.Value = txtsCap.Text; _SCollection.Add(pCap); try { if (itemId == 0) { i_RowsAffected = _Enti.Add(_SCollection); } else { i_RowsAffected = _Enti.Update(_SCollection, itemId); } if (i_RowsAffected == -11) { Classi.SiteJavaScript.msgBox(this.Page, "Ditta già inserita nel DataBase."); } if (i_RowsAffected > 0) { //if (itemId==0) //Server.Transfer("Ditte.aspx?"); //Response.Redirect("EditEnti.aspx?ItemId=" + i_RowsAffected +"&FunId=" + FunId); //else Server.Transfer("Enti.aspx"); } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } }