public static IProgram ToProgram(this Mediaportal.TV.Server.TVDatabase.Entities.Program tvProgram, bool includeRecordingStatus = false)
        {
            if (tvProgram == null)
            {
                return(null);
            }
            Program program = new Program
            {
                ChannelId   = tvProgram.IdChannel,
                ProgramId   = tvProgram.IdProgram,
                Title       = tvProgram.Title,
                Description = tvProgram.Description,
                // TODO: Morpheus_xx, 2017-11-25: TVE35 handles genres differently, needs to be checked and fixed.
                // Genre = tvProgram.ProgramCategory?.Category,
                StartTime     = tvProgram.StartTime,
                EndTime       = tvProgram.EndTime,
                SeasonNumber  = tvProgram.SeriesNum,
                EpisodeNumber = tvProgram.EpisodeNum,
                EpisodeTitle  = tvProgram.EpisodeName
            };

            ProgramBLL programLogic = new ProgramBLL(tvProgram);

            program.RecordingStatus = programLogic.IsRecording ? RecordingStatus.Recording : RecordingStatus.None;
            if (programLogic.IsRecordingOncePending || programLogic.IsRecordingOnce)
            {
                program.RecordingStatus |= RecordingStatus.Scheduled;
            }
            if (programLogic.IsRecordingSeriesPending || programLogic.IsRecordingSeries)
            {
                program.RecordingStatus |= RecordingStatus.SeriesScheduled;
            }

            return(program);
        }
Example #2
0
        public ProgramBLL ConstructorTest()
        {
            ProgramBLL target = new ProgramBLL();

            return(target);
            // TODO: add assertions to method ProgramBLLTest.ConstructorTest()
        }
        public static IProgram ToProgram(this Mediaportal.TV.Server.TVDatabase.Entities.Program tvProgram, bool includeRecordingStatus = false)
        {
            if (tvProgram == null)
            {
                return(null);
            }
            Program program = new Program
            {
                ChannelId     = tvProgram.IdChannel,
                ProgramId     = tvProgram.IdProgram,
                Title         = tvProgram.Title,
                Description   = tvProgram.Description,
                StartTime     = tvProgram.StartTime,
                EndTime       = tvProgram.EndTime,
                SeasonNumber  = tvProgram.SeriesNum,
                EpisodeNumber = tvProgram.EpisodeNum,
                EpisodeTitle  = tvProgram.EpisodeName
            };

            ProgramBLL programLogic = new ProgramBLL(tvProgram);

            program.RecordingStatus = programLogic.IsRecording ? RecordingStatus.Recording : RecordingStatus.None;
            if (programLogic.IsRecordingOncePending)
            {
                program.RecordingStatus |= RecordingStatus.Scheduled;
            }
            if (programLogic.IsRecordingSeriesPending)
            {
                program.RecordingStatus |= RecordingStatus.SeriesScheduled;
            }

            return(program);
        }
    public static IProgram ToProgram(this Mediaportal.TV.Server.TVDatabase.Entities.Program tvProgram, bool includeRecordingStatus = false)
    {
      if (tvProgram == null)
        return null;
      Program program = new Program
        {
          ChannelId = tvProgram.IdChannel,
          ProgramId = tvProgram.IdProgram,
          Title = tvProgram.Title,
          Description = tvProgram.Description,
          StartTime = tvProgram.StartTime,
          EndTime = tvProgram.EndTime,
          // TODO: Genre!
        };

      if (includeRecordingStatus)
      {
        ProgramBLL programLogic = new ProgramBLL(tvProgram);
        program.RecordingStatus = programLogic.IsRecording ? RecordingStatus.Recording : RecordingStatus.None;
        if (programLogic.IsRecordingOncePending)
          program.RecordingStatus |= RecordingStatus.Scheduled;
        if (programLogic.IsRecordingSeriesPending)
          program.RecordingStatus |= RecordingStatus.SeriesScheduled;
      }
      return program;
    }
