private void btnsElimina_Click(object sender, System.EventArgs e) { try { Classi.ClassiAnagrafiche.Fornitori _Fornitori = new TheSite.Classi.ClassiAnagrafiche.Fornitori(); this.txtsFornitore.DBDefaultValue = DBNull.Value; this.txtsindirizzo.DBDefaultValue = DBNull.Value; this.txtstelefono.DBDefaultValue = DBNull.Value; this.txtspiva.DBDefaultValue = DBNull.Value; this.txtsfax.DBDefaultValue = DBNull.Value; this.txtscap.DBDefaultValue = DBNull.Value; this.txtsemail.DBDefaultValue = DBNull.Value; this.cmbsprov_res.DBDefaultValue = "-1"; this.cmbscom_res.DBDefaultValue = "-1"; int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); _SCollection.AddItems(this.PanelEdit.Controls); string city = this.cmbscom_res.SelectedItem.Text; //city S_Controls.Collections.S_Object s_Idcity = new S_Object(); s_Idcity.ParameterName = "p_city"; s_Idcity.DbType = CustomDBType.VarChar; s_Idcity.Direction = ParameterDirection.Input; s_Idcity.Index = 9; s_Idcity.Size = 30; s_Idcity.Value = city; _SCollection.Add(s_Idcity); i_RowsAffected = _Fornitori.Delete(_SCollection, itemId); if (i_RowsAffected == -1) { Server.Transfer("Fornitori.aspx"); } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } }
// private void DataGridRicerca_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) // { // Classi.ClassiAnagrafiche.Ditte _Ditte = new TheSite.Classi.ClassiAnagrafiche.Ditte(); // if((e.Item.ItemType == ListItemType.Item) || // (e.Item.ItemType == ListItemType.AlternatingItem)) // { // if (e.Item.Cells[5].Text.Trim() == "()") // e.Item.Cells[5].Text=""; // // Reperisco i Servizi Associati e li associo al ToolTip // int id = Int32.Parse(e.Item.Cells[0].Text); // DataSet _MyDs = _Ditte.GetServiziDitta(id).Copy(); // // if (_MyDs.Tables[0].Rows.Count>0) // { // string str_ToolTip=""; // foreach(DataRow Dr in _MyDs.Tables[0].Rows) // { // str_ToolTip+= Dr["Descrizione"] + "\r"; // } // str_ToolTip=str_ToolTip.Substring(0,str_ToolTip.Length-1); // e.Item.ToolTip=str_ToolTip; // } // } // // } private void Ricerca() { Classi.ClassiAnagrafiche.Fornitori _Fornitori = new TheSite.Classi.ClassiAnagrafiche.Fornitori(); this.txtsComune.DBDefaultValue = "%"; this.txtsFornitore.DBDefaultValue = "%"; this.txtsEmail.DBDefaultValue = "%"; this.txtsTelefono.DBDefaultValue = "%"; this.txtsIndirizzo.DBDefaultValue = "%"; this.txtsComune.Text = this.txtsComune.Text.Trim(); this.txtsFornitore.Text = this.txtsFornitore.Text.Trim(); this.txtsEmail.Text = this.txtsEmail.Text.Trim(); this.txtsTelefono.Text = this.txtsTelefono.Text.Trim(); this.txtsIndirizzo.Text = this.txtsIndirizzo.Text.Trim(); S_ControlsCollection _SCollection = new S_ControlsCollection(); _SCollection.AddItems(this.PanelRicerca.Controls); DataSet _MyDs = _Fornitori.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"]); } if (!Page.IsPostBack) { BindProvince1(); if (itemId != 0) { DataSet _MyDs = new DataSet(); Classi.ClassiAnagrafiche.Fornitori _Fornitori = new TheSite.Classi.ClassiAnagrafiche.Fornitori(); _MyDs = _Fornitori.GetSingleData(itemId); if (_MyDs.Tables[0].Rows.Count == 1) { DataRow _Dr = _MyDs.Tables[0].Rows[0]; this.txtsFornitore.Text = (string)_Dr["FORNITORE"]; if (_Dr["PROVINCIA_ID"] != DBNull.Value) { this.cmbsprov_res.SelectedValue = _Dr["PROVINCIA_ID"].ToString(); } BindComuni1(); if (_Dr["COMUNE_ID"] != DBNull.Value) { this.cmbscom_res.SelectedValue = _Dr["COMUNE_ID"].ToString(); } if (_Dr["INDIRIZZO"] != DBNull.Value) { this.txtsindirizzo.Text = (string)_Dr["INDIRIZZO"].ToString(); } if (_Dr["TELEFONO"] != DBNull.Value) { this.txtstelefono.Text = (string)_Dr["TELEFONO"].ToString(); } if (_Dr["FAX"] != DBNull.Value) { this.txtsfax.Text = (string)_Dr["FAX"].ToString(); } if (_Dr["CAP"] != DBNull.Value) { this.txtscap.Text = (string)_Dr["CAP"].ToString(); } if (_Dr["IVA"] != DBNull.Value) { this.txtspiva.Text = (string)_Dr["IVA"].ToString(); } if (_Dr["EMAIL"] != DBNull.Value) { this.txtsemail.Text = (string)_Dr["EMAIL"].ToString(); } this.lblOperazione.Text = "Modifica Fornitore: " + this.txtsFornitore.Text; this.lblFirstAndLast.Visible = true; this.btnsElimina.Attributes.Add("onclick", "return confirm('Si vuole effettuare la cancellazione?')"); lblFirstAndLast.Text = _Fornitori.GetFirstAndLastUser(_Dr); } } else { this.lblOperazione.Text = "Inserimento Fornitore"; BindComuni1(); this.lblFirstAndLast.Visible = false; this.btnsElimina.Visible = false; } if (Request["TipoOper"] == "read") { AbilitaControlli(false); this.lblOperazione.Text = "Visualizzazione Fornitore: " + this.txtsFornitore.Text; } ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); if (Context.Handler is TheSite.Gestione.Fornitori) { _fp = (TheSite.Gestione.Fornitori)Context.Handler; this.ViewState.Add("mioContenitore", _fp._Contenitore); } } }