private void Page_Load(object sender, System.EventArgs e) { lblMessaggi.Text = ""; FunId = Int32.Parse(Request["FunId"]); string id_tipo = ""; if (Request["ItemId"] != null) { itemId = Int32.Parse(Request["ItemId"]); } if (!Page.IsPostBack) { DataSet _MyDs = new DataSet(); Classi.ClassiAnagrafiche.Richiedenti _Richiedenti = new TheSite.Classi.ClassiAnagrafiche.Richiedenti(); _MyDs = _Richiedenti.GetSingleData(itemId); if (_MyDs.Tables[0].Rows.Count == 1) { DataRow _Dr = _MyDs.Tables[0].Rows[0]; // this.txtsdescrizione .Text= (string) _Dr["DESCRIZIONE"]; if (_Dr["cognome"] != DBNull.Value) { this.txtsCognome.Text = (string)_Dr["cognome"]; } if (_Dr["nome"] != DBNull.Value) { this.txtsNome.Text = _Dr["nome"].ToString(); } this.lblOperazione.Text = "Gestione Contatti"; id_tipo = _Dr["id_tipo"].ToString(); this.getAllGruppo(id_tipo); this.BindDataGrid(); } ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); if (Context.Handler is TheSite.Gestione.Richiedenti) { _fp = (TheSite.Gestione.Richiedenti)Context.Handler; this.ViewState.Add("mioContenitore", _fp._Contenitore); } } }
private void btnsElimina_Click(object sender, System.EventArgs e) { try { this.txtsCognome.DBDefaultValue = DBNull.Value; this.txtsNome.DBDefaultValue = DBNull.Value; this.txtstelefono.DBDefaultValue = DBNull.Value; this.txtsemail.DBDefaultValue = DBNull.Value; this.txtsstanza.DBDefaultValue = DBNull.Value; this.cmbsGruppo.DBDefaultValue = DBNull.Value; int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); _SCollection.AddItems(this.PanelEdit.Controls); S_Controls.Collections.S_Object s_p_idProgetto1 = new S_Object(); s_p_idProgetto1.ParameterName = "p_progetto"; s_p_idProgetto1.DbType = CustomDBType.Integer; s_p_idProgetto1.Direction = ParameterDirection.Input; s_p_idProgetto1.Index = 3; if (CmbProgetto.SelectedValue == "0") { s_p_idProgetto1.Value = DBNull.Value; } else { s_p_idProgetto1.Value = CmbProgetto.SelectedValue; } _SCollection.Add(s_p_idProgetto1); Classi.ClassiAnagrafiche.Richiedenti _Richiedenti = new TheSite.Classi.ClassiAnagrafiche.Richiedenti(); i_RowsAffected = _Richiedenti.Delete(_SCollection, itemId); if (i_RowsAffected == -1) { Server.Transfer("Richiedenti.aspx"); } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } }
private void Page_Load(object sender, System.EventArgs e) { FunId = Int32.Parse(Request["FunId"]); string id_tipo = ""; if (Request["ItemId"] != null) { itemId = Int32.Parse(Request["ItemId"]); } if (!Page.IsPostBack) { BindProgetti(); if (itemId != 0) { DataSet _MyDs = new DataSet(); Classi.ClassiAnagrafiche.Richiedenti _Richiedenti = new TheSite.Classi.ClassiAnagrafiche.Richiedenti(); _MyDs = _Richiedenti.GetSingleData(itemId); if (_MyDs.Tables[0].Rows.Count == 1) { DataRow _Dr = _MyDs.Tables[0].Rows[0]; // this.txtsdescrizione .Text= (string) _Dr["DESCRIZIONE"]; if (_Dr["cognome"] != DBNull.Value) { this.txtsCognome.Text = (string)_Dr["cognome"]; } if (_Dr["nome"] != DBNull.Value) { this.txtsNome.Text = _Dr["nome"].ToString(); } if (_Dr["phone"] != DBNull.Value) { this.txtstelefono.Text = _Dr["phone"].ToString(); } if (_Dr["email"] != DBNull.Value) { this.txtsemail.Text = _Dr["email"].ToString(); } if (_Dr["stanza"] != DBNull.Value) { this.txtsstanza.Text = _Dr["stanza"].ToString(); } if (_Dr["progetto"] != DBNull.Value) { this.CmbProgetto.SelectedValue = _Dr["progetto"].ToString(); } this.lblOperazione.Text = "Modifica Richiedente"; this.btnsElimina.Attributes.Add("onclick", "return confirm('Si vuole effettuare la cancellazione?');"); //Classi.ClassiAnagrafiche.TipoManutenzione _TipoManutenzione = new GStazioni.Classi.ClassiAnagrafiche.TipoManutenzione(); id_tipo = _Dr["id_tipo"].ToString(); } } else { this.lblOperazione.Text = "Inserimento Richiedente"; this.btnsElimina.Visible = false; } if (Request["TipoOper"] == "read") { AbilitaControlli(false); } this.getAllGruppo(id_tipo); ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); if (Context.Handler is TheSite.Gestione.Richiedenti) { _fp = (TheSite.Gestione.Richiedenti)Context.Handler; this.ViewState.Add("mioContenitore", _fp._Contenitore); } } }
private void btnsSalva_Click(object sender, System.EventArgs e) { Classi.ClassiAnagrafiche.Richiedenti _Richiedenti_0 = new Classi.ClassiAnagrafiche.Richiedenti(); this.txtsNome.DBDefaultValue = "%"; this.txtsCognome.DBDefaultValue = "%"; this.CmbProgetto.DBDefaultValue = DBNull.Value; S_ControlsCollection _SCollection_0 = new S_ControlsCollection(); S_Controls.Collections.S_Object s_p_nome = new S_Object(); s_p_nome.ParameterName = "p_nome"; s_p_nome.DbType = CustomDBType.VarChar; s_p_nome.Direction = ParameterDirection.Input; s_p_nome.Index = 0; s_p_nome.Value = txtsNome.Text; _SCollection_0.Add(s_p_nome); S_Controls.Collections.S_Object s_p_cognome = new S_Object(); s_p_cognome.ParameterName = "p_cognome"; s_p_cognome.DbType = CustomDBType.VarChar; s_p_cognome.Direction = ParameterDirection.Input; s_p_cognome.Index = 1; s_p_cognome.Value = txtsCognome.Text; _SCollection_0.Add(s_p_cognome); S_Controls.Collections.S_Object s_p_idGruppo = new S_Object(); s_p_idGruppo.ParameterName = "p_idGruppo"; s_p_idGruppo.DbType = CustomDBType.Integer; s_p_idGruppo.Direction = ParameterDirection.Input; s_p_idGruppo.Index = 2; s_p_idGruppo.Value = cmbsGruppo.SelectedValue; _SCollection_0.Add(s_p_idGruppo); S_Controls.Collections.S_Object s_p_idProgetto = new S_Object(); s_p_idProgetto.ParameterName = "p_progetto"; s_p_idProgetto.DbType = CustomDBType.Integer; s_p_idProgetto.Direction = ParameterDirection.Input; s_p_idProgetto.Index = 3; s_p_idProgetto.Value = CmbProgetto.SelectedValue; _SCollection_0.Add(s_p_idProgetto); DataSet _MyDs = _Richiedenti_0.CheckData(_SCollection_0).Copy(); if (_MyDs.Tables[0].Rows.Count == 0 || itemId != 0) { this.txtsCognome.DBDefaultValue = DBNull.Value; this.txtsNome.DBDefaultValue = DBNull.Value; if (CmbProgetto.SelectedValue == "0") { //this.txtsCognome.Text=this.txtsCognome.Text.Trim(); //this.txtsNome.Text= this.txtsNome.Text.Trim(); this.cmbsGruppo.DBDefaultValue = DBNull.Value; } this.txtstelefono.DBDefaultValue = DBNull.Value; this.txtsemail.DBDefaultValue = DBNull.Value; this.txtsstanza.DBDefaultValue = DBNull.Value; int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); _SCollection.AddItems(this.PanelEdit.Controls); S_Controls.Collections.S_Object s_p_idProgetto1 = new S_Object(); s_p_idProgetto1.ParameterName = "p_progetto"; s_p_idProgetto1.DbType = CustomDBType.Integer; s_p_idProgetto1.Direction = ParameterDirection.Input; s_p_idProgetto1.Index = 3; if (CmbProgetto.SelectedValue == "0") { s_p_idProgetto1.Value = DBNull.Value; } else { s_p_idProgetto1.Value = CmbProgetto.SelectedValue; } _SCollection.Add(s_p_idProgetto1); try { if (itemId == 0) { Classi.ClassiAnagrafiche.Richiedenti _Richiedenti = new TheSite.Classi.ClassiAnagrafiche.Richiedenti(); i_RowsAffected = _Richiedenti.Add(_SCollection); } else { Classi.ClassiAnagrafiche.Richiedenti _Richiedenti = new TheSite.Classi.ClassiAnagrafiche.Richiedenti(); i_RowsAffected = _Richiedenti.Update(_SCollection, itemId); } if (i_RowsAffected > 0) { Server.Transfer("Richiedenti.aspx"); } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } } else { PanelMess.ShowError("Richiedente esistente", true); } }