Beispiel #1
0
        new public void Refresh(EPVDatabase database)
        {
            DbDataReader reader;

            Clear();
            if (unit != null)
            {
                QueryParameters parameters = new QueryParameters("unit", unit.Id);
                reader = database.ExecuteReader(querySelect, parameters);
            }
            else
            {
                reader = database.ExecuteReader(querySelect);
            }
            while (reader.Read())
            {
                if (unit != null)
                {
                    Add(new Point(reader, unit));
                }
                else
                {
                    Add(new Point(reader, units));
                }
            }

            reader.Close();
        }
        public static Permit Load(EPVDatabase database, int id)
        {
            string          query      = DispatcherService.Resources.Doc.Permit.Load;
            QueryParameters parameters = new QueryParameters("id", id);

            Permit permit = null;

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

                reader.Close();
            }

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

            permit.Vehicle = Vehicle.Load(database, permit.VehicleId);

            return(permit);
        }
Beispiel #3
0
        private void SaveDeletedRow(EPVDatabase database)
        {
            QueryParameters parameters = new QueryParameters("id", Id);

            parameters.Add("userId", Modifier.Id);
            database.ExecuteQuery(QueryDelete, parameters);
        }
Beispiel #4
0
        public PlanAppointListControl(EPVDatabase database)
            : this()
        {
            Database = database;

            GetPlanAppointList();
        }
        public PlanAppointForm(Form parent, EPVDatabase dbase)
        {
            InitializeComponent();

            MdiParent = parent;
            database  = dbase;
        }
        public static CargoListForm OpenReference(Form mdiParent, EPVDatabase database)
        {
            CargoListForm form = new CargoListForm(mdiParent, database);

            form.btnOK.Visible = true;
            return(form);
        }
        public static BindingList <IAppointHistory> LoadList(EPVDatabase database,
                                                             int id, DateTime dateFrom, DateTime dateTo, string vehicleNum, int unitId, string cargo)
        {
            BindingList <IAppointHistory> list = new BindingList <IAppointHistory>();

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

            parameters.Add("dateFrom", dateFrom);
            parameters.Add("dateTo", dateTo);
            parameters.Add("vehicleNum", vehicleNum);
            parameters.Add("unitId", unitId);
            parameters.Add("cargo", cargo);

            string query = DispatcherService.Resources.Doc.Appoint.LoadHistory;

            using (DbDataReader reader = database.ExecuteReader(query, parameters))
            {
                while (reader.Read())
                {
                    list.Add(new DispatcherService.AppointStateHistory(reader));
                }

                reader.Close();
            }

            return(list);
        }
Beispiel #8
0
        public static List <Vehicle> LoadList(EPVDatabase database, VehicleMark mark, string licensePlate)
        {
            List <Vehicle> vehicleList = new List <Vehicle>();

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

            if (mark != null)
            {
                parameters.Add("vehicleMark", mark.Id);
            }
            else
            {
                parameters.Add("vehicleMark", DBNull.Value);
            }

            using (DbDataReader reader = database.ExecuteReader(LoadListQuery, parameters))
            {
                while (reader.Read())
                {
                    vehicleList.Add(new Vehicle(reader));
                }

                reader.Close();
            }

            return(vehicleList);
        }
        public void UpdateComment(EPVDatabase database, string comment)
        {
            QueryParameters parameters = new QueryParameters("id", Id);

            parameters.Add("comment", comment);
            database.ExecuteQuery(DispatcherService.Resources.Doc.Permit.UpdateComment, parameters);
        }
Beispiel #10
0
        public FormHistory(Form mdiParent, EPVDatabase dbase)
            : this()
        {
            MdiParent = mdiParent;
            database  = dbase;

            FillControls();
        }
        public CargoListForm(Form mdiParent, EPVDatabase database)
            : this()
        {
            MdiParent = mdiParent;
            Database  = database;

            bsList.DataSource = GetData();
        }
        public FormAppointHistory(Form mdiParent, EPVDatabase dbase, IAppointHistory appoint)
            : this()
        {
            MdiParent = mdiParent;
            database  = dbase;

            appointId = appoint.Id;
        }
        private void SaveModifiedRow(EPVDatabase database, ISystemUser user)
        {
            QueryParameters parameters = CreateParameters();

            parameters.Add("userId", user.Id);

            database.ExecuteQuery(UpdateQuery, parameters);
        }
Beispiel #14
0
        internal void MarkCreated(short value, EPVDatabase database, ISystemUser user)
        {
            CreateFlag = value;
            Creator    = (SecurityUser)user;
            CreateDate = DateTime.Now;

            Save(database, user);
        }
Beispiel #15
0
        internal void MarkSigned(short value, EPVDatabase Database, ISystemUser User)
        {
            SignedFlag = value;
            Signer     = (SecurityUser)User;
            SignDate   = DateTime.Now;

            Save(Database, User);
        }
        public FormRepointAppoint(EPVDatabase _database, Appoint appoint, Point _fromPoint)
            : this()
        {
            database  = _database;
            Appoint   = appoint;
            fromPoint = _fromPoint;

            Text = Appoint.TrackInfo;
        }
        public NewDispatcherForm(Form parent, EPVDatabase dbase)
        {
            InitializeComponent();

            timeRemaining = Settings.Default.SecondsToRefresh;

            MdiParent = parent;
            database  = dbase;
        }
