コード例 #1
0
ファイル: shipmen_edit.cs プロジェクト: divagur/Planning
        private void tbtnDel_Click(object sender, EventArgs e)
        {
            if (tblShipmentOrders.CurrentCell == null)
            {
                return;
            }

            if (MessageBox.Show("Удалить заказ?", "Подверждение", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                ShipmentOrder shipmentOrder = _context.ShipmentOrders.Find(tblShipmentOrders.Rows[tblShipmentOrders.CurrentCell.RowIndex].Cells["colId"].Value);
                _context.ShipmentOrders.Remove(shipmentOrder);
                tblShipmentOrders.DataSource = _shipment.ShipmentOrders.ToList();
            }
        }
コード例 #2
0
ファイル: shipmen_edit.cs プロジェクト: divagur/Planning
        private void tbtnAdd_Click(object sender, EventArgs e)
        {
            ShipmentOrder shipmentOrder        = new ShipmentOrder();
            var           frmShipmentOrderEdit = new ShipmentOrderEdit(shipmentOrder);

            shipmentOrder.ShipmentId = _shipment.Id;
            shipmentOrder.IsBinding  = false;
            if (frmShipmentOrderEdit.ShowDialog() == DialogResult.OK)
            {
                _context.ShipmentOrders.Add(shipmentOrder);
                tblShipmentOrders.DataSource = _shipment.ShipmentOrders.ToList();
            }
            //row["shipment_id"] =_shipment.id;
        }
コード例 #3
0
ファイル: shipmen_edit.cs プロジェクト: divagur/Planning
        private void tbtnEdit_Click(object sender, EventArgs e)
        {
            if (tblShipmentOrders.CurrentCell == null)
            {
                return;
            }
            ShipmentOrder shipmentOrder        = _context.ShipmentOrders.Find(tblShipmentOrders.Rows[tblShipmentOrders.CurrentCell.RowIndex].Cells["colId"].Value);
            var           frmShipmentOrderEdit = new ShipmentOrderEdit(shipmentOrder);

            frmShipmentOrderEdit.ShowDialog();
            if (frmShipmentOrderEdit.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            tblShipmentOrders.Refresh();
        }
コード例 #4
0
ファイル: ShipmentAdd.cs プロジェクト: divagur/Planning
        private void Save()
        {
            if (cmbType.SelectedIndex < 2)
            {
                _shipmentAddResult.IsShipment = true;

                _shipment             = new Shipment();
                _shipment.SDate       = dtSDate.Value;
                _shipment.ShIn        = cmbType.Text == "Вход" ? true : false;
                _shipment.DepositorId = DataService.GetDictIdByName("Депозиторы", cmbDepositor.Text);
                _shipment.TimeSlotId  = DataService.GetDictIdByCondition("ТаймСлоты", $"depositor_id = {_shipment.DepositorId} and slot_time = '{cmbTimeSlot.Text}'");
                _shipment.IsAddLv     = false;

                for (int i = 0; i < tblShipmentItem.RowCount; i++)
                {
                    ShipmentOrder shipmentOrder = new ShipmentOrder();

                    shipmentOrder.OrderId       = tblShipmentItem.Rows[i].Cells["colItemId"].Value.ToString();
                    shipmentOrder.LVOrderId     = (int?)tblShipmentItem.Rows[i].Cells["colLVOrdId"].Value;
                    shipmentOrder.lv_order_code = tblShipmentItem.Rows[i].Cells["colItemId"].Value.ToString();
                    shipmentOrder.IsBinding     = true;
                    _shipment.ShipmentOrders.Add(shipmentOrder);
                }
                _shipmentAddResult.Result = _shipment;
                _context.Shipments.Add(_shipment);
            }
            else if (cmbType.SelectedIndex == 2)
            {
                _shipmentAddResult.IsShipment = false;
                _movement            = new Movement();
                _movement.MDate      = dtSDate.Value;
                _movement.TimeSlotId = DataService.GetDictIdByCondition("ТаймСлоты", $"depositor_id = {DataService.GetDictIdByName("Депозиторы", cmbDepositor.Text)} and slot_time = '{cmbTimeSlot.Text}'");
                for (int i = 0; i < tblShipmentItem.RowCount; i++)
                {
                    MovementItem movementItem = new MovementItem();

                    movementItem.DepositorId = (int)DataService.GetDictIdByName("Депозиторы", cmbDepositor.Text);
                    movementItem.TklLVID     = int.Parse(tblShipmentItem.Rows[i].Cells["colLVOrdId"].Value.ToString());
                    _movement.MovementItems.Add(movementItem);
                }
                _shipmentAddResult.Result = _movement;
                _context.Movements.Add(_movement);
            }
            _context.SaveChanges();
        }
コード例 #5
0
ファイル: ShipmentOrderEdit.cs プロジェクト: divagur/Planning
 public ShipmentOrderEdit(ShipmentOrder shipmentOrder)
 {
     InitializeComponent();
     _shipmentOrder = shipmentOrder;
 }