Exemplo n.º 1
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;
        }
Exemplo n.º 2
0
        private bool ProcessUploadedFiles()
        {
            if(m_oUpload.UploadedFiles.Count > 0)
            {
                foreach(UploadedFile oFile in m_oUpload.UploadedFiles)
                {
                    // Create file record
                    IAJobFile oIAJobFile = new IAJobFile();
                    oIAJobFile.IAJobID = m_oIAJob.IAJobID;
                    oIAJobFile.Filename = oFile.GetName();
                    oIAJobFile.FilenameUnique = string.Format("{0}{1}", Guid.NewGuid(), oFile.GetExtension());
                    oIAJobFile.FileSize = oFile.ContentLength;
                    oIAJobFile.CreatedDateTime = DateTime.Now;
                    DataAccess.IAJobFiles.InsertOnSubmit(oIAJobFile);
                    DataAccess.SubmitChanges();

                    // Save physical file under a new name
                    oFile.SaveAs(string.Format("{0}{1}", ApplicationContext.UploadPath, oIAJobFile.FilenameUnique));
                }

                return true;
            }
            else
            {
                return false;
            }
        }