コード例 #1
0
 /// <summary>
 /// 删除数据
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ExecuteResult DeleteQuotaAlarm(int id)
 {
     ExecuteResult result = new ExecuteResult();
     try
     {
         int count = quotaAlarmOperator.DeleteQuotaAlarm(id);
         if (count > 0)
         {
             result.Success = true;
         }
         else
         {
             result.Success = false;
             result.ExceptionMsg = "服务器断开,请联系管理员!";
         }
         return result;
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.ExceptionMsg = ex.Message;
         result.ExtendContent = null;
         return result;
     }
 }
コード例 #2
0
        /// <summary>
        /// 获取设备信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ResultDevicePropList GetDevicePropInfo(QueryDeviceItemContact query)
        {
            ExecuteResult resultInfo = new ExecuteResult();
            try
            {
                ResultDevicePropList result = new ResultDevicePropList();
                result.DevicePropList = new List<DevicePropInfo>();
                result.Page = new Padding();
                int total = 0;
                //string where = string.Format("and device_itemcode in (select ID from dbo.GetAllChildren({0})) or device_itemcode={1}", query.ItemCodeId, query.ItemCodeId);

                result.DevicePropList = GetDevicePropInfoList(query, out total);
                result.Page.Current = query.PageCurrent;
                result.Page.Total = total;
                resultInfo.Success = true;
                resultInfo.ExceptionMsg = string.Empty;
                result.ResultInfo = resultInfo;
                return result;
            }
            catch (Exception ex)
            {

                resultInfo.Success = false;
                resultInfo.ExceptionMsg = ex.Message;
                return new ResultDevicePropList { ResultInfo = resultInfo };
            }
        }
コード例 #3
0
ファイル: OperateUserBll.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取用户详细信息
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public ResultUserInfo GetUserInfo(int userId)
        {
            ExecuteResult resultInfo = new ExecuteResult();
            try
            {
                ResultUserInfo userDetail = new ResultUserInfo();

                var user = userOperator.GetUserInfo(userId);
                userDetail.UserInfo = new User();
                userDetail.UserInfo.GroupId = user.GroupId;
                userDetail.UserInfo.GroupName = string.Empty;
                userDetail.UserInfo.Id = user.Id;
                userDetail.UserInfo.PassWord = user.PassWord;
                userDetail.UserInfo.Status = user.Status;
                userDetail.UserInfo.UserName = user.Name;

                resultInfo.Success = true;
                resultInfo.ExceptionMsg = string.Empty;
                userDetail.ResultInfo = resultInfo;
                return userDetail;
            }
            catch (Exception ex)
            {
                resultInfo.Success = false;
                resultInfo.ExceptionMsg = ex.Message;
                return new ResultUserInfo { ResultInfo = resultInfo };
            }
        }
コード例 #4
0
ファイル: OperateUserBll.cs プロジェクト: NickQi/TianheDemo
 /// <summary>
 /// 获取所有的用户组
 /// </summary>
 /// <returns></returns>
 public ResultAllUserGroup GetAllUserGroup()
 {
     ExecuteResult resultInfo = new ExecuteResult();
     try
     {
         ResultAllUserGroup userGroups = new ResultAllUserGroup();
         userGroups.UserGroupList = new List<SingleUserGroup>();
         var userGroup = NTS.EMS.Config.ProductInteface.DataSwitchConfig.CreateUserGroupObject();
         userGroups.UserGroupList = userGroup.GetUserGroupList("").Select(p =>
             new SingleUserGroup { GroupName = p.Name, GroupId = p.Id }).ToList();
         resultInfo.Success = true;
         resultInfo.ExceptionMsg = string.Empty;
         userGroups.ResultInfo = resultInfo;
         return userGroups;
     }
     catch (Exception ex)
     {
         resultInfo.Success = false;
         resultInfo.ExceptionMsg = ex.Message;
         return new ResultAllUserGroup { ResultInfo = resultInfo };
     }
 }
コード例 #5
0
 /// <summary>
 /// 删除用户组
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ExecuteResult DeleteUserGroup(int id)
 {
     ExecuteResult resultInfo = new ExecuteResult();
     try
     {
         int count = userGroupOperator.DeleteUserGroup(id);
         if (count == 0)
         {
             resultInfo.Success = false;
             resultInfo.ExceptionMsg = "服务连接断开,请联系管理员!";
             return resultInfo;
         }
         resultInfo.Success = true;
         resultInfo.ExceptionMsg = string.Empty;
         return resultInfo;
     }
     catch (Exception ex)
     {
         resultInfo.Success = false;
         resultInfo.ExceptionMsg = ex.Message;
         return resultInfo;
     }
 }
