Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        internal bool Run(long id, ref Project resultData)
        {
            bool result = false;

            try
            {
                bool            valid   = true;
                Project         raw     = null;
                PcsProjectCheck checker = new PcsProjectCheck(param);
                valid = valid && IsGreaterThanZero(id);
                valid = valid && checker.VerifyId(id, ref raw);
                valid = valid && checker.IsUnLock(raw);
                valid = valid && checker.IsUnFinish(raw);
                if (valid)
                {
                    Mapper.CreateMap <Project, Project>();
                    Project before = Mapper.Map <Project>(raw);
                    raw.ProjectSttId = ProjectSttConstant.PROJECT_STT_ID__FINISH;
                    raw.FinishTime   = Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmss"));
                    if (!this.pcsProjectUpdate.Update(raw, before))
                    {
                        throw new Exception("pcsProjectUpdate. Ket thuc nghiep vu. Rollback du lieu");
                    }

                    resultData = raw;
                    result     = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                this.Rollback();
                result = false;
            }
            return(result);
        }