Exemplo n.º 1
0
        public Int32 DeleteFeeInfo(String yearMonth, String feeID)
        {
            FeeInfo feeInfo = this.LoadFeeInfo(yearMonth, feeID);
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeInfoDBConst.FeeID, feeID);
            if (!String.IsNullOrEmpty(yearMonth))
            {
                builder.AppendItem(FeeMonthInfoDBConst.YearMonth, yearMonth);
            }//Not 需改进
            String sql = String.Format(@"DELETE FROM {0} WHERE {3};
                                         DELETE FROM {1} WHERE {3};
                                         DELETE FROM {2} WHERE {3}",
                                       String.IsNullOrEmpty(yearMonth) ? FeeInfoDBConst.TableName : ORMapping.GetMappingInfo <FeeMonthInfo>().TableName,
                                       String.IsNullOrEmpty(yearMonth) ? TaxInfoDBConst.TableName : ORMapping.GetMappingInfo <TaxMonthInfo>().TableName,
                                       String.IsNullOrEmpty(yearMonth) ? PersonBaseFeeInfoDBConst.TableName : ORMapping.GetMappingInfo <PersonBaseFeeMonthInfo>().TableName,
                                       builder.ToSqlString());

            using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Required))
            {
                int result = _DataHelper.ExecuteSql(sql);
                if (!String.IsNullOrEmpty(feeInfo.ParentID))
                {
                    this.UpdateCalculateExp(yearMonth, feeInfo.ParentID);
                }
                scope.Complete();
                return(result);
            }
        }
Exemplo n.º 2
0
        private String ConvertCaculateToCommon(String yearMonth, String feeID)
        {//将计算型的转换为基本型的
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeMonthInfoDBConst.FeeID, feeID);
            FeeInfo feeInfo = GetFeeInfoList(yearMonth, builder).FirstOrDefault();

            if (feeInfo.FeeType.Equals(FeeType.Common))
            {
                if (!String.IsNullOrEmpty(feeInfo.CalculateExp))
                {
                    return(String.Concat("(", this.ConvertExp(yearMonth, feeInfo.CalculateExp), ")"));
                }
                return("(ISNULL([" + feeID + "],0))");
            }
            else if (feeInfo.FeeType.Equals(FeeType.Tax))
            {
                return(String.Concat("ISNULL(DBO.CACULATETAX(''" + yearMonth + "'',''", feeInfo.FeeID
                                     , "'',", ConvertExp(yearMonth, this.GetTaxFeeCalculateExp(yearMonth, feeInfo.FeeID)), "),0)"));
            }
            else if (feeInfo.FeeType.Equals(FeeType.Parameter))
            {
                return(this.GetParameterFeeValue(yearMonth, feeID).ToString());
            }
            else
            {
                return("(ISNULL(" + ConvertExp(yearMonth, feeInfo.CalculateExp) + ",0))");
            }
        }
Exemplo n.º 3
0
        public List <FeeInfo> GetReportCanSelectFeeList(string reportID)
        {
            String         sql = String.Format(@"SELECT * FROM {0} WHERE ISNULL(PARENT_ID,'')='' AND use_flag=0 AND {3} NOT IN (SELECT {3} FROM {1} WHERE {4} ='{2}') ORDER BY {5}", FeeInfoDBConst.TableName, ReportFeeDBConst.TableName, reportID, FeeInfoDBConst.FeeID, ReportInfoDBConst.ReportID, FeeInfoDBConst.FeeCode);
            DataTable      dt  = _DataHelper.GetDataTable(sql);
            List <FeeInfo> resultFeeInfoList = new List <FeeInfo>();

            for (Int32 i = 0; i < dt.Rows.Count; i++)
            {
                FeeInfo info = new FeeInfo();
                ORMapping.DataRowToObject(dt.Rows[i], info);
                resultFeeInfoList.Add(info);
            }
            List <FeeInfo> childrenFeeInfoList = new List <FeeInfo>();

            foreach (FeeInfo feeInfo in resultFeeInfoList)
            {
                childrenFeeInfoList.AddRange(GetReportFeeChildrenInfoList(reportID, feeInfo));
            }
            resultFeeInfoList.AddRange(childrenFeeInfoList);

            //String sql = String.Format(@"SELECT * FROM {0} WHERE use_flag=0 AND {3} NOT IN (SELECT {3} FROM {1} WHERE {4} ='{2}') ORDER BY {5}", FeeInfoDBConst.TableName, ReportFeeDBConst.TableName, reportID, FeeInfoDBConst.FeeID, ReportInfoDBConst.ReportID, FeeInfoDBConst.FeeCode);
            //DataTable dt = _DataHelper.GetDataTable(sql);
            //List<FeeInfo> result = new List<FeeInfo>();
            //for (Int32 i = 0; i < dt.Rows.Count; i++)
            //{
            //    FeeInfo info = new FeeInfo();
            //    ORMapping.DataRowToObject(dt.Rows[i], info);
            //    result.Add(info);
            //}
            return(resultFeeInfoList);
        }
Exemplo n.º 4
0
 public Int32 UpdateFeeInfo(FeeInfo feeInfo)
 {
     using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Required))
     {
         String sql    = sql = ORMapping.GetUpdateSql(feeInfo, BuilderEx.TSqlBuilderInstance);
         int    result = _DataHelper.ExecuteSql(sql);
         if (!String.IsNullOrEmpty(feeInfo.ParentID))
         {
             this.UpdateCalculateExp((feeInfo is FeeMonthInfo) ? ((FeeMonthInfo)feeInfo).YearMonth : null, feeInfo.ParentID);
         }
         scope.Complete();
         return(result);
     }
 }
Exemplo n.º 5
0
        private Decimal GetParameterFeeValue(String yearMonth, String parameterFeeID)
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeMonthInfoDBConst.FeeType, FeeType.Parameter.ToString("D"));
            builder.AppendItem(String.Concat(FeeMonthInfoDBConst.StartDate, "<= DATEADD(Day,-1,CONVERT(CHAR(8),DATEADD(Month,1,'", yearMonth, "01'),120)+'1')"));

            WhereSqlClauseBuilder builderOr = new WhereSqlClauseBuilder(LogicOperatorDefine.Or);

            builderOr.AppendItem(FeeMonthInfoDBConst.FeeID, parameterFeeID);
            builderOr.AppendItem(FeeMonthInfoDBConst.ParentID, parameterFeeID);
            builder.AppendItem(builderOr.ToSqlString());
            FeeInfo feeInfo = GetFeeInfoList(yearMonth, builder).OrderBy(fee => fee.StartDate).FirstOrDefault();

            return(feeInfo.DefaultValue);
        }
Exemplo n.º 6
0
        public String GetTaxFeeCalculateExp(String yearMonth, String taxFeeID)
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeMonthInfoDBConst.FeeType, FeeType.Tax.ToString("D"));
            builder.AppendItem(String.Concat(FeeMonthInfoDBConst.StartDate, "<= DATEADD(Day,-1,CONVERT(CHAR(8),DATEADD(Month,1,'", yearMonth, "01'),120)+'1')"));

            WhereSqlClauseBuilder builderOr = new WhereSqlClauseBuilder(LogicOperatorDefine.Or);

            builderOr.AppendItem(FeeMonthInfoDBConst.FeeID, taxFeeID);
            builderOr.AppendItem(FeeMonthInfoDBConst.ParentID, taxFeeID);
            builder.AppendItem(builderOr.ToSqlString());
            FeeInfo feeInfo = GetFeeInfoList(yearMonth, builder).OrderBy(fee => fee.StartDate).FirstOrDefault();

            return(feeInfo.CalculateExp);
        }
Exemplo n.º 7
0
        public List <FeeInfo> GetReportFeeChildrenInfoList(String reportID, FeeInfo feeInfo)
        {
            WhereSqlClauseBuilder builderChilder = new WhereSqlClauseBuilder();

            builderChilder.AppendItem(FeeInfoDBConst.ParentID, feeInfo.FeeID);
            builderChilder.AppendItem(String.Concat(FeeInfoDBConst.FeeID, " NOT IN (SELECT FEE_ID FROM REPORT_FEE WHERE REPORT_ID='", reportID, "')"));
            List <FeeInfo> resultList   = FeeInfoAdapter.Instance.GetFeeInfoList(null, builderChilder);
            List <FeeInfo> childrenList = new List <FeeInfo>();

            foreach (FeeInfo info in resultList)
            {
                childrenList.AddRange(this.GetReportFeeChildrenInfoList(reportID, info));
            }
            resultList.AddRange(childrenList);
            return(resultList);
        }
        private String ConvertCommonExpToCommon(String yearMonth, String feeID)
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeMonthInfoDBConst.FeeID, feeID);
            FeeInfo feeInfo = FeeInfoAdapter.Instance.GetFeeInfoList(yearMonth, builder).FirstOrDefault();

            if (feeInfo.FeeType.Equals(FeeType.Common))
            {
                if (!String.IsNullOrEmpty(feeInfo.CalculateExp))
                {
                    return(String.Concat("(", this.ConvertCommonExp(yearMonth, feeInfo.CalculateExp), ")"));
                }
                return("[" + feeID + "]");
            }
            return(feeInfo.CalculateExp);
        }
Exemplo n.º 9
0
        public List <FeeInfo> GetFeeInfoList(String yearMonth, WhereSqlClauseBuilder builder)
        {
            if (!String.IsNullOrEmpty(yearMonth))
            {
                builder.AppendItem(FeeMonthInfoDBConst.YearMonth, yearMonth);
            }
            String         sql    = String.Format("SELECT * FROM {0} WHERE {1} ORDER BY FEE_CODE", String.IsNullOrEmpty(yearMonth) ? FeeInfoDBConst.TableName : ORMapping.GetMappingInfo <FeeMonthInfo>().TableName, builder.ToSqlString());
            DataTable      dt     = _DataHelper.GetDataTable(sql);
            List <FeeInfo> result = new List <FeeInfo>();

            for (Int32 i = 0; i < dt.Rows.Count; i++)
            {
                FeeInfo info = String.IsNullOrEmpty(yearMonth) ? new FeeInfo() : new FeeMonthInfo();
                ORMapping.DataRowToObject(dt.Rows[i], info);
                result.Add(info);
            }
            return(result);
        }
Exemplo n.º 10
0
        private String GetTaxFeeID(String yearMonth, String taxFeeID)
        {
            if (String.IsNullOrEmpty(yearMonth))
            {
                yearMonth = DateTime.Now.ToString("yyyyMM");
            }
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeMonthInfoDBConst.FeeType, FeeType.Tax.ToString("D"));
            builder.AppendItem(String.Concat(FeeMonthInfoDBConst.StartDate, "<= DATEADD(Day,-1,CONVERT(CHAR(8),DATEADD(Month,1,'", yearMonth, "01'),120)+'1')"));
            WhereSqlClauseBuilder builderOr = new WhereSqlClauseBuilder(LogicOperatorDefine.Or);

            builderOr.AppendItem(FeeMonthInfoDBConst.FeeID, taxFeeID);
            builderOr.AppendItem(FeeMonthInfoDBConst.ParentID, taxFeeID);
            builder.AppendItem(builderOr.ToSqlString());
            FeeInfo feeInfo = GetFeeInfoList(yearMonth, builder).OrderBy(fee => fee.StartDate).FirstOrDefault();

            return(feeInfo.FeeID);
        }
        private Decimal CalculateCommonFeeValue(String yearMonth, String personID, String feeID)
        {
            FeeInfo                     feeInfo   = FeeInfoAdapter.Instance.LoadFeeInfo(yearMonth, feeID);
            String                      resultExp = this.ConvertCommonExp(yearMonth, feeInfo.CalculateExp);
            String                      parameterClausePattern = @"\[(.*?)\]";
            MatchCollection             parameterClauseMatchs  = Regex.Matches(resultExp, parameterClausePattern, RegexOptions.Singleline);
            Dictionary <String, String> para = parameterClauseMatchs.OfType <Match>().Select(i => i.Value).Distinct().ToDictionary(i => i, i => string.Empty);

            if (parameterClauseMatchs.Count == 0)
            {
                return(0);
            }
            foreach (String dt in para.Keys)
            {
                String            strFeeID          = dt.Replace("[", "").Replace("]", "");
                PersonBaseFeeInfo personBaseFeeInfo = this.LoadPersonBaseFeeInfo(PersonBaseFeeTarget.PersonBaseFee, yearMonth, personID, strFeeID);
                resultExp = resultExp.Replace(dt, personBaseFeeInfo.FeeValue.ToString());
            }
            return(Decimal.Parse(resultExp));
        }
