Exemplo n.º 1
0
        /// <summary>
        /// 获取返佣明细信息集合
        /// </summary>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="companyId">公司编号(专线)</param>
        /// <param name="buyerCompanyId">客户单位编号(组团)</param>
        /// <param name="buyerContactId">客户单位联系人编号</param>
        /// <param name="commissionType">返佣类型</param>
        /// <param name="searchInfo">查询信息</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.StatisticStructure.MCommissionDetailInfo> GetCommissionDetails(int pageSize, int pageIndex, ref int recordCount
                                                                                                    , int companyId, int buyerCompanyId, int buyerContactId, EyouSoft.Model.EnumType.CompanyStructure.CommissionType commissionType
                                                                                                    , EyouSoft.Model.StatisticStructure.MCommissionStatSeachInfo searchInfo)
        {
            if (companyId < 1 || buyerCompanyId < 1 || buyerContactId < 1)
            {
                throw new System.Exception("方法参数(companyId,buyerCompanyId,buyerContactId都要赋值)传递不正确。");
            }

            return(_dal.GetCommissionDetails(pageSize, pageIndex, ref recordCount
                                             , companyId, buyerCompanyId, buyerContactId, commissionType
                                             , searchInfo));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取返佣明细信息集合
        /// </summary>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="companyId">公司编号(专线)</param>
        /// <param name="buyerCompanyId">客户单位编号(组团)</param>
        /// <param name="buyerContactId">客户单位联系人编号</param>
        /// <param name="commissionType">返佣类型</param>
        /// <param name="searchInfo">查询信息</param>
        /// <returns></returns>
        public IList <EyouSoft.Model.StatisticStructure.MCommissionDetailInfo> GetCommissionDetails(int pageSize, int pageIndex, ref int recordCount
                                                                                                    , int companyId, int buyerCompanyId, int buyerContactId, EyouSoft.Model.EnumType.CompanyStructure.CommissionType commissionType
                                                                                                    , EyouSoft.Model.StatisticStructure.MCommissionStatSeachInfo searchInfo)
        {
            IList <EyouSoft.Model.StatisticStructure.MCommissionDetailInfo> items = new List <EyouSoft.Model.StatisticStructure.MCommissionDetailInfo>();
            StringBuilder cmdQuery      = new StringBuilder();
            string        tableName     = "tbl_TourOrder";
            string        primaryKey    = "Id";
            string        orderByString = "IssueTime DESC";
            string        fields        = "TourId,RouteName,TourNo,ID,OrderNo,AdultNumber,ChildNumber,SumPrice,LastOperatorID,CommissionType,CommissionPrice,CommissionStatus,BuyCompanyID,BuyCompanyName,BuyerContactId,BuyerContactName,(SELECT [ContactName] FROM [tbl_CompanyUser] AS A WHERE A.[Id]=tbl_TourOrder.LastOperatorID) AS OperatorName";

            cmdQuery.AppendFormat(" SellCompanyId={0} ", companyId);
            cmdQuery.AppendFormat(" AND BuyCompanyID={0} ", buyerCompanyId);
            cmdQuery.AppendFormat(" AND BuyerContactId={0} ", buyerContactId);
            cmdQuery.AppendFormat(" AND CommissionType={0} ", (int)commissionType);
            cmdQuery.AppendFormat(" AND OrderState not in ({0},{1}) ", (int)Model.EnumType.TourStructure.OrderState.受理, (int)Model.EnumType.TourStructure.OrderState.留位过期);
            cmdQuery.Append(" AND IsDelete='0' ");

            if (searchInfo != null)
            {
                if (searchInfo.LeaveDateStart.HasValue)
                {
                    cmdQuery.AppendFormat(" AND LeaveDate>='{0}' ", searchInfo.LeaveDateStart.Value);
                }
                if (searchInfo.LeaveDateEnd.HasValue)
                {
                    cmdQuery.AppendFormat(" AND LeaveDate<='{0}' ", searchInfo.LeaveDateEnd.Value.AddDays(1).AddMilliseconds(-1));
                }
                if (searchInfo.OperatorId != null && searchInfo.OperatorId.Length > 0)
                {
                    cmdQuery.AppendFormat(" AND LastOperatorID IN({0}) ", Utils.GetSqlIdStrByArray(searchInfo.OperatorId));
                }
                if (searchInfo.OrderDateStart.HasValue)
                {
                    cmdQuery.AppendFormat(" AND IssueTime>='{0}' ", searchInfo.OrderDateStart.Value);
                }
                if (searchInfo.OrderDateEnd.HasValue)
                {
                    cmdQuery.AppendFormat(" AND IssueTime<='{0}' ", searchInfo.OrderDateEnd.Value.AddDays(1).AddMilliseconds(-1));
                }
            }

            using (IDataReader rdr = DbHelper.ExecuteReader(this._db, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, cmdQuery.ToString(), orderByString))
            {
                while (rdr.Read())
                {
                    items.Add(new MCommissionDetailInfo()
                    {
                        AdultNumber     = rdr.GetInt32(rdr.GetOrdinal("AdultNumber")),
                        ChildrenNumber  = rdr.GetInt32(rdr.GetOrdinal("ChildNumber")),
                        CommissionPrice = rdr.GetDecimal(rdr.GetOrdinal("CommissionPrice")),
                        IsPaid          = this.GetBoolean(rdr.GetString(rdr.GetOrdinal("CommissionStatus"))),
                        OperatorId      = rdr.GetInt32(rdr.GetOrdinal("LastOperatorID")),
                        OperatorName    = rdr["OperatorName"].ToString(),
                        OrderAmount     = rdr.GetDecimal(rdr.GetOrdinal("SumPrice")),
                        OrderId         = rdr.GetString(rdr.GetOrdinal("Id")),
                        OrderNo         = rdr.GetString(rdr.GetOrdinal("OrderNo")),
                        RouteName       = rdr["RouteName"].ToString(),
                        TourCode        = rdr.GetString(rdr.GetOrdinal("TourNo")),
                        TourId          = rdr.GetString(rdr.GetOrdinal("TourId"))
                    });
                }
            }

            return(items);
        }