コード例 #1
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);

                    if (!Agents.ContainsKey(model.AgentID))
                    {
                        Agents.Add(model.AgentID, model);
                    }
                    return Agents[agentid];
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return Agents[agentid];
            }
            
        }
コード例 #2
0
ファイル: AgentsBusiness.cs プロジェクト: GitMr/YXERP
        /// <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;
        }