Esempio n. 1
0
        private void EliminaTRAddetto()
        {
            S_Controls.Collections.S_Object s_id_tr = new S_Object();
            s_id_tr.ParameterName = "p_id_tr";
            s_id_tr.DbType        = CustomDBType.Integer;
            s_id_tr.Direction     = ParameterDirection.Input;
            s_id_tr.Index         = 0;
            s_id_tr.Value         = 0;

            S_Controls.Collections.S_Object s_addetto_id = new S_Object();
            s_addetto_id.ParameterName = "p_addetto_id";
            s_addetto_id.DbType        = CustomDBType.Integer;
            s_addetto_id.Direction     = ParameterDirection.Input;
            s_addetto_id.Index         = 1;
            s_addetto_id.Value         = itemId;


            string S_Operazione = "Delall";

            S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection();
            _SCollection.Add(s_id_tr);
            _SCollection.Add(s_addetto_id);
            TheSite.Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
            _Addetti.ExecuteUpdatePMPAdd_TR(_SCollection, S_Operazione);
        }
Esempio n. 2
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            FunId = Int32.Parse(Request["FunId"]);

            if (Request["ItemId"] != null)
            {
                itemId = Int32.Parse(Request["ItemId"]);
            }
            if (!Page.IsPostBack)
            {
                BindServizi();
                if (itemId != 0)
                {
                    DataSet _MyDs = new DataSet();
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    _MyDs = _Addetti.GetSingleDataTR(itemId);

                    if (_MyDs.Tables[0].Rows.Count == 1)
                    {
                        DataRow _Dr = _MyDs.Tables[0].Rows[0];
                        this.txtsdescrizione.Text = (string)_Dr["DESCRIZIONE"];
                        if (_Dr["servizi_id"] != DBNull.Value)
                        {
                            this.cmbsServizio.SelectedValue = _Dr["servizi_id"].ToString();
                        }

                        this.lblOperazione.Text      = "Modifica Specializzazione";
                        this.lblFirstAndLast.Visible = true;
                        this.btnsElimina.Attributes.Add("onclick", "return confirm('Si vuole effettuare la cancellazione?');");

                        lblFirstAndLast.Text = _Addetti.GetFirstAndLastUser(_Dr);
                    }
                }
                else
                {
                    this.lblOperazione.Text      = "Inserimento Specializzazione";
                    this.lblFirstAndLast.Visible = false;
                    this.btnsElimina.Visible     = false;
                }
                if (Request["TipoOper"] == "read")
                {
                    AbilitaControlli(false);
                }
                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                if (Context.Handler is TheSite.Gestione.Specializzazioni)
                {
                    _fp = (TheSite.Gestione.Specializzazioni)Context.Handler;
                    this.ViewState.Add("mioContenitore", _fp._Contenitore);
                }
            }
        }
Esempio n. 3
0
        private void btnsSalva_Click(object sender, System.EventArgs e)
        {
            this.txtsdescrizione.DBDefaultValue = DBNull.Value;
            this.cmbsServizio.DBDefaultValue    = 0;

            this.txtsdescrizione.Text = this.txtsdescrizione.Text.Trim();

            string tr_id = this.txtsdescrizione.Text;

            //city
            S_Controls.Collections.S_Object s_Idtr_id = new S_Object();
            s_Idtr_id.ParameterName = "p_tr_id";
            s_Idtr_id.DbType        = CustomDBType.VarChar;
            s_Idtr_id.Direction     = ParameterDirection.Input;
            s_Idtr_id.Index         = 1;
            s_Idtr_id.Size          = 50;
            s_Idtr_id.Value         = tr_id;

            int i_RowsAffected = 0;

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

            try
            {
                if (itemId == 0)
                {
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    i_RowsAffected = _Addetti.ExecuteUpdateTR(_SCollection, "Insert", itemId);
                }
                else
                {
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    i_RowsAffected = _Addetti.ExecuteUpdateTR(_SCollection, "Update", itemId);
                }

                if (i_RowsAffected > 0 && i_RowsAffected != -11)
                {
                    Server.Transfer("Specializzazioni.aspx");
                }
                else
                {
                    Classi.SiteJavaScript.msgBox(this.Page, "La Specializzazione é stata già inserita");
                }
            }
            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                PanelMess.ShowError(s_Err, true);
            }
        }
