Exemplo n.º 1
0
        public void Create()
        {
            //Persist this definition
            try {
                //Validate
                if (this.mSortCenterID == 0)
                {
                    throw new ApplicationException("Failed to create new ship schedule: must have a valid sort center ID.");
                }

                //Create a new ship schedule for this SortCenterID and ScheduleDate
                this.mScheduleID = ShipScheduleGateway.CreateShipSchedule(this.mSortCenterID, this.mScheduleDate, DateTime.Now, Environment.UserName);
                for (int i = 0; i < this.mTemplates.TemplateViewTable.Rows.Count; i++)
                {
                    //Add all mandatory loads only to the new schedule
                    if (this.mTemplates.TemplateViewTable[i].IsMandatory == 1)
                    {
                        ShipScheduleGateway.CreateShipScheduleTrip(this.mScheduleID, this.mTemplates.TemplateViewTable[i].TemplateID, DateTime.Now, Environment.UserName);
                    }
                }
                Refresh();
            }
            catch (ApplicationException aex) { throw aex; }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
        }
Exemplo n.º 2
0
 public void AddLoads()
 {
     //Add selected template loads to this schedule
     try {
         for (int i = 0; i < this.mTemplates.TemplateViewTable.Rows.Count; i++)
         {
             if (this.mTemplates.TemplateViewTable[i].Selected)
             {
                 ShipScheduleGateway.CreateShipScheduleTrip(this.mScheduleID, this.mTemplates.TemplateViewTable[i].TemplateID, DateTime.Now, Environment.UserName);
             }
         }
         Refresh();
     }
     catch (ApplicationException ex) { throw ex; }
     catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
 }