Beispiel #1
0
        /// <summary>
        /// 更新代理商缓存
        /// </summary>
        /// <param name="agentID"></param>
        /// <returns></returns>
        public static bool UpdatetAgentCache(string agentID)
        {
            if (Agents.ContainsKey(agentID))
            {
                DataTable dt    = AgentsDAL.BaseProvider.GetAgentDetail(agentID);
                Agents    model = new Agents();
                if (dt.Rows.Count == 1)
                {
                    DataRow row = dt.Rows[0];
                    model.FillData(row);

                    Agents[agentID] = model;
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// 获取代理商详情
        /// </summary>
        /// <param name="agentID"></param>
        /// <returns></returns>
        public static Agents GetAgentDetail(string agentID)
        {
            if (!Agents.ContainsKey(agentID))
            {
                DataTable dt    = AgentsDAL.BaseProvider.GetAgentDetail(agentID);
                Agents    model = new Agents();
                if (dt.Rows.Count == 1)
                {
                    DataRow row = dt.Rows[0];
                    model.FillData(row);

                    Agents.Add(model.AgentID, model);
                }
                else
                {
                    return(null);
                }
            }

            return(Agents[agentID]);
        }