Esempio n. 4
0
        private bool checkdate(int itemId)
        {
            bool b_return  = true;
            int  i_Datain  = Int32.Parse(txtsorain.Text + txtsorainmin.Text);
            int  i_Dataout = Int32.Parse(txtsoraout.Text + txtsoraoutmin.Text);


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

            S_Controls.Collections.S_Object s_addetto_id = new S_Object();
            s_addetto_id.ParameterName = "p_addetto_id";
            s_addetto_id.DbType        = CustomDBType.Integer;
            s_addetto_id.Direction     = ParameterDirection.Input;
            s_addetto_id.Index         = 0;
            s_addetto_id.Value         = cmbsadd.SelectedValue;


            S_Controls.Collections.S_Object s_giorno_id = new S_Object();
            s_giorno_id.ParameterName = "p_giorno_id";
            s_giorno_id.DbType        = CustomDBType.Integer;
            s_giorno_id.Direction     = ParameterDirection.Input;
            s_giorno_id.Index         = 1;
            s_giorno_id.Value         = cmbsgiorno.SelectedValue;


            _SCollection.Add(s_addetto_id);
            _SCollection.Add(s_giorno_id);


            Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
            DataSet   _Ds = _Addetti.GetDateRep(_SCollection);
            DataTable _Dt = _Ds.Tables[0];

            foreach (DataRow _Dr in _Dt.Rows)
            {
                if (i_Datain >= Int32.Parse(_Dr["datain"].ToString()) && i_Datain <= Int32.Parse(_Dr["dataout"].ToString()))
                {
                    b_return = false;
                    break;
                }

                if (i_Dataout >= Int32.Parse(_Dr["datain"].ToString()) && i_Dataout <= Int32.Parse(_Dr["dataout"].ToString()))
                {
                    b_return = false;
                    break;
                }
            }

            return(b_return);
        }
        private void BindAddetti()
        {
            this.cmbsadd.Items.Clear();
            Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
            DataSet _MyDs = _Addetti.GetData().Copy();

            if (_MyDs.Tables[0].Rows.Count > 0)
            {
                this.cmbsadd.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
                    _MyDs.Tables[0], "nominativo", "id", "- Selezionare un Addetto -", "-1");
                this.cmbsadd.DataTextField  = "nominativo";
                this.cmbsadd.DataValueField = "id";
                this.cmbsadd.DataBind();
            }
        }
        private void BindSpecializzazione(int pmp_id)
        {
            this.cmbsSpecializzazione.Items.Clear();

            int eqstd_id    = 0;
            int servizio_id = 0;

            if (cmbsServizio.SelectedValue != "")
            {
                servizio_id = Int32.Parse(cmbsServizio.SelectedValue);
            }
            if (cmdsStdApparecchiatura.SelectedValue != "")
            {
                eqstd_id = Int32.Parse(cmdsStdApparecchiatura.SelectedValue);
            }

            Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
            DataSet _MyDs;

            if (pmp_id == 0)
            {
                _MyDs = _Addetti.GetAllSpecializzazioni().Copy();
            }
            else
            {
                _MyDs = _Addetti.GetSpecializzazionePMP(pmp_id, eqstd_id, servizio_id);
            }

            if (_MyDs.Tables[0].Rows.Count > 0)
            {
                this.cmbsSpecializzazione.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
                    _MyDs.Tables[0], "DESCRIZIONE", "ID", "- Tutte le Specializzazioni -", "");
                this.cmbsSpecializzazione.DataTextField  = "DESCRIZIONE";
                this.cmbsSpecializzazione.DataValueField = "ID";
                this.cmbsSpecializzazione.DataBind();
                if (pmp_id > 0)
                {
                    this.cmbsSpecializzazione.SelectedIndex = 1;
                }
            }
            else
            {
                string s_Messagggio = "- Nessuna Specializzazione -";
                this.cmbsSpecializzazione.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, String.Empty));
            }
        }
Esempio n. 7
0
        private void btnsElimina_Click(object sender, System.EventArgs e)
        {
            try
            {                   // chiamata a routine che elimina tutte le tr associate all'addetto_id
                EliminaTRAddetto();

                Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();

                this.txtscognome.DBDefaultValue               = DBNull.Value;
                this.txtsnome.DBDefaultValue                  = DBNull.Value;
                this.txtsindirizzo.DBDefaultValue             = DBNull.Value;
                this.txtstelefono.DBDefaultValue              = DBNull.Value;
                this.txtscellulare.DBDefaultValue             = DBNull.Value;
                this.txtszona.DBDefaultValue                  = DBNull.Value;
                this.CalendarPicker1.Datazione.DBDefaultValue = DBNull.Value;
                this.cmbsprov_nasc.DBDefaultValue             = "-1";
                this.cmbscom_nasc.DBDefaultValue              = "-1";
                this.cmbsprov_res.DBDefaultValue              = "-1";
                this.cmbscom_res.DBDefaultValue               = "-1";
                this.cmbspriorita.DBDefaultValue              = "1";

                this.cmbsLivello.DBDefaultValue = "-1";

                int i_RowsAffected = 0;

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


                _SCollection.AddItems(this.PanelEdit.Controls);



                i_RowsAffected = _Addetti.Delete(_SCollection, itemId);

                if (i_RowsAffected == -1)
                {
                    Server.Transfer("Addetti.aspx");
                }
            }
            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                PanelMess.ShowError(s_Err, true);
            }
        }
