public IASpot DuplicateSpot(IASpot oIASpot, int iIAProductionOrderID)
        {
            // Duplicate Spot Record
             var oIASpotDuplicate = new IASpot();
             oIASpotDuplicate.IAProductionOrderID = iIAProductionOrderID;
             oIASpotDuplicate.IASpotStatusID = GetSpotStatusID(SpotStatus.OnHold);
             oIASpotDuplicate.IASpotTypeID = oIASpot.IASpotTypeID;
             oIASpotDuplicate.PurchaseOrderNumber = oIASpot.PurchaseOrderNumber;
             oIASpotDuplicate.DueDateTime = oIASpot.DueDateTime;
             oIASpotDuplicate.Length = oIASpot.Length;
             oIASpotDuplicate.LengthActual = oIASpot.LengthActual;
             oIASpotDuplicate.Title = oIASpot.Title;
             oIASpotDuplicate.ProductionNotes = oIASpot.ProductionNotes;
             oIASpotDuplicate.Script = oIASpot.Script;
             oIASpotDuplicate.IsAsap = oIASpot.IsAsap;
             oIASpotDuplicate.IsReviewed = true;

             var oIAProductionOrder = DataAccess.IAProductionOrders.SingleOrDefault(row => row.IAProductionOrderID == iIAProductionOrderID);
             if (oIAProductionOrder != null)
             {
            if (oIAProductionOrder.IAJob.IAJobStatusID == GetJobStatusID(JobStatus.ReCutRequested))
            {
               // Mark duplicates created from recut request as not having been reviewed to force SS staff to review each and every spot before
               // being able to send them off to production.
               oIASpotDuplicate.IsReviewed = false;
            }
             }

             oIASpotDuplicate.CreatedDateTime = DateTime.Now;
             oIASpotDuplicate.CompletedDateTime = DateTime.Now;
             DataAccess.IASpots.InsertOnSubmit(oIASpotDuplicate);
             DataAccess.SubmitChanges();

             // Duplicate Spot Fee Records
             foreach (var oIASpotFee in oIASpot.IASpotFees)
             {
            var oIASpotFeeDuplicate = new IASpotFee();
            oIASpotFeeDuplicate.IASpotID = oIASpotDuplicate.IASpotID;
            oIASpotFeeDuplicate.IASpotFeeTypeID = oIASpotFee.IASpotFeeTypeID;
            oIASpotFeeDuplicate.Fee = oIASpotFee.Fee;
            oIASpotFeeDuplicate.LengthActual = oIASpotFee.LengthActual;
            DataAccess.IASpotFees.InsertOnSubmit(oIASpotFeeDuplicate);
            DataAccess.SubmitChanges();
             }

             // Duplicate Spot File Records
             foreach (var oIASpotFile in oIASpot.IASpotFiles.Where(row => row.IASpotFileTypeID == GetSpotFileTypeID(SpotFileTypes.Production)))
             {
            var sExtension = string.Empty;
            var iIndex = oIASpotFile.FilenameUnique.LastIndexOf(".");
            if (iIndex > 0)
            {
               sExtension = oIASpotFile.FilenameUnique.Substring(iIndex, oIASpotFile.FilenameUnique.Length - iIndex);
            }

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

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

            var oIASpotFileDuplicate = new IASpotFile();
            oIASpotFileDuplicate.IASpotID = oIASpotDuplicate.IASpotID;
            oIASpotFileDuplicate.IASpotFileTypeID = oIASpotFile.IASpotFileTypeID;
            oIASpotFileDuplicate.Filename = oIASpotFile.Filename;
            oIASpotFileDuplicate.FilenameUnique = sFilename;
            oIASpotFileDuplicate.FileSize = oIASpotFile.FileSize;
            oIASpotFileDuplicate.IsDeletable = true;
            oIASpotFileDuplicate.CreatedDateTime = DateTime.Now;
            DataAccess.IASpotFiles.InsertOnSubmit(oIASpotFileDuplicate);
            DataAccess.SubmitChanges();
             }

             return oIASpotDuplicate;
        }
        private void LoadFeeForm(IASpotFee oIASpotFee)
        {
            if(oIASpotFee != null)
            {
                IASpotFeeID = oIASpotFee.IASpotFeeID;

                LoadVisibility();
            }
        }
        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;
        }
        protected void OnAddFee(object sender, EventArgs e)
        {
            SaveFees();

            if(IASpotID > 0)
            {
                IASpotFee oIASpotFee = new IASpotFee();
                oIASpotFee.IASpotID = IASpotID;
                oIASpotFee.IASpotFeeTypeID = Business.Services.SpotFeeTypeService.GetSpotFeeTypes(DataAccess).First().SpotFeeTypeId;
                oIASpotFee.LengthActual = string.Empty;
                oIASpotFee.Fee = 0;

                DataAccess.IASpotFees.InsertOnSubmit(oIASpotFee);
                DataAccess.SubmitChanges();
            }
            else
            {
                CreateNewFee();
            }

            RefreshFeeList();
        }