/// <summary> /// 修改线路库线路团队收客数,上团数 /// </summary> /// <param name="RouteId">线路编号</param> /// <param name="type">团队上团数和收客数修改类型</param> /// <returns></returns> public bool UpdateRouteSomething(int[] RouteId, EyouSoft.Model.EnumType.TourStructure.UpdateTourType type) { bool IsTrue = false; EyouSoft.DAL.TourStructure.TourOrder dal = new EyouSoft.DAL.TourStructure.TourOrder(); string RouteIds = dal.ConvertIntArrayTostring(RouteId); DbCommand dc = this._db.GetStoredProcCommand("proc_UpdateTourCountOrVisitorCount"); this._db.AddInParameter(dc, "RouteId", DbType.AnsiString, RouteIds); this._db.AddInParameter(dc, "UpdateTourType", DbType.Int32, (int)type); this._db.AddOutParameter(dc, "Result", DbType.Int32, 4); DbHelper.RunProcedure(dc, _db); object Result = this._db.GetParameterValue(dc, "Result"); dal = null; if (!Result.Equals(null)) { IsTrue = int.Parse(Result.ToString()) > 0 ? true : false; } return(IsTrue); }
/// <summary> /// 根据查询条件生成SqlWhere语句 /// </summary> /// <param name="queryInfo">查询条件实体</param> /// <param name="orderByStr">排序字符串</param> /// <param name="haveUserIds">用户Id集合,半角逗号分割</param> /// <returns>SqlWhere语句</returns> private string GetSqlWhereByQuery(EyouSoft.Model.StatisticStructure.QueryAccountAgeStatistic queryInfo , string haveUserIds, ref string orderByStr) { if (queryInfo == null || queryInfo.CompanyId <= 0) { return(" group by salerid "); } StringBuilder Query = new StringBuilder(); Query.AppendFormat(" CompanyId={0} ", queryInfo.CompanyId); orderByStr = queryInfo.OrderIndex == 0 ? " salerid asc" : " salerid desc "; EyouSoft.DAL.TourStructure.TourOrder ConvertDal = new EyouSoft.DAL.TourStructure.TourOrder(); if (queryInfo.AreaId > 0) { Query.AppendFormat(" AND areaid={0} ", queryInfo.AreaId); } if (queryInfo.SaleIds != null && queryInfo.SaleIds.Length > 0) { string salerIds = ConvertDal.ConvertIntArrayTostring(queryInfo.SaleIds); Query.AppendFormat(" AND SalerId in({0})", salerIds); } if (queryInfo.BuyCompanyId != null && queryInfo.BuyCompanyId.Length > 0) { string BuyCompanyIds = ConvertDal.ConvertIntArrayTostring(queryInfo.BuyCompanyId); Query.AppendFormat(" AND BuyCompanyId in({0})", BuyCompanyIds); } if (!string.IsNullOrEmpty(queryInfo.BuyCompanyName)) { Query.AppendFormat(" AND BuyCompanyName LIKE '%{0}%' ", queryInfo.BuyCompanyName); } if (queryInfo.TourType.HasValue) { Query.AppendFormat(" AND TourType={0}", (int)queryInfo.TourType.Value); } if (queryInfo.LeaveDateStart.HasValue) { Query.AppendFormat(" AND DATEDIFF(DAY,'{0}',LeaveDate)>=0", queryInfo.LeaveDateStart); } if (queryInfo.LeaveDateEnd.HasValue) { Query.AppendFormat(" AND DATEDIFF(DAY,LeaveDate,'{0}')>=0", queryInfo.LeaveDateEnd); } if (queryInfo.ComputeOrderType == EyouSoft.Model.EnumType.CompanyStructure.ComputeOrderType.统计有效订单) { Query.AppendFormat(" AND OrderState in ({0},{1},{2})", (int)Model.EnumType.TourStructure.OrderState.未处理, (int)Model.EnumType.TourStructure.OrderState.已成交, (int)Model.EnumType.TourStructure.OrderState.已留位); } else if (queryInfo.ComputeOrderType == EyouSoft.Model.EnumType.CompanyStructure.ComputeOrderType.统计确认成交订单) { Query.AppendFormat(" AND OrderState = {0} ", (int)Model.EnumType.TourStructure.OrderState.已成交); } if (queryInfo.IsAccount.HasValue) { if (queryInfo.IsAccount.Value) { Query.Append(" and TotalAmount <> 0 and TotalAmount = HasCheckAmount ");// + NotCheckAmount } else { Query.Append(" and TotalAmount <> 0 and TotalAmount <> HasCheckAmount ");//+ + NotCheckAmount } } if (!string.IsNullOrEmpty(haveUserIds)) { Query.AppendFormat(" and TourOperatorId in ({0}) ", haveUserIds); } Query.Append(" group by salerid "); return(Query.ToString()); }