コード例 #1
0
ファイル: SpotService.cs プロジェクト: psychotiic/speedyspots
        /// <summary>
        /// Attemps to place the spot, it's associated Production Order and Job back into their previous state based off of each of their completed dates
        /// </summary>
        /// <param name="spot"></param>
        /// <param name="context"></param>
        public static void CancelSpotReRecordRequest(IASpot spot, DataAccessDataContext context)
        {
            spot = SetSpotToPreviousStatus(spot, context);

            bool allSpotsFinishedWithinPO = ProductionOrdersService.AreAllSpotsFinished(spot.IAProductionOrder, context);
            bool allProductionOrdersComplete = JobsService.AreAllProducitonOrdersComplete(spot.IAProductionOrder.IAJob, context);
            bool jobWasPreviouslyCompleted = spot.IAProductionOrder.IAJob.WasJobPreviouslyCompleted();
            JobStatus jobStatus = JobStatus.Incomplete;
            ProductionOrderStatus productionOrderStatus = ProductionOrderStatus.Incomplete;

            if (allSpotsFinishedWithinPO && allProductionOrdersComplete)
            {
                //Production orders and spots are completed, if the job was previously completed, then fast forward it back to that
                jobStatus = jobWasPreviouslyCompleted ? JobStatus.Complete : JobStatus.CompleteNeedsProduction;
                productionOrderStatus = ProductionOrderStatus.Complete;
            }
            else if (allSpotsFinishedWithinPO && !allProductionOrdersComplete)
            {
                //At least one PO isn't complete within the parent job, but all the spots within this PO are completed
                jobStatus = JobStatus.Incomplete;
                productionOrderStatus = ProductionOrderStatus.Complete;
            }
            else if (!allSpotsFinishedWithinPO && !allProductionOrdersComplete)
            {
                //This PO and maybe others are still not completed
                jobStatus = JobStatus.Incomplete;
                productionOrderStatus = ProductionOrderStatus.Incomplete;
            }

            spot.IAProductionOrder.IAJob.IAJobStatusID = JobsService.GetStatusOption(jobStatus, context).ID;
            spot.IAProductionOrder.IAProductionOrderStatusID = ProductionOrdersService.GetStatusOption(productionOrderStatus, context).ID;
            context.SubmitChanges();
        }
コード例 #2
0
ファイル: SpotService.cs プロジェクト: psychotiic/speedyspots
        public static void MarkSpotForReRecord(IASpot spot, DataAccessDataContext context)
        {
            spot.IAProductionOrder.IAJob.IAJobStatusID = JobsService.GetStatusOption(JobStatus.Incomplete, context).ID;
            spot.IAProductionOrder.IAProductionOrderStatusID = ProductionOrdersService.GetStatusOption(ProductionOrderStatus.Incomplete, context).ID;
            spot.IASpotStatusID = GetStatusOption(SpotStatus.NeedsFix, context).ID;

            // For each file in the spot that is a talent file, mark them as not deletable
            SpotFileType spotFileType = SpotFileTypeService.GetSpotTypeByName("Talent", context);
            foreach (IASpotFile oIASpotFile in spot.IASpotFiles.Where(row => row.IASpotFileTypeID == spotFileType.SpotFileTypeId))
            {
                oIASpotFile.IsDeletable = false;
            }

            context.SubmitChanges();
        }
コード例 #3
0
ファイル: SpotService.cs プロジェクト: psychotiic/speedyspots
 /// <summary>
 /// Determins what a spots previous status was based on dates and flags in the spot and it's PO
 /// </summary>
 /// <param name="spot"></param>
 /// <returns></returns>
 public static SpotStatus GetSpotPreviousStatus(IASpot spot)
 {
     if (spot.WasSpotPreviouslyCompleted())
     {
         return SpotStatus.Finished;
     }
     else
     {
         if (spot.IAProductionOrder.IAJob.ProductionDateTime >= spot.IAProductionOrder.OnHoldDateTime)
         {
             return (spot.IAProductionOrder.HasBeenViewedByTalent) ? SpotStatus.Viewed : SpotStatus.Unviewed;
         }
         else
         {
             return SpotStatus.OnHold;
         }
     }
 }
