コード例 #1
0
        protected void OnCreateJob(object sender, EventArgs e)
        {
            if (!m_dtJobDueDateTime.SelectedDate.HasValue || m_dtJobDueDateTime.SelectedDate.Value.CompareTo(DateTime.Now) <= 0)
             {
            SetMessage("Please select a future due date for the job.", MessageTone.Negative);
            return;
             }

             var oIAJob = new IAJob
             {
            IARequestID = m_oIARequest.IARequestID,
            IAJobStatusID = ApplicationContext.GetJobStatusID(JobStatus.Incomplete),
            MPUserID = MemberProtect.CurrentUser.UserID,
            MPUserIDProducer = Guid.Empty,
            MPUserIDCompleted = Guid.Empty,
            Sequence = JobsService.GetNextJobSequenceNumberForRequest(m_oIARequest.IARequestID, DataAccess),
            Name = m_txtJobName.Text,
            Language = m_cboLanguage.SelectedValue,
            Notes = string.Empty,
            DueDateTime = m_dtJobDueDateTime.SelectedDate.Value,
            IsASAP = m_chkASAP.Checked,
            QuantityMusic = 0,
            QuantitySFX = 0,
            QuantityProduction = 0,
            QuantityConvert = 0,
            PriceMusic = 0,
            PriceSFX = 0,
            PriceProduction = 0,
            PriceConvert = 0,
            IsMusic = false,
            IsSFX = false,
            IsProduction = false,
            IsConvert = false,
            IsSentToProduction = false,
            MPUserIDCreated = MemberProtect.CurrentUser.UserID,
            CreatedDateTime = DateTime.Now,
            ProductionDateTime = new DateTime(1950, 1, 1, 0, 0, 0, 0),
            CompletedDateTime = new DateTime(1950, 1, 1, 0, 0, 0, 0)
             };
             DataAccess.IAJobs.InsertOnSubmit(oIAJob);

             // If request has an estimate and it has been approved, mark request as 'Processing', or no estimate exists
             if (m_oIARequest.IARequestEstimates.Any())
             {
            if (m_oIARequest.IARequestEstimates[0].IsApproved)
            {
               m_oIARequest.IARequestStatusID = ApplicationContext.GetRequestStatusID(RequestStatus.Processing);
            }
             }
             else
             {
            m_oIARequest.IARequestStatusID = ApplicationContext.GetRequestStatusID(RequestStatus.Processing);
             }

             ApplicationContext.RequestAssignStaff(m_oIARequest, MemberProtect.CurrentUser.UserID);
             DataAccess.SubmitChanges();

             m_oTabs.RequestDetailsReload();

             ShowMessage("Job created succesfully!", MessageTone.Positive);
        }
コード例 #2
0
        private void SendReactiveEmail(IAJob oIAJob)
        {
            var fromAddress = MemberProtect.CurrentUser.Username;
             var fromName = MemberProtect.User.GetDataItem(MemberProtect.CurrentUser.UserID, "FirstName") + " " +
                        MemberProtect.User.GetDataItem(MemberProtect.CurrentUser.UserID, "LastName");
             var subject = string.Format("Job Reactivated - {0}", oIAJob.Name);
             var messageBody = string.Format("{0} has reactivated job {1} - {2} at {3}", fromName, oIAJob.JobIDForDisplay, oIAJob.Name, DateTime.Now.ToString("f"));

             EmailCommunicationService.JobReactivedBillingNotificationSend(messageBody, subject, fromAddress, fromName);
        }
