예제 #1
0
        internal bool Create(ModuleRole data)
        {
            bool result = false;

            try
            {
                bool valid = true;
                AasModuleRoleCheck checker = new AasModuleRoleCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                if (valid)
                {
                    if (!DAOWorker.AasModuleRoleDAO.Create(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.AasModuleRole_ThemMoiThatBai);
                        throw new Exception("Them moi thong tin AasModuleRole that bai." + LogUtil.TraceData("data", data));
                    }
                    this.recentAasModuleRoles.Add(data);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
예제 #2
0
        internal bool TruncateList(List <ModuleRole> listData)
        {
            bool result = false;

            try
            {
                bool valid = true;
                valid = IsNotNullOrEmpty(listData);
                AasModuleRoleCheck checker = new AasModuleRoleCheck(param);
                foreach (var data in listData)
                {
                    valid = valid && IsNotNull(data) && IsGreaterThanZero(data.Id);
                    valid = valid && checker.IsUnLock(data.Id);
                }
                if (valid)
                {
                    result = DAOWorker.AasModuleRoleDAO.TruncateList(listData);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
예제 #3
0
        internal bool Update(ModuleRole data)
        {
            bool result = false;

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

                    this.beforeUpdateAasModuleRoles.Add(raw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
예제 #4
0
        internal bool Truncate(ModuleRole data)
        {
            bool result = false;

            try
            {
                bool valid = true;
                AasModuleRoleCheck checker = new AasModuleRoleCheck(param);
                valid = valid && IsNotNull(data);
                ModuleRole 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.AasModuleRoleDAO.Truncate(data);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
예제 #5
0
        internal bool UpdateList(List <ModuleRole> listData)
        {
            bool result = false;

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