using GMW_data;
using SteamWare;
using System;
using System.Data;
using System.Web.UI.WebControls;

namespace GMW.WebUserControls
{
    public partial class mod_detailUDC : SteamWare.ApplicationUserControl
    {
        #region area da NON modificare

        #region area protected

        protected string _idxGridView;
        protected string _idxGridViewExt;
        protected string _tabCache;
        protected bool _showNewBtn = false;

        /// <summary>
        /// aggiorna controlli datagrid e numero righe in pagina
        /// </summary>
        protected override void aggiornaControlliDataGL()
        {
            base.aggiornaControlliDataGL();
        }
       
        
        
        /// <summary>
        /// collega i controlli
        /// </summary>
        protected override void bindControlli()
        {
            base.bindControlli();
            caricaTabelle();
        }

        #endregion

        #region gestione eventi

        //public event EventHandler eh_resetSelezione;
        //public event EventHandler eh_nuovoValore;
        //public event EventHandler eh_selValore;

        #endregion
     
        #endregion

        #region area codice variabile


        /// <summary>
        /// carico le tabelle
        /// </summary>
        private void caricaTabelle()
        {
        }
        /// <summary>
        /// elenco colonne del datagrid
        /// </summary>
        /// <returns></returns>
        protected DataColumnCollection colonneObj()
        {
            DS_magazzino.v_UdcDetailDataTable tabella = new DS_magazzino.v_UdcDetailDataTable();
            DataColumnCollection colonne = tabella.Columns;
            return colonne;
        }
        /// <summary>
        /// inizializzazione valori di default
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            _idxGridView = "UDC";
        }
        /// <summary>
        /// verifica se attivo filtro company e imposta ods di conseguenza...
        /// </summary>
        private void checkFixOds()
        {
            // svuoto select parameters
            ods.SelectParameters.Clear();
            // imposto i parametri...
            ods.SelectParameters.Add("UDC", DbType.String, memLayer.ML.StringSessionObj("UDC_sel"));
            ods.SelectParameters.Add("CodCS", DbType.String, memLayer.ML.StringSessionObj("CodCS"));
            // metto nuovo metodo select
            ods.SelectMethod = "getByFullUdc";
        }
       /// <summary>
        /// effettua update del modulo
        /// </summary>
        public void doUpdate()
        {
            checkFixOds();
        }


        protected void detView_DataBound(object sender, EventArgs e)
        {
            if (detView.Rows.Count > 0)
            {
                // aggiorno gli headers        
                foreach (DetailsViewRow riga in detView.Rows)
                {
                    try
                    {
                        riga.Cells[0].Text = traduci(riga.Cells[0].Text);
                    }
                    catch
                    { }
                }
            }
        }

        #endregion

    }
}