Ejemplo n.º 1
0
    public List <DriverTrip> GetDriverTrip_ByDate(string date)
    {
        List <DriverTrip> list = new List <DriverTrip>();
        string            sql  = string.Format(@"with tab1 as (
select Driver,Towhead from CTM_DriverLog where DATEDIFF(d,Date,'{0}')=0
),
tab2 as (
select DriverCode,JobNo,ContainerNo,FromDate,FromTime,ToDate,ToTime,Id from CTM_JobDet2 where DATEDIFF(d,FromDate,'{0}')=0 or DATEDIFF(d,ToDate,'{0}')=0
)
select tab1.Driver,tab1.Towhead,tab2.* from tab1 left outer join tab2 on tab1.Driver=tab2.DriverCode order by Driver,FromDate,FromTime,ToDate,ToTime", date);
        DataTable         dt   = ConnectSql.GetTab(sql);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow    dr  = dt.Rows[i];
            DriverTrip row = new DriverTrip();
            row.Driver      = dr["Driver"].ToString();
            row.Towhead     = dr["Towhead"].ToString();
            row.ContainerNo = dr["ContainerNo"].ToString();
            row.JobNo       = dr["JobNo"].ToString();
            row.FromDate    = dr["FromDate"].ToString();
            row.FromTime    = dr["FromTime"].ToString();
            row.ToDate      = dr["ToDate"].ToString();
            row.ToTime      = dr["ToTime"].ToString();
            row.Id          = dr["Id"].ToString();
            list.Add(row);
        }
        return(list);
    }
Ejemplo n.º 2
0
    public DriverTrip GetDriverTripToast_ById(string Id)
    {
        string     sql   = string.Format(@"select det1.JobNo,det1.ContainerNo,det1.ContainerType,DriverCode,TowheadCode,convert(nvarchar,FromDate,111) as FromDate,FromTime,convert(nvarchar,ToDate,111) as ToDate,ToTime
,(case job.JobType when 'KD-IMP' then 'I' when 'KD-EXP' then 'E' when 'FCL-IMP' then 'I' when 'FCL-EXP' then 'E' else 'L' end) as JobType,LoadCode,StageCode,StageStatus
from CTM_JobDet2 as det2 
left outer join CTM_JobDet1 as det1 on det2.Det1Id=det1.Id
left outer join CTM_Job as job on det1.JobNo=job.JobNo
where det2.Id={0}", Id);
        DataTable  dt    = ConnectSql.GetTab(sql);
        DriverTrip toast = new DriverTrip();

        if (dt.Rows.Count > 0)
        {
            DataRow dr = dt.Rows[0];
            toast.Id            = Id;
            toast.JobNo         = dr["JobNo"].ToString();
            toast.ContainerNo   = dr["ContainerNo"].ToString();
            toast.ContainerSize = dr["ContainerType"].ToString();
            toast.Driver        = dr["DriverCode"].ToString();
            toast.Towhead       = dr["TowheadCode"].ToString();
            toast.FromDate      = dr["FromDate"].ToString();
            toast.FromTime      = dr["FromTime"].ToString();
            toast.ToDate        = dr["ToDate"].ToString();
            toast.ToTime        = dr["ToTime"].ToString();
            toast.JobType       = dr["JobType"].ToString();
            toast.LoadCode      = dr["LoadCode"].ToString();
            toast.StageCode     = dr["StageCode"].ToString();
            toast.StageStatus   = dr["StageStatus"].ToString();
        }
        return(toast);
    }
Ejemplo n.º 3
0
            public void Add(ITrip driverTrip, ExtractPersonalAndTripRecords module)
            {
                var chain     = driverTrip.TripChain;
                var driver    = chain.Person;
                var driverID  = driver.Id;
                int tripIndex = ComputeTripIndex(driverTrip, chain, driver, module);

                // Now that we have our index data see if it already exists
                for (int i = 0; i < _driverRecords.Count; i++)
                {
                    if (_driverRecords[i].DriverID == driverID && _driverRecords[i].DriverTripID == tripIndex)
                    {
                        _driverRecords[i] = new DriverTrip(_driverRecords[i]);
                        return;
                    }
                }
                // If it was not found we need to add a new record
                _driverRecords.Add(new DriverTrip(driverID, tripIndex, 1));
            }
Ejemplo n.º 4
0
 public DriverTrip(DriverTrip previous) : this(previous.DriverID, previous.DriverTripID, previous.Count + 1)
 {
 }