Example #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);
        }
Example #2
0
        internal bool Truncate(UserRole data)
        {
            bool result = false;

            try
            {
                bool             valid   = true;
                AasUserRoleCheck checker = new AasUserRoleCheck(param);
                valid = valid && IsNotNull(data);
                UserRole 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.AasUserRoleDAO.Truncate(data);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }