private void GetDati(DataGrid Ctrl)
        {
            Hashtable _HS = null;

            if (Session["DatiListMP"] != null)
            {
                _HS = (Hashtable)Session["DatiListMP"];
            }
            else
            {
                return;
            }

            foreach (DataGridItem o_Litem in Ctrl.Items)
            {
                System.Web.UI.WebControls.CheckBox  cb   = (System.Web.UI.WebControls.CheckBox)o_Litem.Cells[2].Controls[1];
                System.Web.UI.WebControls.HyperLink link = (System.Web.UI.WebControls.HyperLink)o_Litem.Cells[3].Controls[0];

                if (_HS.ContainsKey(link.Text))
                {
                    cb.Checked = true;
                    WRList _campi = (WRList)_HS[link.Text];
                    WebControls.UserOption Opt = (WebControls.UserOption)o_Litem.Cells[9].FindControl("UserOption1");
                    if (_campi.stato == false)
                    {
                        Opt.OptChiusaSospesa.Items[0].Selected = false;
                        Opt.OptChiusaSospesa.Items[1].Selected = true;
                        Opt.TxtMotivoSospensione.Enabled       = true;
                    }
                    else
                    {
                        Opt.OptChiusaSospesa.Items[0].Selected = true;
                        Opt.OptChiusaSospesa.Items[1].Selected = false;
                    }

                    Opt.TxtMotivoSospensione.Text = _campi.descrizione;
                }
            }                   //end for
        }
        private void SaveDati(DataGrid Ctrl)
        {
            Hashtable _HS = null;

            if (Session["DatiListMP"] != null)
            {
                _HS = (Hashtable)Session["DatiListMP"];
            }
            else
            {
                _HS = new Hashtable();
            }


            foreach (DataGridItem o_Litem in Ctrl.Items)
            {
                System.Web.UI.WebControls.CheckBox  cb   = (System.Web.UI.WebControls.CheckBox)o_Litem.Cells[2].Controls[1];
                System.Web.UI.WebControls.HyperLink link = (System.Web.UI.WebControls.HyperLink)o_Litem.Cells[3].Controls[0];

                if (_HS.ContainsKey(link.Text))
                {
                    _HS.Remove(link.Text);
                }

                if (cb.Checked && cb.Enabled == true)
                {
                    WRList _campi = new WRList();
                    WebControls.UserOption Opt = (WebControls.UserOption)o_Litem.Cells[9].FindControl("UserOption1");

                    _campi.id          = link.Text;
                    _campi.stato       = Opt.OptChiusaSospesa.Items[0].Selected;
                    _campi.descrizione = Opt.TxtMotivoSospensione.Text;
                    _HS.Add(_campi.id, _campi);
                }
            }                   //end for

            Session.Remove("DatiListMP");
            Session.Add("DatiListMP", _HS);
        }
Exemplo n.º 3
0
        private DataTable UpdateWr()
        {
            int       ck = 0;
            DataTable Dt = new DataTable();

            if (Session["DatiListMP"] != null)
            {
                Classi.ManProgrammata.CompletaOrdine _Completa = new TheSite.Classi.ManProgrammata.CompletaOrdine();
                Hashtable             _HS          = (Hashtable)Session["DatiListMP"];
                IDictionaryEnumerator myEnumerator = _HS.GetEnumerator();

                while (myEnumerator.MoveNext())
                {
                    WRList _campi = (WRList)myEnumerator.Value;

                    S_Controls.Collections.S_ControlsCollection CollezioneControlli = new S_Controls.Collections.S_ControlsCollection();

                    S_Controls.Collections.S_Object p_wo_id = new S_Object();
                    p_wo_id.ParameterName = "p_wo_id";
                    p_wo_id.DbType        = CustomDBType.Integer;
                    p_wo_id.Direction     = ParameterDirection.Input;
                    p_wo_id.Index         = 0;
                    p_wo_id.Value         = Wo;
                    CollezioneControlli.Add(p_wo_id);

                    S_Controls.Collections.S_Object p_wr_id = new S_Object();
                    p_wr_id.ParameterName = "p_wr_id";
                    p_wr_id.DbType        = CustomDBType.Integer;
                    p_wr_id.Direction     = ParameterDirection.Input;
                    p_wr_id.Index         = 1;
                    p_wr_id.Value         = _campi.id;
                    CollezioneControlli.Add(p_wr_id);

                    S_Controls.Collections.S_Object p_dataip = new S_Object();
                    p_dataip.ParameterName = "p_dataip";
                    p_dataip.DbType        = CustomDBType.Date;
                    p_dataip.Direction     = ParameterDirection.Input;
                    p_dataip.Index         = 2;
                    if (Dataip.ToString() != String.Empty)
                    {
                        p_dataip.Value = Convert.ToDateTime(Dataip).ToString("d");
                    }
                    else
                    {
                        p_dataip.Value = Convert.ToDateTime("01/01/1900").ToString("d");
                    }
                    CollezioneControlli.Add(p_dataip);

                    S_Controls.Collections.S_Object p_datafp = new S_Object();
                    p_datafp.ParameterName = "p_datafp";
                    p_datafp.DbType        = CustomDBType.Date;
                    p_datafp.Direction     = ParameterDirection.Input;
                    p_datafp.Index         = 3;
                    if (Datafp.ToString() != String.Empty)
                    {
                        p_datafp.Value = Convert.ToDateTime(Datafp).ToString("d");
                    }
                    else
                    {
                        p_datafp.Value = Convert.ToDateTime("01/01/1900").ToString("d");
                    }
                    CollezioneControlli.Add(p_datafp);


                    S_Controls.Collections.S_Object p_data = new S_Object();
                    p_data.ParameterName = "p_data";
                    p_data.DbType        = CustomDBType.Date;
                    p_data.Direction     = ParameterDirection.Input;
                    p_data.Index         = 4;
                    p_data.Value         = Convert.ToDateTime(Data).ToString("d");
                    CollezioneControlli.Add(p_data);

                    S_Controls.Collections.S_Object p_data1 = new S_Object();
                    p_data1.ParameterName = "p_data1";
                    p_data1.DbType        = CustomDBType.Date;
                    p_data1.Direction     = ParameterDirection.Input;
                    p_data1.Index         = 5;
                    p_data1.Value         = Convert.ToDateTime(Data1).ToString("d");
                    CollezioneControlli.Add(p_data1);

                    S_Controls.Collections.S_Object p_stato = new S_Object();
                    p_stato.ParameterName = "p_stato";
                    p_stato.DbType        = CustomDBType.Integer;
                    p_stato.Direction     = ParameterDirection.Input;
                    p_stato.Index         = 4;

                    if (_campi.stato == false)                 //sospesa
                    {
                        p_stato.Value = 1;
                    }
                    else                    //chiusa
                    {
                        p_stato.Value = 0;
                    }
                    CollezioneControlli.Add(p_stato);

                    S_Controls.Collections.S_Object p_motivo = new S_Object();
                    p_motivo.ParameterName = "p_motivo";
                    p_motivo.DbType        = CustomDBType.VarChar;
                    p_motivo.Direction     = ParameterDirection.Input;
                    p_motivo.Size          = 4000;
                    p_motivo.Index         = 5;
                    p_motivo.Value         = _campi.descrizione;
                    CollezioneControlli.Add(p_motivo);
                    ck = _Completa.AggiornaWr1(CollezioneControlli);


                    S_Controls.Collections.S_Object p_addetto_id = new S_Object();
                    p_addetto_id.ParameterName = "p_addetto_id";
                    p_addetto_id.DbType        = CustomDBType.Integer;
                    p_addetto_id.Direction     = ParameterDirection.Input;
                    p_addetto_id.Index         = 1;
                    p_addetto_id.Value         = int.Parse(addettoWR);
                    CollezioneControlli.Add(p_addetto_id);


//					DataSet DsTemp=	_Completa.GETWO11(Wo);
//					Dt=DsTemp.Tables[0].Clone();
//					if (DsTemp.Tables[0].Rows.Count>0)
//					{
//						int r=DsTemp.Tables[0].Rows.Count;
//
//						if(Dt.Rows.Count==0)
//							Dt=DsTemp.Tables[0].Clone();
//						else
//						{
//							Dt.ImportRow(DsTemp.Tables[0].Rows[0]);
//						  }
                }
                int v = int.Parse(Wo);
                //p_addetto_id
                Classi.ManProgrammata.CompletaOrdine _Completa1 = new TheSite.Classi.ManProgrammata.CompletaOrdine();
                DataSet DsTemp = _Completa1.GETWO11(v);
                Dt = DsTemp.Tables[0];
            }

            return(Dt);
        }
