コード例 #1
0
ファイル: Index.aspx.cs プロジェクト: hofmannzhu/bwjs
        public int BackgroundRefreshTime = int.Parse(LinkFun.ConfigString("BackgroundRefreshTime", "7200000")); //背景刷新时间


        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ProductIndexRefreshTime = LinkFun.ConfigString("ProductIndexRefreshTime", "7200000"); //LinkFun.getProductIndexRefreshTime();
                ProductsBLL        adHelper            = new ProductsBLL();
                ProductCategoryBLL oProductCategoryBLL = new ProductCategoryBLL();
                oCategoryList = oProductCategoryBLL.GetCardTypeList();
                LoginUserCookie cookie = MerchantFrontCookieBLL.GetMerchantFrontUserCookie();
                magName = cookie.LoginName;
                CompanyBLL opCompanyBLL = new CompanyBLL();

                StringBuilder where = new StringBuilder();
                //where.AppendFormat("IsDeleted=0 and CompanyCategoryId=2 order by OrderId asc");
                //litCompanyNetLoan = opCompanyBLL.GetModelList(where.ToString());

                where = new StringBuilder();
                where.AppendFormat("IsDeleted=0 and CompanyCategoryId=4 order by OrderId asc");
                litCompanyBank = opCompanyBLL.GetModelList(where.ToString());

                where = new StringBuilder();
                where.AppendFormat("IsDeleted=0 and CompanyCategoryId=5 order by OrderId asc");
                litCompanyOther = opCompanyBLL.GetModelList(where.ToString());
            }
        }
コード例 #2
0
ファイル: ILog.cs プロジェクト: hofmannzhu/bwjs
        /// <summary>
        /// 操作日志
        /// </summary>
        /// <param name="logContent">日志内容</param>
        /// <param name="companyId">渠道编号</param>
        /// <param name="businessType">业务类型1网贷2保险3信用卡</param>
        /// <param name="relationId">关联编号</param>
        /// <returns>操作日志添加结果</returns>
        static public int OperationLogAdd(int relationId, string logContent, int companyId = 1, int businessType = 1)
        {
            int result = -1;

            try
            {
                int    userId         = -1;
                string realName       = string.Empty;
                int    departmentId   = -1;
                string departmentName = string.Empty;

                LoginUserCookie currentUser = MerchantFrontCookieBLL.GetMerchantFrontUserCookie();
                if (currentUser != null)
                {
                    UsersBLL op    = new UsersBLL();
                    Users    model = new Users();
                    model        = op.GetModel(currentUser.LoginUserID);
                    userId       = currentUser.LoginUserID;
                    departmentId = model.DepartmentID;
                    if (model != null)
                    {
                        realName = model.UserName;

                        DepartmentInfoBLL opDepartment        = new DepartmentInfoBLL();
                        DepartmentInfo    modelDepartmentInfo = new DepartmentInfo();
                        modelDepartmentInfo = opDepartment.GetModel(departmentId);
                        if (modelDepartmentInfo != null)
                        {
                            departmentName = modelDepartmentInfo.DepartmentName;
                        }
                    }
                }

                StackTrace st        = new StackTrace(true);
                MethodBase mb        = st.GetFrame(1).GetMethod();
                string     clsString = mb.DeclaringType.FullName;
                string     mName     = mb.Name;

                OperationLogBLL opOperationLog    = new OperationLogBLL();
                OperationLog    modelOperationLog = new OperationLog();

                modelOperationLog.BusinessType   = businessType;
                modelOperationLog.RelationId     = relationId;
                modelOperationLog.LogContent     = logContent;
                modelOperationLog.Ip             = System.Web.HttpContext.Current.Request.UserHostAddress;
                modelOperationLog.UserId         = userId;
                modelOperationLog.RealName       = realName;
                modelOperationLog.CreateDate     = DateTime.Now;
                modelOperationLog.DepartmentId   = departmentId;
                modelOperationLog.DepartmentName = departmentName;
                modelOperationLog.CreateDate     = DateTime.Now;
                result = opOperationLog.Add(modelOperationLog);
            }
            catch (Exception ex)
            {
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
コード例 #3
0
        public static LoginUserCookie GetMerchantFrontUserCookie()
        {
            HttpCookie      userInfoCookie = HttpContext.Current.Request.Cookies.Get("MerchantFrontUserCookie");
            string          strUserInfo    = HttpUtility.UrlDecode(userInfoCookie.Value, Encoding.GetEncoding("UTF-8"));
            LoginUserCookie userInfo       = JsonToObject(strUserInfo) as LoginUserCookie;

            return(userInfo);
        }
コード例 #4
0
        public static void SetMerchantFrontCookie(int UserID, string LoginName)
        {
            LoginUserCookie loginuserCookie = new LoginUserCookie()
            {
                LoginUserID = UserID,
                LoginName   = LoginName,
            };
            HttpCookie userInfo = new HttpCookie("MerchantFrontUserCookie");

            //将序列化之后的Json串以UTF-8编码,再存入Cookie
            userInfo.Value   = HttpUtility.UrlEncode(ObjectToJson(loginuserCookie), Encoding.GetEncoding("UTF-8"));
            userInfo.Expires = DateTime.Now.AddHours(8);//8小时过期

            HttpContext.Current.Response.Cookies.Add(userInfo);
        }
コード例 #5
0
        /// <summary>
        /// 获取商家用户Cookie
        /// </summary>
        /// <returns></returns>
        public static int GetMerchantFrontUserId()
        {
            HttpCookie userInfoCookie = System.Web.HttpContext.Current.Request.Cookies["MerchantFrontUserCookie"];

            if (userInfoCookie != null)
            {
                string          strUserInfo = HttpUtility.UrlDecode(userInfoCookie.Value, Encoding.GetEncoding("UTF-8"));
                LoginUserCookie userInfo    = Newtonsoft.Json.JsonConvert.DeserializeObject <LoginUserCookie>(strUserInfo) as LoginUserCookie;
                return(userInfo.LoginUserID);
            }
            else
            {
                return(0);
            }
        }