Ejemplo n.º 1
0
        public static List <PermitMoving> LoadList(Database database, Permit permit)
        {
            List <PermitMoving> permitMovingList = new List <PermitMoving>();

            QueryParameters parameters = new QueryParameters("permit", permit.Id);

            using (DbDataReader reader = database.ExecuteReader(LoadListQuery, parameters))
            {
                while (reader.Read())
                {
                    permitMovingList.Add(new PermitMoving(permit, reader));
                }

                reader.Close();
            }

            return(permitMovingList);
        }
Ejemplo n.º 2
0
        public static List <PermitPoint> LoadPointList(Database database, Permit permit)
        {
            List <PermitPoint> pointList = new List <Classes.PermitPoint>();

            string          query      = EntryControl.Resources.Doc.Permit.GetPermitPointList;
            QueryParameters parameters = new QueryParameters("permit", permit.Id);

            using (DbDataReader reader = database.ExecuteReader(query, parameters))
            {
                while (reader.Read())
                {
                    pointList.Add(new Classes.PermitPoint(permit, reader));
                }

                reader.Close();
            }

            return(pointList);
        }
Ejemplo n.º 3
0
        public static Permit LoadByNumber(EntryControlDatabase database, string fullNumber)
        {
            int period    = DateTime.Today.Year;
            int docNumber = 0;

            if (!int.TryParse(fullNumber.Substring(0, 4), out period))
            {
                throw new FormatException(EntryControl.Resources.Message.Error.WrongPermitNumber);
            }

            if (!int.TryParse(fullNumber.Substring(4, 8), out docNumber))
            {
                throw new FormatException(EntryControl.Resources.Message.Error.WrongPermitNumber);
            }

            Permit permit = null;

            string          query      = EntryControl.Resources.Doc.Permit.LoadByNum;
            QueryParameters parameters = new QueryParameters("period", period);

            parameters.Add("docNumber", docNumber);

            using (DbDataReader reader = database.ExecuteReader(query, parameters))
            {
                if (reader.Read())
                {
                    permit = new Permit(reader);
                }

                reader.Close();
            }

            if (permit == null)
            {
                throw new ArgumentException(EntryControl.Resources.Message.Error.PermitNumberNotFound);
            }

            return(permit);
        }
Ejemplo n.º 4
0
        public static Permit Load(Database database, int id)
        {
            QueryParameters parameters = new QueryParameters("permitId", id);

            Permit permit = null;

            using (DbDataReader reader = database.ExecuteReader(LoadQuery, parameters))
            {
                if (reader.Read())
                {
                    permit = new Permit(reader);
                }

                reader.Close();
            }

            if (permit == null)
            {
                throw new ArgumentException(EntryControl.Resources.Message.Error.WrongIdentifier);
            }

            return(permit);
        }
Ejemplo n.º 5
0
 public PermitPoint(Permit permit, DbDataReader reader)
 {
     Permit    = permit;
     Point     = new Classes.EntryPoint((int)reader["pointid"], (string)reader["pointName"]);
     isAllowed = ((int)reader["isAllowed"]) > 0;
 }
Ejemplo n.º 6
0
 public Permit LoadPermit(Database database)
 {
     return(Permit.Load(database, permitId));
 }
Ejemplo n.º 7
0
 public void SetProperties(Permit previousPermit)
 {
     Vehicle    = previousPermit.Vehicle;
     DriverName = previousPermit.DriverName;
     Contact    = previousPermit.Contact;
 }
Ejemplo n.º 8
0
 public PermitMoving(Permit permit, DbDataReader reader) : this(reader)
 {
     Permit = permit;
 }
Ejemplo n.º 9
0
 public PermitMoving(Permit permit) : this()
 {
     Permit = permit;
 }