Exemplo n.º 4
0
        private DataTable UpdateWr()
        {
            DataTable Dt = new DataTable();

            if (Session["DatiListMP"] != null)
            {
                Classi.ManProgrammata.CompletaOrdine _Completa = new TheSite.Classi.ManProgrammata.CompletaOrdine();
                Hashtable             _HS          = (Hashtable)Session["DatiListMP"];
                IDictionaryEnumerator myEnumerator = _HS.GetEnumerator();

                while (myEnumerator.MoveNext())
                {
                    WRList _campi = (WRList)myEnumerator.Value;

                    S_Controls.Collections.S_ControlsCollection CollezioneControlli = new S_Controls.Collections.S_ControlsCollection();

                    S_Controls.Collections.S_Object p_wo_id = new S_Object();
                    p_wo_id.ParameterName = "p_wo_id";
                    p_wo_id.DbType        = CustomDBType.Integer;
                    p_wo_id.Direction     = ParameterDirection.Input;
                    p_wo_id.Index         = 0;
                    p_wo_id.Value         = Wo;
                    CollezioneControlli.Add(p_wo_id);

                    S_Controls.Collections.S_Object p_wr_id = new S_Object();
                    p_wr_id.ParameterName = "p_wr_id";
                    p_wr_id.DbType        = CustomDBType.Integer;
                    p_wr_id.Direction     = ParameterDirection.Input;
                    p_wr_id.Index         = 1;
                    p_wr_id.Value         = _campi.id;
                    CollezioneControlli.Add(p_wr_id);

                    S_Controls.Collections.S_Object p_data = new S_Object();
                    p_data.ParameterName = "p_data";
                    p_data.DbType        = CustomDBType.Date;
                    p_data.Direction     = ParameterDirection.Input;
                    p_data.Index         = 2;
                    p_data.Value         = Convert.ToDateTime(Data).ToString("d");
                    CollezioneControlli.Add(p_data);

                    S_Controls.Collections.S_Object p_stato = new S_Object();
                    p_stato.ParameterName = "p_stato";
                    p_stato.DbType        = CustomDBType.Integer;
                    p_stato.Direction     = ParameterDirection.Input;
                    p_stato.Index         = 3;

                    if (_campi.stato == false)                 //sospesa
                    {
                        p_stato.Value = 1;
                    }
                    else                    //chiusa
                    {
                        p_stato.Value = 0;
                    }
                    CollezioneControlli.Add(p_stato);

                    S_Controls.Collections.S_Object p_motivo = new S_Object();
                    p_motivo.ParameterName = "p_motivo";
                    p_motivo.DbType        = CustomDBType.VarChar;
                    p_motivo.Direction     = ParameterDirection.Input;
                    p_motivo.Size          = 4000;
                    p_motivo.Index         = 4;
                    p_motivo.Value         = _campi.descrizione;
                    CollezioneControlli.Add(p_motivo);

                    DataSet DsTemp = _Completa.AggiornaWr(CollezioneControlli);

                    if (DsTemp.Tables[0].Rows.Count > 0)
                    {
                        if (Dt.Rows.Count == 0)
                        {
                            Dt = DsTemp.Tables[0].Clone();
                        }
                        Dt.ImportRow(DsTemp.Tables[0].Rows[0]);
                    }
                }
            }

            return(Dt);
        }