コード例 #6
0
 public ExecuteResult DeleteUserGroup()
 {
     var inputValue = _ntsPage.Request.Form["Inputs"];
     var query = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(inputValue);
     var operaterUserGroup = new NTS.EMS.Config.BLL.OperateUserGroupBll();
     var userGroup = operaterUserGroup.GetUserGroupInfo(query);
     if (userGroup.ResultInfo.Success)
     {
         if (userGroup.UserGroupInfo.Name.Equals("系统组"))
         {
             ExecuteResult systemResult = new ExecuteResult();
             systemResult.Success = false;
             systemResult.ExceptionMsg = "系统组不允许删除!";
             return systemResult;
         }
     }
     else
     {
         return userGroup.ResultInfo;
     }
     var result = operaterUserGroup.DeleteUserGroup(query);
     result.ExtendContent = new List<string> { "删除", userGroup.UserGroupInfo.Name };
     return result;
 }
コード例 #7
0
 /// <summary>
 /// 保存定额告警信息
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public ExecuteResult SaveQuotaAlarm(Model.QuotaAlarmDataContact data)
 {
     ExecuteResult result = new ExecuteResult();
     try
     {
         result.Success = false;
         int count = quotaAlarmOperator.SaveQuotaAlarm(data);
         if (count > 0)
         {
             QueryQuotaAlarmSingle query = new QueryQuotaAlarmSingle();
             query.AlarmType = data.AlarmType;
             query.ItemCode = data.ItemCode;
             query.QuotaType = data.QuotaType;
             query.ObjectType = data.ObjectType;
             query.ObjectId = data.ObjectId;
             var quotaAlarm = GetQuotaAlarmInfo(query);
             if (quotaAlarm != null)
             {
                 result.Success = true;
                 result.ExtendContent = quotaAlarm.QuotaAlarm.Id;
             }
         }
         if (!result.Success)
         {
             result.ExceptionMsg = "服务器断开,请联系管理员!";
         }
         return result;
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.ExceptionMsg = ex.Message;
         result.ExtendContent = null;
         return result;
     }
 }
コード例 #8
0
        /// <summary>
        /// 获取用户组信息
        /// </summary>
        /// <param name="id">用户组ID</param>
        /// <returns></returns>
        public ResultUserGroupInfo GetUserGroupInfo(int id)
        {
            ExecuteResult resultInfo = new ExecuteResult();
            try
            {
                ResultUserGroupInfo userGroupDetail = new ResultUserGroupInfo();
                userGroupDetail.UserGroupInfo = new UserGroup();
                userGroupDetail.MenuRightList = new List<MenuRight>();
                userGroupDetail.ObjectRightList = new List<ObjectRight>();

                var userGroupInfo = userGroupOperator.GetUserGroupInfo(id);
                if (userGroupInfo != null)
                {
                    userGroupDetail.UserGroupInfo.Description = userGroupInfo.Description;
                    userGroupDetail.UserGroupInfo.Id = userGroupInfo.Id;
                    userGroupDetail.UserGroupInfo.Name = userGroupInfo.Name;
                }
                var userGroupMenuList = userGroupOperator.GetUserGroupMenuRightList(id);
                userGroupDetail.MenuRightList = userGroupMenuList.Select(
                    p => new MenuRight { MenuName = string.Empty, MenuRightId = p.MenuId }).ToList();
                var userGroupObjectList = userGroupOperator.GetUserGroupObjectRightList(id);
                userGroupDetail.ObjectRightList = userGroupObjectList.Select(
                    p => new ObjectRight { ObjectId = p.ObjectId, ObjectName = string.Empty, Type = p.Type }).ToList();
                resultInfo.Success = true;
                resultInfo.ExceptionMsg = string.Empty;
                userGroupDetail.ResultInfo = resultInfo;
                return userGroupDetail;
            }
            catch (Exception ex)
            {
                resultInfo.Success = false;
                resultInfo.ExceptionMsg = ex.Message;
                return new ResultUserGroupInfo { ResultInfo = resultInfo };
            }
        }