Beispiel #18
0
        public BindingList <MaterialPermitItem> GetItemList(EPVDatabase database)
        {
            if (itemList == null)
            {
                itemList = new BindingList <MaterialPermitItem>(MaterialPermitItem.LoadList(this, database));
            }

            return(itemList);
        }
        public PlanAppointControl(EPVDatabase database, PlanAppoint planAppoint)
            : this()
        {
            Database = database;

            PreloadData();
            planAppoint.PropertyChanged += planAppointPropertyChanged;
            PlanAppoint = planAppoint;
            AddBindings();
        }
Beispiel #20
0
        public MaterialPermitForm(Form mdiParent, EPVDatabase database, MaterialPermit document)
            : this()
        {
            MdiParent = mdiParent;
            Database  = database;

            Document = document;

            AddBindings();
        }
        public VehicleItemForm(Form mdiParent, EPVDatabase database, Vehicle vehicle)
            : this()
        {
            MdiParent = mdiParent;
            Database  = database;

            AddBindings();

            Vehicle = vehicle;
        }
Beispiel #22
0
        internal void ClearNew(EPVDatabase database, ISystemUser user)
        {
            string          query      = DispatcherService.Resources.Doc.MaterialPermit.ClearNew;
            QueryParameters parameters = new QueryParameters("documentId", Id);

            parameters.Add("userId", user.Id);

            database.ExecuteQuery(query, parameters);

            IsNew = false;
        }
        private void comboBoxUnits_SelectedValueChanged(object sender, EventArgs e)
        {
            if (comboBoxUnits.SelectedValue == null)
            {
                return;
            }
            Unit        unit     = (Unit)comboBoxUnits.SelectedValue;
            EPVDatabase database = epvGridPoints.Database;

            epvGridPoints.DataSource = new Points(database, unit);
        }
        private void WriteLogRow(EPVDatabase database, int stateId, SecurityUser user)
        {
            string          query      = DispatcherService.Resources.Doc.Appoint.InsertLog;
            QueryParameters parameters = new QueryParameters("appoint", Id);

            parameters.Add("appointState", stateId);
            parameters.Add("hostName", Environment.MachineName);
            parameters.Add("userName", user.Name);

            database.ExecuteQuery(query, parameters);
        }
Beispiel #25
0
        public Points(EPVDatabase database)
        {
            units       = new Units(database);
            querySelect = "select * from refPoints order by idunit, id";
            DbDataReader reader = database.ExecuteReader(querySelect);

            while (reader.Read())
            {
                Add(new Point(reader, units));
            }
            reader.Close();
        }
Beispiel #26
0
 private BindingList <IAppointHistory> LoadData(EPVDatabase dbase, bool grouped,
                                                DateTime dateFrom, DateTime dateTo, string vehicleNum, int unitId, string cargo)
 {
     if (grouped)
     {
         return(AppointHistory.LoadList(dbase, 0, dateFrom, dateTo, vehicleNum, unitId, cargo));
     }
     else
     {
         return(AppointStateHistory.LoadList(dbase, 0, dateFrom, dateTo, vehicleNum, unitId, cargo));
     }
 }
        public MaterialPermitListForm(Form mdiParent, EPVDatabase database)
            : this()
        {
            MdiParent = mdiParent;
            Database  = database;

            bsDocumentList.DataSource = new MaterialPermit(Unit.Empty);
            cboxUnit.DataSource       = Unit.LoadList(Database, User);

            AddBindings();
            ForceRefresh();
            isInitialized = true;
        }
        new void Refresh(EPVDatabase database)
        {
            QueryParameters parameters = new QueryParameters("appoint", appoint.Id);

            docStates = new Enumeration(database, "docState");
            DbDataReader reader = database.ExecuteReader(querySelect, parameters);

            while (reader.Read())
            {
                Add(new AppointState(reader, appoint, docStates));
            }
            reader.Close();
        }
        public void SetToPoint(EPVDatabase database, Unit unt, Point pnt, DateTime dateTime, SecurityUser user)
        {
            Unit  = unt;
            Point = pnt;
            Save(database);

            SetDocState(database, 3, Point, user);
            if (Unit.IsAutoExit)
            {
                StandAtPoint(database, Point, dateTime, user);
                EndPoint(database, user);
            }
        }
        public void ReturnToDispatcher(EPVDatabase database, SecurityUser user)
        {
            string query = "update docAppoints set point = 0, dateToPoint='31.12.2100' where id = " + id.ToString();

            database.ExecuteQuery(query);

            query = "delete from docAppointStates where appoint = @appoint and docState > 0";
            QueryParameters parameters = new QueryParameters("appoint", Id);

            database.ExecuteQuery(query, parameters);

            WriteLogRow(database, -1, user);
        }