Exemplo n.º 12
0
        private void UpdateCalculateExp(String yearMonth, String feeID)
        {
            FeeInfo feeInfo = this.LoadFeeInfo(yearMonth, feeID);

            if (feeInfo != null)
            {
                WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
                builder.AppendItem(FeeInfoDBConst.UseFlag, Status.True.ToString("D"));
                builder.AppendItem(FeeInfoDBConst.ParentID, feeID);
                String exp = String.Empty;
                foreach (FeeInfo fee in this.GetFeeInfoList(yearMonth, builder))
                {
                    if (!String.IsNullOrEmpty(fee.CalculateSign.Trim()))
                    {
                        exp += String.Concat(EnumHelper.GetDescription <CalculateSign>(fee.CalculateSign), " [", fee.FeeID, "] ");//Not第一个运算符不是+怎么办
                    }
                }
                feeInfo.CalculateExp = exp.Length > 1 ? exp.StartsWith("+") ? exp.Remove(0, 2) : exp : "";
                this.UpdateFeeInfo(feeInfo);
            }
        }
Exemplo n.º 13
0
        public Int32 ChangeStatus(String yearMonth, String feeID, Int32 userFlag)
        {
            FeeInfo feeInfo = this.LoadFeeInfo(yearMonth, feeID);
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeInfoDBConst.FeeID, feeID);
            if (!String.IsNullOrEmpty(yearMonth))
            {
                builder.AppendItem(FeeMonthInfoDBConst.YearMonth, yearMonth);
            }
            String sql = String.Format("UPDATE {0} SET USE_FLAG={1} WHERE {2} ", String.IsNullOrEmpty(yearMonth) ? FeeInfoDBConst.TableName : ORMapping.GetMappingInfo <FeeMonthInfo>().TableName, userFlag, builder.ToSqlString());

            using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Required))
            {
                int result = _DataHelper.ExecuteSql(sql);
                if (!String.IsNullOrEmpty(feeInfo.ParentID))
                {
                    this.UpdateCalculateExp(yearMonth, feeInfo.ParentID);
                }
                scope.Complete();
                return(result);
            }
        }
Exemplo n.º 14
0
        //将费用编码替换为名称
        public String ConvertFeeCodeWithFeeNameInExp(String yearMonth, String caculateExp)
        {
            String                      rtn = caculateExp;
            String                      parameterClausePattern = @"\[(.*?)\]";
            MatchCollection             parameterClauseMatchs  = Regex.Matches(rtn, parameterClausePattern, RegexOptions.Singleline);
            Dictionary <String, String> para = parameterClauseMatchs.OfType <Match>().Select(i => i.Value).Distinct().ToDictionary(i => i, i => string.Empty);

            if (parameterClauseMatchs.Count > 0)
            {
                foreach (String dt in para.Keys)
                {
                    String  strReplace = "";
                    FeeInfo feeInfo    = this.LoadFeeInfo(yearMonth, dt);
                    if (!String.IsNullOrEmpty(feeInfo.ParentID))
                    {
                        strReplace = String.Concat("{", feeInfo.ParentName, "}");
                    }
                    strReplace += feeInfo.FeeName;
                    rtn         = rtn.Replace(dt, String.Concat("[", strReplace, "]"));
                }
            }
            return(rtn);
        }
Exemplo n.º 15
0
        public bool IsFeeNameUsed(FeeInfo feeInfo, bool isAdd)
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            builder.AppendItem(FeeMonthInfoDBConst.FeeName, feeInfo.FeeName);
            FeeInfo info = GetFeeInfoList((feeInfo is FeeMonthInfo) ? ((FeeMonthInfo)feeInfo).YearMonth : null, builder).FirstOrDefault();

            if (info == null)
            {
                return(false);
            }
            else
            {
                if (isAdd)
                {
                    return(true);
                }
                else
                {
                    return(info.FeeID.Equals(feeInfo.FeeID) ? false : true);
                }
            }
        }
Exemplo n.º 16
0
        public String CreateFeeCode(String feeTypeValue, String parentFeeID)
        {
            String sql;
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            if (String.IsNullOrEmpty(parentFeeID))
            {
                builder.AppendItem(String.Concat("ISNULL(", FeeInfoDBConst.ParentID, ", '')"), "");
                if (!String.IsNullOrEmpty(feeTypeValue))
                {
                    builder.AppendItem(FeeInfoDBConst.FeeType, feeTypeValue);
                }
                sql = String.Format("SELECT ISNULL(MAX({1}) + 1,100) FROM {0} WHERE {2}", FeeInfoDBConst.TableName, FeeInfoDBConst.FeeCode, builder.ToSqlString());
            }
            else
            {
                FeeInfo parentFeeInfo = this.LoadFeeInfo(null, parentFeeID);
                builder.AppendItem(FeeInfoDBConst.ParentID, parentFeeID);
                sql = String.Format("SELECT ISNULL(MAX({1}) + 1,'{2}01') FROM {0} WHERE {3}", FeeInfoDBConst.TableName, FeeInfoDBConst.FeeCode, parentFeeInfo.FeeCode, builder.ToSqlString());
            }
            DataTable dt = _DataHelper.GetDataTable(sql);

            return(dt.Rows[0][0].ToString());
        }
Exemplo n.º 17
0
 public List<FeeInfo> GetReportFeeChildrenInfoList(String reportID, FeeInfo feeInfo)
 {
     WhereSqlClauseBuilder builderChilder = new WhereSqlClauseBuilder();
     builderChilder.AppendItem(FeeInfoDBConst.ParentID, feeInfo.FeeID);
     builderChilder.AppendItem(String.Concat(FeeInfoDBConst.FeeID, " NOT IN (SELECT FEE_ID FROM REPORT_FEE WHERE REPORT_ID='", reportID, "')"));
     List<FeeInfo> resultList = FeeInfoAdapter.Instance.GetFeeInfoList(null, builderChilder);
     List<FeeInfo> childrenList = new List<FeeInfo>();
     foreach (FeeInfo info in resultList)
     {
         childrenList.AddRange(this.GetReportFeeChildrenInfoList(reportID, info));
     }
     resultList.AddRange(childrenList);
     return resultList;
 }
