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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
//This is used to get the list of files names that we can revert the DB in the case of needing to undo a LOCK static public void GetFileNames(DropDownList myDDL) { Impersonate.ImpersonateUser(); string serverPath = "\\\\shares\\TimesheetAttach$\\TS_Config\\"; string[] fileNames = Directory.GetFiles(serverPath, "*.csv"); List <string> reversionList = new List <string> { "---" }; for (int i = 0; i < fileNames.Length; i++) { reversionList.Add(Path.GetFileName(fileNames[i])); } FillDropdown(myDDL, myStringList: reversionList); }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
static public string CheckStatus(Page currentPage) { using (WindowsIdentity.Impersonate(IntPtr.Zero)) { //This code executes under app pool user string access = ""; List <string> emailList = new List <string>(); string username = currentPage.User.Identity.Name.Replace(@"CCSO\", "").ToUpper(); string serverPath = "\\\\shares\\TimesheetAttach$\\TS_Config\\HREmails.txt"; bool isMaintenanceMode = false; if (ConfigurationManager.AppSettings["MaintenanceMode"].ToString().Equals("On")) { isMaintenanceMode = true; } ArrayList groups = TSADGroups.Groups(username.Substring(username.IndexOf("\\") + 1)); if (!isMaintenanceMode) { Impersonate.ImpersonateUser(); var emails = File.ReadAllLines(serverPath).Where(line => line.Contains("@")); foreach (string emailAddress in emails) { emailList.Add(emailAddress); } Impersonate.impersonationContext.Undo(); //lbluserName.Text = userName1; //Session["Access"] = "Denied"; foreach (string users in emailList) { if (users.Contains(username)) { access = "HRER"; } } for (int y = 0; y < groups.Count; y++) { //if (groups[y].ToString().Contains("Financial Services"))//need group name to look for to be able to edit //groups[y].ToString().Contains("Information Technology Unit") if (groups[y].ToString().Contains("Payroll") /*|| groups[y].ToString().Contains("Information Technology Unit")*/) //need group name to look for to be able to edit { access = "Payroll"; } if ((groups[y].ToString().Contains("Developer Unit") && !currentPage.Request.Url.ToString().Contains("iis2016"))) { access = "Developer"; } if ((groups[y].ToString().Contains("Developer Unit") || groups[y].ToString().Contains("ittechs")) && currentPage.Request.Url.ToString().Contains("iis2016")) { access = "ITTech"; } if (groups[y].ToString().Contains("Command Staff Assistants")) { access = "StaffAssistant"; } } return(access); } else { for (int y = 0; y < groups.Count; y++) { if (groups[y].ToString().Contains("Developer Unit")) { access = "Developer"; break; } else { access = "Denied"; } } return(access); } } }