Пример #1
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            int nextWaybillID = 0;

            if (comboBoxNextWaybill.SelectedValue != null)
            {
                nextWaybillID = (int)comboBoxNextWaybill.SelectedValue;
            }
            string displayText = comboBoxShipper.Text + " -> " + comboBoxConsignee.Text + " - " + textBoxDescOfArticles.Text.Trim();

            CoreWebService.BillOfLadingResponse response = client.updateBillOfLading((int)listBoxBillOfLading.SelectedValue, (int)comboBoxConsignee.SelectedValue, (int)comboBoxShipper.SelectedValue, (int)comboBoxRequestedCarType.SelectedValue, (int)numericUpDownRequestedLength.Value, (int)numericUpDownCapacityTons.Value, textBoxNoPkgs.Text, textBoxDescOfArticles.Text, checkBoxIsPerishable.Checked, checkBoxPreIce.Checked, checkBoxInitialIce.Checked, 0, false, checkBoxIsLiveStock.Checked, checkBoxReverseRoute.Checked, checkBoxReturnEmpty.Checked, checkBoxNextWaybill.Checked, nextWaybillID, (decimal)numericUpDownCarsPerDay.Value, (int)numericUpDownUnloadTime.Value, (int)numericUpDownLoadTime.Value, displayText, true);

            if (response.Status == 0)
            {
                CoreWebService.BillOfLadingPathResponse path = new CoreWebService.BillOfLadingPathResponse();
                client.deleteBillOfLadingPath(response.Data.ID);
                for (int i = 0; i < listBoxPath.Items.Count; i++)
                {
                    if (i == 0)
                    {
                        CoreWebService.Location item = (CoreWebService.Location)listBoxLocations.Items[i];
                        path = client.addBillOfLadingPath(response.Data.ID, item.ID, 0, true);
                    }
                    else
                    {
                        CoreWebService.Location item = (CoreWebService.Location)listBoxLocations.Items[i];
                        int previousPathID           = path.Data.ID;
                        path = client.addBillOfLadingPath(response.Data.ID, item.ID, 0, false);
                        client.updateBillOfLadingPath(previousPathID, response.Data.ID, path.Data.ID);
                    }
                }

                client.deleteBillOfLadingCartypeAttribute((int)listBoxBillOfLading.SelectedValue);
                foreach (var i in listBoxCarTypeAttributes.SelectedIndices)
                {
                    CoreWebService.CarTypeAttribute item = (CoreWebService.CarTypeAttribute)listBoxCarTypeAttributes.Items[(int)i];
                    CoreWebService.BillOfLadingCarTypeAttributesResponse rsResponse = client.addBillOfLadingCartypeAttribute(response.Data.ID, item.ID);
                }

                CoreWebService.BillOfLadingListResponse waybillTemplates = client.listBillOfLading(textBoxSearch.Text);
                if (waybillTemplates.Status == 0)
                {
                    listBoxBillOfLading.DisplayMember = "displayText";
                    listBoxBillOfLading.ValueMember   = "ID";
                    listBoxBillOfLading.DataSource    = waybillTemplates.Data;
                }

                listBoxBillOfLading.SelectedValue = response.Data.ID;
            }
        }
Пример #2
0
        private void buttonAddLocation_Click(object sender, EventArgs e)
        {
            CoreWebService.Path     path     = new CoreWebService.Path();
            CoreWebService.Location location = client.getLocation(Convert.ToInt32(listBoxLocations.SelectedValue));
            path.RouteID        = 0;
            path.locationID     = location.ID;
            path.nextLocationID = 0;
            path.symbol         = textBoxSymbol.Text;
            path.defaultStatus  = "";
            if (listBoxNewRoute.Items.Count == 0)
            {
                path.isStart = true;
            }
            else
            {
                path.isStart = false;
            }
            path.isEnd = false;

            int i = listBoxNewRoute.SelectedIndex + 1;

            if (paths.Count == 0)
            {
                paths.Add(path);
                newLocations.Add(location);
            }
            else
            {
                paths.Insert(listBoxNewRoute.SelectedIndex + 1, path);
                newLocations.Insert(listBoxNewRoute.SelectedIndex + 1, location);
            }

            try
            {
                locations.RemoveAt(listBoxLocations.SelectedIndex);
                refreshNewRoute(i);
                refreshLocations();
            }
            catch (ArgumentOutOfRangeException)
            {
                paths.RemoveAt(paths.Count - 1);
                newLocations.RemoveAt(newLocations.Count - 1);
            }
        }