Esempio n. 8
0
        private void UpdateTR_Addetti(DataTable UpdateDataTable)
        {
            foreach (DataRow dr in UpdateDataTable.Rows)
            {
                if (dr["Operazione"] != DBNull.Value)
                {
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    try
                    {
                        S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection();

                        S_Controls.Collections.S_Object s_id_tr = new S_Controls.Collections.S_Object();
                        s_id_tr.ParameterName = "p_Id_tr";
                        s_id_tr.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
                        s_id_tr.Direction     = ParameterDirection.Input;
                        s_id_tr.Index         = 0;
                        s_id_tr.Value         = Convert.ToInt32(dr["id_tr"].ToString());

                        S_Controls.Collections.S_Object s_addetto_id = new S_Controls.Collections.S_Object();
                        s_addetto_id.ParameterName = "p_addetto_Id";
                        s_addetto_id.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
                        s_addetto_id.Direction     = ParameterDirection.Input;
                        s_addetto_id.Index         = 1;
                        s_addetto_id.Value         = itemId;

                        _SColl.Add(s_id_tr);
                        _SColl.Add(s_addetto_id);


                        if (dr["Operazione"].ToString() == "I")
                        {
                            _Addetti.ExecuteUpdatePMPAdd_TR(_SColl, "Insert");
                        }
                        else
                        {
                            _Addetti.ExecuteUpdatePMPAdd_TR(_SColl, "Delete");
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }
Esempio n. 9
0
        private void btnsElimina_Click(object sender, System.EventArgs e)
        {
            try
            {
                this.txtsdescrizione.DBDefaultValue = DBNull.Value;
                string tr_id = this.txtsdescrizione.Text;
                //city
                S_Controls.Collections.S_Object s_Idtr_id = new S_Object();
                s_Idtr_id.ParameterName = "p_tr_id";
                s_Idtr_id.DbType        = CustomDBType.VarChar;
                s_Idtr_id.Direction     = ParameterDirection.Input;
                s_Idtr_id.Index         = 1;
                s_Idtr_id.Size          = 50;
                s_Idtr_id.Value         = tr_id;
                int i_RowsAffected = 0;
                S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection();
                _SCollection.AddItems(this.PanelEdit.Controls);
                _SCollection.Add(s_Idtr_id);
                Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                i_RowsAffected = _Addetti.ExecuteUpdateTR(_SCollection, "Delete", itemId);
                switch (i_RowsAffected)
                {
                case -1:
                    Server.Transfer("Specializzazioni.aspx");
                    break;

                case -5:
                    PanelMess.ShowMessage("Impossibile eliminare in quanto legata ad un addetto");
                    break;

                case -6:
                    PanelMess.ShowMessage("Impossibile eliminare in quanto legata ad una Procedure di Manutenzione Programmata");
                    break;

                default:
                    PanelMess.ShowMessage("Impossibile eliminare");
                    break;
                }
            }
            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                PanelMess.ShowError(s_Err, true);
            }
        }
Esempio n. 10
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)
            {
                DataSet _MyDs = new DataSet();
                Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                _MyDs = _Addetti.GetSingleData(itemId);

                if (_MyDs.Tables[0].Rows.Count == 1)
                {
                    DataRow _Dr = _MyDs.Tables[0].Rows[0];
                    this.txtsCognome.Text = (string)_Dr["COGNOME"];

                    if (_Dr["NOME"] != DBNull.Value)
                    {
                        this.txtsNome.Text = (string)_Dr["NOME"];
                    }

                    this.lblOperazione.Text      = "Piano Ferie Addetto: " + this.txtsCognome.Text + " " + this.txtsNome.Text;
                    this.lblFirstAndLast.Visible = true;
                    lblFirstAndLast.Text         = _Addetti.GetFirstAndLastUser(_Dr);


                    this.BindDataGrid();
                }
                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                if (Context.Handler is TheSite.Gestione.Addetti)
                {
                    _fp = (TheSite.Gestione.Addetti)Context.Handler;
                    this.ViewState.Add("mioContenitore", _fp._Contenitore);
                }
            }
        }
        private void CaricaAddetto()
        {
            DataSet _MyDs;

            Classi.ClassiAnagrafiche.Addetti _addetto = new TheSite.Classi.ClassiAnagrafiche.Addetti();
            //Classi.Function _Fun = new TheSite.Classi.Function();

            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         = Int32.Parse(Request.QueryString["wo_id"]);
            CollezioneControlli.Add(p_wo_id);

            _MyDs = _addetto.GetDataWo(CollezioneControlli);

            if (_MyDs.Tables[0].Rows.Count > 0)
            {
                //this.cmbsDitta.DataSource = _MyDs.Tables[0];
                this.cmbsAddetto.DataSource = Classi.GestoreDropDownList.ItemBlankDataSource(
                    _MyDs.Tables[0], "DESCRIZIONE", "ID", "- Selezionare un Addetto -", "");

                this.cmbsAddetto.DataTextField  = "DESCRIZIONE";
                this.cmbsAddetto.DataValueField = "id";
                this.cmbsAddetto.DataBind();
                this.cmbsAddetto.SelectedValue = "88";
            }

            else
            {
                string s_Messagggio = "- Nessuna Addetto  -";
                this.cmbsAddetto.Items.Add(Classi.GestoreDropDownList.ItemMessaggio(s_Messagggio, String.Empty));
            }
        }
Esempio n. 12
0
        private void DataGridRicerca_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            int itemId = Int32.Parse(e.CommandArgument.ToString());

            try
            {
                Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();

                int i_RowsAffected = 0;

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

                S_Controls.Collections.S_Object s_addetto_id = new S_Object();
                s_addetto_id.ParameterName = "p_addetto_id";
                s_addetto_id.DbType        = CustomDBType.Integer;
                s_addetto_id.Direction     = ParameterDirection.Input;
                s_addetto_id.Index         = 0;
                s_addetto_id.Value         = 0;

                S_Controls.Collections.S_Object s_giorno_id = new S_Object();
                s_giorno_id.ParameterName = "p_giorno_id";
                s_giorno_id.DbType        = CustomDBType.Integer;
                s_giorno_id.Direction     = ParameterDirection.Input;
                s_giorno_id.Index         = 1;
                s_giorno_id.Value         = 0;


                S_Controls.Collections.S_Object s_orain = new S_Object();
                s_orain.ParameterName = "p_orain";
                s_orain.DbType        = CustomDBType.VarChar;
                s_orain.Direction     = ParameterDirection.Input;
                s_orain.Index         = 2;
                s_orain.Value         = "%";


                S_Controls.Collections.S_Object s_oraout = new S_Object();
                s_oraout.ParameterName = "p_oraout";
                s_oraout.DbType        = CustomDBType.VarChar;
                s_oraout.Direction     = ParameterDirection.Input;
                s_oraout.Index         = 3;
                s_oraout.Value         = "%";;


                _SCollection.Add(s_addetto_id);
                _SCollection.Add(s_giorno_id);
                _SCollection.Add(s_orain);
                _SCollection.Add(s_oraout);


                string s_operazione = "Delete";

                i_RowsAffected = _Addetti.ExecuteUpdateAddRep(_SCollection, s_operazione, itemId);

                if (i_RowsAffected == -1)
                {
                    //Server.Transfer("RepAddetti.aspx");
                    Ricerca();
                }
            }
            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                //PanelMess.ShowError(s_Err, true);
            }
        }
