internal bool TruncateList(List <ApplicationRole> listData)
        {
            bool result = false;

            try
            {
                bool valid = true;
                valid = IsNotNullOrEmpty(listData);
                AasApplicationRoleCheck checker = new AasApplicationRoleCheck(param);
                foreach (var data in listData)
                {
                    valid = valid && IsNotNull(data) && IsGreaterThanZero(data.Id);
                    valid = valid && checker.IsUnLock(data.Id);
                }
                if (valid)
                {
                    result = DAOWorker.AasApplicationRoleDAO.TruncateList(listData);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
Example #2
0
        internal bool Update(ApplicationRole data)
        {
            bool result = false;

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

                    this.beforeUpdateAasApplicationRoles.Add(raw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
        internal bool Truncate(ApplicationRole data)
        {
            bool result = false;

            try
            {
                bool valid = true;
                AasApplicationRoleCheck checker = new AasApplicationRoleCheck(param);
                valid = valid && IsNotNull(data);
                ApplicationRole raw = null;
                valid = valid && checker.VerifyId(data.Id, ref raw);
                valid = valid && checker.IsUnLock(raw);
                valid = valid && checker.CheckConstraint(data.Id);
                if (valid)
                {
                    result = DAOWorker.AasApplicationRoleDAO.Truncate(data);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
Example #4
0
        internal bool UpdateList(List <ApplicationRole> listData)
        {
            bool result = false;

            try
            {
                bool valid = true;
                valid = IsNotNullOrEmpty(listData);
                AasApplicationRoleCheck checker = new AasApplicationRoleCheck(param);
                List <ApplicationRole>  listRaw = new List <ApplicationRole>();
                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.AasApplicationRoleDAO.UpdateList(listData))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.AasApplicationRole_CapNhatThatBai);
                        throw new Exception("Cap nhat thong tin AasApplicationRole that bai." + LogUtil.TraceData("listData", listData));
                    }
                    this.beforeUpdateAasApplicationRoles.AddRange(listRaw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }