internal bool Create(Address data) { bool result = false; try { bool valid = true; Project project = null; PcsAddressCheck checker = new PcsAddressCheck(param); PcsProjectCheck projectChecker = new PcsProjectCheck(param); valid = valid && checker.VerifyRequireField(data); valid = valid && projectChecker.VerifyId(data.ProjectId, ref project); valid = valid && projectChecker.IsUnLock(project); valid = valid && projectChecker.IsUnFinish(project); if (valid) { if (!DAOWorker.PcsAddressDAO.Create(data)) { BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsAddress_ThemMoiThatBai); throw new Exception("Them moi thong tin PcsAddress that bai." + LogUtil.TraceData("data", data)); } this.recentPcsAddresss.Add(data); result = true; } } catch (Exception ex) { LogSystem.Error(ex); param.HasException = true; result = false; } return(result); }
internal bool TruncateList(List <Address> listData) { bool result = false; try { bool valid = true; valid = IsNotNullOrEmpty(listData); PcsAddressCheck checker = new PcsAddressCheck(param); foreach (var data in listData) { valid = valid && IsNotNull(data) && IsGreaterThanZero(data.Id); valid = valid && checker.IsUnLock(data.Id); } if (valid) { result = DAOWorker.PcsAddressDAO.TruncateList(listData); } } catch (Exception ex) { LogSystem.Error(ex); param.HasException = true; result = false; } return(result); }
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 UpdateList(List <Address> listData) { bool result = false; try { bool valid = true; valid = IsNotNullOrEmpty(listData); PcsAddressCheck checker = new PcsAddressCheck(param); List <Address> listRaw = new List <Address>(); 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.PcsAddressDAO.UpdateList(listData)) { BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsAddress_CapNhatThatBai); throw new Exception("Cap nhat thong tin PcsAddress that bai." + LogUtil.TraceData("listData", listData)); } this.beforeUpdatePcsAddresss.AddRange(listRaw); result = true; } } catch (Exception ex) { LogSystem.Error(ex); param.HasException = true; result = false; } return(result); }