using System.Collections.Generic;
using System;


namespace hukpiWinApp.hukpiDatabaseDataSetTableAdapters {


    public partial class DefaultTransportDaysTableAdapter
    {
        public virtual hukpiDatabaseDataSet.DefaultTransportDaysDataTable GetByDaysList(List<string> days, bool inWinter)
        {
            string searchExpression = "";

            if (inWinter)
            {
                searchExpression = " WHERE isWinter = '" + Properties.Settings.Default.DBYesChar + "' ";
            }
            else
            {
                searchExpression = " WHERE isWinter = '" + Properties.Settings.Default.DBNoChar + "' ";
            }

            if (days != null)
            {
                searchExpression += " AND (";

                searchExpression += Utils.implodeExtra("DefaultTransportDays.", days, " = '" + Properties.Settings.Default.DBYesChar + "' ", " OR ");
                
                searchExpression += " ) ";
            }

            this.Adapter.SelectCommand = this.CommandCollection[0];

            this.Adapter.SelectCommand.CommandText = this.Adapter.SelectCommand.CommandText + searchExpression;
            System.Windows.Forms.MessageBox.Show(this.Adapter.SelectCommand.CommandText);

            hukpiDatabaseDataSet.DefaultTransportDaysDataTable dataTable = new hukpiDatabaseDataSet.DefaultTransportDaysDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }
    }

    public partial class ReportRoutesSimpleViewTableAdapter {

        public virtual int FillByOwnQuery(hukpiDatabaseDataSet.ReportRoutesSimpleViewDataTable dataTable, string extraQuery)
        {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            this.Adapter.SelectCommand.CommandText = this.Adapter.SelectCommand.CommandText + " " + extraQuery;
            
            if ((this.ClearBeforeFill == true))
            {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }

        public virtual int FillByRoutesModalitiesAndTransportDays(hukpiDatabaseDataSet.ReportRoutesSimpleViewDataTable dataTable, bool isWinter, List<decimal> RouteCodesIds, List<decimal> ModalitiesIds, List<decimal> TransportDaysIds)
        {
            string searchExpression = " WHERE 1=1 ";

            if (RouteCodesIds != null)
            {
                searchExpression += " AND Routes.RouteCodesId IN(" + Utils.implode(",",RouteCodesIds) + ") ";
            }

            if (ModalitiesIds != null)
            {
                searchExpression += " AND DepotsAndModalities.ModalityId IN(" + Utils.implode(",", ModalitiesIds) + ") ";
            }

            if (TransportDaysIds != null)
            {
                searchExpression += " AND DefaultTransportDays.dtdId IN(" + Utils.implode(",", TransportDaysIds) + ") ";
            }

            if (isWinter)
            {
                this.Adapter.SelectCommand = this.CommandCollection[1];
            }
            else
            {
                this.Adapter.SelectCommand = this.CommandCollection[0];
            }

            this.Adapter.SelectCommand.CommandText = this.Adapter.SelectCommand.CommandText + searchExpression;

            //System.Windows.Forms.MessageBox.Show(this.Adapter.SelectCommand.CommandText);

            if ((this.ClearBeforeFill == true))
            {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
    }

    public partial class ReportAnimalDepotsSimpleViewTableAdapter
    {
        public virtual int FillByModalities(hukpiDatabaseDataSet.ReportAnimalDepotsSimpleViewDataTable dataTable, List<decimal> ModalitiesIds)
        {
            string searchExpression = " WHERE 1=1 ";

            if (ModalitiesIds != null)
            {
                searchExpression += " AND DepotsAndModalities.ModalityId IN(" + Utils.implode(",", ModalitiesIds) + ") ";
            }

            this.Adapter.SelectCommand.CommandText = this.Adapter.SelectCommand.CommandText + searchExpression;

            //System.Windows.Forms.MessageBox.Show(this.Adapter.SelectCommand.CommandText);

            if ((this.ClearBeforeFill == true))
            {
                dataTable.Clear();
            }
            int returnValue = this.Adapter.Fill(dataTable);
            return returnValue;
        }
    }
}

namespace hukpiWinApp.hukpiDatabaseDataSetTableAdapters
{
    
    
    
    
        partial class DepotClassesViewDataTable
        {
        }
    
}
namespace hukpiWinApp {
    
    
    public partial class hukpiDatabaseDataSet {
    }
}