コード例 #4
0
        private IASpot SaveSpotForm()
        {
            IASpot oIASpot = new IASpot();

            if(IASpotID == 0)
            {
                if(IsProducerView)
                {
                    oIASpot = new IASpot();
                    oIASpot.IAProductionOrderID = m_oIAProductionOrder.IAProductionOrderID;
                    oIASpot.IASpotStatusID = ApplicationContext.GetSpotStatusID(SpotStatus.OnHold);
                    oIASpot.LengthActual = string.Empty;
                    oIASpot.CreatedDateTime = DateTime.Now;
                    oIASpot.CompletedDateTime = DateTime.Now;

                    m_oIAProductionOrder.IASpots.Add(oIASpot);
                }
            }
            else
            {
                oIASpot = DataAccess.IASpots.SingleOrDefault(row => row.IASpotID == IASpotID);
            }

            if(oIASpot != null)
            {
                oIASpot.PurchaseOrderNumber = m_txtPurchaseOrderNumber.Text;
                oIASpot.DueDateTime = m_dtDueDateTime.SelectedDate.Value;
                oIASpot.IsAsap = m_chkASAP.Checked;
                oIASpot.Length = m_txtLength.Text;
                oIASpot.Title = m_txtTitle.Text;
                oIASpot.IASpotTypeID = MemberProtect.Utility.ValidateInteger(m_cboSpotType.SelectedValue);
                oIASpot.ProductionNotes = StripNewlineCharchters(m_txtProductionNotes.Content);
                oIASpot.Script = StripNewlineCharchters(m_txtScript.Content);
                oIASpot.IsReviewed = true;
                DataAccess.SubmitChanges();

                // Save spot fees in memory
                if(IASpotID == 0)
                {
                    foreach(RepeaterItem oItem in m_listFees.Items)
                    {
                        RadNumericTextBox txtFee = oItem.FindControl("m_txtFee") as RadNumericTextBox;
                        DropDownList cboFeeType = oItem.FindControl("m_cboSpotFeeType") as DropDownList;

                        IASpotFee oIASpotFee = new IASpotFee();
                        oIASpotFee.IASpotID = oIASpot.IASpotID;
                        oIASpotFee.IASpotFeeTypeID = MemberProtect.Utility.ValidateInteger(cboFeeType.SelectedValue);
                        oIASpotFee.Fee = MemberProtect.Utility.ValidateDecimal(txtFee.Text);
                        oIASpotFee.LengthActual = string.Empty;
                        oIASpot.IASpotFees.Add(oIASpotFee);
                        DataAccess.SubmitChanges();
                    }

                    // Clear out fees to reset the information for a new Spot
                    m_listFees.DataSource = null;
                    m_listFees.DataBind();

                    SpotFees = new List<SpotFee>();
                    SpotFeesCount = 0;
                    CreateNewFee();
                }

                SaveFees();

                IASpotID = 0;

                ProcessUploadedProducerFiles(oIASpot.IASpotID);
                RefreshFilesList();
                RefreshSpotList();
                RefreshFeeList();
            }
            else
            {
                throw new ApplicationException(string.Format("Spot '{0}' cannot be found.", IASpotID));
            }

            return oIASpot;
        }
コード例 #5
0
        private void LoadSpotForm(IASpot oIASpot)
        {
            if(oIASpot != null)
            {
                IASpotID = oIASpot.IASpotID;

                m_txtPurchaseOrderNumber.Text = oIASpot.PurchaseOrderNumber;
                m_dtDueDateTime.SelectedDate = oIASpot.DueDateTime;
                m_chkASAP.Checked = oIASpot.IsAsap;
                m_txtLength.Text = oIASpot.Length;
                m_txtTitle.Text = oIASpot.Title;
                m_cboSpotType.SelectedValue = MemberProtect.Utility.FormatInteger(oIASpot.IASpotTypeID);
                m_txtProductionNotes.Content = oIASpot.ProductionNotes;
                m_txtScript.Content = oIASpot.Script;

                RefreshSpotList();
                RefreshFeeList();
                RefreshFilesList();

                LoadVisibility();
            }
        }
コード例 #6
0
ファイル: SpotService.cs プロジェクト: psychotiic/speedyspots
        private static IASpot SetSpotToPreviousStatus(IASpot spot, DataAccessDataContext context)
        {
            SpotStatus spotStatus = SpotService.GetSpotPreviousStatus(spot);
            spot.IASpotStatusID = GetStatusOption(spotStatus, context).ID;
            context.SubmitChanges();

            if (spot.IAProductionOrder.IAProductionOrderStatusID == ProductionOrdersService.GetStatusOption(ProductionOrderStatus.Incomplete, context).ID)
            {
                if (ProductionOrdersService.AreAllSpotsFinished(spot.IAProductionOrder, context))
                {
                    spot.IAProductionOrder.IAProductionOrderStatusID = ProductionOrdersService.GetStatusOption(ProductionOrderStatus.Complete, context).ID;
                    context.SubmitChanges();
                }
            }

            return spot;
        }