Esempio n. 13
0
        private void btnsSalva_Click(object sender, System.EventArgs e)
        {
            this.cmbsadd.DBDefaultValue    = "-1";
            this.cmbsgiorno.DBDefaultValue = "-1";

            this.txtsoraout.Text = this.txtsoraout.Text.Trim();
            this.txtsorain.Text  = this.txtsorain.Text.Trim();
            if (checkdate(itemId) == false)
            {
                Classi.SiteJavaScript.msgBox(this.Page, "Gli orari di inizio o fine turno del giorno prescelto coincidono con orari già esistenti");
            }
            else
            {
                string s_operazione   = "";
                int    i_RowsAffected = 0;
                S_Controls.Collections.S_ControlsCollection _SCollection = new S_Controls.Collections.S_ControlsCollection();

                S_Controls.Collections.S_Object s_orain = new S_Object();
                s_orain.ParameterName = "p_orain";
                s_orain.DbType        = CustomDBType.VarChar;
                s_orain.Direction     = ParameterDirection.Input;
                s_orain.Index         = 2;
                s_orain.Value         = txtsorain.Text + ":" + txtsorainmin.Text;


                S_Controls.Collections.S_Object s_oraout = new S_Object();
                s_oraout.ParameterName = "p_oraout";
                s_oraout.DbType        = CustomDBType.VarChar;
                s_oraout.Direction     = ParameterDirection.Input;
                s_oraout.Index         = 3;
                s_oraout.Value         = txtsoraout.Text + ":" + txtsoraoutmin.Text;

                _SCollection.AddItems(this.PanelEdit.Controls);
                _SCollection.Add(s_orain);
                _SCollection.Add(s_oraout);
                try
                {
                    if (itemId == 0)
                    {
                        s_operazione = "Insert";
                        Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                        i_RowsAffected = _Addetti.ExecuteUpdateAddRep(_SCollection, s_operazione, itemId);
                    }
                    else
                    {
                        s_operazione = "Update";
                        Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                        i_RowsAffected = _Addetti.ExecuteUpdateAddRep(_SCollection, s_operazione, itemId);
                    }

                    if (i_RowsAffected > 0)
                    {
                        Server.Transfer("RepAddetti.aspx");
                    }
                }
                catch (Exception ex)
                {
                    string s_Err = ex.Message.ToString().ToUpper();
                    PanelMess.ShowError(s_Err, true);
                }
            }
        }
