Ejemplo n.º 1
0
        public static List <PlanAppoint> LoadListForTree(Database database, DateTime dateStart)
        {
            List <PlanAppoint> appointList = new List <PlanAppoint>();

            string          query      = EntryControl.Resources.Doc.PlanAppoint.LoadList;
            QueryParameters parameters = CreateParametersForList();

            if (database is EntryControlDatabase)
            {
                parameters["creator"] = ((EntryControlDatabase)database).ConnectedUser.Id;
            }
            parameters.Add("DateStart", dateStart);

            using (DbDataReader reader = database.ExecuteReader(query, parameters))
            {
                while (reader.Read())
                {
                    PlanAppoint appoint = new PlanAppoint(reader);
                    appoint.PermitState = (int)reader["permitState"];
                    appointList.Add(appoint);
                }

                reader.Close();
            }

            return(appointList);
        }
Ejemplo n.º 2
0
        public Permit(PlanAppoint appoint)
            : base()
        {
            PermitState = EntryControlDatabase.OneTimePermitState;

            DateFrom = appoint.DateFrom.AddDays(-1);
            DateTo   = appoint.DateTo.AddDays(1);

            Cargo      = (Cargo)appoint.Cargo;
            Vehicle    = (Vehicle)appoint.Vehicle;
            DriverName = appoint.DriverName;
            Contact    = appoint.Contact;

            MultiEntry = 0;

            planAppoint = appoint;

            comment = appoint.Comment;
        }
Ejemplo n.º 3
0
        public PlanAppoint LoadCopy(Database database)
        {
            PlanAppoint planAppoint = null;

            string          query      = EntryControl.Resources.Doc.PlanAppoint.Load;
            QueryParameters parameters = new QueryParameters("id", Id);

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

                reader.Close();
            }

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

            return(planAppoint);
        }