Exemplo n.º 18
0
        public List<FeeInfo> GetReportCanSelectFeeList(string reportID)
        {
            String sql = String.Format(@"SELECT * FROM {0} WHERE ISNULL(PARENT_ID,'')='' AND use_flag=0 AND {3} NOT IN (SELECT {3} FROM {1} WHERE {4} ='{2}') ORDER BY {5}", FeeInfoDBConst.TableName, ReportFeeDBConst.TableName, reportID, FeeInfoDBConst.FeeID, ReportInfoDBConst.ReportID, FeeInfoDBConst.FeeCode);
            DataTable dt = _DataHelper.GetDataTable(sql);
            List<FeeInfo> resultFeeInfoList = new List<FeeInfo>();
            for (Int32 i = 0; i < dt.Rows.Count; i++)
            {
                FeeInfo info = new FeeInfo();
                ORMapping.DataRowToObject(dt.Rows[i], info);
                resultFeeInfoList.Add(info);
            }
            List<FeeInfo> childrenFeeInfoList = new List<FeeInfo>();
            foreach (FeeInfo feeInfo in resultFeeInfoList)
            {
                childrenFeeInfoList.AddRange(GetReportFeeChildrenInfoList(reportID, feeInfo));
            }
            resultFeeInfoList.AddRange(childrenFeeInfoList);

            //String sql = String.Format(@"SELECT * FROM {0} WHERE use_flag=0 AND {3} NOT IN (SELECT {3} FROM {1} WHERE {4} ='{2}') ORDER BY {5}", FeeInfoDBConst.TableName, ReportFeeDBConst.TableName, reportID, FeeInfoDBConst.FeeID, ReportInfoDBConst.ReportID, FeeInfoDBConst.FeeCode);
            //DataTable dt = _DataHelper.GetDataTable(sql);
            //List<FeeInfo> result = new List<FeeInfo>();
            //for (Int32 i = 0; i < dt.Rows.Count; i++)
            //{
            //    FeeInfo info = new FeeInfo();
            //    ORMapping.DataRowToObject(dt.Rows[i], info);
            //    result.Add(info);
            //}
            return resultFeeInfoList;
        }
Exemplo n.º 19
0
 public bool IsFeeNameUsed(FeeInfo feeInfo, bool isAdd)
 {
     WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
     builder.AppendItem(FeeMonthInfoDBConst.FeeName, feeInfo.FeeName);
     FeeInfo info = GetFeeInfoList((feeInfo is FeeMonthInfo) ? ((FeeMonthInfo)feeInfo).YearMonth : null, builder).FirstOrDefault();
     if (info == null)
     {
         return false;
     }
     else
     {
         if (isAdd)
         {
             return true;
         }
         else
         {
             return info.FeeID.Equals(feeInfo.FeeID) ? false : true;
         }
     }
 }
Exemplo n.º 20
0
 public Int32 UpdateFeeInfo(FeeInfo feeInfo)
 {
     using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Required))
     {
         String sql = sql = ORMapping.GetUpdateSql(feeInfo, BuilderEx.TSqlBuilderInstance);
         int result = _DataHelper.ExecuteSql(sql);
         if (!String.IsNullOrEmpty(feeInfo.ParentID))
         {
             this.UpdateCalculateExp((feeInfo is FeeMonthInfo) ? ((FeeMonthInfo)feeInfo).YearMonth : null, feeInfo.ParentID);
         }
         scope.Complete();
         return result;
     }
 }
Exemplo n.º 21
0
 public Int32 InsertPayMonthInfo(String yearMonth, bool rewrite)
 {
     using (TransactionScope scope = TransactionScopeFactory.Create(TransactionScopeOption.Required))
     {
         StringBuilder         sql     = new StringBuilder();
         WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
         if (rewrite)
         {
             builder.AppendItem(PayMonthInfoDBConst.YearMonth, yearMonth);
             this.DeletePayMonthInfo(builder);
             //工资月表
             foreach (PayMonthInfo payMonthInfo in PersonBaseFeeInfoAdapter.Instance.GetPersonBaseFeeInfoList(PersonBaseFeeTarget.PayMonth, yearMonth))
             {
                 sql.Append(ORMapping.GetInsertSql(payMonthInfo, BuilderEx.TSqlBuilderInstance));
                 sql.Append(";");
             }
         }
         else
         {
             builder.AppendItem(String.Concat(PersonInfoDBConst.EntryDate, "<= DATEADD(Day,-1,CONVERT(CHAR(8),DATEADD(Month,1,'", yearMonth, "01'),120)+'1')"));
             builder.AppendItem(String.Concat("ISNULL(", PersonInfoDBConst.LeftDate, ",DATEADD(Month,1,GETDATE()))"), yearMonth + "01", ">=");
             List <PersonInfo> personList = PersonInfoAdapter.Instance.GetPersonInfoList(builder);
             //工资项目月表
             foreach (FeeInfo feeInfo in FeeInfoAdapter.Instance.GetFeeInfoList(null, null))
             {
                 FeeMonthInfo feeMonthInfo = Tools.ClassDataCopy <FeeInfo, FeeMonthInfo>(feeInfo);
                 feeMonthInfo.YearMonth = yearMonth;
                 sql.Append(ORMapping.GetInsertSql(feeMonthInfo, BuilderEx.TSqlBuilderInstance));
                 sql.Append(";");
             }//人员基本工资月表
             foreach (PersonBaseFeeMonthInfo personBaseFeeMonthInfo in PersonBaseFeeInfoAdapter.Instance.GetPersonBaseFeeInfoList(PersonBaseFeeTarget.PersonBaseFeeMonth, null).Join(personList, baseFee => baseFee.PersonID, person => person.PersonID, (baseFeeDepart, person) => baseFeeDepart).ToList())
             {
                 personBaseFeeMonthInfo.YearMonth = yearMonth;
                 sql.Append(ORMapping.GetInsertSql(personBaseFeeMonthInfo, BuilderEx.TSqlBuilderInstance));
                 sql.Append(";");
                 //工资月表
                 FeeInfo feeInfo = FeeInfoAdapter.Instance.LoadFeeInfo(null, personBaseFeeMonthInfo.FeeID);
                 if (String.IsNullOrEmpty(feeInfo.CalculateExp))
                 {
                     PayMonthInfo PayMonthInfo = Tools.ClassDataCopy <PersonBaseFeeMonthInfo, PayMonthInfo>(personBaseFeeMonthInfo);
                     PayMonthInfo.YearMonth = yearMonth;
                     PayMonthInfo.PayMoney  = PayMonthInfo.FeeValue;
                     sql.Append(ORMapping.GetInsertSql(PayMonthInfo, BuilderEx.TSqlBuilderInstance));
                     sql.Append(";");
                 }
             }
             //人员基本工资项目部门分摊月表
             WhereSqlClauseBuilder builderDepartment = new WhereSqlClauseBuilder();
             foreach (PersonBaseFeeDepartmentProjectInfo personFeeDepartmentProjectInfo in PersonBaseFeeDepartmentProjectInfoAdapter.Instance.GetPersonBaseFeeDepartmentProjectInfoList(null, null).Join(personList, baseFeeDepart => baseFeeDepart.PersonID, person => person.PersonID, (baseFeeDepart, person) => baseFeeDepart).ToList())
             {
                 PersonBaseFeeDepartmentProjectMonthInfo personFeeDepartmentProjectMonthInfo = Tools.ClassDataCopy <PersonBaseFeeDepartmentProjectInfo, PersonBaseFeeDepartmentProjectMonthInfo>(personFeeDepartmentProjectInfo);
                 personFeeDepartmentProjectMonthInfo.YearMonth = yearMonth;
                 sql.Append(ORMapping.GetInsertSql(personFeeDepartmentProjectMonthInfo, BuilderEx.TSqlBuilderInstance));
                 sql.Append(";");
             }
             //税率月表
             builder.Clear();
             foreach (TaxInfo taxInfo in TaxInfoAdapter.Instance.GetTaxInfoList(null, builder))
             {
                 TaxMonthInfo taxMonthInfo = Tools.ClassDataCopy <TaxInfo, TaxMonthInfo>(taxInfo);
                 taxMonthInfo.YearMonth = yearMonth;
                 sql.Append(ORMapping.GetInsertSql(taxMonthInfo, BuilderEx.TSqlBuilderInstance));
                 sql.Append(";");
             }
         }
         int result = _DataHelper.ExecuteSql(sql.ToString());
         scope.Complete();
         return(result);
     }
 }