Beispiel #1
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            CoreWebService.ArrCodeResponse arrCode = client.getArrCode((int)comboBoxArrCode.SelectedValue);
            string displayText = arrCode.Data.Abbr + " " + textBoxRoadNumber.Text.Trim();

            CoreWebService.RollingStockResponse response = client.updateRollingstock((int)listBoxCars.SelectedValue, textBoxRoadNumber.Text, (int)comboBoxArrCode.SelectedValue, (int)numericUpDownLength.Value, (int)numericUpDownCapacityTons.Value, (int)comboBoxCarType.SelectedValue, textBoxRFID.Text, displayText);

            if (response.Status == 0)
            {
                CoreWebService.RollingStockAttributeListResponse rsDeleteResponse = client.deleteAllRollingStockAttribute(response.Data.ID);

                foreach (var i in listBoxCarTypeAttributes.SelectedIndices)
                {
                    CoreWebService.CarTypeAttribute item = (CoreWebService.CarTypeAttribute)listBoxCarTypeAttributes.Items[(int)i];
                    CoreWebService.RollingStockAttributeResponse rsResponse = client.addRollingStockAttribute(response.Data.ID, item.ID);
                }

                CoreWebService.RollingStockListResponse rollingStock = client.listAllRollingStock("");
                listBoxCars.DisplayMember = "displayText";
                listBoxCars.ValueMember   = "ID";
                listBoxCars.DataSource    = rollingStock.Data;

                listBoxCars.SelectedValue = response.Data.ID;
            }
            else
            {
                MessageBox.Show(response.Message);
            }
        }
Beispiel #2
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;
            }
        }