Exemple #1
0
        private static List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE> ConvertDataTableToList(DataTable dt)
        {
            VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection lanes = ConvertDataTableToCollection(dt);

            List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE> laneList = new List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE>();

            foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE lane in lanes)
            {
                laneList.Add(lane);
            }

            return(laneList);
        }
Exemple #2
0
        /// <summary>
        /// Get next value for the primary key
        /// </summary>
        /// <returns></returns>
        private static int GetNextValue()
        {
            //next value will be 1 if there is no row in the datatable.
            int nextValue = 1;

            try
            {
                //Get object collection
                VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection objs = GetAllAsCollection();

                //Get all objects Id
                int[] sortedObjsId = new int[objs.Count];
                for (int i = 0; i < objs.Count; i++)
                {
                    sortedObjsId[i] = objs[i].LaneId;
                }

                //Sort the object id
                Array.Sort(sortedObjsId);

                for (int j = 0; j < sortedObjsId.Length; j++)
                {
                    if (j + 1 < sortedObjsId.Length)
                    {
                        if (sortedObjsId[j] + 1 < sortedObjsId[j + 1])
                        {
                            nextValue = sortedObjsId[j] + 1;
                            break;
                        }
                    }
                    else
                    {
                        nextValue = sortedObjsId[sortedObjsId.Length - 1] + 1;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(nextValue);
        }
Exemple #3
0
        public static VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection GetAllAsCollection()
        {
            VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection lanes = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection();
            try
            {
                //Stored procedure must have cur_out parameter.
                //There is no need to add ref cursor for oracle in code.
                string    spName  = VaaaN.MLFF.Libraries.CommonLibrary.Constants.oraclePackagePrefix + "LANE_GETALL";
                DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName);

                DataSet   ds = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName);
                DataTable dt = ds.Tables[tableName];
                lanes = ConvertDataTableToCollection(dt);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lanes);
        }
        private int GetLaneTypeByLaneId(int laneId)
        {
            int result = -1;

            try
            {
                lanes = VaaaN.MLFF.Libraries.CommonLibrary.BLL.LaneBLL.GetAll();
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE lane in lanes)
                {
                    if (lane.LaneId == laneId)
                    {
                        result = lane.LaneTypeId;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                result = -1;
            }

            return(result);
        }
Exemple #5
0
        private static VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection ConvertDataTableToCollection(DataTable dt)
        {
            try
            {
                VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection lanes = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCollection();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE lane = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE();

                    if (dt.Rows[i]["TMS_ID"] != DBNull.Value)
                    {
                        lane.TMSId = Convert.ToInt32(dt.Rows[i]["TMS_ID"]);
                    }

                    if (dt.Rows[i]["PLAZA_ID"] != DBNull.Value)
                    {
                        lane.PlazaId = Convert.ToInt32(dt.Rows[i]["PLAZA_ID"]);
                    }

                    if (dt.Rows[i]["PLAZA_NAME"] != DBNull.Value)
                    {
                        lane.PlazaName = Convert.ToString(dt.Rows[i]["PLAZA_NAME"]);
                    }

                    if (dt.Rows[i]["LANE_ID"] != DBNull.Value)
                    {
                        lane.LaneId = Convert.ToInt32(dt.Rows[i]["LANE_ID"]);
                    }

                    if (dt.Rows[i]["LANE_TYPE_ID"] != DBNull.Value)
                    {
                        lane.LaneTypeId = Convert.ToInt32(dt.Rows[i]["LANE_TYPE_ID"]);
                    }

                    if (dt.Rows[i]["LANE_NAME"] != DBNull.Value)
                    {
                        lane.LaneName = Convert.ToString(dt.Rows[i]["LANE_NAME"]);
                    }

                    if (dt.Rows[i]["CAMERA_ID_FRONT"] != DBNull.Value)
                    {
                        lane.CameraIdFront = Convert.ToInt32(dt.Rows[i]["CAMERA_ID_FRONT"]);
                    }

                    if (dt.Rows[i]["CAMERA_NAME_FRONT"] != DBNull.Value)
                    {
                        lane.CameraNameFront = Convert.ToString(dt.Rows[i]["CAMERA_NAME_FRONT"]);
                    }

                    if (dt.Rows[i]["CAMERA_ID_REAR"] != DBNull.Value)
                    {
                        lane.CameraIdRear = Convert.ToInt32(dt.Rows[i]["CAMERA_ID_REAR"]);
                    }

                    if (dt.Rows[i]["CAMERA_NAME_REAR"] != DBNull.Value)
                    {
                        lane.CameraNameRear = Convert.ToString(dt.Rows[i]["CAMERA_NAME_REAR"]);
                    }

                    if (dt.Rows[i]["ETC_ANTENNA_ID_FRONT"] != DBNull.Value)
                    {
                        lane.AntennaIdFront = Convert.ToInt32(dt.Rows[i]["ETC_ANTENNA_ID_FRONT"]);
                    }

                    if (dt.Rows[i]["ETC_ANTENNA_ID_REAR"] != DBNull.Value)
                    {
                        lane.AntennaIdRear = Convert.ToInt32(dt.Rows[i]["ETC_ANTENNA_ID_REAR"]);
                    }

                    if (dt.Rows[i]["ETC_ANTENNA_NAME_FRONT"] != DBNull.Value)
                    {
                        lane.EtcAntennaNameFront = Convert.ToString(dt.Rows[i]["ETC_ANTENNA_NAME_FRONT"]);
                    }

                    if (dt.Rows[i]["ETC_ANTENNA_NAME_REAR"] != DBNull.Value)
                    {
                        lane.EtcAntennaNameRear = Convert.ToString(dt.Rows[i]["ETC_ANTENNA_NAME_REAR"]);
                    }

                    if (dt.Rows[i]["CREATION_DATE"] != DBNull.Value)
                    {
                        lane.CreationDate = Convert.ToDateTime(dt.Rows[i]["CREATION_DATE"]);
                    }

                    if (dt.Rows[i]["MODIFICATION_DATE"] != DBNull.Value)
                    {
                        lane.ModificationDate = Convert.ToDateTime(dt.Rows[i]["MODIFICATION_DATE"]);
                    }

                    if (dt.Rows[i]["MODIFIED_BY"] != DBNull.Value)
                    {
                        lane.ModifierId = Convert.ToInt32(dt.Rows[i]["MODIFIED_BY"]);
                    }

                    if (dt.Rows[i]["TRANSFER_STATUS"] != DBNull.Value)
                    {
                        lane.TransferStatus = Convert.ToInt32(dt.Rows[i]["TRANSFER_STATUS"]);
                    }

                    lanes.Add(lane);
                }
                return(lanes);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }