コード例 #1
0
        private Document SubmissionToFile(dtoExportSubmission settings)
        {
            Document doc = null;

            System.IO.FileStream stream       = null;
            Impersonate          oImpersonate = new Impersonate();
            Boolean wasImpersonated           = Impersonate.isImpersonated();

            try
            {
                if (!wasImpersonated && oImpersonate.ImpersonateValidUser() == FileMessage.ImpersonationFailed)
                {
                    return(null);
                }
                else
                {
                    stream = new System.IO.FileStream(settings.Filename, System.IO.FileMode.Create);
                    if (stream != null)
                    {
                        doc = FileExport(stream);
                    }
                }
            }
            catch (Exception ex)
            {
                if (stream != null)
                {
                    stream.Close();
                }
                if (lm.Comol.Core.File.Exists.File(settings.Filename))
                {
                    lm.Comol.Core.File.Delete.File(settings.Filename);
                }

                if (!wasImpersonated)
                {
                    oImpersonate.UndoImpersonation();
                }
                doc = null;
            }
            finally
            {
                if (!wasImpersonated)
                {
                    oImpersonate.UndoImpersonation();
                }
            }
            return(doc);
        }
コード例 #2
0
        //Se Setting == null, viene preso quello di default!
        private iTextSharp5.text.Document SavePDFtoFile(String storeFileName, lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Settings settings,
                                                        IList <lm.Comol.Core.DomainModel.DocTemplateVers.Domain.DTO.ServiceExport.DTO_Signature> signatures)
        {
            iTS.Document         doc          = null;
            System.IO.FileStream stream       = null;
            Impersonate          oImpersonate = new Impersonate();
            Boolean wasImpersonated           = Impersonate.isImpersonated();

            try
            {
                if (!wasImpersonated && oImpersonate.ImpersonateValidUser() == FileMessage.ImpersonationFailed)
                {
                    return(null);
                }
                else
                {
                    stream = new System.IO.FileStream(storeFileName, System.IO.FileMode.Create);
                    if (stream != null)
                    {
                        doc = FileExport(settings, stream, signatures);
                    }
                }
            }
            catch (Exception ex)
            {
                if (stream != null)
                {
                    stream.Close();
                }
                if (lm.Comol.Core.File.Exists.File(storeFileName))
                {
                    lm.Comol.Core.File.Delete.File(storeFileName);
                }
                if (!wasImpersonated)
                {
                    oImpersonate.UndoImpersonation();
                }
                doc = null;
            }
            finally
            {
                if (!wasImpersonated)
                {
                    oImpersonate.UndoImpersonation();
                }
            }
            return(doc);
        }
コード例 #3
0
        public IEnumerable <R_RegistroNotas> GetGrades(string userName, int year, string period)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                this.db = new SGA_DesarrolloEntities();
                db.Configuration.ProxyCreationEnabled = false;

                var grades = (from g in db.R_RegistroNotas.Include(g => g.R_Cursos)
                              join s in db.R_Estudiantes
                              on g.Estudiante equals s.IdPersona
                              where s.usuario == userName &&
                              g.A_Adem == year &&
                              g.Trimestre == period
                              select g);

                return(grades);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }
コード例 #4
0
 public IEnumerable <VR_Rendimiento_A_Academ> GetYearsByUser(string userName)
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         var years = (from y in db.VR_Rendimiento_A_Academ
                      join e in db.R_Estudiantes
                      on y.Estudiante equals e.IdPersona
                      join p in db.P_Personas
                      on e.IdPersona equals p.IdPersona
                      orderby y.A_Adem
                      where p.login_red == userName
                      select y
                      );
         return(years);
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
コード例 #5
0
 public IEnumerable <VR_Rendimiento_Periodos> GetPeriodsByYearAndUser(string userName, int year)
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         var periods = (from p in db.VR_Rendimiento_Periodos
                        join e in db.R_Estudiantes
                        on p.Estudiante equals e.IdPersona
                        join pe in db.P_Personas
                        on e.IdPersona equals pe.IdPersona
                        where pe.login_red == userName &&
                        p.A_Adem == year
                        select p
                        );
         return(periods);
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
コード例 #6
0
 public IEnumerable <P_Notas> GetOldUserMessages(string userName, int last)
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         IEnumerable <P_Notas>  messages;
         SGA_DesarrolloEntities context = new SGA_DesarrolloEntities();
         context.Configuration.ProxyCreationEnabled = false;
         messages = (from n in context.P_Notas
                     join p in context.P_Personas
                     on n.IdPersona equals p.IdPersona
                     where p.login_red == userName && n.idNota <= last
                     select n).Take(50);
         return(messages);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
コード例 #7
0
 public HttpResponseMessage Post(LogOnModel user)
 {
     try
     {
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user.UserName, user.Password);
         if (this.ValidateUser(user))
         {
             FormsAuthentication.SetAuthCookie(user.UserName, true);
             return(Request.CreateResponse(HttpStatusCode.OK, true));
         }
         return(Request.CreateResponse(HttpStatusCode.OK, false));
     }
     catch (DirectoryServicesCOMException dse)
     {
         HttpError error = new HttpError(dse.Message.Replace("\n", " ").Replace("\r", " ").Replace("\t", " "));
         return(Request.CreateResponse(HttpStatusCode.Unauthorized, error));
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
コード例 #8
0
 public IEnumerable <VR_Rendimiento_A_Academ> GetVR_Rendimiento_A_Academ()
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         return(db.VR_Rendimiento_A_Academ.AsEnumerable());
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
コード例 #9
0
 public IEnumerable <R_RegistroNotas> GetR_RegistroNotas()
 {
     try
     {
         NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
         Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
         this.db = new SGA_DesarrolloEntities();
         var r_registronotas = db.R_RegistroNotas.Include(r => r.R_Estudiantes);
         return(r_registronotas.AsEnumerable());
     }
     catch (System.Exception)
     {
         throw;
     }
     finally
     {
         Impersonate.UndoImpersonation();
     }
 }
コード例 #10
0
        public R_RegistroNotas GetR_RegistroNotas(int id)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                this.db = new SGA_DesarrolloEntities();
                R_RegistroNotas r_registronotas = db.R_RegistroNotas.Find(id);
                if (r_registronotas == null)
                {
                    throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(r_registronotas);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }
コード例 #11
0
        public IEnumerable <P_NotasPublicas> GetOldPublicMessages(int last)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                SGA_DesarrolloEntities context = new SGA_DesarrolloEntities();
                context.Configuration.ProxyCreationEnabled = false;
                IEnumerable <P_NotasPublicas> notas;

                notas = (from pm in context.P_NotasPublicas
                         where pm.Activa == true && pm.idNotasPublicas <= last
                         select pm).Take(50);;
                return(notas);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }
コード例 #12
0
        public VR_Rendimiento_A_Academ GetVR_Rendimiento_A_Academ(int id)
        {
            try
            {
                NameValueCollection user = HttpUtility.ParseQueryString(Request.RequestUri.Query);
                Impersonate.ImpersonateUser(ConfigurationManager.AppSettings["Domain"].ToString(), user["UserName"], user["Password"]);
                this.db = new SGA_DesarrolloEntities();
                VR_Rendimiento_A_Academ vr_rendimiento_a_academ = db.VR_Rendimiento_A_Academ.Find(id);
                if (vr_rendimiento_a_academ == null)
                {
                    throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(vr_rendimiento_a_academ);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
                Impersonate.UndoImpersonation();
            }
        }