Example #5
0
        public string createIDTest([PexAssumeUnderTest] ProgramBLL target)
        {
            string result = target.createID();

            return(result);
            // TODO: add assertions to method ProgramBLLTest.createIDTest(ProgramBLL)
        }
Example #6
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            Int32 records = 0;

            if (validateData())
            {
                Entities.Program oProgram = new Entities.Program();
                oProgram.code  = Convert.ToInt32(txtCode.Text);
                oProgram.name  = txtName.Text.ToString();
                oProgram.unit  = Convert.ToInt64(txtUnit.Text);
                oProgram.state = Convert.ToInt16(cboState.SelectedValue);

                if (ProgramBLL.getInstance().exists(oProgram.code))      //If the program exists in the database
                {
                    records = ProgramBLL.getInstance().modify(oProgram); //To modify the program
                }
                else
                {
                    records = ProgramBLL.getInstance().insert(oProgram);//To insert a program
                }
                blockControls();
                loadData();
                if (records > 0)
                {
                    lblMessage.Text = "Datos almacenados correctamente.";
                }
            }
        }
Example #7
0
        public List <Program> LoadTest([PexAssumeUnderTest] ProgramBLL target)
        {
            List <Program> result = target.Load();

            return(result);
            // TODO: add assertions to method ProgramBLLTest.LoadTest(ProgramBLL)
        }
Example #8
0
        public List <Program> LoadProgramTest([PexAssumeUnderTest] ProgramBLL target, string id)
        {
            List <Program> result = target.LoadProgram(id);

            return(result);
            // TODO: add assertions to method ProgramBLLTest.LoadProgramTest(ProgramBLL, String)
        }
        public void LoadTest01()
        {
            ProgramBLL     programBLL;
            List <Program> list;

            programBLL = new ProgramBLL();
            list       = this.LoadTest(programBLL);
        }
Example #10
0
        public void createIDTest01()
        {
            ProgramBLL programBLL;
            string     s;

            programBLL = new ProgramBLL();
            s          = this.createIDTest(programBLL);
        }
        public void CreateProgramTest01()
        {
            ProgramBLL programBLL;
            bool       b;

            programBLL = new ProgramBLL();
            b          = this.CreateProgramTest(programBLL, (string)null, (string)null);
        }
Example #12
0
        public void LoadProgramTest01()
        {
            ProgramBLL     programBLL;
            List <Program> list;

            programBLL = new ProgramBLL();
            list       = this.LoadProgramTest(programBLL, (string)null);
        }
        public void UpdateProgramTest01()
        {
            ProgramBLL programBLL;
            bool       b;

            programBLL = new ProgramBLL();
            b          = this.UpdateProgramTest(programBLL, (string)null, (string)null,
                                                (string)null, (string)null, (string)null,
                                                (string)null, (string)null, (string)null, 0, 0, 0);
        }
