Esempio n. 1
0
        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);
                }
            }
        }
Esempio n. 2
0
        private void BindGrid()
        {
            Classi.PmpS _PmpS = new TheSite.Classi.PmpS();

            DataTable _MyDt = (DataTable)Session["PmpS"];             //_PmpS.GetSingleData(itemId).Copy();
            DataView  _dv   = new DataView(_MyDt);

            _dv.Sort = "PASSO ASC";
            this.DataGridEsegui.DataSource = _dv;            //_MyDt;
            this.DataGridEsegui.DataBind();

            this.lblRecord.Text            = _MyDt.Rows.Count.ToString();
            this.DataGridEsegui.ShowFooter = false;
        }
Esempio n. 3
0
        private int ExecuteAllUpdate()
        {
            int     i_Result       = 0;
            int     i_MaxParametri = 0;
            DataRow riga;

            S_Controls.Collections.S_ControlsCollection _SCollection;
            S_Controls.Collections.S_Object             s_Istruz;
            S_Controls.Collections.S_Object             s_Tmp;
            S_Controls.Collections.S_Object             s_Step;

            Classi.PmpS _PmpS       = new TheSite.Classi.PmpS();
            DataTable   TabellaStep = (DataTable)Session["PmpS"];

            //inizio la transazione
            _PmpS.beginTransaction();

            try
            {
                //prima cancello tutto
                this.cancellaTutto(_PmpS);
                //poi riscrivo tutto
                for (int i = 0; i < TabellaStep.Rows.Count; i++)
                //foreach (DataRow riga in TabellaStep)
                {
                    i_Result       = 0;
                    i_MaxParametri = 0;

                    riga         = TabellaStep.Rows[i];
                    _SCollection = new S_Controls.Collections.S_ControlsCollection();

                    //ISTRUZIONI
                    s_Istruz = new S_Object();
                    s_Istruz.ParameterName = "p_Istruzioni";
                    s_Istruz.DbType        = CustomDBType.VarChar;
                    s_Istruz.Direction     = ParameterDirection.Input;
                    s_Istruz.Size          = 4000;
                    s_Istruz.Index         = i_MaxParametri;
                    s_Istruz.Value         = riga["ISTRUZIONE"];

                    i_MaxParametri++;

                    //TEMPO
                    s_Tmp = new S_Object();
                    s_Tmp.ParameterName = "p_Tempo";
                    s_Tmp.DbType        = CustomDBType.Integer;
                    s_Tmp.Direction     = ParameterDirection.Input;
                    s_Tmp.Size          = 10;
                    s_Tmp.Index         = i_MaxParametri;
                    s_Tmp.Value         = riga["TEMPO"];

                    //PASSO
                    s_Step = new S_Object();
                    s_Step.ParameterName = "p_seq_id";
                    s_Step.DbType        = CustomDBType.Integer;
                    s_Step.Direction     = ParameterDirection.Input;
                    s_Step.Size          = 10;
                    s_Step.Index         = i_MaxParametri;
                    s_Step.Value         = riga["PASSO"];

                    _SCollection.Add(s_Istruz);
                    _SCollection.Add(s_Tmp);
                    _SCollection.Add(s_Step);


                    i_Result = _PmpS.Update(_SCollection, itemId);
                }
                _PmpS.commitTransaction();
            }
            catch
            {
                _PmpS.rollbackTransaction();
                return(0);
            }

            return(i_Result);
        }