private void btImgDeleteCons_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            int i_RowsAffected = 0;

            if (LkCons.Text == "")
            {
                LkCons.Visible          = false;
                btImgDeleteCons.Visible = false;
                return;
            }

            Classi.GestioneCP.CompletamentoCP _CCP = new TheSite.Classi.GestioneCP.CompletamentoCP();
            S_ControlsCollection _SCollection      = new S_ControlsCollection();
            int result = 0;

            S_Object p_id_wr_cp = new S_Object();

            p_id_wr_cp.ParameterName = "p_id_wr_cp";
            p_id_wr_cp.DbType        = CustomDBType.Integer;
            p_id_wr_cp.Direction     = ParameterDirection.Input;
            p_id_wr_cp.Index         = i_RowsAffected;
            p_id_wr_cp.Size          = 100;
            p_id_wr_cp.Value         = Int32.Parse(LbCPnr.Text);
            _SCollection.Add(p_id_wr_cp);

            result = _CCP.ExecuteUpdateFile(_SCollection);

            string destDir = Server.MapPath("../Doc_DB/cp");

            destDir = System.IO.Path.Combine(destDir, LkCons.Text);
            File.Delete(destDir);

            LkCons.Visible          = false;
            btImgDeleteCons.Visible = false;
        }
        //		private void cmbs_Edificio_SelectedIndexChanged(object sender, System.EventArgs e)
        //		{
        //			LoadApparato();
        //		}



        private void btnCancella_Click(object sender, System.EventArgs e)
        {
            if (itemId != 0)
            {
                Classi.GestioneCP.CompletamentoCP _CCP = new TheSite.Classi.GestioneCP.CompletamentoCP();
                int i_RowsAffected = 0;
                S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection();

                S_Object p_id_wr_cp = new S_Object();
                p_id_wr_cp.ParameterName = "p_id_wr_cp";
                p_id_wr_cp.DbType        = CustomDBType.Integer;
                p_id_wr_cp.Direction     = ParameterDirection.Input;
                p_id_wr_cp.Index         = i_RowsAffected;
                p_id_wr_cp.Size          = 100;
                p_id_wr_cp.Value         = Int32.Parse(LbCPnr.Text);
                _SCollection.Add(p_id_wr_cp);

                itemId = _CCP.DEL_CP(_SCollection);
                Server.Transfer("CP.aspx");
            }
        }
        //		private void LoadStatoLavoro()
        //		{
        //			this.cmbsstatolavoro.Items.Clear();
        //
        //
        //			DataSet _MyDs = _ClManCorrettiva.GetStatoLavoro();
        //
        //			if (_MyDs.Tables[0].Rows.Count > 0)
        //			{
        //				this.cmbsstatolavoro.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
        //					_MyDs.Tables[0], "descrizione", "id", "- Selezionare lo Stato di Lavoro  -", "");
        //				this.cmbsstatolavoro.DataTextField = "descrizione";
        //				this.cmbsstatolavoro.DataValueField = "id";
        //				this.cmbsstatolavoro.DataBind();
        //
        //			//this.cmbsstatolavoro.Attributes.Add("onchange","SetStato(this.value);");
        //
        //			}
        //			else
        //			{
        //				string s_Messagggio = "- Nessuno Stato di Lavoro  -";
        //				this.cmbsstatolavoro.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, String.Empty));
        //			}
        //		}

        //		private void LoadEdificio()
        //		{
        //			cmbs_Edificio.Items.Clear();
        //
        //			Classi.GestioneCP.CompletamentoCP  _inviodoc = new TheSite.Classi.GestioneCP.CompletamentoCP(Context.User.Identity.Name);
        //			DataSet Ds=_inviodoc.GetEdifici(Context.User.Identity.Name);
        //
        //			if (Ds.Tables[0].Rows.Count > 0)
        //			{
        //				this.cmbs_Edificio.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
        //					Ds.Tables[0], "denominazione", "id", "- Selezionare Edificio  -", "");
        //				this.cmbs_Edificio.DataTextField = "denominazione";
        //				this.cmbs_Edificio.DataValueField = "id";
        //				this.cmbs_Edificio.DataBind();
        //
        //			}
        //			else
        //			{
        //				string s_Messagggio = "- Nessuno Edificio  -";
        //				this.cmbs_Edificio.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, String.Empty));
        //
        //			}
        //		}

        //		private void LoadApparato()
        //		{
        //			this.cmbs_Apparato.Items.Clear();
        //
        //			Classi.GestioneCP.CompletamentoCP  _CompletamentoCP = new TheSite.Classi.GestioneCP.CompletamentoCP(Context.User.Identity.Name);
        //
        //			DataSet _MyDs;
        //
        //			S_ControlsCollection _SColl = new S_ControlsCollection();
        //
        //			S_Controls.Collections.S_Object s_p_id_bl = new S_Object();
        //			s_p_id_bl.ParameterName = "p_id_bl";
        //			s_p_id_bl.DbType = CustomDBType.Integer;
        //			s_p_id_bl.Direction = ParameterDirection.Input;
        //			s_p_id_bl.Size =100;
        //			s_p_id_bl.Index = 0;
        //			s_p_id_bl.Value =(cmbs_Edificio.SelectedValue=="")?0:int.Parse(cmbs_Edificio.SelectedValue);
        //			_SColl.Add(s_p_id_bl);
        //
        //			_MyDs = _CompletamentoCP.GetApparati(_SColl).Copy();
        //
        //
        //
        //			if (_MyDs.Tables[0].Rows.Count > 0)
        //			{
        //				this.cmbs_Apparato.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
        //					_MyDs.Tables[0], "DESCRIZIONE", "ID", "- Selezionare Apparato -", "0");
        //				this.cmbs_Apparato.DataTextField = "DESCRIZIONE";
        //				this.cmbs_Apparato.DataValueField = "ID";
        //				this.cmbs_Apparato.DataBind();
        //			}
        //			else
        //			{
        //				string s_Messagggio = "- Nessun Apparato -";
        //				this.cmbs_Apparato.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio,  String.Empty));
        //			}
        //
        //		}
        //


        private void LoadFrequenze()
        {
            this.cmbs_Frequenza.Items.Clear();

            Classi.GestioneCP.CompletamentoCP _CompletamentoCP = new TheSite.Classi.GestioneCP.CompletamentoCP(Context.User.Identity.Name);

            DataSet _MyDs = _CompletamentoCP.GetDataFReq().Copy();

            if (_MyDs.Tables[0].Rows.Count > 0)
            {
                this.cmbs_Frequenza.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
                    _MyDs.Tables[0], "fqdes", "id", "- Selezionare una Frequenza -", "");
                this.cmbs_Frequenza.DataTextField  = "fqdes";
                this.cmbs_Frequenza.DataValueField = "id";
                this.cmbs_Frequenza.DataBind();
            }
            else
            {
                string s_Messagggio = "- Nessuna Frequenza -";
                this.cmbs_Frequenza.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, String.Empty));
            }
        }
        private void Ricerca(int wo_id)
        {
            //-- Valorizzo i Dati della WO
            hiddenreload.Value = "";
            S_Controls.Collections.S_ControlsCollection CollezioneControlli = new S_Controls.Collections.S_ControlsCollection();

            // WO_ID
            S_Controls.Collections.S_Object s_WO_ID = new S_Object();

            s_WO_ID.ParameterName = "p_WO_ID";
            s_WO_ID.DbType        = CustomDBType.Integer;
            s_WO_ID.Direction     = ParameterDirection.Input;
            s_WO_ID.Index         = 0;
            s_WO_ID.Size          = 4;
            s_WO_ID.Value         = wo_id;
            CollezioneControlli.Add(s_WO_ID);

            //Classi.ManProgrammata.Completamento _Compl = new TheSite.Classi.ManProgrammata.Completamento();
            Classi.GestioneCP.CompletamentoCP _Compl = new TheSite.Classi.GestioneCP.CompletamentoCP();

            DataSet _MyDs = _Compl.GetDatiWO(CollezioneControlli).Copy();
            DataRow _Dr   = _MyDs.Tables[0].Rows[0];

            // Wo_ID
            LblODL.Text = _Dr["wo_id"].ToString();
            // Localita
            if (_Dr["Localita"].ToString().Trim() != "()")
            {
                LblLocalita.Text = _Dr["Localita"].ToString();
            }
            // Edificio
            LblCodEdificio.Text = _Dr["Edificio"].ToString();
            // Indirizzo
            LblIndirizzo.Text = _Dr["Indirizzo"].ToString();
            // Data Emissione ODL
            if (_Dr["DataEmissione"].ToString() != "")
            {
                LblDataEmissione.Text = DateTime.Parse(_Dr["DataEmissione"].ToString()).ToLongDateString();
            }
            // DataPianificata
            string _CampoData = _Dr["DataPianificata"].ToString();

            if (_CampoData.Length > 0)
            {
                DateTime _Data = Convert.ToDateTime(_CampoData);
                string   mese  = Classi.Function.ImpostaMese(_Data.Month, false);
                string   anno  = _Data.Year.ToString();
                LblDataPianificata.Text    = mese + " - " + anno;
                LblDataPianificata.ToolTip = _CampoData;
            }
            // Addetto
            LblAddetto.Text = _Dr["Addetto"].ToString();
            //-- Visualizzo i Dati delle WR legate alla WO
            ///DataSet _MyDsWR = _Compl.GetDatiWR1(CollezioneControlli).Copy();
            DataSet _MyDsWR = _Compl.GetDatiWR1(CollezioneControlli).Copy();

            this.DataGridRicerca.DataSource = _MyDsWR.Tables[0];
            this.DataGridRicerca.DataBind();
            this.GridTitle1.NumeroRecords = _MyDsWR.Tables[0].Rows.Count.ToString();

            if (_MyDsWR.Tables[0].Rows.Count > 0)
            {
                DatapanelCompleta.Visible = true;
                DataGridRicerca.Visible   = true;
            }
            else
            {
                DatapanelCompleta.Visible = false;
                DataGridRicerca.Visible   = false;
            }
        }
        private void btnSalva_Click(object sender, System.EventArgs e)
        {
////////////////////////////// gestione file
            ///
            string exte     = string.Empty;
            string nomefile = string.Empty;

            //Si tratta di un inserimento
            if (Uploader.PostedFile.FileName != null)
            {
                if (LkCons != null && LkCons.Text != null && !LkCons.Text.Equals(""))
                {
                    string destDir = Server.MapPath("../Doc_DB/cp");

                    destDir = System.IO.Path.Combine(destDir, LkCons.Text);
                    File.Delete(destDir);
                }

                exte = System.IO.Path.GetExtension(Uploader.PostedFile.FileName);
                if (this.ExistFile(exte) == true)
                {
                    S_Lblerror.Text = "Il file è già presente impossibile inserire.";
                    return;
                }
            }

            //Posto il file eventuale selezionato
            nomefile = PostFile(exte);
////////// Gestione file



            Classi.GestioneCP.CompletamentoCP _CCP = new TheSite.Classi.GestioneCP.CompletamentoCP();
            int i_RowsAffected = 0;

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

            S_Object p_descrizione = new S_Object();

            p_descrizione.ParameterName = "p_descrizione";
            p_descrizione.DbType        = CustomDBType.VarChar;
            p_descrizione.Direction     = ParameterDirection.Input;
            p_descrizione.Index         = i_RowsAffected++;
            p_descrizione.Size          = 4000;
            p_descrizione.Value         = txtsCP.Text;
            _SCollection.Add(p_descrizione);

            S_Controls.Collections.S_Object p_servizio = new S_Object();
            p_servizio.ParameterName = "p_servizio";
            p_servizio.DbType        = CustomDBType.VarChar;
            p_servizio.Direction     = ParameterDirection.Input;
            p_servizio.Index         = i_RowsAffected++;;
            p_servizio.Size          = 255;
            p_servizio.Value         = Dropdownlist1.SelectedValue;
            _SCollection.Add(p_servizio);

            S_Object p_data_inizio_prevista = new S_Object();

            p_data_inizio_prevista.ParameterName = "p_data_inizio_prevista";
            p_data_inizio_prevista.DbType        = CustomDBType.VarChar;
            p_data_inizio_prevista.Direction     = ParameterDirection.Input;
            p_data_inizio_prevista.Index         = i_RowsAffected++;
            p_data_inizio_prevista.Size          = 255;
            p_data_inizio_prevista.Value         = CalendarPicker1.Datazione.Text;
            _SCollection.Add(p_data_inizio_prevista);

            //				if (itemId != 0)
            //				{
            S_Object p_data_completamento_fine = new S_Object();

            p_data_completamento_fine.ParameterName = "p_data_completamento_fine";
            p_data_completamento_fine.DbType        = CustomDBType.VarChar;
            p_data_completamento_fine.Direction     = ParameterDirection.Input;
            p_data_completamento_fine.Index         = i_RowsAffected++;
            p_data_completamento_fine.Size          = 255;
            p_data_completamento_fine.Value         = CalendarPicker3.Datazione.Text;
            _SCollection.Add(p_data_completamento_fine);

            S_Object p_note_completamento = new S_Object();

            p_note_completamento.ParameterName = "p_note_completamento";
            p_note_completamento.DbType        = CustomDBType.VarChar;
            p_note_completamento.Direction     = ParameterDirection.Input;
            p_note_completamento.Index         = i_RowsAffected++;
            p_note_completamento.Size          = 500;
            p_note_completamento.Value         = txtsNoteCompletamento.Text;
            _SCollection.Add(p_note_completamento);
            //				}

            //				S_Object p_id_bl = new S_Object();
            //				p_id_bl.ParameterName = "p_id_bl";
            //				p_id_bl.DbType = CustomDBType.Integer;
            //				p_id_bl.Direction = ParameterDirection.Input;
            //				p_id_bl.Index = i_RowsAffected++;
            //				p_id_bl.Size = 100;
            //				p_id_bl.Value = Convert.ToInt32(cmbs_Edificio.SelectedValue);
            //				_SCollection.Add(p_id_bl);


            S_Controls.Collections.S_Object s_p_Bl_Id = new S_Controls.Collections.S_Object();
            s_p_Bl_Id.ParameterName = "p_Bl_Id";
            s_p_Bl_Id.DbType        = ApplicationDataLayer.DBType.CustomDBType.VarChar;
            s_p_Bl_Id.Direction     = ParameterDirection.Input;
            s_p_Bl_Id.Size          = 50;
            s_p_Bl_Id.Index         = 0;
            s_p_Bl_Id.Value         = RicercaModulo1.TxtCodice.Text;
            _SCollection.Add(s_p_Bl_Id);

            //				S_Object p_id_eq = new S_Object();
            //				p_id_eq.ParameterName = "p_id_eq";
            //				p_id_eq.DbType = CustomDBType.Integer;
            //				p_id_eq.Direction = ParameterDirection.Input;
            //				p_id_eq.Index = i_RowsAffected++;
            //				p_id_eq.Size = 100;
            //				p_id_eq.Value = (cmbs_Apparato.SelectedValue=="")?0:int.Parse(cmbs_Apparato.SelectedValue);
            //					//Convert.ToInt32(cmbs_Apparato.SelectedValue);
            //				_SCollection.Add(p_id_eq);



            S_Object p_id_freq = new S_Object();

            p_id_freq.ParameterName = "p_id_freq";
            p_id_freq.DbType        = CustomDBType.Integer;
            p_id_freq.Direction     = ParameterDirection.Input;
            p_id_freq.Index         = i_RowsAffected++;
            p_id_freq.Size          = 100;
            p_id_freq.Value         = Convert.ToInt32(cmbs_Frequenza.SelectedValue);
            _SCollection.Add(p_id_freq);

            S_Controls.Collections.S_Object s_p_nomefile = new S_Object();
            s_p_nomefile.ParameterName = "p_nomefile";
            s_p_nomefile.DbType        = CustomDBType.VarChar;
            s_p_nomefile.Direction     = ParameterDirection.Input;
            s_p_nomefile.Index         = 1;
            s_p_nomefile.Size          = 50;
            s_p_nomefile.Value         = nomefile;
            _SCollection.Add(s_p_nomefile);

            if (itemId != 0)
            {
                S_Object p_id_wr_cp = new S_Object();
                p_id_wr_cp.ParameterName = "p_id_wr_cp";
                p_id_wr_cp.DbType        = CustomDBType.Integer;
                p_id_wr_cp.Direction     = ParameterDirection.Input;
                p_id_wr_cp.Index         = i_RowsAffected;
                p_id_wr_cp.Size          = 100;
                p_id_wr_cp.Value         = Int32.Parse(LbCPnr.Text);
                _SCollection.Add(p_id_wr_cp);
            }

            try
            {
                //					int DATAINIZIONUM=0;
                //					int DATAFINENUM=0;
                //					if (CalendarPicker1.Datazione.Text!= "")
                //					{
                //						string[] DATAINIZIO =  CalendarPicker1.Datazione.Text.Split(Convert.ToChar("/"));
                //
                //						DATAINIZIONUM= Int32.Parse(DATAINIZIO[2]+DATAINIZIO[1]+DATAINIZIO[0]);}
                //
                //					if (CalendarPicker3.Datazione.Text!= "")
                //					{
                //						string[] DATAFINE = CalendarPicker3.Datazione.Text.Split(Convert.ToChar("/"));
                //						DATAFINENUM= Int32.Parse(DATAFINE[2]+DATAFINE[1]+DATAFINE[0]);
                //					}
                if (itemId != 0)
                {
                    itemId = _CCP.UPD_CP(_SCollection);
                    Server.Transfer("CP.aspx");
                }
                else
                {
                    itemId = _CCP.INS_CP(_SCollection);
                    Server.Transfer("CP.aspx");
                }
            }
            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                PanelMess.ShowError(s_Err, true);
            }
        }