コード例 #9
0
        /// <summary>
        /// 插入用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public ExecuteResult SaveUserGroup(UserGroupDataContact data)
        {
            ExecuteResult resultInfo = new ExecuteResult();
            try
            {
                #region 组织参数
                Model.UserGroup userGroup = new UserGroup();
                userGroup.Id = data.UGData.ID;
                userGroup.Name = data.UGData.Name;
                userGroup.Description = data.UGData.Description;
                string menuIds = "";
                string objectIds = "";
                string objectTypes = "";
                if (data.UGMenuRightDataList != null && data.UGMenuRightDataList.Count > 0)
                {
                    int[] menuArr = data.UGMenuRightDataList.Select(p => p.MenuId).ToArray();
                    menuIds = string.Join(",", Array.ConvertAll(menuArr, p => p.ToString()));
                }
                if (data.UGObjectRightDataList != null && data.UGObjectRightDataList.Count > 0)
                {
                    int[] objectArr = data.UGObjectRightDataList.Select(p => p.ObjdetId).ToArray();
                    objectIds = string.Join(",", Array.ConvertAll(objectArr, p => p.ToString()));
                    int[] objectTypeArr = data.UGObjectRightDataList.Select(p => p.Type).ToArray();
                    objectTypes = string.Join(",", Array.ConvertAll(objectTypeArr, p => p.ToString()));
                }
                #endregion

                int count = userGroupOperator.SaveUserGroupInfo(userGroup, menuIds, objectIds, objectTypes);
                //if (count == 0)
                //{
                //    resultInfo.Success = false;
                //    resultInfo.ExceptionMsg = "服务连接断开,请联系管理员!";
                //    return resultInfo;
                //}
                resultInfo.Success = true;
                resultInfo.ExceptionMsg = string.Empty;
                return resultInfo;
            }
            catch (Exception ex)
            {
                resultInfo.Success = false;
                resultInfo.ExceptionMsg = ex.Message;
                return resultInfo;
            }
        }
コード例 #10
0
 /// <summary>
 /// 是否存在相同的用户组名称
 /// </summary>
 /// <param name="userGroupName"></param>
 /// <returns></returns>
 public ExecuteResult HasExistUserGroup(string userGroupName, int userGroupId)
 {
     ExecuteResult resultInfo = new ExecuteResult();
     try
     {
         if (userGroupOperator.GetUserGroupList(string.Format(" and cname='{0}' ", userGroupName)).Where(p => p.Id != userGroupId).Count() > 0)
         {
             resultInfo.Success = false;
             resultInfo.ExceptionMsg = "已有相同用户组,请修改用户组名!";
             return resultInfo;
         }
         resultInfo.Success = true;
         resultInfo.ExceptionMsg = string.Empty;
         return resultInfo;
     }
     catch (Exception ex)
     {
         resultInfo.Success = false;
         resultInfo.ExceptionMsg = ex.Message;
         return resultInfo;
     }
 }
コード例 #11
0
        /// <summary>
        /// 获取用户组列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ResultUserGroups GetUserGroupList(QueryUserGroupContact query)
        {
            ExecuteResult resultInfo = new ExecuteResult();
            try
            {
                ResultUserGroups resultUserGroups = new ResultUserGroups();
                resultUserGroups.Page = new Padding();
                resultUserGroups.UserGroupList = new List<UserGroup>();

                var result = userGroupOperator.GetUserGroupList(string.Empty);
                if (result.Count > 0)
                {
                    resultUserGroups.Page.Current = query.PageCurrent;
                    resultUserGroups.Page.Total = result.Count;
                    resultUserGroups.UserGroupList = result.Select(p =>
                        new Model.UserGroup
                        {
                            Description = p.Description,
                            Id = p.Id,
                            Name = p.Name
                        }).Skip((query.PageCurrent - 1) * query.PageSize).Take(query.PageSize).ToList();
                    resultInfo.Success = true;
                    resultInfo.ExceptionMsg = string.Empty;
                    resultUserGroups.ResultInfo = resultInfo;
                    return resultUserGroups;
                }
                else
                {
                    resultInfo.Success = false;
                    resultInfo.ExceptionMsg = "暂无数据!";
                    return new ResultUserGroups { ResultInfo = resultInfo };
                }
            }
            catch (Exception ex)
            {
                resultInfo.Success = false;
                resultInfo.ExceptionMsg = ex.Message;
                return new ResultUserGroups { ResultInfo = resultInfo };
            }
        }
コード例 #12
0
ファイル: AjaxUserInfo.cs プロジェクト: NickQi/TianheDemo
 private ExecuteResult ValidatePara(UserDataContact query)
 {
     ExecuteResult execResult = new ExecuteResult();
     if (string.IsNullOrEmpty(query.Name))
     {
         execResult.Success = false;
         execResult.ExceptionMsg = "请填写用户名!";
         return execResult;
     }
     if (string.IsNullOrEmpty(query.PassWord))
     {
         execResult.Success = false;
         execResult.ExceptionMsg = "请填写用户密码!";
         return execResult;
     }
     execResult.Success = true;
     execResult.ExceptionMsg = "";
     return execResult;
 }