Example #14
0
        public bool CreateProgramTest(
            [PexAssumeUnderTest] ProgramBLL target,
            string idAcc,
            string namepro
            )
        {
            bool result = target.CreateProgram(idAcc, namepro);

            return(result);
            // TODO: add assertions to method ProgramBLLTest.CreateProgramTest(ProgramBLL, String, String)
        }
        public static IProgram ToProgram(this Mediaportal.TV.Server.TVDatabase.Entities.Program tvProgram, bool includeRecordingStatus = false)
        {
            if (tvProgram == null)
            {
                return(null);
            }
            Program program = new Program
            {
                ChannelId             = tvProgram.IdChannel,
                ProgramId             = tvProgram.IdProgram,
                Title                 = tvProgram.Title,
                Description           = tvProgram.Description,
                Genre                 = tvProgram.ProgramCategory?.Category,
                StartTime             = tvProgram.StartTime,
                EndTime               = tvProgram.EndTime,
                OriginalAirDate       = tvProgram.OriginalAirDate,
                Classification        = tvProgram.Classification,
                ParentalRating        = tvProgram.ParentalRating,
                StarRating            = tvProgram.StarRating,
                SeasonNumber          = tvProgram.SeriesNum,
                EpisodeNumber         = tvProgram.EpisodeNum,
                EpisodeNumberDetailed = tvProgram.EpisodeNum, // TVE3.5 doesn't have Episode.Number?
                EpisodePart           = tvProgram.EpisodePart,
                EpisodeTitle          = tvProgram.EpisodeName,
            };

            ProgramBLL programLogic = new ProgramBLL(tvProgram);

            program.RecordingStatus = programLogic.IsRecording ? RecordingStatus.Recording : RecordingStatus.None;
            if (programLogic.IsRecordingOncePending || programLogic.IsRecordingOnce)
            {
                program.RecordingStatus |= RecordingStatus.Scheduled;
            }
            if (programLogic.IsRecordingSeriesPending || programLogic.IsRecordingSeries)
            {
                program.RecordingStatus |= RecordingStatus.SeriesScheduled;
            }
            if (programLogic.IsRecordingOnce)
            {
                program.RecordingStatus |= RecordingStatus.RecordingOnce;
            }
            if (programLogic.IsRecordingSeries)
            {
                program.RecordingStatus |= RecordingStatus.RecordingSeries;
            }
            if (programLogic.IsRecordingManual)
            {
                program.RecordingStatus |= RecordingStatus.RecordingManual;
            }
            program.HasConflict = programLogic.HasConflict;

            return(program);
        }
Example #16
0
        public bool EditProgramTest(
            [PexAssumeUnderTest] ProgramBLL target,
            string id,
            string name,
            string idacc
            )
        {
            bool result = target.EditProgram(id, name, idacc);

            return(result);
            // TODO: add assertions to method ProgramBLLTest.EditProgramTest(ProgramBLL, String, String, String)
        }
Example #17
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Int32 records = ProgramBLL.getInstance().delete(program_id);

            ScriptManager.RegisterStartupScript(this, this.GetType(), "closeConfirmMessage", "$('#confirmMessage').modal('toggle');", true);

            if (records > 0)
            {
                lblMessage.Text = "Programa eliminado correctamente.";
            }
            loadData();
        }
Example #18
0
        } //End loadData()

        protected void loadPrograms()
        {
            List <Entities.Program> listPrograms = new List <Entities.Program>();

            listPrograms = ProgramBLL.getInstance().getAllActived();
            ListItem oItemS = new ListItem("---- Seleccione ----", "0");

            cboprogram.Items.Add(oItemS);
            foreach (Entities.Program oProgram in listPrograms)
            {
                ListItem oItem = new ListItem(oProgram.name, oProgram.code.ToString());
                cboprogram.Items.Add(oItem);
            }
            cboProgramValue();
        }
Example #19
0
        protected void gvProgram_RowEditing(object sender, GridViewEditEventArgs e)
        {
            unlockControls();
            Int32 code = Convert.ToInt32(gvProgram.Rows[e.NewEditIndex].Cells[0].Text);

            Entities.Program oProgram = ProgramBLL.getInstance().getProgram(code);
            txtCode.Text = oProgram.code.ToString();
            txtName.Text = oProgram.name.ToString();
            txtUnit.Text = oProgram.unit.ToString();
            try
            {
                cboState.SelectedValue = oProgram.state.ToString();
            }
            catch (Exception)
            {
                cboState.SelectedValue = "1";
            }

            ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "$('html, body').animate({ scrollTop: $('body').offset().top });", true);
        }
