Exemple #1
0
        /// <summary>
        /// 更新状态为“打印中”
        /// </summary>
        /// <param name="printId"></param>
        /// <returns></returns>
        private bool UpdatePrintStatusToPrinting(int printId)
        {
            var nowTime = DateTime.Now;
            List <PropertyParam> list = new List <PropertyParam>()
            {
                new PropertyParam()
                {
                    PropertyName = "lastModifyTime", ObjectValue = nowTime, dbType = SqlDbType.DateTime
                },
                new PropertyParam()
                {
                    PropertyName = "printFlag", ObjectValue = Convert.ToInt32(PrintStatus.Printing).ToString(), dbType = SqlDbType.NVarChar, size = 10
                }
            };

            list.Add(new PropertyParam()
            {
                IsWhereFilter = true,
                PropertyName  = "id",
                ObjectValue   = printId,
                dbType        = SqlDbType.Int
            });
            var result = WIPDataAccess.CreateDAL <ICommonDAL>("CommonDAL").UpdateExtend(list, Table.PrintInfo);

            return(result);
        }
        /// <summary>
        /// 更新权限到Redis
        /// </summary>
        /// <param name="userList"></param>
        public static void UpdateAuthToRedis()
        {
            try
            {
                Task.Run(() =>
                {
                    List <UserInfoLogon> userList = WIPDataAccess.CreateDAL <ICommonDAL>("CommonDAL").GetUserAccountView();

                    if (userList != null && userList.Count > 0)
                    {
                        foreach (var user in userList)
                        {
                            List <ResourceMenuInfo> menus = new List <ResourceMenuInfo>();
                            menus = getResourceMenu(user.Name, 0, "");
                            setResourceMenuToRedisOrMemory(user.Name, menus);
                        }

                        //判断如果这次内存字典中有,而userList没有的用户,表示该用户已删除了,要把他从内存中移除掉
                        List <string> removeList = new List <string>();
                        foreach (var item in wipAuthCacheDict)
                        {
                            if (!userList.Exists(t => t.Name == item.Key))
                            {
                                removeList.Add(item.Key);
                            }
                        }
                        foreach (var removeItem in removeList)
                        {
                            RedisModel redisModel = null;
                            wipAuthCacheDict.TryRemove(removeItem, out redisModel);
                        }
                    }
                    else
                    {//表示没有用户了,清空内存
                        wipAuthCacheDict = new ConcurrentDictionary <string, RedisModel>();
                    }
                });
            }
            catch
            {
                throw;
            }
        }
Exemple #3
0
        public void MailSending(string MailSubject, string Describe, string File_Path)
        {
            #region 数据获取

            try
            {
                _recipientsAddressRange = MailRuleBLL.GetInstance().GetMailPersonListRetStr(_categoryId);

                List <MailBaseData> mailBaseDataList = WIPDataAccess.CreateDAL <ICommonDAL>("CommonDAL").GetMailBaseData();
                if (mailBaseDataList == null || mailBaseDataList.Count == 0)
                {
                    throw new Exception("没有找到邮箱基础数据");
                }
                if (mailBaseDataList.Count > 1)
                {
                    throw new Exception(string.Format("配置的邮箱基础数据大于1条,请检查数据!查到的条数是{0}条", mailBaseDataList.Count.ToString()));
                }
                _MailBaseData = mailBaseDataList[0];
            }
            catch (Exception ex)
            {
                IDictionary <string, object> logDict = new Dictionary <string, object>();
                logDict.Add("MailSubject", MailSubject);
                logDict.Add("Describe", Describe);

                ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "MailSending", logDict, "", "");
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                WipLogHelper.WriteExceptionInfo(exception);
            }


            #endregion

            if (string.IsNullOrEmpty(_recipientsAddressRange) || _MailBaseData == null) // 如果基础数据没有获取到,就不发邮件
            {
                return;
            }
            this.PostMail(_MailBaseData, _recipientsAddressRange, MailSubject, Describe.ToString(), "");
        }
        /// <summary>
        /// 获取权限
        /// </summary>
        /// <param name="userList"></param>
        public static List <RedisModel> GetAuthFormRedis()
        {
            List <RedisModel> redisModelList = new List <RedisModel>();

            try
            {
                List <UserInfoLogon> userList = WIPDataAccess.CreateDAL <ICommonDAL>("CommonDAL").GetUserAccountView();
                RedisModel           aa       = null;
                if (userList != null && userList.Count > 0)
                {
                    foreach (var user in userList)
                    {
                        aa = getResourceMenuOnlyFormRedisOrMemory(user.Name);
                        redisModelList.Add(aa);
                    }
                }
            }
            catch
            {
                throw;
            }
            return(redisModelList);
        }
Exemple #5
0
 /// <summary>
 /// 查询用户登录记录列表
 /// </summary>
 /// <param name="userName">用户名</param>
 /// <returns>用户登录记录列表</returns>
 public List <UserLoginLogEntity> GetUserLoginLogList(string userName)
 {
     return(WIPDataAccess.CreateDAL <IUserLoginLogDAL>("UserLoginLogDAL").GetUserLoginLogList(userName));
 }
Exemple #6
0
        /// <summary>
        /// 处理打印结果
        /// </summary>
        /// <param name="printResult">打印结果</param>
        /// <param name="printInfo">打印信息</param>
        /// <param name="errMsg">错误信息</param>
        /// <returns></returns>
        public virtual bool DoByPrintResult(bool printResult, PrintInfoModel printInfo, string errMsg = "")
        {
            var retResult = false;//返回结果
            IDictionary <string, object> logDict = new Dictionary <string, object>();

            logDict.Add("printResult", printResult);
            logDict.Add("printInfo", printInfo);
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "DoByPrintResult", logDict
                                                                                                          , "", printInfo == null ? "" : printInfo.processCardNumber, ExceptionSource.WIPPost, ExceptionLevel.BusinessError, wipSource);

            try
            {
                #region 准备数据

                SqlParameter[] parameters_UpdatePrintResult = this.GetSqlParamForUpdatePrintResult(printResult, printInfo, errMsg);

                #endregion

                #region 事务处理

                using (SqlConnection conn = new SqlConnection(SQLServerHelper.connectionString))
                {
                    conn.Open();
                    using (SqlTransaction trans = conn.BeginTransaction())
                    {
                        TransactionModel transModel = new TransactionModel()
                        {
                            conn  = conn,
                            trans = trans
                        };
                        try
                        {
                            var execResult = WIPDataAccess.CreateDAL <IPrintInfoDAL>("PrintInfoDAL").UpdatePrintResult(parameters_UpdatePrintResult, transModel);
                            if (execResult != 1)
                            {//返回1代表执行成功,返回-1代表失败
                                throw new Exception("处理打印结果失败,parameters:" + JsonConvert.SerializeObject(parameters_UpdatePrintResult)
                                                    + ",execResult:" + execResult.ToString());
                            }

                            trans.Commit();
                            retResult = true;
                        }
                        catch
                        {
                            retResult = false;
                            trans.Rollback();
                            throw;
                        }
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                retResult = false;
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                WipLogHelper.WriteExceptionInfo(exception);
            }
            return(retResult);
        }