Beispiel #6
0
        private void btnSalva_Click(object sender, System.EventArgs e)
        {
            Classi.GestioneCP.CompletamentoCP _CCP = new TheSite.Classi.GestioneCP.CompletamentoCP();
            int i_RowsAffected = 0;

            S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection();
            //_SCollection.AddItems(this.PanelEdit.Controls);


            S_Object p_id_wr_cp = new S_Object();

            p_id_wr_cp.ParameterName = "p_id_wr_cp";
            p_id_wr_cp.DbType        = CustomDBType.Integer;
            p_id_wr_cp.Direction     = ParameterDirection.Input;
            p_id_wr_cp.Index         = i_RowsAffected;
            p_id_wr_cp.Size          = 100;
            p_id_wr_cp.Value         = Int32.Parse(LblRdl.Text);
            _SCollection.Add(p_id_wr_cp);

            S_Object p_data_inizio_prevista = new S_Object();

            p_data_inizio_prevista.ParameterName = "p_data_inizio_prevista";
            p_data_inizio_prevista.DbType        = CustomDBType.VarChar;
            p_data_inizio_prevista.Direction     = ParameterDirection.Input;
            p_data_inizio_prevista.Index         = i_RowsAffected++;
            p_data_inizio_prevista.Size          = 255;
            p_data_inizio_prevista.Value         = CalendarPicker1.Datazione.Text;
            _SCollection.Add(p_data_inizio_prevista);


            S_Object p_data_fine_prevista = new S_Object();

            p_data_fine_prevista.ParameterName = "p_data_fine_prevista";
            p_data_fine_prevista.DbType        = CustomDBType.VarChar;
            p_data_fine_prevista.Direction     = ParameterDirection.Input;
            p_data_fine_prevista.Index         = i_RowsAffected++;
            p_data_fine_prevista.Size          = 255;
            p_data_fine_prevista.Value         = CalendarPicker2.Datazione.Text;
            _SCollection.Add(p_data_fine_prevista);

            S_Object p_data_completamento_inizio = new S_Object();

            p_data_completamento_inizio.ParameterName = "p_data_completamento_inizio";
            p_data_completamento_inizio.DbType        = CustomDBType.VarChar;
            p_data_completamento_inizio.Direction     = ParameterDirection.Input;
            p_data_completamento_inizio.Index         = i_RowsAffected++;
            p_data_completamento_inizio.Size          = 255;
            p_data_completamento_inizio.Value         = CalendarPicker3.Datazione.Text;
            _SCollection.Add(p_data_completamento_inizio);

            S_Object p_data_completamento_fine = new S_Object();

            p_data_completamento_fine.ParameterName = "p_data_completamento_fine";
            p_data_completamento_fine.DbType        = CustomDBType.VarChar;
            p_data_completamento_fine.Direction     = ParameterDirection.Input;
            p_data_completamento_fine.Index         = i_RowsAffected++;
            p_data_completamento_fine.Size          = 255;
            p_data_completamento_fine.Value         = CalendarPicker4.Datazione.Text;
            _SCollection.Add(p_data_completamento_fine);

            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         = i_RowsAffected++;
            p_addetto_id.Size          = 100;
            p_addetto_id.Value         = Convert.ToInt32(cmbsAddetto.SelectedValue);
            _SCollection.Add(p_addetto_id);


            S_Object p_id_stato_richiesta = new S_Object();

            p_id_stato_richiesta.ParameterName = "p_id_stato_richiesta";
            p_id_stato_richiesta.DbType        = CustomDBType.Integer;
            p_id_stato_richiesta.Direction     = ParameterDirection.Input;
            p_id_stato_richiesta.Index         = i_RowsAffected++;
            p_id_stato_richiesta.Size          = 100;
            p_id_stato_richiesta.Value         = Convert.ToInt32(cmbsstatolavoro.SelectedValue);
            _SCollection.Add(p_id_stato_richiesta);



            S_Object p_note_completamento = new S_Object();

            p_note_completamento.ParameterName = "p_note_completamento";
            p_note_completamento.DbType        = CustomDBType.VarChar;
            p_note_completamento.Direction     = ParameterDirection.Input;
            p_note_completamento.Index         = i_RowsAffected++;
            p_note_completamento.Size          = 500;
            p_note_completamento.Value         = txtsNoteCompletamento.Text;
            _SCollection.Add(p_note_completamento);

            try
            {
                string result        = "";
                int    DATAINIZIONUM = 0;
                int    DATAFINENUM   = 0;
                if (CalendarPicker1.Datazione.Text != "")
                {
                    string[] DATAINIZIO = CalendarPicker1.Datazione.Text.Split(Convert.ToChar("/"));

                    DATAINIZIONUM = Int32.Parse(DATAINIZIO[2] + DATAINIZIO[1] + DATAINIZIO[0]);
                }

                if (CalendarPicker3.Datazione.Text != "")
                {
                    string[] DATAFINE = CalendarPicker3.Datazione.Text.Split(Convert.ToChar("/"));
                    DATAFINENUM = Int32.Parse(DATAFINE[2] + DATAFINE[1] + DATAFINE[0]);
                }

                if (DATAFINENUM < DATAINIZIONUM && cmbsstatolavoro.SelectedValue == "4")
                {
                    result = "La Data Completamento Lavori è inferiore alla Data Inizio Previsto la Odl non può essere completata";
                    String scriptString = "<script language=\"JavaScript\">alert(\"" + result + "\");<";
                    scriptString += "/";
                    scriptString += "script>";
                    this.RegisterStartupScript("Startup1", scriptString);
                    return;
                }

                i_RowsAffected = _CCP.UPD_CP(_SCollection);
                if (cmbsstatolavoro.SelectedValue == "4")
                {
                    cmbsstatolavoro.Enabled = false;
                }
            }

            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                PanelMess.ShowError(s_Err, true);
            }
        }