Пример #1
0
        public void GenerateCallDayPlanning(Guid id)
        {
            RouteUserMappingEntity usermapEntity = new RouteBLL(CurrentUserInfo).GetRouteUser(id);
            IDbTransaction         tran          = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    if (usermapEntity.ClientUserID.HasValue)
                    {
                        this._currentDAO.GenerateCallDayPlanning(id, usermapEntity.ClientUserID.Value.ToString(), tran);
                    }
                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 删除路线
        /// </summary>
        /// <param name="id"></param>
        public void DeleteRoute(Guid id)
        {
            RouteUserMappingEntity usermapEntity = new RouteBLL(CurrentUserInfo).GetRouteUser(id);
            IDbTransaction         tran          = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    this._currentDAO.DeleteRoute(id, tran);

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }

            this.GenerateCallDayPlanning_RouteDelete(id, usermapEntity);
        }
Пример #3
0
        /// <summary>
        /// 分页数据
        /// </summary>
        /// <param name="pSearch">查询条件</param>
        /// <param name="pPageSize">分页数</param>
        /// <param name="pPageIndex">当前页</param>
        /// <returns>数据,记录数,页数</returns>
        public PageResultEntity GetRouteStoreList(List <DefindControlEntity> pSearch, int?pPageSize, int?pPageIndex, string routeid)
        {
            //通过routeid 获取 clientuserid
            RouteUserMappingEntity userEntity = new RouteBLL(CurrentUserInfo).GetRouteUser(Guid.Parse(routeid));

            StringBuilder sql = new StringBuilder();

            sql.Append(base.GetTempSql());                                                        //需要生成的临时表
            sql.AppendLine("select ");
            sql.Append(new StoreDefindModuleBLL(CurrentUserInfo, "Store").GetStoreGridFildSQL()); //获取字SQL

            //new
            sql.AppendFormat(" RPOPM.MappingID,cast('{0}' as uniqueidentifier) as RouteID,RPOPM.POPID,RPOPM.Sequence, ", routeid);

            sql.AppendLine("ROW_NUMBER() OVER( order by case when RPOPM.MappingID is null then 1 else 0 end asc,RPOPM.Sequence asc,RPOPM.CreateTime asc) ROW_NUMBER,");
            sql.AppendLine("main.StoreID into #outTemp");
            sql.AppendLine("from Store main");
            sql.Append(new StoreDefindModuleBLL(CurrentUserInfo, "Store").GetStoreLeftGridJoinSQL());      //获取联接SQL
            sql.AppendLine("");
            sql.Append(new StoreDefindModuleBLL(CurrentUserInfo, "Store").GetStoreSearchJoinSQL(pSearch)); //获取条件联接SQL

            //new
            sql.AppendLine(string.Format(" inner join (select distinct StoreID from dbo.fnGetStoreByUserID('{0}',1)) fn_sad on  CONVERT(nvarchar(100),main.StoreID) = CONVERT(nvarchar(100),fn_sad.StoreID) ", userEntity.ClientUserID));

            sql.AppendFormat(" left join RoutePOPMapping RPOPM on cast(main.StoreID as nvarchar(200))=RPOPM.POPID and RPOPM.isdelete=0 and cast(RPOPM.RouteID as nvarchar(200))='{0}' and RPOPM.ClientID={1} and RPOPM.ClientDistributorID={2}",
                             routeid,
                             CurrentUserInfo.ClientID,
                             CurrentUserInfo.ClientDistributorID);

            sql.AppendLine(string.Format("Where main.IsDelete=0 and main.ClientID={0}",
                                         base._pUserInfo.ClientID));

            sql.Append(new StoreDefindModuleBLL(CurrentUserInfo, "").GetStroeGridSearchSQL(pSearch)); //获取条件
            sql.Append(base.GetPubPageSQL(pPageSize, pPageIndex));
            sql.Append(base.GetDropTempSql());                                                        //需要删除的临时表
            return(base.GetPageData(sql.ToString()));
        }