using System;
using System.Collections.Generic;
using System.Text;
namespace ChainOfRespExample
{
class Program
{
static List<CustomerService> gmTeam = new List<CustomerService>();
static List<CustomerService> managerTeam = new List<CustomerService>();
static List<CustomerService> directorTeam = new List<CustomerService>();
static Random random = new Random();
static void InitCOR()
{
if (managerTeam.Count > 0)
{
foreach (CustomerService cs in gmTeam)
cs.SetLeader(managerTeam[random.Next(managerTeam.Count)]);
}
else
{
foreach (CustomerService cs in gmTeam)
cs.SetLeader(directorTeam[random.Next(directorTeam.Count)]);
}
foreach (CustomerService cs in managerTeam)
cs.SetLeader(directorTeam[random.Next(directorTeam.Count)]);
// These configs above depends on business logic.
}
static void InitGM()
{
for (int i = 1; i <= 9; i++)
{
CustomerService gm = new NormalGM("gm" + i);
gm.SetResponsibleCaseCategory(new int[] { 1, 2 });
gmTeam.Add(gm);
}
for (int i = 1; i <= 2; i++)
{
CustomerService manager = new GMManager("manager" + i);
manager.SetResponsibleCaseCategory(new int[] { 3, 4 });
managerTeam.Add(manager);
}
for (int i = 1; i <=1; i++)
directorTeam.Add(new GMDirector("director" + i));
// These configs above should be from database.
}
static void Main(string[] args)
{
InitGM();
InitCOR();
CustomerService gm = gmTeam[random.Next(gmTeam.Count)];
gm.HandleCase(new Case(1, false));
Console.WriteLine(Environment.NewLine);
gm = gmTeam[random.Next(gmTeam.Count)];
gm.HandleCase(new Case(2, true));
Console.WriteLine(Environment.NewLine);
gm = gmTeam[random.Next(gmTeam.Count)];
gm.HandleCase(new Case(3, false));
Console.WriteLine(Environment.NewLine);
gm = gmTeam[random.Next(gmTeam.Count)];
gm.HandleCase(new Case(4, true));
Console.WriteLine(Environment.NewLine);
gm = gmTeam[random.Next(gmTeam.Count)];
gm.HandleCase(new Case(5, true));
}
}
class Case
{
private int caseCategory;
public int CaseCategory
{
get { return caseCategory; }
}
private bool importantCase;
public bool ImportantCase
{
get { return importantCase; }
}
private string reply;
public string Reply
{
get { return reply ; }
set { reply = value; }
}
public Case(int caseCategory, bool importantCase)
{
this.caseCategory = caseCategory;
this.importantCase = importantCase;
}
}
abstract class CustomerService
{
protected CustomerService leader;
protected List<int> responsibleCaseCategory = new List<int>();
protected string name;
public string Name
{
get { return name; }
}
public CustomerService(string name)
{
this.name = name;
}
public void SetLeader(CustomerService leader)
{
this.leader = leader;
}
public abstract void HandleCase(Case gameCase);
public void SetResponsibleCaseCategory(int[] responsibleCaseCategory)
{
foreach (int i in responsibleCaseCategory)
this.responsibleCaseCategory.Add(i);
}
}
class NormalGM : CustomerService
{
public NormalGM(string name) : font-size: 10
分享到:
Global site tag (gtag.js) - Google Analytics
|
相关推荐
RESP.app GUI for Redis离线安装包下载(原Redis Desktop Manager)
最新版本 Redis 可视化客户端软件,RedisDesktopManager 最新版本 RESP.app 2022.5 GUI for Redis,Windows 64 位最新版本,安全可靠,下载直接安装可用。
Windows Reids可视化工具RESP 版本2022.1的安装包。一款比较稳定简洁的 redis UI 工具。
mvn_resp.rar
LEON 2 SystemC model on ReSP, 21页,目录如下: 1 Leon 2 5 1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2 Architecture Description . . . . . . . . . . . . . . . . . ...
defer resp.Body.Close() // Don't forget close the response body POST: req.Data = map[string]string{ "key": "value", "a": "123", } resp, err := req.Post("http://httpbin.org/post")...
RedisDesktopManager 2022.5.0.0
resp.Write("<table class='table'><tr><th>" +"文件标题"+ "</th><th>" + "档案类别" + "</th><th>" +"发文日期" + "</th><th>" +"文件链接" + "</th><th>" +"备注" + "</th></tr>"); //VideoList = (List)...
redis windows最终版 RESP.app_RedisDesktopManager_2022.5.zip
已经编译好的windows x64位版本的redis desktop manager
JAVAHttpClientThe server failed to respond with a validCaused by: org.apache.htt
Chain of Resp. A way of passing a request between a chain of objects Command Encapsulate a command request as an object Interpreter A way to include language elements in a program Iterator ...
RedisDesktopManager 2022.0.0.0
截至2024年3月14日,我无法直接提供resp-2022.2这个特定版本的Redis,因为Redis官方发布版本格式通常是`redis-x.y.z.tar.gz`,其中x、y、z代表主版本号、次版本号和修订版本号。 如果您想安装Redis的某个特定历史...
windows 64位 已编译好的安装程序(编译之路漫长,此程序由官方编译) Redis桌面管理器(又名RDM) -是一个可以应用于Windows, Linux和MacOS操作系统的快速开源的Redis数据库管理应用程序。这个工具为你提供了一个...
resp = s.send(url) POST 使用data参数 api = 'https://xxx.xxx.xxx' data = { 'key1': 'value1', 'key2': 'value2' } resp = s.send(api, data=data) 使用json参数 api = 'https://xxx.xxx.xxx' json = { 'key1'...
ERP系统信息化资料:OOCU_RESP_维护支持人员自动确定.doc
RedisDesktopManager 2022.1.0.0
1. 发送普通的GET请求 func testGet() { ...resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close() fmt.Println(response Status:, resp....fmt.Println(response Headers:, resp.Header)
html-css-resp-wannabe:31.03.21