Пример #1
0
        internal bool Update(UserRole data)
        {
            bool result = false;

            try
            {
                bool             valid   = true;
                AasUserRoleCheck checker = new AasUserRoleCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                UserRole raw = null;
                valid = valid && checker.VerifyId(data.Id, ref raw);
                valid = valid && checker.IsUnLock(raw);
                if (valid)
                {
                    if (!DAOWorker.AasUserRoleDAO.Update(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.AasUserRole_CapNhatThatBai);
                        throw new Exception("Cap nhat thong tin AasUserRole that bai." + LogUtil.TraceData("data", data));
                    }

                    this.beforeUpdateAasUserRoles.Add(raw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
Пример #2
0
        internal bool Create(UserRole data)
        {
            bool result = false;

            try
            {
                bool             valid   = true;
                AasUserRoleCheck checker = new AasUserRoleCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                if (valid)
                {
                    if (!DAOWorker.AasUserRoleDAO.Create(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.AasUserRole_ThemMoiThatBai);
                        throw new Exception("Them moi thong tin AasUserRole that bai." + LogUtil.TraceData("data", data));
                    }
                    this.recentAasUserRoles.Add(data);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
Пример #3
0
        internal bool UpdateList(List <UserRole> listData)
        {
            bool result = false;

            try
            {
                bool valid = true;
                valid = IsNotNullOrEmpty(listData);
                AasUserRoleCheck checker = new AasUserRoleCheck(param);
                List <UserRole>  listRaw = new List <UserRole>();
                List <long>      listId  = listData.Select(o => o.Id).ToList();
                valid = valid && checker.VerifyIds(listId, listRaw);
                valid = valid && checker.IsUnLock(listRaw);
                foreach (var data in listData)
                {
                    valid = valid && checker.VerifyRequireField(data);
                }
                if (valid)
                {
                    if (!DAOWorker.AasUserRoleDAO.UpdateList(listData))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.AasUserRole_CapNhatThatBai);
                        throw new Exception("Cap nhat thong tin AasUserRole that bai." + LogUtil.TraceData("listData", listData));
                    }
                    this.beforeUpdateAasUserRoles.AddRange(listRaw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }