/// <summary>
        /// 阅读消息
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="id">主键</param>
        public void Read(UserInfo userInfo, string id)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.MessageService_Read);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => new CiMessageManager(dbProvider, userInfo).Read(id));
        }
        /// <summary>
        /// 全部清除日志(业务)
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <returns>数据表</returns>
        public void TruncateApplication(UserInfo userInfo)
        {
            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.LogService_TruncateApplication);

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => new LogManager(dbProvider, userInfo).Truncate());
        }
        /// <summary>
        /// 写入日志
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="processId">服务</param>
        /// <param name="processName">服务名称</param>
        /// <param name="methodId">操作</param>
        /// <param name="methodName">操作名称</param>
        public void WriteLog(UserInfo userInfo, string processId, string processName, string methodId, string methodName)
        {
            var parameter = ParameterUtil.CreateWithLog(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessRDIReadDb(userInfo, parameter, dbProvider => LogManager.Instance.Add(userInfo, processName, methodName, processId, methodId, string.Empty));
        }
Beispiel #4
0
        /// <summary>
        /// 批量置删除标志
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="ids">主键数组</param>
        /// <returns>影响的行数</returns>
        public int SetDeleted(UserInfo userInfo, string[] ids)
        {
            int returnValue = 0;

            if (ids == null || ids.Length <= 0)
            {
                return(returnValue);
            }

            var parameter = ParameterUtil.CreateWithMessage(userInfo, MethodBase.GetCurrentMethod(), this.serviceName, RDIFrameworkMessage.OrganizeService_SetDeleted);

            ServiceUtil.ProcessRDIWriteDbWithTran(userInfo, parameter, dbProvider =>
            {
                var manager = new PiOrganizeManager(dbProvider, userInfo);
                for (int pos = 0; pos < ids.Length; pos++)
                {
                    //逻辑删除组织机构
                    returnValue += manager.SetDeleted(ids[pos]);
                    //同步处理用户表组织机构相关数据
                    var userManager = new PiUserManager(dbProvider, userInfo);
                    var parameters  = new List <KeyValuePair <string, object> >
                    {
                        new KeyValuePair <string, object>(PiUserTable.FieldCompanyId, null),
                        new KeyValuePair <string, object>(PiUserTable.FieldCompanyName, null)
                    };
                    userManager.SetProperty(new KeyValuePair <string, object>(PiUserTable.FieldCompanyId, ids[pos]), parameters);
                    parameters = new List <KeyValuePair <string, object> >
                    {
                        new KeyValuePair <string, object>(PiUserTable.FieldSubCompanyId, null),
                        new KeyValuePair <string, object>(PiUserTable.FieldSubCompanyName, null)
                    };
                    userManager.SetProperty(new KeyValuePair <string, object>(PiUserTable.FieldSubCompanyId, ids[pos]), parameters);
                    parameters = new List <KeyValuePair <string, object> >
                    {
                        new KeyValuePair <string, object>(PiUserTable.FieldDepartmentId, null),
                        new KeyValuePair <string, object>(PiUserTable.FieldDepartmentName, null)
                    };
                    userManager.SetProperty(new KeyValuePair <string, object>(PiUserTable.FieldDepartmentId, ids[pos]), parameters);
                    parameters = new List <KeyValuePair <string, object> >
                    {
                        new KeyValuePair <string, object>(PiUserTable.FieldSubDepartmentId, null),
                        new KeyValuePair <string, object>(PiUserTable.FieldSubDepartmentName, null)
                    };
                    userManager.SetProperty(new KeyValuePair <string, object>(PiUserTable.FieldSubDepartmentId, ids[pos]), parameters);
                    parameters = new List <KeyValuePair <string, object> >
                    {
                        new KeyValuePair <string, object>(PiUserTable.FieldWorkgroupId, null),
                        new KeyValuePair <string, object>(PiUserTable.FieldWorkgroupName, null)
                    };
                    userManager.SetProperty(new KeyValuePair <string, object>(PiUserTable.FieldWorkgroupId, ids[pos]), parameters);
                    //同步处理员工表组织机构相关数据
                    var staffOrganizeManager = new PiStaffOrganizeManager(dbProvider, userInfo);
                    parameters = new List <KeyValuePair <string, object> >
                    {
                        new KeyValuePair <string, object>(PiStaffOrganizeTable.FieldOrganizeId, ids[pos])
                    };
                    staffOrganizeManager.SetDeleted(parameters, true);
                }
            });
            return(returnValue);
        }