Exemple #1
0
        internal bool Truncate(Application data)
        {
            bool result = false;

            try
            {
                bool valid = true;
                AasApplicationCheck checker = new AasApplicationCheck(param);
                valid = valid && IsNotNull(data);
                Application 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.AasApplicationDAO.Truncate(data);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
        internal bool Update(Application data)
        {
            bool result = false;

            try
            {
                bool valid = true;
                AasApplicationCheck checker = new AasApplicationCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                Application raw = null;
                valid = valid && checker.VerifyId(data.Id, ref raw);
                valid = valid && checker.IsUnLock(raw);
                valid = valid && checker.ExistsCode(data.ApplicationCode, data.Id);
                if (valid)
                {
                    if (!DAOWorker.AasApplicationDAO.Update(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.AasApplication_CapNhatThatBai);
                        throw new Exception("Cap nhat thong tin AasApplication that bai." + LogUtil.TraceData("data", data));
                    }

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