Example #20
0
        public bool UpdateProgramTest(
            [PexAssumeUnderTest] ProgramBLL target,
            string id,
            string programlevel,
            string programbranch,
            string programtype,
            string programtime,
            string programactor,
            string programvolume,
            string programprocess,
            int programpoint,
            int programsem,
            int programmark
            )
        {
            bool result = target.UpdateProgram(id, programlevel, programbranch, programtype, programtime,
                                               programactor, programvolume, programprocess, programpoint, programsem, programmark);

            return(result);
            // TODO: add assertions to method ProgramBLLTest.UpdateProgramTest(ProgramBLL, String, String, String, String, String, String, String, String, Int32, Int32, Int32)
        }
 public static bool IsScheduleRecording(int idSchedule, int idProgram)
 {
   bool isScheduleRecording = false;
   Program prg = ProgramManagement.GetProgram(idProgram);
   
   if (prg != null)
   {
     var programBll = new ProgramBLL(prg);
     if (programBll.IsRecording)
     {
       using (IScheduleRepository scheduleRepository = new ScheduleRepository())
       {
         Schedule schedule = scheduleRepository.FindOne<Schedule>(s => s.IdSchedule == idSchedule);
         if (schedule != null)
         {
           Schedule spawnedSchedule = RetrieveSpawnedSchedule(idSchedule, prg.StartTime);
           if (spawnedSchedule != null)
           {
             schedule = spawnedSchedule;
           }
         }
         if (schedule != null)
         {
           isScheduleRecording = (RecordingManagement.GetActiveRecording(schedule.IdSchedule) != null);
         }
       }
     }
   }
   
   return isScheduleRecording;
 }
Example #22
0
 protected void btnNew_Click(object sender, ImageClickEventArgs e)
 {
     unlockControls();
     txtCode.Text = ProgramBLL.getInstance().getNextCode().ToString();
 }
Example #23
0
        protected void btnReport_Click(object sender, EventArgs e)
        {
            try
            {
                List <Entities.Program> listProgram  = ProgramBLL.getInstance().getAll();
                System.IO.MemoryStream  memoryStream = new System.IO.MemoryStream();
                text::Document          pdfDoc       = new text::Document(text::PageSize.A4, 10, 10, 10, 10);
                pdfDoc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
                PdfWriter.GetInstance(pdfDoc, memoryStream);
                pdfDoc.Open();

                String imagepath           = Server.MapPath("../../images/page-icons");
                iTextSharp.text.Image deas = iTextSharp.text.Image.GetInstance(imagepath + "/DEAS-logo.jpg");
                deas.ScaleToFit(140f, 120f);
                //Give space before image
                deas.SpacingBefore = 10f;
                //Give some space after the image
                deas.SpacingAfter = 1f;
                deas.Alignment    = text::Element.ALIGN_LEFT;
                pdfDoc.Add(deas);

                text::Paragraph title = new text::Paragraph();
                title.Font      = text::FontFactory.GetFont("dax-black", 32, new text::BaseColor(0, 51, 102));
                title.Alignment = text::Element.ALIGN_CENTER;
                title.Add("\n\n Reporte de Programas\n\n\n\n");
                pdfDoc.Add(title);

                PdfPTable oPTable = new PdfPTable(3);
                oPTable.TotalWidth    = 100;
                oPTable.SpacingBefore = 20f;
                oPTable.SpacingAfter  = 30f;
                oPTable.AddCell("DescripciĆ³n");
                oPTable.AddCell("Unidad Ejecutora");
                oPTable.AddCell("Estado");

                if (listProgram.Count > 0)
                {
                    foreach (Entities.Program pProgram in listProgram)
                    {
                        oPTable.AddCell(pProgram.name);
                        oPTable.AddCell(pProgram.unit.ToString());
                        oPTable.AddCell((pProgram.state == 1 ? "Activo" : "Inactivo"));
                    }
                }
                else
                {
                    PdfPCell cell = new PdfPCell(new text::Phrase("No existen programas registrados."));
                    cell.Colspan             = 5;
                    cell.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    oPTable.AddCell(cell);
                }

                pdfDoc.Add(oPTable);
                pdfDoc.Close();

                byte[] bytes = memoryStream.ToArray();
                memoryStream.Close();
                Response.Clear();
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-Disposition", "attachment; filename=Programas.pdf");
                Response.ContentType = "application/pdf";
                Response.Buffer      = true;
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.BinaryWrite(bytes);
                Response.End();
                Response.Close();
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Example #24
0
 /**
  * Method to get programs registered in the database and load in a gridView
  */
 protected void loadData()
 {
     gvProgram.DataSource = ProgramBLL.getInstance().getAll();
     gvProgram.DataBind();
 }