Example #1
0
        /// <summary>
        /// 批量新建职位
        /// </summary>
        /// <param name="positionList">职位实体对象集合</param>
        /// <returns>返回处理后的职位实体对象集合</returns>
        public IList <Position> Add(IList <Position> positionList)
        {
            ICTransaction    tran            = DalManager.DalFactory.BeginTransaction();
            IList <Position> newPositionList = new List <Position>();
            Position         newPosition     = null;
            bool             allSucc         = true;

            try
            {
                if (positionList != null)
                {
                    foreach (Position position in positionList)
                    {
                        if (allSucc)
                        {
                            newPosition = this.Add(position, tran);
                        }

                        if (string.IsNullOrEmpty(newPosition.PositionId))
                        {
                            allSucc = false;
                        }

                        newPositionList.Add(newPosition);
                    }

                    if (allSucc)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }

            return(newPositionList);
        }
Example #2
0
        /// <summary>
        /// 批量新建公司
        /// </summary>
        /// <param name="companyList">公司实体对象集合</param>
        /// <returns>返回处理后的公司实体对象集合</returns>
        public IList <Company> Add(IList <Company> companyList)
        {
            ICTransaction   tran           = DalManager.DalFactory.BeginTransaction();
            IList <Company> newCompanyList = new List <Company>();
            Company         newCompany     = null;
            bool            allSucc        = true;

            try
            {
                if (companyList != null)
                {
                    foreach (Company company in companyList)
                    {
                        if (allSucc)
                        {
                            newCompany = this.Add(company, tran);
                        }

                        if (string.IsNullOrEmpty(newCompany.CompanyId))
                        {
                            allSucc = false;
                        }

                        newCompanyList.Add(newCompany);
                    }

                    if (allSucc)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }

            return(newCompanyList);
        }
Example #3
0
        /// <summary>
        /// 批量新建员工
        /// </summary>
        /// <param name="employeeList">员工实体对象集合</param>
        /// <returns>返回处理后的员工实体对象集合</returns>
        public IList <Employee> Add(IList <Employee> employeeList)
        {
            ICTransaction    tran            = DalManager.DalFactory.BeginTransaction();
            IList <Employee> newEmployeeList = new List <Employee>();
            Employee         newEmployee     = null;
            bool             allSucc         = true;

            try
            {
                if (employeeList != null)
                {
                    foreach (Employee employee in employeeList)
                    {
                        if (allSucc)
                        {
                            newEmployee = this.Add(employee, tran);
                        }

                        if (string.IsNullOrEmpty(newEmployee.EmployeeId))
                        {
                            allSucc = false;
                        }

                        newEmployeeList.Add(newEmployee);
                    }

                    if (allSucc)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }

            return(newEmployeeList);
        }
Example #4
0
        /// <summary>
        /// 批量新建部门
        /// </summary>
        /// <param name="departmentList">部门实体对象集合</param>
        /// <returns>返回处理后的部门实体对象集合</returns>
        public IList <Department> Add(IList <Department> departmentList)
        {
            ICTransaction      tran = DalManager.DalFactory.BeginTransaction();
            IList <Department> newDepartmentList = new List <Department>();
            Department         newDepartment     = null;
            bool allSucc = true;

            try
            {
                if (departmentList != null)
                {
                    foreach (Department department in departmentList)
                    {
                        if (allSucc)
                        {
                            newDepartment = this.Add(department, tran);
                        }

                        if (string.IsNullOrEmpty(newDepartment.DepartmentId))
                        {
                            allSucc = false;
                        }

                        newDepartmentList.Add(newDepartment);
                    }

                    if (allSucc)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }

            return(newDepartmentList);
        }
Example #5
0
        public void DropColumn(TableInfo tableInfo, ColumnInfo columnInfo)
        {
            ICTransaction tran = this.BeginTransaction();

            try
            {
                DropColumn(tableInfo, columnInfo, tran);
                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }
        }
Example #6
0
        public void CreateTable(TableInfo tableInfo)
        {
            ICTransaction tran = this.BeginTransaction();

            try
            {
                CreateTable(tableInfo, tran);
                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }
        }
Example #7
0
        /// <summary>
        /// 更新公司数据
        /// </summary>
        /// <param name="companyList">公司实体对象</param>
        public void Update(IList <Company> companyList)
        {
            ICTransaction tran = DalManager.DalFactory.BeginTransaction();

            try
            {
                if (companyList != null)
                {
                    foreach (Company company in companyList)
                    {
                        this.Update(company, tran);
                    }

                    tran.Commit();
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }
        }
Example #8
0
        /// <summary>
        /// 更新员工数据
        /// </summary>
        /// <param name="employeeList">员工实体对象</param>
        public void Update(IList <Employee> employeeList)
        {
            ICTransaction tran = DalManager.DalFactory.BeginTransaction();

            try
            {
                if (employeeList != null)
                {
                    foreach (Employee employee in employeeList)
                    {
                        this.Update(employee, tran);
                    }

                    tran.Commit();
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }
        }
Example #9
0
        /// <summary>
        /// 更新职位数据
        /// </summary>
        /// <param name="positionList">职位实体对象</param>
        public void Update(IList <Position> positionList)
        {
            ICTransaction tran = DalManager.DalFactory.BeginTransaction();

            try
            {
                if (positionList != null)
                {
                    foreach (Position position in positionList)
                    {
                        this.Update(position, tran);
                    }

                    tran.Commit();
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }
        }
Example #10
0
        /// <summary>
        /// 更新部门数据
        /// </summary>
        /// <param name="departmentList">部门实体对象</param>
        public void Update(IList <Department> departmentList)
        {
            ICTransaction tran = DalManager.DalFactory.BeginTransaction();

            try
            {
                if (departmentList != null)
                {
                    foreach (Department department in departmentList)
                    {
                        this.Update(department, tran);
                    }

                    tran.Commit();
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception(ex.Message, ex);
            }
        }