コード例 #1
0
ファイル: PcsEmployeeUpdate.cs プロジェクト: dunglh/MyProject
        internal bool Update(Employee data)
        {
            bool result = false;

            try
            {
                bool             valid   = true;
                PcsEmployeeCheck checker = new PcsEmployeeCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                Employee raw = null;
                valid = valid && checker.VerifyId(data.Id, ref raw);
                valid = valid && checker.IsUnLock(raw);
                if (valid)
                {
                    if (!DAOWorker.PcsEmployeeDAO.Update(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsEmployee_CapNhatThatBai);
                        throw new Exception("Cap nhat thong tin PcsEmployee that bai." + LogUtil.TraceData("data", data));
                    }

                    this.beforeUpdatePcsEmployees.Add(raw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
コード例 #2
0
        internal bool Truncate(Employee data)
        {
            bool result = false;

            try
            {
                bool             valid   = true;
                PcsEmployeeCheck checker = new PcsEmployeeCheck(param);
                valid = valid && IsNotNull(data);
                Employee 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.PcsEmployeeDAO.Truncate(data);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
コード例 #3
0
        internal bool TruncateList(List <Employee> listData)
        {
            bool result = false;

            try
            {
                bool valid = true;
                valid = IsNotNullOrEmpty(listData);
                PcsEmployeeCheck checker = new PcsEmployeeCheck(param);
                foreach (var data in listData)
                {
                    valid = valid && IsNotNull(data) && IsGreaterThanZero(data.Id);
                    valid = valid && checker.IsUnLock(data.Id);
                }
                if (valid)
                {
                    result = DAOWorker.PcsEmployeeDAO.TruncateList(listData);
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
コード例 #4
0
ファイル: PcsEmployeeCreate.cs プロジェクト: dunglh/MyProject
        internal bool Create(Employee data)
        {
            bool result = false;

            try
            {
                bool             valid   = true;
                PcsEmployeeCheck checker = new PcsEmployeeCheck(param);
                valid = valid && checker.VerifyRequireField(data);
                if (valid)
                {
                    if (!DAOWorker.PcsEmployeeDAO.Create(data))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsEmployee_ThemMoiThatBai);
                        throw new Exception("Them moi thong tin PcsEmployee that bai." + LogUtil.TraceData("data", data));
                    }
                    this.recentPcsEmployees.Add(data);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }
コード例 #5
0
ファイル: PcsEmployeeUpdate.cs プロジェクト: dunglh/MyProject
        internal bool UpdateList(List <Employee> listData)
        {
            bool result = false;

            try
            {
                bool valid = true;
                valid = IsNotNullOrEmpty(listData);
                PcsEmployeeCheck checker = new PcsEmployeeCheck(param);
                List <Employee>  listRaw = new List <Employee>();
                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.PcsEmployeeDAO.UpdateList(listData))
                    {
                        BugUtil.SetBugCode(param, LibraryBug.Bug.Enum.PcsEmployee_CapNhatThatBai);
                        throw new Exception("Cap nhat thong tin PcsEmployee that bai." + LogUtil.TraceData("listData", listData));
                    }
                    this.beforeUpdatePcsEmployees.AddRange(listRaw);
                    result = true;
                }
            }
            catch (Exception ex)
            {
                LogSystem.Error(ex);
                param.HasException = true;
                result             = false;
            }
            return(result);
        }