Example #1
0
        public void UpdateSubmissionLimitDate()
        {
            Console.WriteLine("\nFILL THE FIELDS: <SUBMISSION DATE> <CONFERENCE NAME> <CONFERENCE YEAR>");
            string[] parameters = Console.ReadLine().Split(' ');

            DateTime date;

            if (parameters.Length == 3)
            {
                if (DateTime.TryParseExact(parameters[0], dateFormat, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out date))
                {
                    using (var ts = new TransactionScope())
                    {
                        using (EntityConnection cn = new EntityConnection(connectionStringName))
                        {
                            try
                            {
                                using (var ctx = new ConferenceManagerEntities())
                                {
                                    string nomeConferencia = parameters[1];
                                    int    anoConferencia  = Int32.Parse(parameters[2]);
                                    ctx.AtualizarConferenciaDataLimiteSubmissao(date, nomeConferencia, anoConferencia);
                                    Conferencia ic = ctx.Conferencias.Find(nomeConferencia, anoConferencia);
                                    if (ic != null)
                                    {
                                        ctx.Entry(ic).State = EntityState.Modified;
                                        ctx.SaveChanges();
                                        ts.Complete();
                                        Console.WriteLine($"NEW SUBMISSION LIMIT DATE: {ic.dataLimiteSubmissao.ToString()}");
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                if (e.InnerException != null)
                                {
                                    Console.WriteLine(e.InnerException.Message);
                                }
                                else
                                {
                                    Console.WriteLine(e.Message);
                                }
                            }
                        }
                    }
                    Console.WriteLine($"\n{pressAnyKeyForANewCommandMessage}\n");
                }
                else
                {
                    Console.WriteLine($"{invalidNewDateFormatMessage}\n");
                }
            }

            else
            {
                Console.WriteLine(invalidNumberOfArgumentsMessage);
            }
        }
Example #2
0
        public void AssignAuthorRole()
        {
            Console.WriteLine("\nFILL THE FIELDS: <ARTICLE ID> <USER EMAIL> <RESPONSIBLE (0/1)> <CONFERENCE NAME> <CONFERENCE YEAR>");
            string[] parameters = Console.ReadLine().Split(' ');

            if (parameters.Length == 5)
            {
                using (var ts = new TransactionScope())
                {
                    using (EntityConnection cn = new EntityConnection(connectionStringName))
                    {
                        try
                        {
                            using (var ctx = new ConferenceManagerEntities())
                            {
                                int    idArtigo        = Int32.Parse(parameters[0]);
                                string emailUtilizador = parameters[1];
                                bool   responsavel     = false;
                                if (parameters[2].Equals("1"))
                                {
                                    responsavel = true;
                                }
                                string nomeConferencia = parameters[3];
                                int    anoConferencia  = Int32.Parse(parameters[4]);
                                ctx.AtribuirPapelAutor(idArtigo, emailUtilizador, responsavel, nomeConferencia, anoConferencia);
                                Submissao subm = ctx.Submissaos.Find(idArtigo, emailUtilizador, nomeConferencia, anoConferencia);
                                if (subm != null)
                                {
                                    ctx.Entry(subm).State = EntityState.Modified;
                                    ctx.SaveChanges();
                                    ts.Complete();
                                    Console.WriteLine($"NEW AUTHOR: {subm.emailAutor.ToString()}");
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            if (e.InnerException != null)
                            {
                                Console.WriteLine(e.InnerException.Message);
                            }
                            else
                            {
                                Console.WriteLine(e.Message);
                            }
                        }
                    }
                }
                Console.WriteLine($"\n{pressAnyKeyForANewCommandMessage}\n");
            }
            else
            {
                Console.WriteLine(invalidNumberOfArgumentsMessage);
            }
        }
Example #3
0
        public void AssignReviser()
        {
            Console.WriteLine("\nFILL THE FIELDS: <REVISER EMAIL> <ARTICLE ID> <CONFERENCE NAME> <CONFERENCE YEAR>");
            string[] parameters = Console.ReadLine().Split(' ');

            if (parameters.Length == 4)
            {
                using (var ts = new TransactionScope())
                {
                    using (EntityConnection cn = new EntityConnection(connectionStringName))
                    {
                        try
                        {
                            using (var ctx = new ConferenceManagerEntities())
                            {
                                string emailUtilizador = parameters[0];
                                int    idArtigo        = Int32.Parse(parameters[1]);
                                string nomeConferencia = parameters[2];
                                int    anoConferencia  = Int32.Parse(parameters[3]);
                                ctx.AtribuirRevisor(emailUtilizador, idArtigo, nomeConferencia, anoConferencia);
                                Revisao rev = ctx.Revisaos.Find(idArtigo, emailUtilizador, nomeConferencia, anoConferencia);
                                if (rev != null)
                                {
                                    ctx.Entry(rev).State = EntityState.Modified;
                                    ctx.SaveChanges();
                                    ts.Complete();
                                    Console.WriteLine($"NEW REVISER: {rev.emailRevisor.ToString()}");
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            if (e.InnerException != null)
                            {
                                Console.WriteLine(e.InnerException.Message);
                            }
                            else
                            {
                                Console.WriteLine(e.Message);
                            }
                        }
                    }
                }
                Console.WriteLine($"\n{pressAnyKeyForANewCommandMessage}\n");
            }
            else
            {
                Console.WriteLine(invalidNumberOfArgumentsMessage);
            }
        }
Example #4
0
        public void UpdateConferencePresident()
        {
            Console.WriteLine("\nFILL THE FIELDS: <PRESIDENT EMAIL> <CONFERENCE NAME> <CONFERENCE YEAR>");
            string[] parameters = Console.ReadLine().Split(' ');

            if (parameters.Length == 3)
            {
                using (var ts = new TransactionScope())
                {
                    using (EntityConnection cn = new EntityConnection(connectionStringName))
                    {
                        try
                        {
                            using (var ctx = new ConferenceManagerEntities())
                            {
                                string emailPresidente = parameters[0];
                                string nomeConferencia = parameters[1];
                                int    anoConferencia  = Int32.Parse(parameters[2]);
                                ctx.AtualizarConferenciaPresidente(emailPresidente, nomeConferencia, anoConferencia);
                                Conferencia ic = ctx.Conferencias.Find(nomeConferencia, anoConferencia);
                                if (ic != null)
                                {
                                    ctx.Entry(ic).State = EntityState.Modified;
                                    ctx.SaveChanges();
                                    ts.Complete();
                                    Console.WriteLine($"NEW PRESIDENT EMAIL: {ic.emailPresidente.ToString()}");
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            if (e.InnerException != null)
                            {
                                Console.WriteLine(e.InnerException.Message);
                            }
                            else
                            {
                                Console.WriteLine(e.Message);
                            }
                        }
                    }
                }
                Console.WriteLine($"\n{pressAnyKeyForANewCommandMessage}\n");
            }

            else
            {
                Console.WriteLine(invalidNumberOfArgumentsMessage);
            }
        }
Example #5
0
        //A DATA TEM DE SER ALGO COMO 20181112 PORQUE A DATA LIMITE DE REVISAO DA CONFERENCIA B 2018 FOI ALTERADA PARA 20181120
        public void RegisterRevision()
        {
            Console.WriteLine("\nFILL THE FIELDS: <REVISION DATE> <MINIMUM GRADE> <GRADE> <TEXT> <ARTICLE ID> <REVISER EMAIL> <CONFERENCE NAME> <CONFERENCE YEAR>");
            string[] parameters = Console.ReadLine().Split(' ');

            if (parameters.Length == 8)
            {
                using (var ts = new TransactionScope())
                {
                    using (EntityConnection cn = new EntityConnection(connectionStringName))
                    {
                        try
                        {
                            using (var ctx = new ConferenceManagerEntities())
                            {
                                DateTime date;
                                if (DateTime.TryParseExact(parameters[0], dateFormat, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out date))
                                {
                                    int    notaMinima      = Int32.Parse(parameters[1]);
                                    int    nota            = Int32.Parse(parameters[2]);
                                    string texto           = parameters[3];
                                    int    idArtigo        = Int32.Parse(parameters[4]);
                                    string emailRevisor    = parameters[5];
                                    string nomeConferencia = parameters[6];
                                    int    anoConferencia  = Int32.Parse(parameters[7]);
                                    ctx.RegistarRevisao(date, notaMinima, nota, texto, idArtigo, emailRevisor, nomeConferencia, anoConferencia);
                                    Revisao revisao = ctx.Revisaos.Find(idArtigo, emailRevisor, nomeConferencia, anoConferencia);
                                    Artigo  artigo  = ctx.Artigoes.Find(idArtigo, nomeConferencia, anoConferencia);
                                    if (revisao != null)
                                    {
                                        ctx.Entry(revisao).State = EntityState.Modified;
                                        ctx.SaveChanges();
                                        ts.Complete();
                                        Console.WriteLine($"NEW REVISION: \nidArtigo: {revisao.idArtigo}\nemailRevisor: {revisao.emailRevisor}\nnomeConferencia: {revisao.nomeConferencia}\nanoConferencia: {anoConferencia}");
                                        Console.WriteLine($"NEW ARTICLE STATE: {artigo.estado}");
                                    }
                                }
                                else
                                {
                                    Console.WriteLine(invalidNewDateFormatMessage);
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            if (e.InnerException != null)
                            {
                                Console.WriteLine(e.InnerException.Message);
                            }
                            else
                            {
                                Console.WriteLine(e.Message);
                            }
                        }
                    }
                }
                Console.WriteLine($"{pressAnyKeyForANewCommandMessage}\n");
            }
            else
            {
                Console.WriteLine(invalidNumberOfArgumentsMessage);
            }
        }