예제 #1
0
        internal bool Truncate(Project data)
        {
            bool result = false;

            try
            {
                bool            valid   = true;
                PcsProjectCheck checker = new PcsProjectCheck(param);
                valid = valid && IsNotNull(data);
                Project raw = null;
                valid = valid && checker.VerifyId(data.Id, ref raw);
                valid = valid && checker.IsUnLock(raw);
                valid = valid && checker.IsUnFinish(raw);
                valid = valid && checker.CheckConstraint(data.Id);
                if (valid)
                {
                    result = DAOWorker.PcsProjectDAO.Truncate(data);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
예제 #2
0
        internal bool Update(Project data, Project before)
        {
            bool result = false;

            try
            {
                bool            valid   = true;
                PcsProjectCheck checker = new PcsProjectCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                valid = valid && checker.IsUnLock(before);
                valid = valid && checker.IsUnFinish(before);
                valid = valid && checker.ExistsCode(data.ProjectCode, data.Id);
                if (valid)
                {
                    if (!DAOWorker.PcsProjectDAO.Update(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsProject_CapNhatThatBai);
                        throw new Exception("Cap nhat thong tin PcsProject that bai." + LogUtil.TraceData("data", data));
                    }

                    this.beforeUpdatePcsProjects.Add(before);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }