예제 #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
        private void loadPoints()
        {
            MyPointList myPointList = MyPointList.getInstance();
            DataTable   dt          = (_route.MyPoint2 == null) ? myPointList.ToDataTableWithoutExists(_idRegion, _route.MyPoint1) : myPointList.ToDataTable(_idRegion);

            cbMyPoint2.DataSource    = dt;
            cbMyPoint2.ValueMember   = dt.Columns[0].ColumnName;
            cbMyPoint2.DisplayMember = dt.Columns[1].ColumnName;
        }
예제 #6
0
        public override void Save()
        {
            int id;

            int.TryParse(Provider.Insert("MyPoint", Id, RegionID, Name), out id);
            Id = id;

            MyPointList pointList = MyPointList.getInstance();

            pointList.Add(this);
        }
예제 #7
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));
        }
예제 #8
0
        private void loadPoints()
        {
            int idRegion;

            int.TryParse(cbRegion.SelectedValue.ToString(), out idRegion);

            MyPointList myPointList = MyPointList.getInstance();
            DataTable   dt          = myPointList.ToDataTable(idRegion);

            cbMyPoint1.DataSource    = dt;
            cbMyPoint1.ValueMember   = dt.Columns[0].ColumnName;
            cbMyPoint1.DisplayMember = dt.Columns[1].ColumnName;

            loadData();

            ResizeDGV();
        }
예제 #9
0
        private void loadMyPoints()
        {
            if (cbRegion.SelectedValue == null)
            {
                return;
            }

            MyPointList myPointList = MyPointList.getInstance();

            int idRegion;

            int.TryParse(cbRegion.SelectedValue.ToString(), out idRegion);

            DataTable dt = myPointList.ToDataTable(idRegion);

            cbMyPoint.DataSource    = dt;
            cbMyPoint.ValueMember   = dt.Columns[0].ColumnName;
            cbMyPoint.DisplayMember = dt.Columns[1].ColumnName;
        }
예제 #10
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;
            }
        }
예제 #11
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;
        }
예제 #12
0
        public formMyPointList()
        {
            InitializeComponent();

            _myPointList = MyPointList.getInstance();
        }
예제 #13
0
        public formMyPointList()
        {
            InitializeComponent();

            _myPointList = MyPointList.getInstance();
        }