Exemplo n.º 1
0
        /// <summary>
        /// 修改管理员 清除Cache和Session
        /// </summary>
        /// <param name="adminID"></param>
        /// <returns></returns>
        public static bool ClearAdminCacheByCRUD(int?userID = null)
        {
            bool isSuccess = false;

            try
            {
                AdminSessionEntity adminEntity = HttpContext.Current.Session[WebKeys.AdminSessionKey] as AdminSessionEntity;
                if (userID.HasValue)
                {
                    if (adminEntity.Sys_UserID == userID.Value.ToString())
                    {
                        HttpContext.Current.Session[WebKeys.AdminSessionKey] = null;
                    }
                }
                else
                {
                    if (HttpContext.Current.Session[WebKeys.AdminSessionKey] != null)
                    {
                        HttpContext.Current.Session[WebKeys.AdminSessionKey] = null;
                    }
                }

                isSuccess = true;
            }
            catch (Exception ex)
            {
                LogUtil.WriteLog(ex);
                return(false);
            }
            return(isSuccess);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 当操作Role时,删除相关缓存和Session
        /// </summary>
        /// <returns></returns>
        public static bool ClearRoleCacheByCRUD()
        {
            bool isSuccess = false;

            try
            {
                if (HttpContext.Current.Session[WebKeys.AdminSessionKey] != null)
                {
                    AdminSessionEntity adminEntity = HttpContext.Current.Session[WebKeys.AdminSessionKey] as AdminSessionEntity;

                    string key = string.Format(WebKeys.CK_SYS_LEFTMENU, adminEntity.Sys_UserID);
                    HttpContext.Current.Session[key] = null;

                    adminEntity.Functions = new BCtrl_Function().GetFunction(adminEntity.Sys_UserID);
                    HttpContext.Current.Session[WebKeys.AdminSessionKey] = adminEntity;
                }
                isSuccess = true;
            }
            catch (Exception ex)
            {
                LogUtil.WriteLog(ex);
                return(false);
            }
            return(isSuccess);
        }
Exemplo n.º 3
0
        private DataTable GetQueryData(bool isDownload)
        {
            string strWhere = string.Empty;

            AdminSessionEntity ue = (AdminSessionEntity)Session[WebKeys.AdminSessionKey];

            if (ue != null)
            {
                strWhere = " SysUserID = " + ue.Sys_UserID + " ";
            }
            else
            {
                return(new DataTable());
            }
            if (HidType == "2")
            {
                strWhere += " AND IsSend=0 ";
            }
            int keyFlag = 0;

            int.TryParse(Key, out keyFlag);
            switch (keyFlag)
            {
            case 1: strWhere += " AND Customer like '%" + Value.Trim() + "%' "; break;

            case 2: strWhere += " AND Moblie like '%" + Value.Trim() + "%' "; break;

            case 3: strWhere += " AND Content like '%" + Value.Trim() + "%' "; break;

            case 4:
                DateTime stime = DateTime.Parse(Value);
                DateTime etime = DateTime.Parse(Value).AddDays(1).AddSeconds(-1);
                strWhere += " AND SendTime >='" + stime + "' AND  SendTime<= '" + etime + "' ";
                break;
            }
            int       count = 0;
            DataTable table =
                BCtrl_SMS.Instance.SMS_GetList(base.PageIndex, PageSize, " SendTime DESC ", strWhere, out count);

            foreach (DataRow row in table.Rows)
            {
                string contentFlag = StringUti.SubStr(row["Content"].ToString(), 30);
                row["Content"] = contentFlag;
            }
            base.TotalRecords = count;
            return(table);
        }
Exemplo n.º 4
0
        public AdminSessionEntity QuerySysUserInfo(string uid)
        {
            DataTable dt = sysuserobj.QuerySysUserInfo(uid);

            if (dt != null && dt.Rows.Count > 0)
            {
                AdminSessionEntity ase = new AdminSessionEntity();
                ase.Sys_DisplayName = dt.Rows[0]["User_Name"].ToString();
                ase.Sys_RoleID      = int.Parse(dt.Rows[0]["User_RoleID"].ToString());
                ase.Sys_RoleName    = dt.Rows[0]["Role_Name"].ToString();
                return(ase);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AdminSessionEntity ue = (AdminSessionEntity)Session[WebKeys.AdminSessionKey];

            if (ue != null)
            {
                sUserID = ue.Sys_UserID;
            }
            OperationResult <IList <SMSModeEntity> > result = BCtrl_SignSMSModel.Instance.SignSMSModel_GetWhere();

            if (result.ResultType == OperationResultType.Success)
            {
                IList <SMSModeEntity> entitys = result.AppendData;
                foreach (var entity in entitys)
                {
                    signSMSModel += " <option value='" + entity.ModelKey + "'>" + entity.ModelKey + "</option> ";
                }
            }
        }