Example #1
0
        private void bwSave_DoWork(object sender, DoWorkEventArgs e)
        {
            if (insertOrUpdate == true)
            {
                OffDayController.Insert(offDay);
                offDayCurrentList.Add(offDay);

                foreach (var supp in supplierCurrentList)
                {
                    var offDayMapInsert = new OffDay_Supplier_Mapping()
                    {
                        SupplierID = supp.SupplierID,
                        OffDayID   = offDay.OffDayID
                    };
                    OffDayMapController.Insert(offDayMapInsert);
                }
            }
            if (insertOrUpdate == false)
            {
                // Update OffDay
                OffDayController.Update(offDayCurrent);

                // Delete OffDayMap
                RemoveOffDayMap(offDayCurrent.OffDayID);
                // Insert OffDayMap
                foreach (var supp in supplierCurrentList)
                {
                    var offDayMapInsert = new OffDay_Supplier_Mapping()
                    {
                        SupplierID = supp.SupplierID,
                        OffDayID   = offDayCurrent.OffDayID
                    };
                    OffDayMapController.Insert(offDayMapInsert);
                }
            }
        }
Example #2
0
 private void bwInsert_DoWork(object sender, DoWorkEventArgs e)
 {
     OffDayController.Insert(offDayToInsert);
 }