コード例 #3
0
        public IAJob RequestJobRecut(IAJob oIAJob)
        {
            var oIAJobDuplicate = new IAJob();
             oIAJobDuplicate.IARequestID = oIAJob.IARequestID;
             oIAJobDuplicate.IAJobStatusID = GetJobStatusID(JobStatus.ReCutRequested);
             oIAJobDuplicate.MPUserID = oIAJob.MPUserID;
             oIAJobDuplicate.MPUserIDCreated = oIAJob.MPUserIDCreated;
             oIAJobDuplicate.MPUserIDCompleted = Guid.Empty;
             oIAJobDuplicate.MPUserIDProducer = Guid.Empty;
             oIAJobDuplicate.Sequence = JobsService.GetNextJobSequenceNumberForRequest(oIAJob.IARequestID, DataAccess);
             oIAJobDuplicate.Name = string.Format("{0} - RECUT", oIAJob.Name);
             oIAJobDuplicate.Language = oIAJob.Language;
             oIAJobDuplicate.Notes = oIAJob.Notes;
             oIAJobDuplicate.QuantityMusic = oIAJob.QuantityMusic;
             oIAJobDuplicate.QuantitySFX = oIAJob.QuantitySFX;
             oIAJobDuplicate.QuantityProduction = oIAJob.QuantityProduction;
             oIAJobDuplicate.QuantityConvert = oIAJob.QuantityConvert;
             oIAJobDuplicate.PriceMusic = oIAJob.PriceMusic;
             oIAJobDuplicate.PriceSFX = oIAJob.PriceSFX;
             oIAJobDuplicate.PriceProduction = oIAJob.PriceProduction;
             oIAJobDuplicate.PriceConvert = oIAJob.PriceConvert;
             oIAJobDuplicate.IsASAP = true;
             oIAJobDuplicate.IsMusic = oIAJob.IsMusic;
             oIAJobDuplicate.IsSFX = oIAJob.IsSFX;
             oIAJobDuplicate.IsProduction = oIAJob.IsProduction;
             oIAJobDuplicate.IsConvert = oIAJob.IsConvert;
             oIAJobDuplicate.IsSentToProduction = false;
             oIAJobDuplicate.ProductionDateTime = new DateTime(1950, 1, 1, 0, 0, 0, 0);
             oIAJobDuplicate.DueDateTime = oIAJob.DueDateTime;
             oIAJobDuplicate.CreatedDateTime = DateTime.Now;
             oIAJobDuplicate.CompletedDateTime = new DateTime(1950, 1, 1, 0, 0, 0, 0);
             DataAccess.IAJobs.InsertOnSubmit(oIAJobDuplicate);
             DataAccess.SubmitChanges();

             // Duplicate Job File Records
             foreach (var oIAJobFile in oIAJob.IAJobFiles)
             {
            var sExtension = string.Empty;
            var iIndex = oIAJobFile.FilenameUnique.LastIndexOf(".");
            if (iIndex > 0)
            {
               sExtension = oIAJobFile.FilenameUnique.Substring(iIndex, oIAJobFile.FilenameUnique.Length - iIndex);
            }

            var sFilename = string.Format("{0}{1}", Guid.NewGuid(), sExtension);

            try
            {
               File.Copy(string.Format("{0}{1}", UploadPath, oIAJobFile.FilenameUnique), string.Format("{0}{1}", UploadPath, sFilename));
            }
            catch (Exception)
            {
            }

            var oIAJobFileDuplicate = new IAJobFile();
            oIAJobFileDuplicate.IAJobID = oIAJobDuplicate.IAJobID;
            oIAJobFileDuplicate.Filename = oIAJobFile.Filename;
            oIAJobFileDuplicate.FilenameUnique = sFilename;
            oIAJobFileDuplicate.FileSize = oIAJobFile.FileSize;
            oIAJobFileDuplicate.CreatedDateTime = DateTime.Now;
            DataAccess.IAJobFiles.InsertOnSubmit(oIAJobFileDuplicate);
            DataAccess.SubmitChanges();
             }

             // Duplicate Production Orders and files
             foreach (var oIAProductionOrder in oIAJob.IAProductionOrders)
             {
            DuplicateProductionOrder(oIAProductionOrder, oIAJobDuplicate.IAJobID);
             }

             return oIAJobDuplicate;
        }
