Exemplo n.º 1
0
        public Appoint(PlanAppoint plan)
        {
            if (plan.Vehicle.VehicleMark != null)
            {
                trackMark = plan.Vehicle.VehicleMark.ToString();
            }
            else
            {
                trackMark = "";
            }

            licensePlate = plan.Vehicle.LicensePlate;
            trailer      = "";
            driverName   = plan.DriverName;
            driverPhone  = plan.Contact;
            warrant      = "";
            whereTo      = plan.WhereTo;
            cargo        = plan.Cargo.ToString();
            docStateDate = DateTime.Now;
            dateComing   = DateTime.Now;
            point        = null;
            dateToPoint  = new DateTime(2100, 12, 31);

            unit     = Unit.Empty;
            citizen  = DispatcherService.State.Empty;
            docState = new EnumerationItem("docState", 0, "ожидает обработки");

            PlanAppoint = plan;

            HasPermit = PlanAppoint.HasPermit;
            permitId  = PlanAppoint.PermitId;

            Insert();
        }
Exemplo n.º 2
0
        public override bool Equals(object obj)
        {
            PlanAppoint planAppoint = obj as PlanAppoint;

            if (planAppoint != null)
            {
                return(planAppoint.Id.Equals(Id));
            }

            return(false);
        }
Exemplo n.º 3
0
        public PlanAppoint GetLastPlanAppoint(EPVDatabase database)
        {
            string          query      = DispatcherService.Resources.Ref.Vehicle.GetLastPlanAppoint;
            QueryParameters parameters = new QueryParameters("id", Id);
            object          result     = database.ExecuteScalar(query, parameters);

            if (result != null && !DBNull.Value.Equals(result))
            {
                PlanAppoint planAppoint = PlanAppoint.Load(database, (int)result);
                return(planAppoint);
            }

            return(null);
        }
Exemplo n.º 4
0
        public static PlanAppoint Load(EPVDatabase database, int id)
        {
            PlanAppoint planAppoint = null;

            QueryParameters parameters = new QueryParameters("id", id);

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

                reader.Close();
            }

            if (planAppoint == null)
            {
                throw new ArgumentException(DispatcherService.Resources.Error.WrongIdentifier);
            }

            return(planAppoint);
        }