internal bool Truncate(Address data) { bool result = false; try { bool valid = true; Address raw = null; Project project = null; PcsAddressCheck checker = new PcsAddressCheck(param); PcsProjectCheck projectChecker = new PcsProjectCheck(param); valid = valid && IsNotNull(data); valid = valid && checker.VerifyId(data.Id, ref raw); valid = valid && checker.IsUnLock(raw); valid = valid && projectChecker.VerifyId(data.ProjectId, ref project); valid = valid && projectChecker.IsUnLock(project); valid = valid && projectChecker.IsUnFinish(project); valid = valid && checker.CheckConstraint(data.Id); if (valid) { result = DAOWorker.PcsAddressDAO.Truncate(data); } } catch (Exception ex) { LogSystem.Error(ex); param.HasException = true; result = false; } return(result); }
internal bool Update(Address data) { bool result = false; try { bool valid = true; Address raw = null; Project project = null; PcsAddressCheck checker = new PcsAddressCheck(param); PcsProjectCheck projectChecker = new PcsProjectCheck(param); valid = valid && checker.VerifyRequireField(data); valid = valid && checker.VerifyId(data.Id, ref raw); valid = valid && checker.IsUnLock(raw); valid = valid && projectChecker.VerifyId(data.ProjectId, ref project); valid = valid && projectChecker.IsUnLock(project); valid = valid && projectChecker.IsUnFinish(project); if (valid) { if (!DAOWorker.PcsAddressDAO.Update(data)) { BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsAddress_CapNhatThatBai); throw new Exception("Cap nhat thong tin PcsAddress that bai." + LogUtil.TraceData("data", data)); } this.beforeUpdatePcsAddresss.Add(raw); result = true; } } catch (Exception ex) { LogSystem.Error(ex); param.HasException = true; result = false; } return(result); }