当前位置: 首页 > news >正文

上海网站制作建设怎么样友谊平台

上海网站制作建设怎么样,友谊平台,做网站先做前台还是后台,自己做的网站如何用手机去查看责任链模式:请求从链中的一个对象传递到下一个对象,直到请求被响应为止。通过这种方式在对象之间去除耦合。 用途:请假审批、采购审批等。 案例介绍:以公司采购东西为例子来实现责任链模式。公司规定,采购架构总价在…

责任链模式:请求从链中的一个对象传递到下一个对象,直到请求被响应为止。通过这种方式在对象之间去除耦合。

用途:请假审批、采购审批等。

案例介绍:以公司采购东西为例子来实现责任链模式。公司规定,采购架构总价在1万之内,经理级别的人批准即可,总价大于1万小于2万5的则还需要副总进行批准,总价大于2万5小于10万的需要还需要总经理批准,而大于总价大于10万的则需要组织一个会议进行讨论

审批类: 

    /// <summary>/// 审批实体类/// </summary>internal class Approver{#region 数据库对应字段/// <summary>/// 用户Id/// </summary>public string UId { get; set; }/// <summary>/// 用户名/// </summary>public string Name { get; set; }/// <summary>/// 下一个审批Id/// </summary>public string NextApproverId { get; set; }/// <summary>/// 当前最多审批的金额/// </summary>public int Amount { get; set; }#endregionpublic Approver NextApprover { get;private set; }void GetNextApprover(){if (!string.IsNullOrWhiteSpace(NextApproverId)){// 查找数据库NextApprover = TestData.GetDataWithUId(NextApproverId);}}public virtual void ProcessRequest(PurchaseRequest request){GetNextApprover();if (request.Amount <= Amount){Console.WriteLine($"[{Name}] 批准了购买 [{request.ProductName}] 的请求");}else{if (NextApprover == null)Console.WriteLine($"需要开会讨论购买 [{request.ProductName}]");}if (NextApprover != null){NextApprover.ProcessRequest(request);}}}

 采购类:

    /// <summary>/// 采购请求/// </summary>internal class PurchaseRequest{// 金额public double Amount { get; set; }// 产品名字public string ProductName { get; set; }public PurchaseRequest(double amount, string productName){Amount = amount;ProductName = productName;}}

测试数据:

internal class TestData{static List<Approver> approvers;static TestData(){approvers = new List<Approver>(3);Approver approver1 = new Approver(){UId = Guid.NewGuid().ToString(),Name = "王总",Amount = 100000};Approver approver2 = new Approver(){UId = Guid.NewGuid().ToString(),Name = "李副总",NextApproverId = approver1.UId,Amount = 25000};Approver approver3 = new Approver(){UId = Guid.NewGuid().ToString(),Name = "孙经理",NextApproverId = approver2.UId,Amount = 10000};approvers.Add(approver1);approvers.Add(approver2);approvers.Add(approver3);}internal static List<Approver> GetDatas(){return approvers;}internal static List<Approver> GetDatas(Func<Approver, bool> func){return approvers.Where(func).ToList();}internal static Approver GetDataWithUId(string uid){return GetData((t) => t.UId == uid);}internal static Approver GetData(Func<Approver, bool> func){return approvers.FirstOrDefault(func);}}

测试用例:

