Esempio n. 1
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);
        }