コード例 #1
0
        public WayBillRoute(DataRow row)
        {
            int id;

            int.TryParse(row[0].ToString(), out id);
            ID = id;

            int idWayBillDay;

            int.TryParse(row[1].ToString(), out idWayBillDay);
            WayBillDay = WayBillDayList.getInstance().getItem(idWayBillDay);

            MyPointList myPointList = MyPointList.getInstance();
            int         idMyPoint1;

            int.TryParse(row[2].ToString(), out idMyPoint1);
            MyPoint myPoint1 = myPointList.getItem(idMyPoint1);

            int idMyPoint2;

            int.TryParse(row[3].ToString(), out idMyPoint2);
            MyPoint myPoint2 = myPointList.getItem(idMyPoint2);

            string distance = row[4].ToString();

            Route = new Route(myPoint1, myPoint2, distance);
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                if (cbMyPoint2.SelectedValue == null)
                {
                    MessageBox.Show("Выберите пункт назначения", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else if (tbDistance.Text == string.Empty)
                {
                    MessageBox.Show("Введите дистанцию", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    MyPointList myPointList = MyPointList.getInstance();
                    int         idMyPoint2;
                    int.TryParse(cbMyPoint2.SelectedValue.ToString(), out idMyPoint2);

                    _route.MyPoint2 = myPointList.getItem(idMyPoint2);
                    int distance;
                    int.TryParse(tbDistance.Text, out distance);
                    _route.Distance = distance;
                    _route.Save();
                }

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
コード例 #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (_workWithForm.IsEditMode())
            {
                if (cbMyPoint.SelectedValue == null)
                {
                    MessageBox.Show("Выберите адрес подачи", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int idPoint;
                int.TryParse(cbMyPoint.SelectedValue.ToString(), out idPoint);
                MyPointList myPointList = MyPointList.getInstance();
                MyPoint     point       = myPointList.getItem(idPoint);
                _suppyAddress.Point = point;

                _suppyAddress.Save();

                DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                _workWithForm.SetEditMode(true);
            }
        }
コード例 #4
0
        public SuppyAddress(DataRow row)
        {
            int         idPoint;
            MyPointList myPointList = MyPointList.getInstance();

            int.TryParse(row.ItemArray[0].ToString(), out idPoint);
            Point = myPointList.getItem(idPoint);
        }
コード例 #5
0
        public Route(DataRow row)
        {
            int id;

            int.TryParse(row[0].ToString(), out id);
            Id = id;

            MyPointList myPointList = MyPointList.getInstance();
            int         idMyPoint1;

            int.TryParse(row[1].ToString(), out idMyPoint1);
            MyPoint1 = myPointList.getItem(idMyPoint1);

            int idMyPoint2;

            int.TryParse(row[2].ToString(), out idMyPoint2);
            MyPoint2 = myPointList.getItem(idMyPoint2);

            int distance;

            int.TryParse(row[3].ToString(), out distance);
            Distance = distance;
        }
コード例 #6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (cbMyPoint1.SelectedValue == null)
            {
                return;
            }

            int idMyPoint1;

            int.TryParse(cbMyPoint1.SelectedValue.ToString(), out idMyPoint1);
            MyPointList myPointList = MyPointList.getInstance();
            MyPoint     myPoint1    = myPointList.getItem(idMyPoint1);

            openAddEdit(new Route(myPoint1));
        }
コード例 #7
0
        private void loadData()
        {
            if (cbMyPoint1.SelectedValue == null)
            {
                return;
            }

            int idMyPoint1;

            int.TryParse(cbMyPoint1.SelectedValue.ToString(), out idMyPoint1);
            MyPointList myPointList = MyPointList.getInstance();
            MyPoint     myPoint1    = myPointList.getItem(idMyPoint1);

            dgv.DataSource = _routeList.ToDataTable(myPoint1);

            if (dgv.Columns.Count > 0)
            {
                dgv.Columns[0].Visible = false;
            }
        }
コード例 #8
0
 private void dgv_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     openAddEdit(_myPointList.getItem(_dgvMain.GetID()));
 }