Esempio n. 1
0
        /// <summary>
        /// 关闭当前客户端
        /// </summary>
        /// <param name="service"></param>
        internal void CloseService(Client service)
        {
            try
            {
                // 如果有老的通讯, 先终止掉它
                if (null != service.ClientChannel)
                {
                    ServiceOperate.GetServiceOperate().AbortOldChannel(service.ClientChannel);
                }
                else if (null != service.SignalRClientSessionId)
                {
                    var hub = GlobalHost.ConnectionManager.GetHubContext <ServiceHub>();
                    //hub.Clients.Client(service.SignalRClientSessionId).Close();

                    // SingnalR这个设计....不能手动关闭连接...
                }

                service.Dispose();
            }
            catch (Exception ex)
            {
                ExceptionPro.ExpLog(ex);
            }

            Resources.GetRes().Services.Remove(service);
        }
Esempio n. 2
0
        /// <summary>
        /// 服务新情求
        /// </summary>
        /// <param name="toServer"></param>
        /// <returns></returns>
        public ToClientServiceNewRequest ServiceNewRequest(ToServerServiceNewRequest toServer)
        {
            string IpAddress = Context?.Request?.Environment["server.RemoteIpAddress"]?.ToString();

            if (!string.IsNullOrWhiteSpace(IpAddress))
            {
                // 实属无奈, SignalR设计原因只能这么做了....
                if (null == ServiceHubContext.Instance.ServiceHub)
                {
                    ServiceHubContext.Instance.Initial(this);
                }
            }

            return(ServiceOperate.GetServiceOperate().ServiceNewRequest(toServer, Context?.ConnectionId, IpAddress));
        }
Esempio n. 3
0
        /// <summary>
        /// 清理其他人用的账户
        /// </summary>
        private void CleanUsedByOtherService()
        {
            List <Client> removeUsedServiceCount = new List <Client>();

            foreach (var item in Resources.GetRes().ServicesUsedByOther)
            {
                if ((DateTime.Now - item.CheckDate).TotalSeconds >= 60 * 3)
                {
                    // 这里之所以保留原始逻辑, 即便不按原始逻辑检测, 到时session也会失效
                    int countLimit = 1;


                    if (item.LostCount >= countLimit)
                    {
                        removeUsedServiceCount.Add(item);
                    }
                    else
                    {
                        ++item.LostCount;
                    }
                }
                else
                {
                    item.LostCount = 0;
                }
            }



            //移出失效的
            foreach (var item in removeUsedServiceCount)
            {
                lock (Resources.GetRes().ServicesUsedByOther)
                {
                    // 如果有老的通讯, 先终止掉它
                    if (null != item.ClientChannel)
                    {
                        ServiceOperate.GetServiceOperate().AbortOldChannel(item.ClientChannel);
                    }

                    item.Dispose();

                    Resources.GetRes().ServicesUsedByOther.Remove(item);
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 删除管理员
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceDelAdmin ServiceDelAdmin(ToServerServiceDelAdmin toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceDelAdmin(toServer));
 }
Esempio n. 5
0
 /// <summary>
 /// 增加管理员支付
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceAddAdminPay ServiceAddAdminPay(ToServerServiceAddAdminPay toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceAddAdminPay(toServer));
 }
Esempio n. 6
0
 /// <summary>
 /// 修改产品
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceEditProduct ServiceEditProduct(ToServerServiceEditProduct toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceEditProduct(toServer));
 }
Esempio n. 7
0
 /// <summary>
 /// 删除包厢
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceDelRoom ServiceDelRoom(ToServerServiceDelRoom toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceDelRoom(toServer));
 }
Esempio n. 8
0
 /// <summary>
 /// 查找会员
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetMember ServiceGetMembers(ToServerServiceGetMember toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGetMembers(toServer));
 }
Esempio n. 9
0
 /// <summary>
 /// 新建订单
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceNewOrder ServiceAddOrder(ToServerServiceNewOrder toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceAddOrder(toServer));
 }
Esempio n. 10
0
 /// <summary>
 /// 删除订单明细
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceDelTakeoutDetail ServiceDelTakeoutDetail(ToServerServiceDelTakeoutDetail toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceDelTakeoutDetail(toServer));
 }
Esempio n. 11
0
 /// <summary>
 /// 修改密码
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceChangePWD ServiceChangePWD(ToServerServiceChangePWD toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceChangePWD(toServer));
 }