Esempio n. 14
0
        private void UpdateREP_Addetti(DataTable UpdateDataTable)
        {
            foreach (DataRow dr in UpdateDataTable.Rows)
            {
                if (dr["Operazione"] != DBNull.Value)
                {
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    try
                    {
                        S_Controls.Collections.S_ControlsCollection _SColl = new S_Controls.Collections.S_ControlsCollection();

                        this.cmbsadd.DBDefaultValue = "-1";
                        this.txtsoraout.Text        = this.txtsoraout.Text.Trim();
                        this.txtsorain.Text         = this.txtsorain.Text.Trim();

//						if (checkdate(itemId)==false)
//						{
//							Classi.SiteJavaScript.msgBox(this.Page,"Gli orari di inizio o fine turno del giorno prescelto coincidono con orari già esistenti");
//						}

                        string s_operazione   = "";
                        int    i_RowsAffected = 0;

                        S_Controls.Collections.S_Object s_orain = new S_Object();
                        s_orain.ParameterName = "p_orain";
                        s_orain.DbType        = CustomDBType.VarChar;
                        s_orain.Direction     = ParameterDirection.Input;
                        s_orain.Index         = 2;
                        s_orain.Value         = txtsorain.Text + ":" + txtsorainmin.Text;


                        S_Controls.Collections.S_Object s_oraout = new S_Object();
                        s_oraout.ParameterName = "p_oraout";
                        s_oraout.DbType        = CustomDBType.VarChar;
                        s_oraout.Direction     = ParameterDirection.Input;
                        s_oraout.Index         = 3;
                        s_oraout.Value         = txtsoraout.Text + ":" + txtsoraoutmin.Text;

                        S_Controls.Collections.S_Object s_id_giorno = new S_Controls.Collections.S_Object();
                        s_id_giorno.ParameterName = "p_giorno_id";
                        s_id_giorno.DbType        = ApplicationDataLayer.DBType.CustomDBType.Integer;
                        s_id_giorno.Direction     = ParameterDirection.Input;
                        s_id_giorno.Index         = 1;
                        s_id_giorno.Value         = Convert.ToInt32(dr["id"].ToString());



                        _SColl.AddItems(this.PanelEdit.Controls);
                        _SColl.Add(s_id_giorno);
                        _SColl.Add(s_orain);
                        _SColl.Add(s_oraout);
                        try
                        {
                            if (itemId == 0)
                            {
                                s_operazione = "Insert";
                                Classi.ClassiAnagrafiche.Addetti _Add = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                                i_RowsAffected = _Add.ExecuteUpdateAddRep1(_SColl, s_operazione, itemId);
                            }
                            if (i_RowsAffected == -100)
                            {
                                Classi.SiteJavaScript.msgBox(this.Page, "Gli orari di inizio o fine turno del giorno prescelto coincidono con orari già esistenti");
                            }
                        }
                        catch (Exception ex)
                        {
                            string s_Err = ex.Message.ToString().ToUpper();
                            PanelMess.ShowError(s_Err, true);
                        }
                    }



                    catch (Exception ex)
                    {
                        string s_Err = ex.Message.ToString().ToUpper();
                        PanelMess.ShowError(s_Err, true);
                        //throw ex;
                    }
                }
            }
        }