コード例 #4
0
        private bool AllSpotsHaveBeenReviewed(IAJob oIAJob)
        {
            var iTotalSpots = 0;
             var iTotalReviewedSpots = 0;

             foreach (var oIASpot in oIAJob.IAProductionOrders.SelectMany(oIAProductionOrder => oIAProductionOrder.IASpots))
             {
            iTotalSpots++;
            if (oIASpot.IsReviewed)
            {
               iTotalReviewedSpots++;
            }
             }

             return iTotalSpots == iTotalReviewedSpots;
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["jid"] != null)
             {
            Session["IAJobID"] = MemberProtect.Utility.ValidateInteger(Request.QueryString["jid"]);
             }

             if (Session["IAJobID"] != null)
             {
            m_oIAJob = DataAccess.IAJobs.SingleOrDefault(row => row.IAJobID == (int) Session["IAJobID"]);

            foreach (var oIARequestProduction in m_oIAJob.IARequestProductions)
            {
               foreach (var oIARequestProductionFile in oIARequestProduction.IARequestProductionFiles)
               {
                  if (!m_oSentFilenames.Contains(oIARequestProductionFile.Filename))
                  {
                     m_oSentFilenames.Add(oIARequestProductionFile.Filename);
                  }
               }
            }
             }

             if (!IsPostBack)
             {
            m_grdList.PageSize = ApplicationContext.GetGridPageSize();
            m_grdTalentFiles.PageSize = ApplicationContext.GetGridPageSize();
             }

             m_btnRerecordUndo.Visible = false;
             m_btnFinished.Visible = false;
             if (m_oIAJob == null)
             {
            Response.Redirect("~/Default.aspx");
             }
             else
             {
            m_oRepeaterProduction.ItemCreated += OnRepeaterProductionItemCreated;
            m_oRepeaterProduction.DataSource = m_oIAJob.IARequest.IARequestProductions.Where(row => row.IAJobID == m_oIAJob.IAJobID);
            m_oRepeaterProduction.DataBind();

            // Rules to show Finished button:
            var bFinishVisible = true;
            //1. All spots have had files delivered by the talent
            foreach (var oIAProductionOrder in m_oIAJob.IAProductionOrders)
            {
               foreach (var oIASpot in oIAProductionOrder.IASpots)
               {
                  if (oIASpot.IASpotFiles.Count(row => row.IASpotFileTypeID == ApplicationContext.GetSpotFileTypeID(SpotFileTypes.Talent)) == 0)
                  {
                     bFinishVisible = false;
                     break;
                  }
               }
            }

            //2. At least one file delivery has been sent to the customer
            if (bFinishVisible)
            {
               if (DataAccess.IARequestProductions.Count(row => row.IAJobID == m_oIAJob.IAJobID) == 0)
               {
                  bFinishVisible = false;
               }
            }

            // 3. The actual time has been filled out by the QC for each spot
            if (bFinishVisible)
            {
               foreach (var oIAProductionOrder in m_oIAJob.IAProductionOrders)
               {
                  foreach (var oIASpot in oIAProductionOrder.IASpots)
                  {
                     // TODO for 6674 check each spot fee for actual length, except for type 6
                     foreach (var spotFee in oIASpot.IASpotFees)
                     {
                        if (spotFee.IASpotFeeTypeID != (int) SpotFeeTypes.ListeningFee && string.IsNullOrEmpty(spotFee.LengthActual))
                        {
                           bFinishVisible = false;
                           break;
                        }
                     }
                  }
               }
            }

            // MF 1/31/2012 - Undoing this for case https://inet.fogbugz.com/default.asp?6534 until that work around is addressed
            // MF 3/9/2012 - Re-enableing this for case https://inet.fogbugz.com/default.asp?6615
            // 4. The job hasn't been marked as complete
            if (bFinishVisible && m_oIAJob.IAJobStatusID == ApplicationContext.GetJobStatusID(JobStatus.Complete))
            {
               bFinishVisible = false;
            }

            m_btnFinished.Visible = bFinishVisible;
            if (!JobsService.AreAllProducitonOrdersComplete(m_oIAJob, DataAccess))
            {
               m_btnFinished.Attributes["onclick"] =
                  "return ConfirmUser('The talent has not marked this job as finished. Are you sure you want to complete it and send to billing?');";
            }
             }
        }