コード例 #13
0
ファイル: OperateUserBll.cs プロジェクト: NickQi/TianheDemo
 /// <summary>
 /// 更新用户
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public ExecuteResult UpdateUser(UserDataContact data)
 {
     ExecuteResult resultInfo = new ExecuteResult();
     try
     {
         Model.User user = new User();
         user.GroupId = data.GroupId;
         user.Id = data.ID;
         user.PassWord = data.PassWord;
         if (string.IsNullOrEmpty(user.PassWord))
         {
             //表示密码没修改
             user.PassWord = userOperator.GetUserInfo(data.ID).PassWord;
         }
         else
         {
             user.PassWord = data.PassWord;
         }
         user.Status = data.Status;
         user.UserName = data.Name;
         if (userOperator.IsContainUser(user.UserName) && !userOperator.GetUserInfo(user.Id).Name.Equals(user.UserName))
         {
             resultInfo.Success = false;
             resultInfo.ExceptionMsg = "已有相同的用户名,请重新填写!";
             return resultInfo;
         }
         int count = userOperator.UpdateUser(user);
         if (count == 0)
         {
             resultInfo.Success = false;
             resultInfo.ExceptionMsg = "服务连接断开,请联系管理员!";
             return resultInfo;
         }
         resultInfo.Success = true;
         resultInfo.ExceptionMsg = string.Empty;
         return resultInfo;
     }
     catch (Exception ex)
     {
         resultInfo.Success = false;
         resultInfo.ExceptionMsg = ex.Message;
         return resultInfo;
     }
 }
コード例 #14
0
ファイル: OperateUserBll.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 插入用户
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public ExecuteResult InsertUser(UserDataContact data)
        {
            ExecuteResult resultInfo = new ExecuteResult();
            try
            {
                Model.User user = new User();
                user.GroupId = data.GroupId;
                user.Id = userOperator.GetMaxId() + 1;
                user.PassWord = data.PassWord;
                user.Status = data.Status;
                user.UserName = data.Name;

                if (userOperator.IsContainUser(user.UserName))
                {
                    resultInfo.Success = false;
                    resultInfo.ExceptionMsg = "已有相同的用户名,请重新填写!";
                    return resultInfo;
                }
                int count = userOperator.InsertUser(user);
                if (count == 0)
                {
                    resultInfo.Success = false;
                    resultInfo.ExceptionMsg = "服务连接断开,请联系管理员!";
                    return resultInfo;
                }
                resultInfo.Success = true;
                resultInfo.ExceptionMsg = string.Empty;
                return resultInfo;
            }
            catch (Exception ex)
            {
                resultInfo.Success = false;
                resultInfo.ExceptionMsg = ex.Message;
                return resultInfo;
            }
        }
コード例 #15
0
ファイル: OperateUserBll.cs プロジェクト: NickQi/TianheDemo
        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ResultUsers GetUserList(QueryUserContact query)
        {
            ExecuteResult resultInfo = new ExecuteResult();
            try
            {
                ResultUsers resultUsers = new ResultUsers();
                resultUsers.Page = new Padding();
                resultUsers.UserList = new List<User>();

                var result = userOperator.GetUserList(" order by id desc");
                if (result.Count > 0)
                {
                    resultUsers.Page.Current = query.PageCurrent;
                    resultUsers.Page.Total = result.Count;
                    resultUsers.UserList = result.Select(p =>
                        new Model.User
                        {
                            GroupId = p.GroupId,
                            GroupName = userOperator.GetUserGroupName(int.Parse(p.GroupId)),
                            Id = p.Id,
                            PassWord = p.PassWord,
                            Status = p.Status,
                            UserName = p.Name
                        }).Skip((query.PageCurrent - 1) * query.PageSize).Take(query.PageSize).ToList();
                    resultInfo.Success = true;
                    resultInfo.ExceptionMsg = string.Empty;
                    resultUsers.ResultInfo = resultInfo;
                    return resultUsers;
                }
                else
                {
                    resultInfo.Success = false;
                    resultInfo.ExceptionMsg = "暂无数据!";
                    return new ResultUsers { ResultInfo = resultInfo };
                }
            }
            catch (Exception ex)
            {
                resultInfo.Success = false;
                resultInfo.ExceptionMsg = ex.Message;
                return new ResultUsers { ResultInfo = resultInfo };
            }
        }