Esempio n. 15
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            CalendarPicker1.Datazione.DBParameterName = "p_data_nascita";
            CalendarPicker1.Datazione.DBDirection     = ParameterDirection.Input;
            CalendarPicker1.Datazione.DBDataType      = CustomDBType.VarChar;
            CalendarPicker1.Datazione.DBIndex         = 2;
            CalendarPicker1.Datazione.DBSize          = 8;
            CalendarPicker1.Datazione.DBDefaultValue  = "";
            check_caselle_testo();


            FunId = Int32.Parse(Request["FunId"]);


            if (Request["ItemId"] != null)
            {
                itemId = Int32.Parse(Request["ItemId"]);
            }
            if (!Page.IsPostBack)
            {
                BindPriorita();
                BindProvince();
                BindProvince1();
                BindDitte();
                BindLivello();
                if (itemId != 0)
                {
                    DataSet _MyDs = new DataSet();
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    _MyDs = _Addetti.GetSingleData(itemId);

                    if (_MyDs.Tables[0].Rows.Count == 1)
                    {
                        DataRow _Dr = _MyDs.Tables[0].Rows[0];
                        this.txtscognome.Text = (string)_Dr["COGNOME"];

                        if (_Dr["NOME"] != DBNull.Value)
                        {
                            this.txtsnome.Text = (string)_Dr["NOME"];
                        }

                        if (_Dr["DATA_NASCITA"] != DBNull.Value)
                        {
                            this.CalendarPicker1.Datazione.Text = System.DateTime.Parse(_Dr["DATA_NASCITA"].ToString()).ToShortDateString();
                        }

                        if (_Dr["PROV_NASC_ID"] != DBNull.Value)
                        {
                            this.cmbsprov_nasc.SelectedValue = _Dr["PROV_NASC_ID"].ToString();
                        }

                        BindComuni();


                        if (_Dr["PROV_RES_ID"] != DBNull.Value)
                        {
                            this.cmbsprov_res.SelectedValue = _Dr["PROV_RES_ID"].ToString();
                        }
                        BindComuni1();

                        if (_Dr["COM_NASC_ID"] != DBNull.Value)
                        {
                            this.cmbscom_nasc.SelectedValue = _Dr["COM_NASC_ID"].ToString();
                        }

                        if (_Dr["COM_RES_ID"] != DBNull.Value)
                        {
                            this.cmbscom_res.SelectedValue = _Dr["COM_RES_ID"].ToString();
                        }

                        if (_Dr["INDIRIZZO"] != DBNull.Value)
                        {
                            this.txtsindirizzo.Text = (string)_Dr["INDIRIZZO"].ToString();
                        }

                        if (_Dr["TELEFONO"] != DBNull.Value)
                        {
                            this.txtstelefono.Text = (string)_Dr["TELEFONO"].ToString();
                        }

                        if (_Dr["CELLULARE"] != DBNull.Value)
                        {
                            this.txtscellulare.Text = (string)_Dr["CELLULARE"].ToString();
                        }

                        if (_Dr["DITTA_ID"] != DBNull.Value)
                        {
                            this.cmbsditta_id.SelectedValue = _Dr["DITTA_ID"].ToString();
                        }

                        if (_Dr["PRIORITA"] != DBNull.Value)
                        {
                            this.cmbspriorita.SelectedValue = _Dr["PRIORITA"].ToString();
                        }

                        if (_Dr["ZONA"] != DBNull.Value)
                        {
                            this.txtszona.Text = (string)_Dr["ZONA"].ToString();
                        }

                        if (_Dr["livello"] != DBNull.Value)
                        {
                            this.cmbsLivello.SelectedValue = _Dr["livello"].ToString();
                        }



                        this.lblOperazione.Text      = "Modifica Addetto: " + this.txtscognome.Text + " " + this.txtsnome.Text;
                        this.lblFirstAndLast.Visible = true;
                        this.btnsElimina.Attributes.Add("onclick", "return confirm('Si vuole effettuare la cancellazione?')");
                        lblFirstAndLast.Text = _Addetti.GetFirstAndLastUser(_Dr);
                    }
                }
                else
                {
                    this.lblOperazione.Text = "Inserimento Addetto";
                    BindComuni();
                    BindComuni1();
                    this.lblFirstAndLast.Visible = false;
                    this.btnsElimina.Visible     = false;
                }
                AggiornaListbox();
                if (Request["TipoOper"] == "read")
                {
                    AbilitaControlli(false);
                    this.lblOperazione.Text = "Visualizzazione Addetto: " + this.txtscognome.Text + " " + this.txtsnome.Text;
                }
                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
                if (Context.Handler is TheSite.Gestione.Addetti)
                {
                    _fp = (TheSite.Gestione.Addetti)Context.Handler;
                    this.ViewState.Add("mioContenitore", _fp._Contenitore);
                }
            }
        }
