Exemplo n.º 1
0
 public static bool Update(Semester item)
 {
     return(SemesterDAO.Update(item));
 }
Exemplo n.º 2
0
 public static bool Add(Semester item)
 {
     return(SemesterDAO.Add(item));
 }
Exemplo n.º 3
0
 public static List <Semester> List(Semester filters = null)
 {
     return(SemesterDAO.List(filters));
 }
Exemplo n.º 4
0
        public static bool Copy(Guid idOrigin, Guid idDestiny)
        {
            try
            {
                if (Equals(idOrigin, Guid.Empty))
                {
                    throw new Exception("Parâmetro 'idOrigin' inválido");
                }

                if (Equals(idDestiny, Guid.Empty))
                {
                    throw new Exception("Parâmetro 'idDestiny' inválido");
                }

                Grid filters = new Grid()
                {
                    Semester = new Semester()
                    {
                        IdSemester = idOrigin
                    },
                    Status = FINISHED
                };

                var list = List(filters);

                if (list == null)
                {
                    throw new Exception("As grades não foram listadas");
                }

                var semester = Semester.Find(idDestiny);

                if (semester == null)
                {
                    throw new Exception(string.Format("Semestre {0} não existe", idDestiny));
                }

                foreach (Grid item in list)
                {
                    item.Semester = semester;
                    item.Status   = REGISTERED;
                }

                var insert = GridDAO.Add(list);

                if (insert == false)
                {
                    throw new Exception("A grade não foi copiada");
                }

                return(true);
            }
            catch (Exception e)
            {
                object[] parameters = { idOrigin, idDestiny };
                string   notes      = LogHelper.Notes(parameters, e.Message);
                Log.Add(Log.TYPE_ERROR, "SistemaMatricula.Models.Grid.Copy", notes);
            }

            return(false);
        }