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

            try
            {
                bool valid = true;
                valid = IsNotNullOrEmpty(listData);
                AasCredentialDataCheck checker = new AasCredentialDataCheck(param);
                foreach (var data in listData)
                {
                    valid = valid && IsNotNull(data) && IsGreaterThanZero(data.Id);
                    valid = valid && checker.IsUnLock(data.Id);
                }
                if (valid)
                {
                    result = DAOWorker.AasCredentialDataDAO.TruncateList(listData);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
        internal bool Truncate(CredentialData data)
        {
            bool result = false;

            try
            {
                bool valid = true;
                AasCredentialDataCheck checker = new AasCredentialDataCheck(param);
                valid = valid && IsNotNull(data);
                CredentialData 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.AasCredentialDataDAO.Truncate(data);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
Example #3
0
        internal bool Update(CredentialData data)
        {
            bool result = false;

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

                    this.beforeUpdateAasCredentialDatas.Add(raw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
Example #4
0
        internal bool Create(CredentialData data)
        {
            bool result = false;

            try
            {
                bool valid = true;
                AasCredentialDataCheck checker = new AasCredentialDataCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                if (valid)
                {
                    if (!DAOWorker.AasCredentialDataDAO.Create(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.AasCredentialData_ThemMoiThatBai);
                        throw new Exception("Them moi thong tin AasCredentialData that bai." + LogUtil.TraceData("data", data));
                    }
                    this.recentAasCredentialDatas.Add(data);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
Example #5
0
        internal bool UpdateList(List <CredentialData> listData)
        {
            bool result = false;

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