private void BindSpecStd(int id_serv) { //cambio il valore della combo delle specializzazioni in base al servizio passato this.cmbstr_id.Items.Clear(); S_ControlsCollection _SColl = new S_ControlsCollection(); S_Controls.Collections.S_Object s_Id = new S_Object(); s_Id.ParameterName = "p_servizio_id"; s_Id.DbType = CustomDBType.Integer; s_Id.Direction = ParameterDirection.Input; s_Id.Index = 0; s_Id.Value = id_serv; _SColl.Add(s_Id); Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); DataSet _MyDs = _Pmp.GetSpecData(_SColl).Copy(); if (_MyDs.Tables[0].Rows.Count > 0) { this.cmbstr_id.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource( _MyDs.Tables[0], "descrizione", "id", "- Selezionare una Specializzazione -", "0"); this.cmbstr_id.DataTextField = "descrizione"; this.cmbstr_id.DataValueField = "id"; this.cmbstr_id.DataBind(); } else { string s_Messagggio = "- Nessuna Specializzazione -"; this.cmbstr_id.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, "-1")); } }
private string generacodice(int id_eqstd, int id_freq) { S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); S_Controls.Collections.S_Object s_p_id_eqstd = new S_Object(); s_p_id_eqstd.ParameterName = "p_id_eqstd"; s_p_id_eqstd.DbType = CustomDBType.Integer; s_p_id_eqstd.Direction = ParameterDirection.Input; s_p_id_eqstd.Value = id_eqstd; s_p_id_eqstd.Size = 10; s_p_id_eqstd.Index = 0; _SCollection.Add(s_p_id_eqstd); S_Controls.Collections.S_Object s_p_id_freq = new S_Object(); s_p_id_freq.ParameterName = "p_id_freq"; s_p_id_freq.DbType = CustomDBType.Integer; s_p_id_freq.Direction = ParameterDirection.Input; s_p_id_freq.Value = id_freq; s_p_id_freq.Size = 10; s_p_id_freq.Index = 1; _SCollection.Add(s_p_id_freq); Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); return(_Pmp.GetCodicepmp(_SCollection)); }
private void Page_Load(object sender, System.EventArgs e) { lblMessaggi.Text = ""; FunId = Int32.Parse(Request["FunId"]); if (Request["ItemId"] != null) { itemId = Int32.Parse(Request["ItemId"]); } if (!Page.IsPostBack) { //leggo le info del pmp e le metto nel datagrid del dettaglio //string id_pmp =""; Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); DataSet _MyDsPmp = _Pmp.GetSingleData(itemId).Copy(); //id_pmp = _MyDsPmp.Tables[0].Rows[0]["pmp_id"].ToString(); this.DataGridDettaglio.DataSource = _MyDsPmp.Tables[0]; this.DataGridDettaglio.DataBind(); //leggo i passi Classi.PmpS _PmpS = new TheSite.Classi.PmpS(); //this.lblFirstAndLast.Text = _PmpS.GetFirstAndLastUser(_Dr); DataSet _MyDsPmpS = _PmpS.GetSingleData(itemId).Copy(); DataView _dv = new DataView(_MyDsPmpS.Tables[0]); _dv.Sort = "PASSO ASC"; this.DataGridEsegui.DataSource = _dv; //_MyDsPmpS.Tables[0]; this.DataGridEsegui.DataBind(); Session.Add("PmpS", _MyDsPmpS.Tables[0]); this.lblRecord.Text = _MyDsPmpS.Tables[0].Rows.Count.ToString(); this.DataGridEsegui.Columns[1].Visible = true; this.DataGridEsegui.Columns[2].Visible = false; this.DataGridEsegui.Columns[3].Visible = false; this.lblOperazione.Text = ""; this.PageTitle1.Title = "Passi per Procedura di Manutenzione Programmata "; // + id_pmp; //this.lblFirstAndLast.Visible = true; ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); if (Context.Handler is TheSite.Gestione.Pmp) { _fp = (TheSite.Gestione.Pmp)Context.Handler; this.ViewState.Add("mioContenitore", _fp._Contenitore); } } }
private void cmbseq_std_SelectedIndexChanged(object sender, System.EventArgs e) { // if (cmbseq_std.SelectedIndex>0) // { if (cmbsServizio.SelectedIndex == 0) { DataSet _MyDs; Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); int id_std = int.Parse(cmbseq_std.SelectedValue); _MyDs = _Pmp.GetStdData(id_std); DataRow _Dr = _MyDs.Tables[0].Rows[0]; int id_serv = int.Parse(_Dr["id"].ToString()); BindSpecStd(id_serv); } // } }
private void BindSpecStd() { //cambio il valore della combo delle specializzazioni this.cmbstr_id.Items.Clear(); Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); DataSet _MyDs = _Pmp.GetAllTr().Copy(); if (_MyDs.Tables[0].Rows.Count > 0) { this.cmbstr_id.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource( _MyDs.Tables[0], "descrizione", "id", "- Selezionare una Specializzazione -", "0"); this.cmbstr_id.DataTextField = "descrizione"; this.cmbstr_id.DataValueField = "id"; this.cmbstr_id.DataBind(); } else { string s_Messagggio = "- Nessuna Specializzazione -"; this.cmbstr_id.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, "-1")); } }
private void cmbseq_std_SelectedIndexChanged(object sender, System.EventArgs e) { if (cmbsServ.SelectedIndex == 0) { DataSet _MyDs; Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); int id_std = int.Parse(cmbseq_std.SelectedValue); _MyDs = _Pmp.GetStdData(id_std); DataRow _Dr = _MyDs.Tables[0].Rows[0]; int id_serv = int.Parse(_Dr["id"].ToString()); BindSpecStd(id_serv); } if (cmbseq_std.SelectedValue != "0") { txtspmp_id.Text = generacodice(Int32.Parse(cmbseq_std.SelectedValue), Int32.Parse(cmbspmp.SelectedValue)); } // s_Pmp_id = cmbseq_std.SelectedItem.Text.Substring(0,8) + "_" + cmbspmp.SelectedItem.Text.Split(Convert.ToChar("-"))[0]; // txtspmp_id.Text=s_Pmp_id; }
private void Page_Load(object sender, System.EventArgs e) { check_caselle_testo(); 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.cmbspmp.ClientID + "').disabled = true;"); sbValid.Append("document.getElementById('" + this.cmbseq_std.ClientID + "').disabled = true;"); this.cmbsServ.Attributes.Add("onchange", sbValid.ToString()); sbValid = new System.Text.StringBuilder(); sbValid.Append("document.getElementById('" + this.cmbspmp.ClientID + "').disabled = true;"); sbValid.Append("document.getElementById('" + this.cmbsServ.ClientID + "').disabled = true;"); this.cmbseq_std.Attributes.Add("onchange", sbValid.ToString()); sbValid = new System.Text.StringBuilder(); sbValid.Append("document.getElementById('" + this.cmbsServ.ClientID + "').disabled = true;"); sbValid.Append("document.getElementById('" + this.cmbseq_std.ClientID + "').disabled = true;"); this.cmbspmp.Attributes.Add("onchange", sbValid.ToString()); if (!Page.IsPostBack) { BindServizio(); //BindSpecStd();//BindTr(); BindPmPFrequenza(); if (itemId != 0) { DataSet _MyDs = new DataSet(); Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); _MyDs = _Pmp.GetSingleData(itemId); if (_MyDs.Tables[0].Rows.Count == 1) { DataRow _Dr = _MyDs.Tables[0].Rows[0]; this.txtsdescrizione.Text = _Dr["DES"].ToString(); if (_Dr["UH"] != DBNull.Value) { this.txtsunitshour.Text = _Dr["UH"].ToString(); } if (_Dr["servizi_id"] != DBNull.Value) { this.cmbsServ.SelectedValue = _Dr["servizi_id"].ToString(); } BindEqstd(int.Parse(this.cmbsServ.SelectedValue)); if (_Dr["eq_std"] != DBNull.Value) { this.cmbseq_std.SelectedValue = _Dr["eq_std"].ToString(); } BindSpecStd(int.Parse(this.cmbsServ.SelectedValue)); if (_Dr["freq"] != DBNull.Value) { this.cmbspmp.SelectedValue = _Dr["freq"].ToString(); } if (_Dr["tr"] != DBNull.Value) { BindSpecStd(); this.cmbstr.SelectedValue = _Dr["tr"].ToString(); } if (_Dr["pmp_id"] != DBNull.Value) { this.txtspmp_id.Text = _Dr["pmp_id"].ToString(); } if (_Dr["ac_id"] != DBNull.Value) { this.ChekDismesso.Checked = true; } this.lblOperazione.Text = "Modifica Procedura di Manutenzione: " + _Dr["pmp_id"].ToString(); this.lblFirstAndLast.Visible = true; this.btnsElimina.Attributes.Add("onclick", "return confirm('Si vuole effettuare la cancellazione?')"); lblFirstAndLast.Text = _Pmp.GetFirstAndLastUser(_Dr); } } else { this.lblOperazione.Text = "Inserimento Procedura di Manutenzione"; BindEqstd(0); BindSpecStd(); this.lblFirstAndLast.Visible = false; this.btnsElimina.Visible = false; } if (Request["TipoOper"] == "read") { AbilitaControlli(false); this.lblOperazione.Text = "Visualizzazione Procedura di Manutenzione: " + this.txtspmp_id.Text; } ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); if (Context.Handler is TheSite.Gestione.Pmp) { _fp = (TheSite.Gestione.Pmp)Context.Handler; this.ViewState.Add("mioContenitore", _fp._Contenitore); } } }
private void btnsSalva_Click(object sender, System.EventArgs e) { // this.txtsdescrizione.DBDefaultValue = DBNull.Value; // this.txtsunitshour.DBDefaultValue = "0"; // this.txtspmp_id.DBDefaultValue = DBNull.Value; // this.cmbseq_std.DBDefaultValue = "-1"; // this.cmbspmp.DBDefaultValue = "-1"; // this.cmbstr .DBDefaultValue = "-1"; // this.ChekDismesso.DBDefaultValue=false; // this.txtsdescrizione.Text=this.txtsdescrizione.Text.Trim(); // this.txtsunitshour.Text= this.txtsunitshour.Text.Trim(); S_Controls.Collections.S_Object s_p_descrizione = new S_Object(); s_p_descrizione.ParameterName = "p_descrizione"; s_p_descrizione.DbType = CustomDBType.VarChar; s_p_descrizione.Direction = ParameterDirection.Input; s_p_descrizione.Index = 0; s_p_descrizione.Value = txtsdescrizione.Text; s_p_descrizione.Size = 255; S_Controls.Collections.S_Object s_p_unitshour = new S_Object(); s_p_unitshour.ParameterName = "p_unitshour"; s_p_unitshour.DbType = CustomDBType.Integer; s_p_unitshour.Direction = ParameterDirection.Input; s_p_unitshour.Index = 1; s_p_unitshour.Value = txtsunitshour.Text; S_Controls.Collections.S_Object s_p_eq_std_id = new S_Object(); s_p_eq_std_id.ParameterName = "p_eq_std_id"; s_p_eq_std_id.DbType = CustomDBType.Integer; s_p_eq_std_id.Direction = ParameterDirection.Input; s_p_eq_std_id.Index = 2; s_p_eq_std_id.Value = cmbseq_std.SelectedValue; S_Controls.Collections.S_Object s_p_pmp = new S_Object(); s_p_pmp.ParameterName = "p_pmp"; s_p_pmp.DbType = CustomDBType.Integer; s_p_pmp.Direction = ParameterDirection.Input; s_p_pmp.Index = 3; s_p_pmp.Value = cmbspmp.SelectedValue; S_Controls.Collections.S_Object s_p_id_tr = new S_Object(); s_p_id_tr.ParameterName = "p_id_tr"; s_p_id_tr.DbType = CustomDBType.Integer; s_p_id_tr.Direction = ParameterDirection.Input; s_p_id_tr.Index = 4; s_p_id_tr.Value = cmbstr.SelectedValue; S_Controls.Collections.S_Object s_p_pmp_id = new S_Object(); s_p_pmp_id.ParameterName = "p_pmp_id"; s_p_pmp_id.DbType = CustomDBType.VarChar; s_p_pmp_id.Direction = ParameterDirection.Input; s_p_pmp_id.Index = 5; s_p_pmp_id.Value = txtspmp_id.Text; s_p_pmp_id.Size = 16; S_Controls.Collections.S_Object s_p_ac_id = new S_Object(); s_p_ac_id.ParameterName = "p_ac_id"; s_p_ac_id.DbType = CustomDBType.VarChar; s_p_ac_id.Direction = ParameterDirection.Input; s_p_ac_id.Index = 6; s_p_ac_id.Value = (ChekDismesso.Checked == true)?"1":"0"; int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); _SCollection.Add(s_p_descrizione); _SCollection.Add(s_p_unitshour); _SCollection.Add(s_p_eq_std_id); _SCollection.Add(s_p_pmp); _SCollection.Add(s_p_id_tr); _SCollection.Add(s_p_pmp_id); _SCollection.Add(s_p_ac_id); //_SCollection.AddItems(this.PanelEdit.Controls); try { if (itemId == 0) { Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); i_RowsAffected = _Pmp.Add(_SCollection); } else { Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); i_RowsAffected = _Pmp.Update(_SCollection, itemId); } if (i_RowsAffected == -11) { Classi.SiteJavaScript.msgBox(this.Page, "Attenzione il Piano di Manutenzione Programmata creato è già presente."); } else { Server.Transfer("Pmp.aspx"); } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } }
private void btnsElimina_Click(object sender, System.EventArgs e) { try { Classi.ClassiAnagrafiche.Pmp _Pmp = new TheSite.Classi.ClassiAnagrafiche.Pmp(); // this.txtsdescrizione.DBDefaultValue = DBNull.Value; // this.txtsunitshour.DBDefaultValue = "0"; // this.txtspmp_id.DBDefaultValue = DBNull.Value; // this.cmbseq_std.DBDefaultValue = "-1"; // this.cmbspmp.DBDefaultValue = -1; // this.cmbstr .DBDefaultValue = "-1"; S_Controls.Collections.S_Object s_p_descrizione = new S_Object(); s_p_descrizione.ParameterName = "p_descrizione"; s_p_descrizione.DbType = CustomDBType.VarChar; s_p_descrizione.Direction = ParameterDirection.Input; s_p_descrizione.Index = 0; s_p_descrizione.Value = txtsdescrizione.Text; s_p_descrizione.Size = 255; S_Controls.Collections.S_Object s_p_unitshour = new S_Object(); s_p_unitshour.ParameterName = "p_unitshour"; s_p_unitshour.DbType = CustomDBType.Integer; s_p_unitshour.Direction = ParameterDirection.Input; s_p_unitshour.Index = 1; s_p_unitshour.Value = txtsunitshour.Text; S_Controls.Collections.S_Object s_p_eq_std_id = new S_Object(); s_p_eq_std_id.ParameterName = "p_eq_std_id"; s_p_eq_std_id.DbType = CustomDBType.Integer; s_p_eq_std_id.Direction = ParameterDirection.Input; s_p_eq_std_id.Index = 2; s_p_eq_std_id.Value = cmbseq_std.SelectedValue; S_Controls.Collections.S_Object s_p_pmp = new S_Object(); s_p_pmp.ParameterName = "p_pmp"; s_p_pmp.DbType = CustomDBType.Integer; s_p_pmp.Direction = ParameterDirection.Input; s_p_pmp.Index = 3; s_p_pmp.Value = cmbspmp.SelectedValue; S_Controls.Collections.S_Object s_p_id_tr = new S_Object(); s_p_id_tr.ParameterName = "p_id_tr"; s_p_id_tr.DbType = CustomDBType.Integer; s_p_id_tr.Direction = ParameterDirection.Input; s_p_id_tr.Index = 4; s_p_id_tr.Value = cmbstr.SelectedValue; S_Controls.Collections.S_Object s_p_pmp_id = new S_Object(); s_p_pmp_id.ParameterName = "p_pmp_id"; s_p_pmp_id.DbType = CustomDBType.VarChar; s_p_pmp_id.Direction = ParameterDirection.Input; s_p_pmp_id.Index = 5; s_p_pmp_id.Value = txtspmp_id.Text; s_p_pmp_id.Size = 16; S_Controls.Collections.S_Object s_p_ac_id = new S_Object(); s_p_ac_id.ParameterName = "p_ac_id"; s_p_ac_id.DbType = CustomDBType.VarChar; s_p_ac_id.Direction = ParameterDirection.Input; s_p_ac_id.Index = 6; s_p_ac_id.Value = (ChekDismesso.Checked == true)?"1":"0"; int i_RowsAffected = 0; S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); _SCollection.Add(s_p_descrizione); _SCollection.Add(s_p_unitshour); _SCollection.Add(s_p_eq_std_id); _SCollection.Add(s_p_pmp); _SCollection.Add(s_p_id_tr); _SCollection.Add(s_p_pmp_id); _SCollection.Add(s_p_ac_id); // int i_RowsAffected = 0; // // S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection(); // // _SCollection.AddItems(this.PanelEdit.Controls); i_RowsAffected = _Pmp.Delete(_SCollection, itemId); if (i_RowsAffected == -1) { Server.Transfer("Pmp.aspx"); } } catch (Exception ex) { string s_Err = ex.Message.ToString().ToUpper(); PanelMess.ShowError(s_Err, true); } }