Esempio n. 16
0
        private void btnsSalva_Click(object sender, System.EventArgs e)
        {
            this.txtscognome.DBDefaultValue               = DBNull.Value;
            this.txtsnome.DBDefaultValue                  = DBNull.Value;
            this.txtsindirizzo.DBDefaultValue             = DBNull.Value;
            this.txtstelefono.DBDefaultValue              = DBNull.Value;
            this.txtscellulare.DBDefaultValue             = DBNull.Value;
            this.txtszona.DBDefaultValue                  = DBNull.Value;
            this.CalendarPicker1.Datazione.DBDefaultValue = DBNull.Value;
            this.cmbsprov_nasc.DBDefaultValue             = DBNull.Value;
            this.cmbscom_nasc.DBDefaultValue              = "-1";
            this.cmbsprov_res.DBDefaultValue              = DBNull.Value;
            this.cmbscom_res.DBDefaultValue               = "-1";
            this.cmbsditta_id.DBDefaultValue              = DBNull.Value;
            this.cmbspriorita.DBDefaultValue              = 1;

            this.cmbsLivello.DBDefaultValue = "-1";



            this.txtscognome.Text   = this.txtscognome.Text.Trim();
            this.txtsnome.Text      = this.txtsnome.Text.Trim();
            this.txtstelefono.Text  = this.txtstelefono.Text.Trim();
            this.txtscellulare.Text = this.txtscellulare.Text.Trim();
            this.txtsindirizzo.Text = this.txtsindirizzo.Text.Trim();
            this.txtszona.Text      = this.txtszona.Text.Trim();


            int i_RowsAffected = 0;

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

            try
            {
                if (itemId == 0)
                {
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    i_RowsAffected = _Addetti.Add(_SCollection);
                }
                else
                {
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    i_RowsAffected = _Addetti.Update(_SCollection, itemId);
                }

                if (i_RowsAffected > 0)
                {
                    if (this.ListBoxRight.Items.Count >= 0)
                    {
                        DataTable o_Dt = (DataTable)Session["SpecAdd"];
                        DataView  o_Dv = new DataView(o_Dt);

                        foreach (ListItem o_Litem in this.ListBoxRight.Items)
                        {
                            o_Dv.RowFilter = "id_tr = " + o_Litem.Value.ToString();

                            if (o_Dv.Count == 0)
                            {
                                DataRow o_Dr = o_Dt.NewRow();
                                o_Dr["id_tr"]       = o_Litem.Value.ToString();
                                o_Dr["descrizione"] = o_Litem.Text.ToString();
                                o_Dr["Operazione"]  = "I";
                                o_Dt.Rows.Add(o_Dr);
                            }
                            else if (o_Dv.Count == 1)
                            {
                                o_Dv[0]["Operazione"] = DBNull.Value;
                            }
                        }
                        this.UpdateTR_Addetti(o_Dt);
                        Session.Remove("SpecAdd");
                    }



                    if (itemId == 0)
                    {
                        Response.Redirect("EditAddetti.aspx?ItemId=" + i_RowsAffected + "&FunId=" + FunId);
                    }
                    else
                    {
                        Server.Transfer("Addetti.aspx");
                    }
                }
            }
            catch (Exception ex)
            {
                string s_Err = ex.Message.ToString().ToUpper();
                PanelMess.ShowError(s_Err, true);
            }
        }
Esempio n. 17
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            //Funzioni Client


            this.btnsSalva.Attributes.Add("onclick", "Valorizza('1');");
            this.btnAnnulla.Attributes.Add("onclick", "Valorizza('0');");

            txtsorain.Attributes.Add("onkeypress", "SoloNumeri();");
            txtsorain.Attributes.Add("onpaste", "return false;");
            string s_funz = "Formatta('" + txtsorain.ClientID + "');";

            txtsorain.Attributes.Add("onblur", s_funz);
            txtsorain.Attributes.Add("maxlength", "2");

            txtsorainmin.Attributes.Add("onkeypress", "SoloNumeri();");
            txtsorainmin.Attributes.Add("onpaste", "return false;");
            s_funz = "Formatta('" + txtsorainmin.ClientID + "');";
            txtsorainmin.Attributes.Add("onblur", s_funz);
            txtsorainmin.Attributes.Add("maxlength", "2");

            txtsoraout.Attributes.Add("onkeypress", "SoloNumeri();");
            txtsoraout.Attributes.Add("onpaste", "return false;");
            s_funz = "Formatta('" + txtsoraout.ClientID + "');";
            txtsoraout.Attributes.Add("onblur", s_funz);
            txtsoraout.Attributes.Add("maxlength", "2");

            txtsoraoutmin.Attributes.Add("onkeypress", "SoloNumeri();");
            txtsoraoutmin.Attributes.Add("onpaste", "return false;");
            s_funz = "Formatta('" + txtsoraoutmin.ClientID + "');";
            txtsoraoutmin.Attributes.Add("onblur", s_funz);
            txtsoraoutmin.Attributes.Add("maxlength", "2");


            FunId = Int32.Parse(Request["FunId"]);


            if (Request["ItemId"] != null)
            {
                itemId = Int32.Parse(Request["ItemId"]);
            }
            if (!Page.IsPostBack)
            {
                BindAddetti();
                AggiornaListbox();
                if (itemId == 0)
                {
                    this.lblOperazione.Text      = "Inserimento Reperibilita' Addetto";
                    this.txtsorain.Text          = "00";
                    this.txtsorainmin.Text       = "00";
                    this.txtsoraout.Text         = "00";
                    this.txtsoraoutmin.Text      = "00";
                    this.lblFirstAndLast.Visible = false;
                    AbilitaControlli(true);
                }
                else
                {
                    DataSet _MyDs = new DataSet();
                    Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
                    _MyDs = _Addetti.GetSingleAddrep(itemId);

                    if (_MyDs.Tables[0].Rows.Count == 1)
                    {
                        DataRow _Dr = _MyDs.Tables[0].Rows[0];

                        if (_Dr["addettoid"] != DBNull.Value)
                        {
                            this.cmbsadd.SelectedValue = _Dr["addettoid"].ToString();
                        }

                        if (_Dr["orain"] != DBNull.Value)
                        {
                            this.txtsorain.Text = _Dr["orain"].ToString().Split(Convert.ToChar(":"))[0];
                        }
                        this.txtsorainmin.Text = _Dr["orain"].ToString().Split(Convert.ToChar(":"))[1];

                        if (_Dr["oraout"] != DBNull.Value)
                        {
                            this.txtsoraout.Text = _Dr["oraout"].ToString().Split(Convert.ToChar(":"))[0];
                        }
                        this.txtsoraoutmin.Text = _Dr["oraout"].ToString().Split(Convert.ToChar(":"))[1];

                        this.lblFirstAndLast.Visible = true;

                        System.Text.StringBuilder _StrBldFirst = new System.Text.StringBuilder();

                        _StrBldFirst.Append("Creato da ");
                        if (_Dr["FIRST"] != DBNull.Value)
                        {
                            _StrBldFirst.Append(_Dr["FIRST"].ToString());
                        }

                        _StrBldFirst.Append(" il ");
                        if (_Dr["FIRSTMODIFIED"] != DBNull.Value)
                        {
                            _StrBldFirst.Append(_Dr["FIRSTMODIFIED"].ToString());
                        }

                        lblFirstAndLast.Text = _StrBldFirst.ToString();
                    }
                    if (Request["TipoOper"] == "read")
                    {
                        AbilitaControlli(false);
                        this.lblOperazione.Text = "Visualizzazione Reperibilita' Addetto: " + this.cmbsadd.SelectedItem;
                    }
                }
            }
            ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
            if (Context.Handler is TheSite.Gestione.RepAddetti)
            {
                _fp = (TheSite.Gestione.RepAddetti)Context.Handler;
                this.ViewState.Add("mioContenitore", _fp._Contenitore);
            }
        }
