public static bool GetPerformBrowserCheck(this HttpSessionStateBase session) { return((bool)(session[Keys.PerformBrowserCheck] ?? true)); }
public static bool CheckRole(string role, HttpSessionStateBase session) { return(session["role"] != null && role.Split(',').Any(r => r == session["role"].ToString())); }
/// <summary> /// Initializes a new instance of the <see cref="YafUserIgnored"/> class. /// </summary> /// <param name="sessionStateBase"> /// The session state base. /// </param> /// <param name="dbBroker"> /// The db broker. /// </param> public YafUserIgnored([NotNull] HttpSessionStateBase sessionStateBase, [NotNull] YafDbBroker dbBroker) { this.SessionStateBase = sessionStateBase; this._dbBroker = dbBroker; }
public static Data.Log Save(this Exception ex, HttpSessionStateBase Session) { return(Save(ex, Session, "", ImpactLevel.Low, "")); }
public static Data.Log Save(this Exception ex, HttpSessionStateBase Session, string callDetail, ImpactLevel impactLevel, string errorDescription) { using (var db = new ScreenPlayCRMEntities()) { Data.Log log = new Data.Log(); log.ContactId = SessionControl.SessionManager.GetContactId(Session); log.ClientId = SessionControl.SessionManager.GetClientId(Session); log.UserId = SessionControl.SessionManager.GetUserId(Session); log.CallDetail = callDetail; log.ErrorDate = DateTime.Now; log.LastModified = DateTime.Now; if (errorDescription != null && errorDescription != "") { log.ErrorShortDescription = errorDescription; } log.ExceptionType = ex.GetType().FullName; var stackTrace = new StackTrace(ex, true); var allFrames = stackTrace.GetFrames().ToList(); foreach (var frame in allFrames) { log.FileName = frame.GetFileName(); log.LineNumber = frame.GetFileLineNumber(); var method = frame.GetMethod(); log.MethodName = method.Name; log.ClassName = frame.GetMethod().DeclaringType.ToString(); } log.ImpactLevel = impactLevel.ToString(); try { log.ApplicationName = Assembly.GetCallingAssembly().GetName().Name; } catch { log.ApplicationName = ""; } log.ErrorMessage = ex.Message; log.StackTrace = ex.StackTrace; if (ex.InnerException != null) { log.InnerException = ex.InnerException.ToString(); log.InnerExceptionMessage = ex.InnerException.Message; } log.IpAddress = ""; try { db.Logs.Add(log); db.SaveChanges(); } catch (Exception eex) { } return(log); } }
public MidiaProfessorCreator(HttpSessionStateBase session) : base(session) { }
public static ClientesContablesModel GetClienteContableSeleccionado(HttpSessionStateBase objSession, string UserID, FacturaPoliContext db = null) { return(ModuloHelper.GetClienteContableSeleccionado(objSession, UserID, db)); }
public static PESSOA Usuario(this HttpSessionStateBase session) { return(session["USUARIO"] as Models.PESSOA); }
public static void Set(HttpSessionStateBase session, SessionKey key, object value) { session[Enum.GetName(typeof(SessionKey), key)] = value; }
public static void Remove(string key) { HttpSessionStateBase session = HttpContextHelper.Current.Session; session.Remove(key); }
public static void Set(string key, object value) { HttpSessionStateBase session = HttpContextHelper.Current.Session; session[key] = value; }
public static void ClearRegardingUserSpecificData(this HttpSessionStateBase session) { // do nothing for now because there isn't currently any user specific data stored in session }
public static void SetDefaultReturnUrl(this HttpSessionStateBase session, string defaultReturnUrl) { session[Keys.DefaultReturnUrl] = defaultReturnUrl; }
public static void SetPerformBrowserCheck(this HttpSessionStateBase session, bool performBrowserCheck) { session[Keys.PerformBrowserCheck] = performBrowserCheck; }
/// <summary> /// Gets the company ID from the HTTPContext as a string /// </summary> /// <param name="session">The HTTPContext</param> /// <returns>The company ID as a string</returns> public static string GetCompanyID(HttpSessionStateBase session) { return(session[keyCompanyNumber] as string); }
public ConnectionBuilder(HttpSessionStateBase session) { usuario = (string)session["usuario"]; pass = (string)session["pass"]; servidor = (string)session["servidor"]; }
/// <summary> /// Delete values from HttpContext (for next web request) /// </summary> /// <param name="session">The HTTPContext</param> public static void Reset(HttpSessionStateBase session) { session[keySiteID] = null; session[keyCompanyNumber] = null; }
/// <summary> /// Check Session[sessionKey] value. If session is empty, return false /// </summary> /// <param name="sessionKey"></param> /// <returns></returns> public bool HasValue(string sessionKey, HttpSessionStateBase session) { return(session[sessionKey] != null); }
public SessionWrapper(HttpSessionStateBase session) { _session = session; }
/// <summary> /// Set Session[sessionKey] /// </summary> /// <param name="sessionKey"></param> /// <param name="value"></param> /// <param name="session"></param> public void SetValue(string sessionKey, object value, HttpSessionStateBase session) { session[sessionKey] = value; }
private List <SelectListItem> CreateLookupList(Data.ScriptQuestion theQuestion, HttpSessionStateBase theSession) { List <SelectListItem> lookupList = new List <SelectListItem>(); ScreenViewer.API.Elements.QuestionController QC = new API.Elements.QuestionController(); var actionResult = QC.GetScriptQuestionLookup(theQuestion.ScriptLookupID.Value); var response = actionResult as OkNegotiatedContentResult <Data.ScriptLookup>; foreach (var item in response.Content.ScriptLookupDetails) { lookupList.Add(new SelectListItem() { Text = item.LookupText, Value = item.LookupValue }); } return(lookupList); }
/// <summary> /// Wersja dla unit testów /// </summary> public static IEnumerable <MessageType> GetMessageTypes(TempDataDictionary tempData, ViewDataDictionary viewData, HttpSessionStateBase session = null, bool useSession = false) { List <MessageType> res = getMessages(tempData, session, useSession) .GroupBy(m => m.MessageType) .Select(gr => gr.Key) .ToList(); //if (tempData.ContainsKey(CommonController.VIEW_DATA_MESSAGES)) // res = (tempData[CommonController.VIEW_DATA_MESSAGES] as List<Message>).GroupBy(m => m.MessageType).Select(gr => gr.Key).ToList(); //else // res = new List<MessageType>(); if (viewData.ModelState.Errors().Count() > 0 && !res.Any(mt => mt == MessageType.Error)) { res.Add(MessageType.Error); } return(res); }
public static Data.Log Save(this Exception ex, HttpSessionStateBase Session, string callDetail, ImpactLevel impactLevel) { return(Save(ex, Session, callDetail, impactLevel, "")); }
/// <summary> /// Wersja dla unit testów /// </summary> public static IEnumerable <Message> GetMessages(MessageType messageType, TempDataDictionary tempData, ViewDataDictionary viewData, HttpSessionStateBase session = null, bool useSession = false) { List <Message> res = getMessages(tempData, session, useSession); //if (tempData.ContainsKey(CommonController.VIEW_DATA_MESSAGES)) // res = (tempData[CommonController.VIEW_DATA_MESSAGES] as List<Message>); //else // res = new List<Message>(); foreach (string modelError in viewData.ModelState.Errors()) { res.Add(new Message { MessageType = MessageType.Error, Text = modelError, AsHtml = false }); } return(res.Where(m => m.MessageType == messageType)); }
public PessoaMatrizCreator(HttpSessionStateBase session) : base(session) { }
/// <summary> /// Move values from Sage 200 SessionContext to HttpContext (for next web request) /// </summary> /// <param name="session">The session</param> /// <param name="siteID">The site ID</param> /// <param name="companyID">The company ID</param> public static void Set(HttpSessionStateBase session, string siteID, string companyID) { session[keySiteID] = siteID; session[keyCompanyNumber] = companyID; }
public override void OnAuthorization(AuthorizationContext filterContext) { string controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; bool HavePermission = false; try { HttpSessionStateBase session = filterContext.HttpContext.Session; User _User = session["LoggedUser"] as User; switch (controllerName) { case "Category": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "City": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Crew": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Dept": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Designation": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Division": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Emp": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "EmpType": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Grade": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Holiday": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Home": break; case "JobTitle": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Location": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "LvApp": if (CheckLeavePermision(_User)) { HavePermission = true; } break; case "LvQuota": if (CheckLeavePermision(_User)) { HavePermission = true; } break; case "LvShort": if (CheckLeavePermision(_User)) { HavePermission = true; } break; case "Reader": if (CheckDevicePermision(_User)) { HavePermission = true; } break; case "ReaderType": if (CheckDevicePermision(_User)) { HavePermission = true; } break; case "Region": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Section": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Shift": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "Site": if (CheckHRPermision(_User)) { HavePermission = true; } break; case "User": if (CheckUserPermision(_User)) { HavePermission = true; } break; case "Vendor": if (CheckDevicePermision(_User)) { HavePermission = true; } break; case "EditAttendance": if (CheckAttEditPermision(_User)) { HavePermission = true; } break; case "Roster": if (CheckRosterPermision(_User)) { HavePermission = true; } break; } if (HavePermission == false) { //filterContext.Result = new HttpUnauthorizedResult(); filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Home", action = "Index" })); filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext); } } catch (Exception ex) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Home", action = "Index" })); filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext); } }
/// <summary> /// Gets the site ID from the HTTPContext as a string /// </summary> /// <param name="session">The HTTPContext</param> /// <returns>The site ID as a string</returns> public static string GetSiteID(HttpSessionStateBase session) { return(session[keySiteID] as string); }
/// <summary> /// 退出登录方法 /// </summary> /// <param name="Session">请求的Session状态对象</param> public void LoginOut(HttpSessionStateBase Session) { Session.Remove("LoginSuccess"); }
public static List <SaleInvoicesModel> get(HttpSessionStateBase Session, Guid?Id, string SaleInvoiceItemIdList, string FILTER_Keyword, string FILTER_PaymentNo, bool?FILTER_chkDateFrom, DateTime?FILTER_DateFrom, bool?FILTER_chkDateTo, DateTime?FILTER_DateTo, int?Cancelled, int?Approved, int?FILTER_HasDueAmount) { Guid Branches_Id = Helper.getActiveBranchId(Session); if (FILTER_chkDateFrom == null || !(bool)FILTER_chkDateFrom) { FILTER_DateFrom = null; } if (FILTER_chkDateTo == null || !(bool)FILTER_chkDateTo) { FILTER_DateTo = null; } string SaleInvoiceItemIdListClause = ""; if (!string.IsNullOrEmpty(SaleInvoiceItemIdList)) { SaleInvoiceItemIdListClause = string.Format("AND SaleInvoices.Id IN ({0})", UtilWebMVC.convertToSqlIdList(SaleInvoiceItemIdList)); } string ShowOnlyOwnUserDataClause = ""; if (UserAccountsController.getShowOnlyUserData(Session)) { ShowOnlyOwnUserDataClause = string.Format(" AND Customer_UserAccounts.Id = '{0}' ", UserAccountsController.getUserId(Session)); } string sql = string.Format(@" SELECT SaleInvoices.*, Branches.Name AS Branches_Name, Customer_UserAccounts.Fullname AS Customer_UserAccounts_Name, Customer_UserAccounts.No AS Customer_UserAccounts_No, ROW_NUMBER() OVER (ORDER BY SaleInvoices.No DESC) AS InitialRowNumber FROM SaleInvoices LEFT JOIN Branches ON Branches.Id = SaleInvoices.Branches_Id LEFT JOIN UserAccounts Customer_UserAccounts ON Customer_UserAccounts.Id = SaleInvoices.Customer_UserAccounts_Id WHERE 1=1 AND (@Id IS NULL OR SaleInvoices.Id = @Id) AND (@Id IS NOT NULL OR ( (@FILTER_Keyword IS NULL OR ( SaleInvoices.No LIKE '%'+@FILTER_Keyword+'%' OR Customer_UserAccounts.Fullname LIKE '%'+@FILTER_Keyword+'%' )) AND (@FILTER_PaymentNo IS NULL OR (SaleInvoices.Id IN ( SELECT SaleInvoices.Id FROM PaymentItems LEFT JOIN Payments ON Payments.Id = PaymentItems.Payments_Id LEFT JOIN SaleInvoices ON Saleinvoices.Id = PaymentItems.ReferenceId WHERE Payments.No = @FILTER_PaymentNo ))) AND (@FILTER_DateFrom IS NULL OR SaleInvoices.Timestamp >= @FILTER_DateFrom) AND (@FILTER_DateTo IS NULL OR SaleInvoices.Timestamp <= @FILTER_DateTo) AND (@Cancelled IS NULL OR SaleInvoices.Cancelled = @Cancelled) AND (@Approved IS NULL OR SaleInvoices.Approved = @Approved) AND (@FILTER_HasDueAmount IS NULL OR ((@FILTER_HasDueAmount = 0 AND SaleInvoices.Due = 0) OR (@FILTER_HasDueAmount = 1 AND SaleInvoices.Due > 0))) AND (@Branches_Id IS NULL OR SaleInvoices.Branches_Id = @Branches_Id) {0}{1} )) ORDER BY SaleInvoices.No DESC ", SaleInvoiceItemIdListClause, ShowOnlyOwnUserDataClause); return(new DBContext().Database.SqlQuery <SaleInvoicesModel>(sql, DBConnection.getSqlParameter(SaleInvoicesModel.COL_Id.Name, Id), DBConnection.getSqlParameter("FILTER_Keyword", FILTER_Keyword), DBConnection.getSqlParameter("FILTER_PaymentNo", FILTER_PaymentNo), DBConnection.getSqlParameter("FILTER_DateFrom", FILTER_DateFrom), DBConnection.getSqlParameter("FILTER_DateTo", Util.getAsEndDate(FILTER_DateTo)), DBConnection.getSqlParameter("FILTER_HasDueAmount", FILTER_HasDueAmount), DBConnection.getSqlParameter(SaleInvoicesModel.COL_Branches_Id.Name, Branches_Id), DBConnection.getSqlParameter(SaleInvoicesModel.COL_Cancelled.Name, Cancelled), DBConnection.getSqlParameter(SaleInvoicesModel.COL_Approved.Name, Approved) ).ToList()); }