Пример #1
0
        /// <summary>
        /// Kiem tra su ton tai cua danh sach cac id dong thoi lay ve du lieu
        /// </summary>
        /// <param name="id"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        internal bool VerifyIds(List <long> listId, List <ModuleRole> listObject)
        {
            bool valid = true;

            try
            {
                if (listId != null && listId.Count > 0)
                {
                    ModuleRoleFilterQuery filter = new ModuleRoleFilterQuery();
                    filter.Ids = listId;
                    List <ModuleRole> listData = new ModuleRoleManagerGet().Get(filter);
                    if (listData == null || listId.Count != listData.Count)
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.Common__KXDDDuLieuCanXuLy);
                        Logging("ListId invalid." + LogUtil.TraceData("listData", listData) + LogUtil.TraceData("listId", listId), LogType.Error);
                        valid = false;
                    }
                    else
                    {
                        listObject.AddRange(listData);
                    }
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                valid = false;
                param.HasException = true;
            }
            return(valid);
        }
 public ApiResult GetView(ApiParam <AasModuleRoleViewFilter> param)
 {
     try
     {
         ApiResultObject <List <ViewModuleRole> > result = new ApiResultObject <List <ViewModuleRole> >(null);
         if (param != null)
         {
             ModuleRoleManagerGet mng = new ModuleRoleManagerGet(param.CommonParam);
             result = mng.GetViewResult(param.ApiData);
         }
         return(new ApiResult(result, this.ActionContext));
     }
     catch (Exception ex)
     {
         LogSystem.Error(ex);
         return(null);
     }
 }
Пример #3
0
        /// <summary>
        /// Kiem tra su ton tai cua id dong thoi lay ve du lieu
        /// </summary>
        /// <param name="id"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        internal bool VerifyId(long id, ref ModuleRole data)
        {
            bool valid = true;

            try
            {
                data = new ModuleRoleManagerGet().GetById(id);
                if (data == null)
                {
                    BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.Common__KXDDDuLieuCanXuLy);
                    Logging("Id invalid." + LogUtil.TraceData("id", id), LogType.Error);
                    valid = false;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                valid = false;
                param.HasException = true;
            }
            return(valid);
        }
Пример #4
0
        /// <summary>
        /// Kiem tra du lieu co o trang thai unlock (su dung danh sach id)
        /// </summary>
        /// <param name="id"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        internal bool IsUnLock(List <long> listId)
        {
            bool valid = true;

            try
            {
                if (listId != null && listId.Count > 0)
                {
                    ModuleRoleFilterQuery filter = new ModuleRoleFilterQuery();
                    filter.Ids = listId;
                    List <ModuleRole> listData = new ModuleRoleManagerGet().Get(filter);
                    if (listData != null && listData.Count > 0)
                    {
                        foreach (var data in listData)
                        {
                            if (Constant.IS_TRUE != data.IsActive)
                            {
                                valid = false;
                                break;
                            }
                        }
                        if (!valid)
                        {
                            MessageUtil.SetMessage(param, LibraryMessage.Message.Enum.Common__DuLieuDangBiKhoa);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                valid = false;
                param.HasException = true;
            }
            return(valid);
        }