private void ShowPermit()
        {
            Appoint appoint = (Appoint)bindingSourceAppoints.Current;
            Permit  permit  = appoint.GetPermit(database);

            permit.Print();
        }
Пример #2
0
 /// <summary>
 ///     создает объект на основе строки БД
 /// </summary>
 /// <param name="reader">строка БД</param>
 /// <param name="apnt">Транспорт</param>
 /// <param name="docStates">набор возможных состояний</param>
 public AppointState(DbDataReader reader, Appoint apnt, Enumeration docStates)
 {
     appoint  = apnt;
     docState = docStates.Find((int)reader["docState"]);
     date     = (DateTime)reader["dateState"];
     reason   = (string)reader["reason"];
 }
Пример #3
0
 /// <summary>
 ///     создает новое состояние для транспорта
 /// </summary>
 /// <param name="apnt">транспорт</param>
 /// <param name="dcSt">новое состояние</param>
 public AppointState(Appoint apnt, EnumerationItem dcSt)
 {
     appoint  = apnt;
     docState = dcSt;
     date     = DateTime.Now;
     reason   = "";
     Insert();
 }
        public FormRepointAppoint(EPVDatabase _database, Appoint appoint, Point _fromPoint)
            : this()
        {
            database  = _database;
            Appoint   = appoint;
            fromPoint = _fromPoint;

            Text = Appoint.TrackInfo;
        }
        private void buttonSetOut_Click(object sender, EventArgs e)
        {
            Appoint appoint = (Appoint)bindingSourceAppoints.Current;

            if (appoint != null)
            {
                appoint.GetOut(database, User);
            }
            toolStripButtonRefresh_Click(sender, e);
        }
 private void buttonOk_Click(object sender, EventArgs e)
 {
     if (CheckPoint(cboxPoint.SelectedItem) &&
         CheckComment(tboxComment.Text))
     {
         UpdatePermitComment(tboxComment.Text);
         Appoint.SetToPoint(database, Appoint.Unit, (Point)cboxPoint.SelectedItem, DateTime.Now, User);
         DialogResult = DialogResult.OK;
     }
 }
Пример #7
0
        private void MoveTrackToOtherPoint(Appoint appoint)
        {
            FormRepointAppoint form = new FormRepointAppoint(database, appoint, Point);

            if (form.ShowDialog(FindForm().MdiParent) == DialogResult.OK)
            {
                FormAccepting parentForm = (FormAccepting)this.FindForm();
                parentForm.RefreshData();
            }
        }
        private void dataGridViewAppoints_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            Appoint appoint = ((Appoints)bindingSourceAppoints.DataSource)[e.RowIndex];

            dataGridViewAppoints.Rows[e.RowIndex].DefaultCellStyle.BackColor = appoint.Color;
            if (appoint.Color != SystemColors.Window)
            {
                dataGridViewAppoints.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.Green;
                dataGridViewAppoints.Rows[e.RowIndex].DefaultCellStyle.SelectionForeColor = appoint.Color;
                dataGridViewAppoints.Rows[e.RowIndex].DefaultCellStyle.Font
                    = new Font(dataGridViewAppoints.DefaultCellStyle.Font, FontStyle.Bold);
            }
        }
        public AppointStates(EPVDatabase database, Appoint apnt)
        {
            appoint     = apnt;
            querySelect = "select * from docAppointStates where appoint = @appoint order by dateState";
            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();
        }
        private void FormRepointAppoint_Load(object sender, EventArgs e)
        {
            Permit permit = Appoint.GetPermit(database);

            if (permit == null)
            {
                MessageBox.Show(DispatcherService.Resources.Error.PermitNotFound);
                Close();
            }

            currentComment   = permit.GetComment(database);
            tboxComment.Text = currentComment;

            Points points = new DispatcherService.Points(database, Appoint.Unit);

            cboxPoint.DataSource = points;
        }