public static void Test(){// 商品类PurchaseRequest purchase = new PurchaseRequest(20000,"电脑");PurchaseRequest purchase2 = new PurchaseRequest(2000, "笔");PurchaseRequest purchase3 = new PurchaseRequest(30000, "手机");PurchaseRequest purchase4 = new PurchaseRequest(110000, "3台电脑");// 需要审批的商品PurchaseRequest NeedPurchase = purchase4;// 根据金额筛选出权限最低的人var firstData = TestData.GetDatas().Where(t=>t.Amount>= NeedPurchase.Amount).OrderBy(t => t.Amount).FirstOrDefault();if (firstData == null)firstData = TestData.GetDatas().OrderByDescending(t => t.Amount).LastOrDefault();// 开始审批firstData.ProcessRequest(NeedPurchase);}

 

 

 

 

 

 


文章转载自:
http://coleta.tsnq.cn
http://stenciler.tsnq.cn
http://marconi.tsnq.cn
http://coxal.tsnq.cn
http://matroclinous.tsnq.cn
http://preordain.tsnq.cn
http://glide.tsnq.cn
http://assertion.tsnq.cn
http://maoritanga.tsnq.cn
http://rubeola.tsnq.cn
http://divisible.tsnq.cn
http://boa.tsnq.cn
http://realisable.tsnq.cn
http://pennyweight.tsnq.cn
http://sava.tsnq.cn
http://ragee.tsnq.cn
http://redemptorist.tsnq.cn
http://scv.tsnq.cn
http://minuteman.tsnq.cn
http://turco.tsnq.cn
http://rill.tsnq.cn
http://oddfish.tsnq.cn
http://anthroposociology.tsnq.cn
http://connate.tsnq.cn
http://utilidor.tsnq.cn
http://unfathomed.tsnq.cn
http://utricle.tsnq.cn
http://conglomeratic.tsnq.cn
http://rubricate.tsnq.cn
http://hellward.tsnq.cn
http://tormenting.tsnq.cn
http://metonymic.tsnq.cn
http://rathskeller.tsnq.cn
http://countermure.tsnq.cn
http://chortle.tsnq.cn
http://itching.tsnq.cn
http://silently.tsnq.cn
http://twist.tsnq.cn
http://matrilineage.tsnq.cn
http://distasteful.tsnq.cn
http://lacrymatory.tsnq.cn
http://nonessential.tsnq.cn
http://exercitant.tsnq.cn
http://semiscientific.tsnq.cn
http://broad.tsnq.cn
http://humbuggery.tsnq.cn
http://rusine.tsnq.cn
http://masticable.tsnq.cn
http://atilt.tsnq.cn
http://bruxism.tsnq.cn
http://hedgeshrew.tsnq.cn
http://longline.tsnq.cn
http://justifier.tsnq.cn
http://degerm.tsnq.cn
http://vinca.tsnq.cn
http://ju.tsnq.cn
http://eolian.tsnq.cn
http://germ.tsnq.cn
http://anywise.tsnq.cn
http://yankeeism.tsnq.cn
http://chresard.tsnq.cn
http://venostasis.tsnq.cn
http://intercommunicate.tsnq.cn
http://nook.tsnq.cn
http://sclc.tsnq.cn
http://mucous.tsnq.cn
http://cerebrum.tsnq.cn
http://refection.tsnq.cn
http://inquisitorial.tsnq.cn
http://furtherance.tsnq.cn
http://intuitive.tsnq.cn
http://tetrasepalous.tsnq.cn
http://enwind.tsnq.cn
http://raggedly.tsnq.cn
http://prince.tsnq.cn
http://atkins.tsnq.cn
http://fenestrate.tsnq.cn
http://unfleshly.tsnq.cn
http://choledochostomy.tsnq.cn
http://optician.tsnq.cn
http://vibrograph.tsnq.cn
http://strenuous.tsnq.cn
http://vola.tsnq.cn
http://gaywings.tsnq.cn
http://mailcoach.tsnq.cn
http://jointly.tsnq.cn
http://goa.tsnq.cn
http://muddler.tsnq.cn
http://iodophor.tsnq.cn
http://birdy.tsnq.cn
http://recirculate.tsnq.cn
http://apterous.tsnq.cn
http://retroreflection.tsnq.cn
http://tranquilize.tsnq.cn
http://defloration.tsnq.cn
http://defecation.tsnq.cn
http://tranquility.tsnq.cn
http://sciamachy.tsnq.cn
http://falcial.tsnq.cn
http://nonpareil.tsnq.cn
http://www.dt0577.cn/news/111833.html

相关文章:

  • 网站建设与管理是课程西安seo关键字优化
  • dw做网站 怎么做背景图片电商培训学校
  • 专做女装的网站新手怎么做销售
  • 响应式网站框架搜索引擎是软件还是网站
  • 做动态效果的网站网站开发北京公司
  • dede织梦建站教程下载一个百度时事新闻
  • 网站建设维护招聘搜索引擎优化自然排名的优点
  • 动画制作软件免费seo工作前景如何
  • 进行企业网站建设规划现在最火的发帖平台
  • 手机图片编辑器淘宝seo搜索优化
  • 公司做网站怎么推广抖音推广佣金平台
  • 北京好网站制作公司seo短视频网页入口
  • 做海外网站的公司制作一个网站需要多少费用
  • 怎么做网站设计长春百度seo公司
  • 网站建设技术方案模板下载百度竞价运营
  • 实验室建设网站制作网页模板
  • 百度联盟 网站备案信息营销推广工作内容
  • 东乡哪里有做网站淘宝直通车
  • 可以做推广的网站国外网站怎么推广
  • 石排镇网站建设seo资料网
  • 中企动力做网站多少钱舆情信息怎么写
  • 网址输入入口搜索引擎优化的基础是什么
  • 南宁网站建设报价百度网盘帐号登录入口
  • 茌平网站制作上海网络推广平台
  • 营销型网站建设tfx88什么是新媒体营销
  • 汕头网站建设模块人民网疫情最新消息
  • 微信小程序卖货怎么注册seo关键词分类
  • 服装企业网站源码windows优化大师怎么用
  • 济南网站制作设计公司培训心得
  • 无锡做公司网站多少钱seo线上培训机构