示例#1
0
 /// <summary>
 /// Creates the cities.
 /// </summary>
 /// <param name="EDC">The EDC.</param>
 public static void CreateCities(EntitiesDataContext EDC)
 {
     for (int i = 0; i < 10; i++)
     {
         CityType _cmm = new CityType()
         {
             Title = String.Format("City {0}", i)
         };
         EDC.City.InsertOnSubmit(_cmm);
         EDC.SubmitChanges();
     }
 }
示例#2
0
        /// <summary>
        /// Writes an entry with the given message text and application-defined event identifier to the event log list.
        /// </summary>
        /// <param name="edc">Provides LINQ (Language Integrated Query) access to, and change tracking for,
        /// the lists and document libraries of a Windows SharePoint Services "14" Web site.</param>
        /// <param name="title">The evrnt title.</param>
        /// <param name="partner">The partner associated with the event.</param>
        /// <param name="shippingIndex">Index of the shipping.</param>
        internal static void WriteEntry(EntitiesDataContext edc, string title, Partner partner, Shipping shippingIndex)
        {
            if (edc == null)
            {
                EventLog.WriteEntry("CAS.SmartFActory", "Cannot open \"Event Log List\" list", EventLogEntryType.Error, 114);
                return;
            }
            AlarmsAndEvents _log = new AlarmsAndEvents()
            {
                Title = title,
                AlarmsAndEventsList2PartnerTitle = partner,
                AlarmsAndEventsList2Shipping     = shippingIndex
            };

            edc.AlarmsAndEvents.InsertOnSubmit(_log);
            edc.SubmitChanges(Microsoft.SharePoint.Linq.ConflictMode.ContinueOnConflict);
        }
示例#3
0
        private void RemoveDrivers(EntitiesDataContext EDC, Partner partner)
        {
            if (partner == null)
            {
                return;
            }
            List <ShippingDriversTeam> _2Delete = new List <ShippingDriversTeam>();

            foreach (ShippingDriversTeam _drv in this.ShippingDriversTeams(EDC))
            {
                if (partner == _drv.DriverTitle.Driver2PartnerTitle)
                {
                    _2Delete.Add(_drv);
                }
            }
            EDC.DriversTeam.DeleteAllOnSubmit(_2Delete);
            EDC.SubmitChanges();
        }
示例#4
0
 /// <summary>
 /// Changes the escort.
 /// </summary>
 /// <param name="nr">The nr.</param>
 /// <param name="EDC">The EDC.</param>
 public void ChangeEscort(SecurityEscortCatalog nr, EntitiesDataContext EDC)
 {
     if (this.SecurityEscortCatalogTitle == nr)
     {
         return;
     }
     this.Shipping2TruckTitle = null;
     EDC.SubmitChanges();
     RemoveDrivers(EDC, this.Shipping2PartnerTitle);
     this.SecurityEscortCatalogTitle = nr;
     if (nr == null)
     {
         this.Shipping2PartnerTitle = null;
         return;
     }
     this.SecurityEscortCatalogTitle = nr;
     this.Shipping2PartnerTitle      = nr == null ? null : nr.PartnerTitle;
 }
示例#5
0
 /// <summary>
 /// Changes the rout.
 /// </summary>
 /// <param name="nr">The nr.</param>
 /// <param name="EDC">The EDC.</param>
 public void ChangeRout(Route nr, EntitiesDataContext EDC)
 {
     if (this.Shipping2RouteTitle == nr)
     {
         return;
     }
     this.TrailerTitle = null;
     this.TruckTitle   = null;
     EDC.SubmitChanges();
     RemoveDrivers(EDC, this.PartnerTitle);
     this.Shipping2RouteTitle = nr;
     if (nr == null)
     {
         this.BusinessDescription = String.Empty;
         this.PartnerTitle        = null;
         return;
     }
     this.BusinessDescription = Shipping2RouteTitle.Route2BusinessDescriptionTitle == null ? String.Empty : Shipping2RouteTitle.Route2BusinessDescriptionTitle.Title;
     this.PartnerTitle        = Shipping2RouteTitle.PartnerTitle;
 }