Пример #11
0
        private void dataGridViewAppoints_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Appoint appoint = ((Appoints)dataGridViewAppoints.DataSource)[e.RowIndex];

            if (e.ColumnIndex == 2 &&
                MessageBox.Show(DispatcherService.Resources.Message.EndPoint,
                                dataGridViewAppoints[0, e.RowIndex].Value.ToString(),
                                MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                appoint.EndPoint(database, User);
                RefreshData();
            }

            if (e.ColumnIndex == 3)
            {
                MoveTrackToOtherPoint(appoint);
            }
        }
        private void CreateAppoint()
        {
            Appoint appoint = new Appoint(PlanAppoint);

            appoint.Citizen = (State)cboxCountry.SelectedItem;
            appoint.SetComingDate(pickComingTime.Value);
            appoint.Unit    = (Unit)cboxUnit.SelectedItem;
            appoint.Warrant = tboxWarrant.Text;
            appoint.Trailer = tboxTrailer.Text;

            appoint.Save(Database);

            string          query      = DispatcherService.Resources.Doc.PlanAppoint.LinkToAppoint;
            QueryParameters parameters = new QueryParameters("plan", PlanAppoint.Id);

            parameters.Add("id", appoint.Id);
            Database.ExecuteQuery(query, parameters);


            FindForm().Close();
        }
Пример #13
0
        public Appoint(EPVDatabase database, Appoint copy, Units units, States states)
        {
            id = copy.Id;
            string query = "select a.*, ";

            query += "(select dateState from docAppointStates where appoint = a.id and docState = 0) as dateComing ";
            query += ", (select PERMIT from docPlanAppoint where id = a.planAppoint) as permitId ";
            query += "from docAppoints a where a.id = @id";
            QueryParameters parameters = new QueryParameters("id", id);
            DbDataReader    reader     = database.ExecuteReader(query, parameters);

            reader.Read();
            unit         = units.Find((int)reader["idUnit"]);
            trackMark    = (string)(DBNull.Value.Equals(reader["trackMark"]) ? string.Empty : reader["trackMark"]);
            licensePlate = (string)reader["licensePlate"];
            trailer      = (string)(DBNull.Value.Equals(reader["trailer"]) ? string.Empty : reader["trailer"]);
            citizen      = states.Find((int)reader["state"]);
            driverName   = (string)(DBNull.Value.Equals(reader["driverName"]) ? string.Empty : reader["driverName"]);
            driverPhone  = (string)(DBNull.Value.Equals(reader["driverPhone"]) ? string.Empty : reader["driverPhone"]);
            warrant      = (string)(DBNull.Value.Equals(reader["warrant"]) ? string.Empty : reader["warrant"]);
            whereTo      = (string)(DBNull.Value.Equals(reader["whereTo"]) ? string.Empty : reader["whereTo"]);
            cargo        = (string)(DBNull.Value.Equals(reader["cargo"]) ? string.Empty : reader["cargo"]);
            idleReason   = (string)(DBNull.Value.Equals(reader["idleReason"]) ? string.Empty : reader["idleReason"]);
            dateComing   = (DateTime)reader["dateComing"];
            docState     = copy.DocState;
            docStateDate = copy.docStateDate;


            if (DBNull.Value.Equals(reader["permitId"]))
            {
                HasPermit = false;
            }
            else
            {
                HasPermit = ((int)reader["permitId"] > 0);
                permitId  = (int)reader["permitId"];
            }

            reader.Close();
        }
Пример #14
0
        private void dataGridViewDispatcher_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            Appoint appoint = ((Appoints)dataGridViewDispatcher.DataSource)[e.RowIndex];

            dataGridViewDispatcher.Rows[e.RowIndex].DefaultCellStyle.BackColor = appoint.Color;
        }
        private void UpdatePermitComment(string text)
        {
            Permit permit = Appoint.GetPermit(database);

            permit.UpdateComment(database, text);
        }