예제 #1
0
        /// <summary>
        /// 获取某个门店的通告信息
        /// </summary>
        /// <param name="customerID">客户ID</param>
        /// <param name="userID">操作用户ID</param>
        /// <param name="unitID">门店ID</param>
        /// <param name="startNo">上次获取的最大的通告编号</param>
        /// <returns></returns>
        public IList <AnnounceQueryInfo> SearchAnnounceList(string customerID, string userID, string unitID, int startNo)
        {
            LoggingSessionInfo loggingSession = this.GetLoggingSessionInfo(customerID, userID, unitID);
            ExchangeService    e_service      = new ExchangeService();
            Hashtable          ht             = new Hashtable();

            ht.Add("UnitID", unitID);
            ht.Add("StartNo", startNo);
            SelectObjectResultsInfo <AnnounceQueryInfo> ret = e_service.SelectDownloadAnnounceList(loggingSession, ht, 200, 0);

            return(ret.Data);
        }
예제 #2
0
        /// <summary>
        /// 获取满足查询条件的通告的某页上的所有通告
        /// </summary>
        /// <param name="loggingSession">当前登录的信息</param>
        /// <param name="condition">UnitID:通告单位;StartNo:起始编号</param>
        /// <param name="maxRowCount">每页所占行数</param>
        /// <param name="startRowIndex">当前页的起始行数</param>
        /// <returns>满足条件的终端的列表</returns>
        public SelectObjectResultsInfo <AnnounceQueryInfo> SelectDownloadAnnounceList(LoggingSessionInfo loggingSession, Hashtable condition, int maxRowCount, int startRowIndex)
        {
            condition.Add("StartRow", startRowIndex);
            condition.Add("EndRow", startRowIndex + maxRowCount);
            condition.Add("MaxRowCount", maxRowCount);

            SelectObjectResultsInfo <AnnounceQueryInfo> ret = new SelectObjectResultsInfo <AnnounceQueryInfo>();

            ISqlMapper sqlMap = cSqlMapper.Instance(loggingSession.CurrentLoggingManager);

            //查某页上的通告
            ret.Data = sqlMap.QueryForList <AnnounceQueryInfo>("Exchange.Announce.SelectAnnounceList3", condition);

            return(ret);
        }
예제 #3
0
        /// <summary>
        /// 获取满足查询条件的通告的某页上的所有通告
        /// </summary>
        /// <param name="loggingSession">当前登录的信息</param>
        /// <param name="condition">Title:主题;BeginDate:通告起始日期;EndDate:通告结束日期;UnitID:通告单位;AllowDownload:允许下发;StartNo:起始编号</param>
        /// <param name="maxRowCount">每页所占行数</param>
        /// <param name="startRowIndex">当前页的起始行数</param>
        /// <returns>满足条件的终端的列表</returns>
        public SelectObjectResultsInfo <AnnounceQueryInfo> SelectAnnounceList(LoggingSessionInfo loggingSession, Hashtable condition, int maxRowCount, int startRowIndex)
        {
            condition.Add("UserID", loggingSession.CurrentUser.User_Id);
            condition.Add("RoleID", loggingSession.CurrentUserRole.RoleId);

            condition.Add("StartRow", startRowIndex);
            condition.Add("EndRow", startRowIndex + maxRowCount);
            condition.Add("MaxRowCount", maxRowCount);

            SelectObjectResultsInfo <AnnounceQueryInfo> ret = new SelectObjectResultsInfo <AnnounceQueryInfo>();
            IList <AnnounceUnitInfo> announce_unit_lst      = null;

            ISqlMapper sqlMap = cSqlMapper.Instance(loggingSession.CurrentLoggingManager);

            try
            {
                sqlMap.BeginTransaction();
                //插入满足条件的单位进临时表
                cPos.Model.Unit.UnitQueryCondition unitQueryCondition = new Model.Unit.UnitQueryCondition();
                if (condition.Contains("UnitID"))
                {
                    unitQueryCondition.SuperUnitIDs.Add(condition["UnitID"].ToString());
                }
                condition.Add("UnitSQL", this.GenInsertUnitTemporaryTableSQL(loggingSession, unitQueryCondition));

                //查某页上的通告
                ret.Data = sqlMap.QueryForList <AnnounceQueryInfo>("Exchange.Announce.SelectAnnounceList2", condition);
                //有StartNo查询条件,表示是从终端发起的查询,不需要单位
                if (!condition.ContainsKey("StartNo"))
                {
                    if (ret.Data != null && ret.Data.Count > 0)
                    {
                        //查通告的通告单位
                        StringBuilder sb = new StringBuilder(string.Format("b.announce_id='{0}' ", ret.Data[0].ID));
                        for (int i = 1; i < ret.Data.Count; i++)
                        {
                            sb.Append(string.Format("or b.announce_id='{0}' ", ret.Data[i].ID));
                        }
                        announce_unit_lst = sqlMap.QueryForList <AnnounceUnitInfo>("Exchange.AnnounceUnit.SelectByCondition", sb.ToString());
                    }
                }

                sqlMap.CommitTransaction();
            }
            catch (Exception ex)
            {
                sqlMap.RollBackTransaction();
                throw ex;
            }

            if (announce_unit_lst != null && announce_unit_lst.Count > 0)
            {
                foreach (AnnounceInfo a in ret.Data)
                {
                    foreach (AnnounceUnitInfo au in announce_unit_lst)
                    {
                        if (au.Announce.ID == a.ID)
                        {
                            a.AnnounceUnits.Add(au);
                        }
                    }
                }
            }
            return(ret);
        }