Beispiel #1
0
        public void Run(string connection, string param)
        {
            Dictionary <string, string> args = GetArgs(param);
            string id = null, name = null, year = null, mail = null, date = null, grade = null;

            using (si2Entities ctx = new si2Entities())
            {
                args.TryGetValue("-i", out id);
                var conf      = ctx.Conferencia.Find(int.Parse(id));
                var president = ctx.Utilizador.Find(conf.idPresidente);
                args.TryGetValue("-n", out name);
                args.TryGetValue("-y", out year);
                args.TryGetValue("-m", out mail);
                args.TryGetValue("-d", out date);
                args.TryGetValue("-g", out grade);
                ctx.updateConference(
                    int.Parse(id),
                    name == null ? conf.nome : name,
                    year == null ? conf.ano : int.Parse(year),
                    mail == null ? president.mail : mail,
                    date == null ? conf.dataLimite : DateTime.Parse(date),
                    grade == null ? conf.notaMinima : int.Parse(grade)
                    );
                ctx.Database.SqlQuery <Conferencia>("select * from Conferencia");
            }
        }
Beispiel #2
0
 public void Run(string connection, string param)
 {
     using (var ctx = new si2Entities())
     {
         var total    = ctx.Database.SqlQuery <Int32>("select count(*) from dbo.Submissao");
         var accepted = ctx.Database.SqlQuery <Int32>("select count(*) from dbo.Submissao as s inner join dbo.Estado as e on " +
                                                      " (s.idEstado = e.id) where e.descricao ='Aceite'");
         int   t   = total.ElementAt(0);
         int   a   = accepted.ElementAt(0);
         float res = ((float)a / (float)t) * 100;
         Console.WriteLine(String.Concat("Percentage of accepted Submissions :", res));
         Console.WriteLine();
     }
 }
Beispiel #3
0
 public void Run(string connection, string param)
 {
     using (var ctx = new si2Entities())
     {
         Dictionary <string, string> dic = GetArgs(param);
         int subId  = -1;
         int confId = -1;
         if (dic.TryGetValue("-is", out string id))
         {
             subId = int.Parse(id);
         }
         if (dic.TryGetValue("-ic", out id))
         {
             confId = int.Parse(id);
         }
         if (subId != -1 && confId != -1)
         {
             SqlParameter p1 = new SqlParameter("@idSubmissao", SqlDbType.Int);
             SqlParameter p2 = new SqlParameter("@idConf", SqlDbType.Int);
             p1.Value = subId;
             p2.Value = confId;
             var reviewers = ctx.Database.SqlQuery <Utilizador>("select u.* from dbo.Utilizador as u " +
                                                                "inner join dbo.Registo as reg on (u.id = reg.idUtilizador) " +
                                                                "inner join dbo.Conferencia as conf on (reg.idConferencia = conf.id) " +
                                                                "where conf.id = @idConf and u.id not in (" +
                                                                "select idUtilizador " +
                                                                "from Autor_Submissao as au " +
                                                                "inner join Submissao_Conferencia as sc on (au.idSubmissao = sc.idSubmissao) " +
                                                                "where sc.idSubmissao = @idSubmissao)", p2, p1);
             Console.WriteLine(String.Concat("submission: ", subId));
             Console.WriteLine("Reviewers Availables:");
             Console.WriteLine();
             foreach (var reviewer in reviewers)
             {
                 Console.WriteLine(String.Concat("name: ", reviewer.nome));
                 Console.WriteLine(String.Concat("id: ", reviewer.id));
                 Console.WriteLine(String.Concat("mail: ", reviewer.mail));
                 Console.WriteLine(String.Concat("institution: ", reviewer.idInstituicao));
                 Console.WriteLine();
             }
         }
     }
 }
Beispiel #4
0
        public void Run(string connection, string param)
        {
            using (si2Entities ctx = new si2Entities())
            {
                Dictionary <string, string> dic = GetArgs(param);
                dic.TryGetValue("-ic", out string id);
                int conf = int.Parse(id);
                if (dic.TryGetValue("-l", out string grade))
                {
                    int limit = int.Parse(grade);
                    ctx.updateSubmissionsState(limit, conf);
                }
                else
                {
                    ctx.updateSubmissionsState(null, conf);
                }

                Console.WriteLine("Submissions updated");
            }
        }
Beispiel #5
0
        public void Run(string connection, string param)
        {
            Dictionary <string, string> args = GetArgs(param);
            string id = null, ic = null;

            using (si2Entities ctx = new si2Entities())
            {
                args.TryGetValue("-i", out id);
                args.TryGetValue("-c", out ic);
                if (id == null || ic == null)
                {
                    Console.WriteLine("type an user id and a conference id");
                    return;
                }
                ctx.updateUserRole(
                    int.Parse(id),
                    int.Parse(ic)
                    );
                ctx.Database.SqlQuery <Revisor>("select * from Revisor");
            }
        }
Beispiel #6
0
        public void Run(string connection, string param)
        {
            Dictionary <string, string> dic = GetArgs(param);
            string idReviewer = null, idSubmission = null;

            using (var ctx = new si2Entities())
            {
                dic.TryGetValue("-ir", out idReviewer);
                dic.TryGetValue("-is", out idSubmission);
                if (idSubmission == null || idReviewer == null)
                {
                    Console.WriteLine("Type a reviewer id and a submission id to assign the reviewer!\n");
                    return;
                }
                ctx.assignReviewerToReview(
                    int.Parse(idReviewer),
                    int.Parse(idSubmission)
                    );
                ctx.Database.SqlQuery <Revisor_Submissao>("select * from Revisor_Submissao");
            }
        }
Beispiel #7
0
 public void Run(string connection, string param)
 {
     using (var ctx = new si2Entities())
     {
         var conferences = ctx.Database.SqlQuery <Conferencia>("select * from Conferencia");
         foreach (var conference in conferences)
         {
             var president = ctx.Database
                             .SqlQuery <Utilizador>("select * from Utilizador")
                             .Where(pres => pres.id == conference.idPresidente).First();
             Console.WriteLine(string.Concat("id: ", conference.id));
             Console.WriteLine(string.Concat("President: ", president.nome));
             Console.WriteLine(string.Concat("President mail: ", president.mail));
             Console.WriteLine(string.Concat("Minimum Grade: ", conference.notaMinima));
             Console.WriteLine(string.Concat("Acronym: ", conference.acronimo));
             Console.WriteLine(string.Concat("name: ", conference.nome));
             Console.WriteLine(string.Concat("year: ", conference.ano));
             Console.WriteLine(string.Concat("Realization Date: ", conference.dataRealizacao));
             Console.WriteLine(string.Concat("Date Line: ", conference.dataLimite));
             Console.WriteLine();
         }
     }
 }
Beispiel #8
0
        public void Run(string connection, string param)
        {
            Dictionary <string, string> dic = GetArgs(param);
            string idSubmission = null, grade = null, text = null;

            using (si2Entities ctx = new si2Entities())
            {
                dic.TryGetValue("-is", out idSubmission);
                dic.TryGetValue("-g", out grade);
                dic.TryGetValue("-t", out text);
                if (idSubmission == null || grade == null || text == null)
                {
                    Console.WriteLine("Type the submission id, the grade and the text related to the submission");
                    return;
                }
                ctx.registerReview(
                    int.Parse(idSubmission),
                    int.Parse(grade),
                    text
                    );
                ctx.Database.SqlQuery <Revisor_Submissao>("select * from Revisor_Submissao");
                Console.WriteLine();
            }
        }