using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using fatd_faturamento.DAL.Persistencia;
using fatd_faturamento.ENTIDADE;

namespace fatd_faturamento.BLL.Repositorio
{
    public class repositorioICDicficdmic
    {
        public IList<entidadeICDicficdmic> Select(entidadeICDicficdmic objICDicficdmic)
        {
            dalICDicficdmic dalICDicficdmic = null;

            var lstICDicficdmic = new List<entidadeICDicficdmic>();
            DataTable dt = null;

            try
            {
                dalICDicficdmic = new dalICDicficdmic();
                dt = dalICDicficdmic.Select(objICDicficdmic);

                foreach (DataRow dr in dt.Rows)
                {
                    objICDicficdmic = new entidadeICDicficdmic();


                    if (!Convert.IsDBNull(dr["ID"]))
                        objICDicficdmic.ID = Convert.ToInt32(dr["ID"]);

                    if (!Convert.IsDBNull(dr["ID_CODIGO"]))
                        objICDicficdmic.ID_CODIGO = Convert.ToInt32(dr["ID_CODIGO"]);

                    if (!Convert.IsDBNull(dr["DIC_ANUAL"]))
                        objICDicficdmic.DIC_ANUAL = Convert.ToDouble(dr["DIC_ANUAL"]);

                    if (!Convert.IsDBNull(dr["DIC_TRIMESTRAL"]))
                        objICDicficdmic.DIC_TRIMESTRAL = Convert.ToDouble(dr["DIC_TRIMESTRAL"]);

                    if (!Convert.IsDBNull(dr["DIC_MENSAL"]))
                        objICDicficdmic.DIC_MENSAL = Convert.ToDouble(dr["DIC_MENSAL"]);

                    if (!Convert.IsDBNull(dr["FIC_ANUAL"]))
                        objICDicficdmic.FIC_ANUAL = Convert.ToDouble(dr["FIC_ANUAL"]);

                    if (!Convert.IsDBNull(dr["FIC_TRIMESTRAL"]))
                        objICDicficdmic.FIC_TRIMESTRAL = Convert.ToDouble(dr["FIC_TRIMESTRAL"]);

                    if (!Convert.IsDBNull(dr["FIC_MENSAL"]))
                        objICDicficdmic.FIC_MENSAL = Convert.ToDouble(dr["FIC_MENSAL"]);

                    if (!Convert.IsDBNull(dr["DMIC_MENSAL"]))
                        objICDicficdmic.DMIC_MENSAL = Convert.ToDouble(dr["DMIC_MENSAL"]);


                    lstICDicficdmic.Add(objICDicficdmic);
                }
                return lstICDicficdmic;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public IList<entidadeICDicficdmic> SelectMax(entidadeICDicficdmic objICDicficdmic)
        {
            dalICDicficdmic dalICDicficdmic = null;

            var lstICDicficdmic = new List<entidadeICDicficdmic>();
            DataTable dt = null;

            try
            {
                dalICDicficdmic = new dalICDicficdmic();
                dt = dalICDicficdmic.SelectMax(objICDicficdmic);

                foreach (DataRow dr in dt.Rows)
                {
                    objICDicficdmic = new entidadeICDicficdmic();

                    if (!Convert.IsDBNull(dr["DMIC_MENSAL"]))
                        objICDicficdmic.DMIC_MENSAL = Convert.ToDouble(dr["DMIC_MENSAL"]);


                    lstICDicficdmic.Add(objICDicficdmic);
                }
                return lstICDicficdmic;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public IList<entidadeICDicficdmic> SelectMax_1(entidadeICDicficdmic objICDicficdmic)
        {
            dalICDicficdmic dalICDicficdmic = null;

            var lstICDicficdmic = new List<entidadeICDicficdmic>();
            DataTable dt = null;

            try
            {
                dalICDicficdmic = new dalICDicficdmic();
                dt = dalICDicficdmic.SelectMax_1(objICDicficdmic);

                foreach (DataRow dr in dt.Rows)
                {
                    objICDicficdmic = new entidadeICDicficdmic();

                    if (!Convert.IsDBNull(dr["DIC_MENSAL"]))
                        objICDicficdmic.DIC_MENSAL = Convert.ToDouble(dr["DIC_MENSAL"]);


                    lstICDicficdmic.Add(objICDicficdmic);
                }
                return lstICDicficdmic;
            }
            catch (Exception)
            {
                throw;
            }
        }
		
        public IList<entidadeICDicficdmic> SelectMax_2(entidadeICDicficdmic objICDicficdmic)
        {
            dalICDicficdmic dalICDicficdmic = null;

            var lstICDicficdmic = new List<entidadeICDicficdmic>();
            DataTable dt = null;

            try
            {
                dalICDicficdmic = new dalICDicficdmic();
                dt = dalICDicficdmic.SelectMax_2(objICDicficdmic);

                foreach (DataRow dr in dt.Rows)
                {
                    objICDicficdmic = new entidadeICDicficdmic();

                    if (!Convert.IsDBNull(dr["FIC_MENSAL"]))
                        objICDicficdmic.FIC_MENSAL = Convert.ToDouble(dr["FIC_MENSAL"]);


                    lstICDicficdmic.Add(objICDicficdmic);
                }
                return lstICDicficdmic;
            }
            catch (Exception)
            {
                throw;
            }
        }		

    }
}