Esempio n. 18
0
        private void AggiornaListbox()
        {
            _DsListboxL = new DataSet();
            _DsListboxR = new DataSet();
            CreaTabelle();


            //Specializzazioni


            Classi.ClassiAnagrafiche.Addetti _Addetti = new TheSite.Classi.ClassiAnagrafiche.Addetti();
            DataView _DvTr = new DataView(_Addetti.GetTRADD(itemId).Tables[0]);

            if (_DvTr.Count > 0)
            {
                foreach (DataRowView _DvrTr in _DvTr)
                {
                    DataRow _DrTr = _DsListboxL.Tables["Specializzazioni"].NewRow();
                    _DrTr["Id"]          = _DvrTr["Id"].ToString();
                    _DrTr["descrizione"] = _DvrTr["descrizione"].ToString();
                    _DsListboxL.Tables["Specializzazioni"].Rows.Add(_DrTr);
                }
            }

            Session.Add("Spec", _DsListboxL.Tables[0]);
            this.ListBoxLeft.DataSource     = _DsListboxL.Tables["Specializzazioni"];
            this.ListBoxLeft.DataValueField = "Id";
            this.ListBoxLeft.DataTextField  = "Descrizione";
            this.ListBoxLeft.DataBind();
            this.ListBoxLeft.SelectedIndex = 0;
            if (itemId > 0)
            {
                this.ListBoxLeft.Enabled = true;
            }
            else
            {
                this.ListBoxLeft.Enabled = false;
            }
            //Specializzazioni Addetto


            if (itemId > 0)
            {
                DataView _DvTrAdd = new DataView(_Addetti.GetTRAddetto(itemId).Tables[0]);
                if (_DvTrAdd.Count > 0)
                {
                    foreach (DataRowView _DrvTrAdd in _DvTrAdd)
                    {
                        DataRow _DrTrAdd = _DsListboxR.Tables["SpecAddetto"].NewRow();
                        _DrTrAdd["descrizione"] = _DrvTrAdd["description"].ToString();
                        _DrTrAdd["id_tr"]       = _DrvTrAdd["id_tr"].ToString();
                        _DsListboxR.Tables["SpecAddetto"].Rows.Add(_DrTrAdd);
                    }
                }
            }

            Session.Add("SpecAdd", _DsListboxR.Tables[0]);
            this.ListBoxRight.DataSource     = _DsListboxR.Tables["SpecAddetto"];
            this.ListBoxRight.DataValueField = "id_tr";
            this.ListBoxRight.DataTextField  = "descrizione";
            this.ListBoxRight.DataBind();
            this.ListBoxRight.SelectedIndex = 0;
        }