Esempio n. 12
0
 /// <summary>
 /// 新建外卖
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceNewTakeout ServiceAddTakeout(ToServerServiceNewTakeout toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceAddTakeout(toServer));
 }
Esempio n. 13
0
 /// <summary>
 /// 查找外卖
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetTakeouts ServiceGetTakeout(ToServerServiceGetTakeouts toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGetTakeout(toServer));
 }
Esempio n. 14
0
 /// <summary>
 /// 修改订单明细
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceSaveOrderDetail ServiceSaveOrderDetail(ToServerServiceSaveOrderDetail toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceSaveOrderDetail(toServer));
 }
Esempio n. 15
0
 /// <summary>
 /// 查找订单
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetOrders ServiceGetOrders(ToServerServiceGetOrders toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGetOrders(toServer));
 }
Esempio n. 16
0
 /// <summary>
 /// 替换订单
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceReplaceOrder ServiceReplaceOrder(ToServerServiceReplaceOrder toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceReplaceOrder(toServer));
 }
Esempio n. 17
0
 /// <summary>
 /// 查找余额
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetBalance ServiceGetBalances(ToServerServiceGetBalance toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGetBalances(toServer));
 }
Esempio n. 18
0
 /// <summary>
 /// 增加进货及明细
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceNewImport ServiceAddImportWithDetail(ToServerServiceNewImport toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceAddImportWithDetail(toServer));
 }
Esempio n. 19
0
 /// <summary>
 /// 删除余额支付
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceDelBalancePay ServiceDelBalancePay(ToServerServiceDelBalancePay toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceDelBalancePay(toServer));
 }
Esempio n. 20
0
 /// <summary>
 /// 修改供应商
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceEditSupplier ServiceEditSupplier(ToServerServiceEditSupplier toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceEditSupplier(toServer));
 }
Esempio n. 21
0
 /// <summary>
 /// 查找管理员日志(按管理员)
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetAdminLog ServiceGetAdminLog(ToServerServiceGetAdminLog toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGetAdminLog(toServer));
 }
Esempio n. 22
0
 /// <summary>
 /// 查找供应商支付(按供应商)
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetSupplierPay ServiceGetSupplierPay(ToServerServiceGetSupplierPay toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGetSupplierPay(toServer));
 }
Esempio n. 23
0
 /// <summary>
 /// 获取UID
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceUID ServiceUID(ToServerServiceUID toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceUID(toServer));
 }
Esempio n. 24
0
 /// <summary>
 /// 删除产品类型
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceDelProductType ServiceDelProductType(ToServerServiceDelProductType toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceDelProductType(toServer));
 }
Esempio n. 25
0
 /// <summary>
 /// 写入设置
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceSetCon ServiceSetCon(ToServerServiceSetCon toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceSetCon(toServer));
 }
Esempio n. 26
0
 /// <summary>
 /// 编辑进货
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceEditImport ServiceEditImport(ToServerServiceEditImport toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceEditImport(toServer));
 }
Esempio n. 27
0
 /// <summary>
 /// 删除打印机
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceDelPrinter ServiceDelPrinter(ToServerServiceDelPrinter toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceDelPrinter(toServer));
 }
Esempio n. 28
0
 /// <summary>
 /// 查找进货
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetImports ServiceGetImports(ToServerServiceGetImports toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGetImports(toServer));
 }
Esempio n. 29
0
 /// <summary>
 /// 查找进货明细(按订单)
 /// </summary>
 /// <param name="toServer"></param>
 /// <returns></returns>
 public ToClientServiceGetImportDetail ServiceGeImportDetail(ToServerServiceGetImportDetail toServer)
 {
     return(ServiceOperate.GetServiceOperate().ServiceGeImportDetail(toServer));
 }
Esempio n. 30
0
        /// <summary>
        /// 刷新会话
        /// </summary>
        /// <param name="toServer"></param>
        /// <returns></returns>
        public ToClientServiceSession ServiceSession(ToServerServiceSession toServer)
        {
            string IpAddress = Context?.Request?.Environment["server.RemoteIpAddress"]?.ToString();

            return(ServiceOperate.GetServiceOperate().ServiceSession(toServer, Context?.ConnectionId, IpAddress));
        }