Exemple #1
0
        private void bntSave_Click(object sender, EventArgs e)
        {
            // Return the id from the NonWorkingDayController.SaveNonWorkingDay method,
            // passing in the object nonWorkingDay and storing the returned id in the nonWorkingDay.Id
            // field.
            nonWorkingDay.Id = NonWorkingDayController.SaveNonWorkingDay(nonWorkingDay);

            if (nonWorkingDay.Id == -1)
            {
                MessageBox.Show("Error to create non-Working Date");
            }
        }
Exemple #2
0
        public void CalculateDeliveryDateWithWeekend()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                //set-up two warehouses
                TDCShipment tdcShipment = new TDCShipment();

                Warehouse stockWarehouse = WarehouseTests.PopulateNewItem();
                WarehouseTests.SaveItem(stockWarehouse);
                tdcShipment.StockWarehouseCode = stockWarehouse.Code;

                Warehouse deliveryWarehouse = WarehouseTests.PopulateNewItem();
                WarehouseTests.SaveItem(deliveryWarehouse);
                tdcShipment.DeliveryWarehouseCode = deliveryWarehouse.Code;



                //set-up non working days
                //saturday
                NonWorkingDay nonWorkingDay = new NonWorkingDay();
                nonWorkingDay.NonWorkingDate = new DateTime(2006, 07, 29);
                nonWorkingDay.Description    = "sat";
                nonWorkingDay.UpdatedBy      = "me";
                nonWorkingDay.WarehouseId    = tdcShipment.DeliveryWarehouse.Id;
                NonWorkingDayController.SaveNonWorkingDay(nonWorkingDay);

                //sunday
                nonWorkingDay = new NonWorkingDay();
                nonWorkingDay.NonWorkingDate = new DateTime(2006, 07, 30);
                nonWorkingDay.Description    = "sun";
                nonWorkingDay.UpdatedBy      = "me";
                nonWorkingDay.WarehouseId    = tdcShipment.DeliveryWarehouse.Id;
                NonWorkingDayController.SaveNonWorkingDay(nonWorkingDay);

                //set-up trunker days
                TrunkerDay trunkerDay = new TrunkerDay();
                trunkerDay.Days = 3;
                trunkerDay.SourceWarehouseId      = tdcShipment.StockWarehouse.Id;
                trunkerDay.DestinationWarehouseId = tdcShipment.DeliveryWarehouse.Id;
                trunkerDay.UpdatedBy = "me";
                trunkerDay.Id        = TrunkerDaysController.SaveTrunkerDay(trunkerDay);


                tdcShipment.RequiredShipmentDate  = new DateTime(2006, 07, 26);
                tdcShipment.OpCoCode              = "HSP";
                tdcShipment.StockWarehouseCode    = tdcShipment.StockWarehouse.Code;
                tdcShipment.DeliveryWarehouseCode = tdcShipment.DeliveryWarehouse.Code;
                tdcShipment.CalculateDeliveryDate();

                Assert.IsTrue(tdcShipment.EstimatedDeliveryDate == new DateTime(2006, 07, 31));
            }
        }
Exemple #3
0
 /// <summary>
 /// Saves the item.
 /// </summary>
 /// <param name="nonWorkingDay">The non working day.</param>
 /// <returns></returns>
 internal int SaveItem(NonWorkingDay nonWorkingDay)
 {
     return(NonWorkingDayController.SaveNonWorkingDay(nonWorkingDay));
 }