public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapHttpRoute(
                name: "Auth",
                routeTemplate: "api/auth/verify",
                defaults: new { controller = "Auth" });

            routes.MapHttpRoute(
                name: "ProxyHandler",
                routeTemplate: "api/{*path}",
                handler: HttpClientFactory.CreatePipeline
                (
                    innerHandler: new HttpClientHandler(),
                    handlers: new DelegatingHandler[] { new MML.Web.LoanCenter.Handlers.ProxyHandler() }
                ),
                defaults: new { path = RouteParameter.Optional },
                constraints: null);

            routes.MapRoute(
                "Default",                    // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
                );

            if (_serviceBrokerInitialized == false)
            {
                XmlNode serviceConfiguration = ConfigurationManager.GetSection("ServiceConfiguration") as XmlNode;
                ServiceBroker.RegisterClients(serviceConfiguration);
                _serviceBrokerInitialized = true;
            }
        }
        public VSCodeEditorWindow(ServiceBroker sb, UserControl parent)
        {
            services = sb;
            coreEditor = new VSCodeEditor(parent.Handle, services);

            //Create window            
            IVsCodeWindow win = coreEditor.CodeWindow;
            cmdTarget = win as IOleCommandTarget;

            IVsTextView textView;
            int hr = win.GetPrimaryView(out textView);
            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            // assign the window handle
            IntPtr commandHwnd = textView.GetWindowHandle();
            AssignHandle(commandHwnd);

            //Register priority command target
            hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
                0, (IOleCommandTarget)this, out cmdTargetCookie);

            if (hr != VSConstants.S_OK)
                Marshal.ThrowExceptionForHR(hr);

            //Add message filter
            Application.AddMessageFilter((System.Windows.Forms.IMessageFilter)this);
        }
        public XDocument Fetch(string fetchXml)
        {
            var    service   = ServiceBroker.GetServiceInstance(_authRequest);
            string resultXml = service.Fetch(fetchXml);

            return(XDocument.Parse(resultXml));
        }
示例#4
0
        /// <summary>
        /// 作废订单
        /// </summary>
        /// <param name="soNumber"></param>
        public static void AbandonSO(int soNumber)
        {
            SOV31 msg = new SOV31()
            {
                Body = new SOMsg()
                {
                    SOMaster = new SOMasterMsg()
                    {
                        SystemNumber = soNumber
                    }
                },
                Header = ServiceAdapterHelper.ApplyMessageHeader()
            };


            IMaintainSOV31 service = ServiceBroker.FindService <IMaintainSOV31>();

            try
            {
                msg = service.SystemAbandonSO(msg);
                ServiceAdapterHelper.DealServiceFault(msg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IMaintainSOV31>(service);
            }
        }
示例#5
0
        public static void SendEmail(MailEntity mailEntity)
        {
            TxtFileLogger logger = LoggerManager.GetLogger();

            try
            {
                var mailService = ServiceBroker.FindService <IPP.Oversea.CN.ServiceCommon.ServiceInterfaces.ServiceContracts.ISendMail>();
                var mail        = new MailBodyV31
                {
                    Body = new MailBodyMsg
                    {
                        MailTo        = mailEntity.To,
                        CCMailAddress = mailEntity.CC,
                        Subjuect      = mailEntity.Subject,
                        MailBody      = mailEntity.Body,
                        Status        = 0, //0:未发送,1:已经发送
                        CreateDate    = DateTime.Now,
                        Priority      = 1  // Normal
                    }
                };

                mail.Header             = new MessageHeader();
                mail.Header.CompanyCode = ConfigurationManager.AppSettings["CompanyCode"];
                DefaultDataContract result = mailService.SendMail2IPP3Internal(mail);
                if (result.Faults != null && result.Faults.Count > 0)
                {
                    throw new Exception(result.Faults[0].ErrorDescription);
                }
            }
            catch (Exception ex)
            {
                logger.WriteLog("邮件发送失败!\r\n" + ex.ToString());
            }
        }
 public VSCodeEditor(IntPtr parent, ServiceBroker services)
   : this()
 {
   parentHandle = parent;
   this.services = services;
   CreateCodeWindow();
 }
示例#7
0
        private static TaobaoResponse Query(string method, Dictionary <string, string> param)
        {
            ITaoBaoMaintain service = ServiceBroker.FindService <ITaoBaoMaintain>();

            try
            {
                TaoBaoRequest taobaoRequest = new TaoBaoRequest();
                taobaoRequest.param  = param;
                taobaoRequest.method = method;
                taobaoRequest.Header = Util.CreateServiceHeader();
                TaoBaoResponse taoBaoResponse = service.GetTaoBaoInventoryQtyByMethod(taobaoRequest);
                string         response       = taoBaoResponse.CommonReturnStringValue;
                //string response = TaoBaoUtil.Post(param);
                response = response.Replace("items_onsale_get_response>", "items_inventory_get_response>");
                if (string.IsNullOrEmpty(response))
                {
                    throw new Exception("淘宝未返回任何信息。");
                }
                if (response.IndexOf("error_response") > -1)
                {
                    throw new Exception(response);
                }
                TaobaoResponse taobaoResponse = XmlSerializerHelper.Deserializer <TaobaoResponse>(response, CommonConst.taobao_response_encoding);
                return(taobaoResponse);
            }
            finally
            {
                ServiceBroker.DisposeService <ITaoBaoMaintain>(service);
            }
        }
示例#8
0
        public static void WriteLog(List <LogInfo> logInfos)
        {
            ICreateLogV31 service = ServiceBroker.FindService <ICreateLogV31>();

            LogV31 log = new LogV31();

            try
            {
                log.Body = ToMessageList(logInfos);
                if (logInfos != null && logInfos.Count > 0)
                {
                    log.Header = new Newegg.Oversea.Framework.Contract.MessageHeader
                    {
                        CompanyCode = Settings.CompanyCode
                    };
                }
                else
                {
                    log.Header = new Newegg.Oversea.Framework.Contract.MessageHeader();
                }
                service.CreateLog(log);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ServiceBroker.DisposeService <ICreateLogV31>(service);
            }
        }
示例#9
0
        public MessageTypeConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (this.ServiceBroker.MessageTypes.Contains(fullName))
            {
                MessageType msgType = this.ServiceBroker.MessageTypes[fullName];
                m_MessageTypeValidation = msgType.MessageTypeValidation;

                base.Urn = new Uri(base.Urn.ToString() + "messagetype/");

                m_Name = msgType.Name.Substring
                    (base.Urn.ToString().Length, msgType.Name.Length - base.Urn.ToString().Length);
                
                m_Owner = msgType.Owner;
                if (msgType.MessageTypeValidation == MessageTypeValidation.XmlSchemaCollection)
                {
                    m_ValidationXmlSchemaCollection = msgType.ValidationXmlSchemaCollection;
                    m_ValidationXmlSchemaCollectionSchema = msgType.ValidationXmlSchemaCollectionSchema;
                    if (this.ServiceBroker.Parent.XmlSchemaCollections.Contains
                        (this.ValidationXmlSchemaCollection))
                    {
                        XmlSchemaCollection schema = this.ServiceBroker.Parent.
                            XmlSchemaCollections[msgType.ValidationXmlSchemaCollection];
                        this.ValidationXmlSchemaCollectionSchema = schema.Text;
                    }
                }
            }

        }
示例#10
0
        private void SynInvnetoryQty(List <TaoBaoSKUMsg> TaoBaoSKUList)
        {
            TaoBaoRequest request = new TaoBaoRequest();

            request.TaoBaoSKUList = TaoBaoSKUList;
            request.Header        = Util.CreateServiceHeader(Common);
            ITaoBaoMaintain service = ServiceBroker.FindService <ITaoBaoMaintain>();

            try
            {
                TaoBaoResponse response = service.TaoBaoItemQantityUpdate(request);

                if (response != null && response.Faults != null && response.Faults.Count > 0)
                {
                    MessageFault      msg = response.Faults[0];
                    BusinessException ex  = new BusinessException(msg.ErrorCode, string.Format("{0}\r\n{1}", msg.ErrorDescription, msg.ErrorDetail), true);

                    throw ex;
                }
            }
            finally
            {
                ServiceBroker.DisposeService <ITaoBaoMaintain>(service);
            }
        }
示例#11
0
        public MessageTypeConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (this.ServiceBroker.MessageTypes.Contains(fullName))
            {
                MessageType msgType = this.ServiceBroker.MessageTypes[fullName];
                m_MessageTypeValidation = msgType.MessageTypeValidation;

                base.Urn = new Uri(base.Urn.ToString() + "messagetype/");

                m_Name = msgType.Name.Substring
                             (base.Urn.ToString().Length, msgType.Name.Length - base.Urn.ToString().Length);

                m_Owner = msgType.Owner;
                if (msgType.MessageTypeValidation == MessageTypeValidation.XmlSchemaCollection)
                {
                    m_ValidationXmlSchemaCollection       = msgType.ValidationXmlSchemaCollection;
                    m_ValidationXmlSchemaCollectionSchema = msgType.ValidationXmlSchemaCollectionSchema;
                    if (this.ServiceBroker.Parent.XmlSchemaCollections.Contains
                            (this.ValidationXmlSchemaCollection))
                    {
                        XmlSchemaCollection schema = this.ServiceBroker.Parent.
                                                     XmlSchemaCollections[msgType.ValidationXmlSchemaCollection];
                        this.ValidationXmlSchemaCollectionSchema = schema.Text;
                    }
                }
            }
        }
示例#12
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .RegisterServiceBroker <ServiceBroker>(options =>
            {
                options.RegisterAutoMappingProviders   = true;
                options.RegisterCacheProviders         = true;
                options.RegisterMessagePackSerialisers = true;
                options.RegisterMediatorServices       = true;
                options.RegisterExceptionHandlers      = true;
                options.RegisterCryptographicProviders = true;
            }, out var serviceBroker);

            ServiceBroker.ConfigureIdentity(services
                                            .AddIdentity <Domains.Dto.Account, Role>());

            services
            .ConfigureApplicationCookie(ConfigureOptions)
            .ConfigureExternalCookie(ConfigureOptions);

            services
            .AddDistributedMemoryCache()
            .AddSession(ConfigureSession)
            .AddAuthentication();
            services
            .AddAuthorization();

            //;

            services
            .AddMvc(options => options.Filters.Add(new AuthorizeFilter(Policies.Build())))
            .AddSessionStateTempDataProvider()
            .AddFluentValidation(configuration => configuration
                                 .RegisterValidatorsFromAssemblies(serviceBroker.Assemblies));
        }
示例#13
0
        public static void AuditNetPay(int soSysNo)
        {
            NetPayV31 message = new NetPayV31
            {
                Header = ServiceAdapterHelper.ApplyMessageHeader(),
                Body   = new NetPayMessage {
                    SOSysNo = soSysNo
                }
            };


            IMaintainNetPayV31 service = ServiceBroker.FindService <IMaintainNetPayV31>();


            try
            {
                //SimpleTypeDataContract<bool> BatchApproveGroupBuy(NetPayV31 msg);
                SimpleTypeDataContract <bool> ResultMsg = service.BatchApproveGroupBuy(message);

                ServiceAdapterHelper.DealServiceFault(ResultMsg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IMaintainNetPayV31>(service);
            }
        }
示例#14
0
        public static void Sync(ChannelProductEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
#if DEBUG
            ISyncChannelInventoryV31 service = ServiceBroker.FindService <ISyncChannelInventoryV31>("CN.InventoryMgmt.UI.IPP01", "LocalDev");
#else
            ISyncChannelInventoryV31 service = ServiceBroker.FindService <ISyncChannelInventoryV31>();
#endif
            ChannelInventoryRequestV31 request = new ChannelInventoryRequestV31();
            request.Body = new List <ChannelInventoryMsg>();
            ChannelInventoryMsg msg = new ChannelInventoryMsg
            {
                ChannelSysNo     = entity.ChannelSysNo,
                ChannelInventory = entity.SynChannelQty,
                ProductSysNo     = entity.ProductSysNo,
                SynProductID     = entity.SynProductID,
                SkuID            = entity.SkuID
            };
            request.Body.Add(msg);

            request.Header = Util.CreateMessageHeader();

            ChannelInventoryResponseV31 response = service.Sync(request);

            if (response == null)
            {
                throw new BusinessException("SyncChannelInventoryJobError",
                                            string.Format("ThirdPart Service返回NULL值,product:{0},channel:{1}({2})  同步失败",
                                                          entity.ProductSysNo, entity.ChannelSysNo, entity.ChannelCode));
            }
            if (response.Faults != null &&
                response.Faults.Count > 0)
            {
                var fault = response.Faults[0];
                throw new BusinessException(fault.ErrorCode, string.IsNullOrEmpty(fault.ErrorDetail) ? fault.ErrorDescription : fault.ErrorDetail);
            }
            if (response.Body == null ||
                response.Body.Count == 0)
            {
                throw new BusinessException("SyncChannelInventoryJobError",
                                            string.Format("ThirdPart Service返回未知错误,product:{0},channel:{1}({2})  同步失败",
                                                          entity.ProductSysNo, entity.ChannelSysNo, entity.ChannelCode));
            }
            msg = response.Body[0];
            if (msg.FaultMsg != null)
            {
                BusinessException ex = new BusinessException(msg.FaultMsg.ErrorCode,
                                                             string.Format("product:{0},channel:{1}({2}) 同步失败\r\n{3}\r\n{4}",
                                                                           entity.ProductSysNo,
                                                                           entity.ChannelSysNo,
                                                                           entity.ChannelCode,
                                                                           msg.FaultMsg.ErrorDescription,
                                                                           msg.FaultMsg.ErrorDetail));
                throw ex;
            }
        }
 protected PushСhannel(EventedConcurrentQueue <T> incomingQueue, ServiceBroker <T> broker, Logger <T> logger, int triesCount = 3)
 {
     IncomingQueue = incomingQueue;
     IncomingQueue.OnElementAdded += IncomingQueueOnOnElementAdded;
     BrokerInst = broker;
     TriesCount = triesCount;
     Logger     = logger;
 }
示例#16
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services
            .AddMvc();

            ServiceBroker
            .RegisterServices <AppServiceBroker>(services);
        }
示例#17
0
 public CertificateConfiguration(ServiceBroker serviceBroker)
     : base(serviceBroker)
 {
     if (serviceBroker != null)
     {
         this.database = serviceBroker.Parent;
     }
 }
示例#18
0
        public static SoDefinitionCollection GetSoDefinitionCollection(ServiceBroker sb)
        {
            string soDefinitionString =
                sb.Service.ServiceConfiguration[Constants.ServiceConfig.ServiceObjectsDefinition].ToString();

            List <SoDefinition> returnList = new JavaScriptSerializer().Deserialize <List <SoDefinition> >(soDefinitionString);

            return(new SoDefinitionCollection(returnList));
        }
示例#19
0
        /// <summary>
        /// 开始检测订单的本地仓状态
        /// </summary>
        /// <param name="jobContext">Job运行上下文</param>
        public static void Run(JobContext jobContext)
        {
            BizLogFile = jobContext.Properties["BizLog"];

            List <SOEntity4OutStockEntity> list = OutStockSODA.GetOutStockSOList(CompanyCode);

            if (list == null || list.Count == 0)
            {
                jobContext.Message += "没有附合条件的记录";
                WriteLog("没有附合条件的记录");

                return;
            }
            else
            {
                jobContext.Message += string.Format(" 共获取到{0}条满足条件的记录", list.Count);
                WriteLog(string.Format(" 共获取到{0}条满足条件的记录", list.Count));
            }
            int successCount = 0;
            IMaintainSOManualChangeWHV31 service = ServiceBroker.FindService <IMaintainSOManualChangeWHV31>();

            GetAutoAuditSendMessageLoginInfo();
            foreach (SOEntity4OutStockEntity so in list)
            {
                // 如果3天没有备到货,改为超时未到货
                TimeSpan ts = DateTime.Now.Subtract(so.OrderDate);
                if (ts.TotalHours > 72)
                {
                    OutStockSODA.UpdateSOStockStatus(so.SysNo, 2);
                    continue;
                }

                // 如果已经到货,修改订单仓库并修改订单为到货可审
                if (OutStockSODA.IsItemAvail(so.SysNo, so.LocalWHSysNo))
                {
                    List <SOItem4OutStockEntity> soItems = OutStockSODA.GetSOItem4OutStock(so.SysNo, so.LocalWHSysNo);
                    foreach (SOItem4OutStockEntity soitem in soItems)
                    {
                        try
                        {
                            UpdateSOStockStatus(so.SysNo, soitem.ProductID, soitem.ProductSysNo, soitem.Quantity,
                                                int.Parse(soitem.WarehouseNumber), int.Parse(so.LocalWHSysNo), service);

                            successCount++;
                            jobContext.Message += string.Format("成功修改订单仓库,单号:{0}\r\n", so.SysNo);
                            WriteLog(string.Format("成功修改订单仓库,单号:{0}", so.SysNo));
                        }
                        catch (Exception ex)
                        {
                            jobContext.Message += string.Format("修改仓库时发生异常,单号:{0},异常:{1}\r\n", so.SysNo, ex.Message);
                            WriteLog(string.Format("修改仓库时发生异常,单号:{0},异常:{1}", so.SysNo, ex.Message));
                        }
                    }
                }
            }
        }
    private EditorBroker(ServiceBroker sb)
    {
      // Register priority command target, this dispatches mappable keys like Enter, Backspace, Arrows, etc.
      int hr = sb.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
        0, (IOleCommandTarget)this, out this.CmdTargetCookie);

      if (hr != VSConstants.S_OK)
        Marshal.ThrowExceptionForHR(hr);
      this.Dte = (EnvDTE.DTE)sb.Site.GetService(typeof(EnvDTE.DTE));
    }
示例#21
0
        internal static BrokerService CreateSMOService(Database db, string name)
        {
            ServiceBroker sb    = db.ServiceBroker;
            BrokerService bserv = null;

            bserv = sb.Services[name];

            //svr.ConnectionContext.Disconnect();
            return(bserv);
        }
        public void Locate_Test()
        {
            ServiceRegistryConfig registryConfig = BuildRegsitryConfig();
            IServiceRegistry serviceRegistry = new ConfigBasedServiceRegistry(registryConfig);
            ServiceBrokerConfig config = BuildBrokerConfig();
            IServiceBroker serviceBroker = new ServiceBroker(serviceRegistry, config);
            ITestService testService = serviceBroker.Locate<ITestService>();

            Assert.IsNotNull(testService);
        }
示例#23
0
        public static void SendMessage(JobContext jobContext)
        {
            BizLogFile = jobContext.Properties["BizLog"];
            //从配置文件中获取自动审核一次最多提取的单数
            TopCount = GetAutoAuditSendMessageTopCount();
            //从配置文件获取为邮件发送JOB中调用WCF服务时所使用到的信息
            GetAutoAuditSendMessageLoginInfo();
            //自动审单时审单人编号
            AuditUserSysNo = GetAutoAuditUserSysNo();

            List <int> sendMailSysNoList = SOAutoAuditSendMessageDA.GetSOList4Audit2SendMessage(TopCount, SendMailCompanyCode);

            if (sendMailSysNoList.Count > 0)
            {
                jobContext.Message += string.Format("共获取到{0}条附合条件的记录\r\n", sendMailSysNoList.Count);
                WriteLog(string.Format("共获取到{0}条附合条件的记录\r\n", sendMailSysNoList.Count));

                IMaintainSOV31 service      = ServiceBroker.FindService <IMaintainSOV31>();
                int            successCount = 0;
                try
                {
                    foreach (int x in sendMailSysNoList)
                    {
                        try
                        {
                            SendMessage4SO(x, service);
                            successCount++;
                            jobContext.Message += string.Format("已为审单通过成功发送邮件,单号:{0}\r\n", x);
                            WriteLog(string.Format("已为审单通过成功发送邮件,单号:{0}", x));
                        }
                        catch (Exception ex)
                        {
                            jobContext.Message += string.Format("发送邮件异常,单号:{0},异常:\r\n", x, ex.Message);
                            WriteLog(string.Format("发送邮件异常,单号:{0},异常:", x, ex.Message));
                        }
                    }
                }
                finally
                {
                    ServiceBroker.DisposeService <IMaintainSOV31>(service);
                }

                jobContext.Message += string.Format("执行结束,成功{0}条,失败{1}条\r\n",
                                                    successCount, sendMailSysNoList.Count - successCount);
                WriteLog(string.Format("执行结束,成功{0}条,失败{1}条\r\n",
                                       successCount, sendMailSysNoList.Count - successCount));
            }
            else
            {
                jobContext.Message += string.Format("没有附合条件的记录\r\n");
                WriteLog("没有附合条件的记录\r\n");
            }
        }
示例#24
0
文件: App.cs 项目: chakrit/fu-sharp
        protected override RequestHandler CreateHandlerCore()
        {
            var broker = new ServiceBroker(Services);

              return c =>
              {
            var context = new FuContext(Settings, broker, c);

            FuTrace.Request(context);
            Pipeline(context);
            FuTrace.Response(context);
              };
        }
示例#25
0
 protected ConfigurationBase(ServiceBroker serviceBroker)
 {
     if (serviceBroker != null)
     {
         m_ServiceBroker = serviceBroker;
         
         //BaseUrn is used in the sample to provide a consistent Urn
         if (this.ServiceBroker.Parent.ExtendedProperties.Contains("BaseUrn"))
         {
             this.Urn = new Uri(this.BaseUrn);
         }
     }
 }
示例#26
0
        protected ConfigurationBase(ServiceBroker serviceBroker)
        {
            if (serviceBroker != null)
            {
                m_ServiceBroker = serviceBroker;

                //BaseUrn is used in the sample to provide a consistent Urn
                if (this.ServiceBroker.Parent.ExtendedProperties.Contains("BaseUrn"))
                {
                    this.Urn = new Uri(this.BaseUrn);
                }
            }
        }
示例#27
0
 public CertificateConfiguration(string fullName, ServiceBroker serviceBroker)
     : base(serviceBroker)
 {
     if (this.ServiceBroker.Parent.Certificates.Contains(fullName))
     {
         Certificate cert = this.ServiceBroker.Parent.Certificates[fullName];
         this.Name           = cert.Name;
         this.Issuer         = cert.Issuer;
         this.Owner          = cert.Owner;
         this.StartDate      = cert.StartDate;
         this.ExpirationDate = cert.ExpirationDate;
         this.Subject        = cert.Subject;
     }
 }
示例#28
0
        public BrokerServiceConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
		{
            if (this.ServiceBroker.Services.Contains(fullName))
            {
                BrokerService item = this.ServiceBroker.Services[fullName];

                base.Urn = new Uri(base.Urn.ToString() + "service/");

                m_Name = item.Name.Substring
                    (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);

                m_QueueName = item.QueueName;
                this.ServiceOwnerName = item.Owner;

                //Fill ContractNames from ServiceContractMapping
                foreach (ServiceContractMapping map in item.ServiceContractMappings)
                {
                    m_ContractNames.Add(map.Name);
                }

                //CertificateConfiguration for this Service
                //CertificateName is store in ExtendedProperties to match the Service to the Certificate
                if (item.ExtendedProperties.Contains("CertificateName"))
                {
                    CertificateConfiguration cert = new
                        CertificateConfiguration(item.ExtendedProperties["CertificateName"].Value.ToString(),
                        this.ServiceBroker);
                    this.Certificate = cert;

                }

                //RemoteServiceBinding for this Service if it exists
                string bindingFullName = base.BaseUrn + "RemoteServiceBinding/" + this.Name + "Binding";
                if (this.ServiceBroker.RemoteServiceBindings.Contains(bindingFullName))
                {
                    this.EnableRemoteService = true;
                    RemoteServiceBinding binding = this.ServiceBroker.
                        RemoteServiceBindings[bindingFullName];

                    this.RemoteServiceBinding.CertificateUser = binding.CertificateUser;
                    this.RemoteServiceBinding.IsAnonymous = binding.IsAnonymous;
                    this.AllowAnonymous = binding.IsAnonymous;
                    this.RemoteServiceBinding.Name = binding.Name;
                    this.RemoteServiceBinding.Owner = binding.Owner;
                    this.RemoteServiceBinding.RemoteService = binding.RemoteService;
                }

            }
		}
        public BusinessEntity Retrieve(Guid dataObjectId, String[] columnSet)
        {
            ColumnSetBase cs;

            if (columnSet == null || columnSet.Length == 0)
            {
                cs = new AllColumns();
            }
            else
            {
                cs = new ColumnSet(columnSet);
            }
            return(ServiceBroker.GetServiceInstance(_authRequest).Retrieve(base.EntityName, dataObjectId, cs));
        }
示例#30
0
 public CertificateConfiguration(string fullName, ServiceBroker serviceBroker)
      : base(serviceBroker)
  {
      if (this.ServiceBroker.Parent.Certificates.Contains(fullName))
      {
          Certificate cert = this.ServiceBroker.Parent.Certificates[fullName];
          this.Name = cert.Name;
          this.Issuer = cert.Issuer;
          this.Owner = cert.Owner;
          this.StartDate = cert.StartDate;
          this.ExpirationDate = cert.ExpirationDate;
          this.Subject = cert.Subject;
      }
 }
示例#31
0
        public BrokerServiceConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (this.ServiceBroker.Services.Contains(fullName))
            {
                BrokerService item = this.ServiceBroker.Services[fullName];

                base.Urn = new Uri(base.Urn.ToString() + "service/");

                m_Name = item.Name.Substring
                             (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);

                m_QueueName           = item.QueueName;
                this.ServiceOwnerName = item.Owner;

                //Fill ContractNames from ServiceContractMapping
                foreach (ServiceContractMapping map in item.ServiceContractMappings)
                {
                    m_ContractNames.Add(map.Name);
                }

                //CertificateConfiguration for this Service
                //CertificateName is store in ExtendedProperties to match the Service to the Certificate
                if (item.ExtendedProperties.Contains("CertificateName"))
                {
                    CertificateConfiguration cert = new
                                                    CertificateConfiguration(item.ExtendedProperties["CertificateName"].Value.ToString(),
                                                                             this.ServiceBroker);
                    this.Certificate = cert;
                }

                //RemoteServiceBinding for this Service if it exists
                string bindingFullName = base.BaseUrn + "RemoteServiceBinding/" + this.Name + "Binding";
                if (this.ServiceBroker.RemoteServiceBindings.Contains(bindingFullName))
                {
                    this.EnableRemoteService = true;
                    RemoteServiceBinding binding = this.ServiceBroker.
                                                   RemoteServiceBindings[bindingFullName];

                    this.RemoteServiceBinding.CertificateUser = binding.CertificateUser;
                    this.RemoteServiceBinding.IsAnonymous     = binding.IsAnonymous;
                    this.AllowAnonymous                     = binding.IsAnonymous;
                    this.RemoteServiceBinding.Name          = binding.Name;
                    this.RemoteServiceBinding.Owner         = binding.Owner;
                    this.RemoteServiceBinding.RemoteService = binding.RemoteService;
                }
            }
        }
示例#32
0
        public static void InStock(POEntity po)
        {
            WMSRequest request = new WMSRequest()
            {
                Header      = ServiceAdapterHelper.ApplyMessageHeader()
                , OrderInfo = new WMSOrderInfo()
                {
                    OrderSysNo        = po.SysNo.Value
                    , OrderType       = "PO"
                    , WarehouseNumber = po.StockSysNo.ToString()
                }
            };

            List <WMSRequestProduct> products = new List <WMSRequestProduct>();

            foreach (var item in po.POItems)
            {
                products.Add(
                    new WMSRequestProduct()
                {
                    Code      = item.ProductID
                    , UnitQty = item.PurchaseQty
                });
            }

            WMSRequestWaitInStock req = new WMSRequestWaitInStock()
            {
                Action          = "ImportAsn"
                , OrderCode     = po.SysNo.ToString()
                , WarehouseCode = po.StockSysNo.ToString()
                , ProductList   = products
            };

            request.WaitInStock = req;

            IWMSMaintain service = ServiceBroker.FindService <IWMSMaintain>();

            try
            {
                WMSResponse response = service.WaitInStock(request);
                ServiceAdapterHelper.DealServiceFault(response.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IWMSMaintain>(service);
            }
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default",                    // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "OldIndex", id = UrlParameter.Optional } // Parameter defaults
                );

            if (_serviceBrokerInitialized == false)
            {
                XmlNode serviceConfiguration = ConfigurationManager.GetSection("ServiceConfiguration") as XmlNode;
                ServiceBroker.RegisterClients(serviceConfiguration);
                _serviceBrokerInitialized = true;
            }
        }
        public List <DynamicEntity> RetrieveMultiple(QueryExpression queryExpression)
        {
            if (queryExpression == null)
            {
                throw new ArgumentNullException("The 'queryExpression' argument cannot be null.");
            }

            var request = new SdkTypeProxy.RetrieveMultipleRequest()
            {
                ReturnDynamicEntities = true,
                Query = queryExpression
            };

            var service = ServiceBroker.GetServiceInstance(_authRequest);

            return(((SdkTypeProxy.RetrieveMultipleResponse)service.Execute(request)).BusinessEntityCollection.BusinessEntities.Select(e => (DynamicEntity)e).ToList());
        }
        public RemoteServiceBindingConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (this.ServiceBroker.RemoteServiceBindings.Contains(fullName))
            {
                RemoteServiceBinding item = this.ServiceBroker.RemoteServiceBindings[fullName];

                base.Urn = new Uri(base.Urn.ToString() + "RemoteServiceBinding/");

                m_Name = item.Name.Substring
                             (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);

                m_Owner           = item.Owner;
                m_CertificateUser = item.CertificateUser;
                m_RemoteService   = item.RemoteService;
                m_IsAnonymous     = item.IsAnonymous;
            }
        }
        public ServiceContractConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (this.ServiceBroker.ServiceContracts.Contains(fullName))
            {
                ServiceContract item = this.ServiceBroker.ServiceContracts[fullName];

                base.Urn = new Uri(base.Urn.ToString() + "contract/");

                m_Name = item.Name.Substring
                             (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);

                foreach (MessageTypeMapping mtm in item.MessageTypeMappings)
                {
                    m_MessageTypeMappings.Add(mtm.Name, mtm.MessageSource.ToString());
                }
            }
        }
示例#37
0
        /// <summary>
        /// 发送带附件的邮件
        /// </summary>
        /// <returns></returns>
        public static void SendMailWithAccessories(MailContract mailContract)
        {
            ISendEmail service = ServiceBroker.FindService <ISendEmail>();

            try
            {
                bool isSuccess = service.SendMail(mailContract, false);
                mailContract.Attachments.Clear();           //清空附件列表

                if (!isSuccess)
                {
                    throw (new BusinessException("Invoice job(SendMailARAmtOfVIPCustomer) Send mail failed!"));
                }
            }
            finally
            {
                ServiceBroker.DisposeService <ISendEmail>(service);
            }
        }
        public RemoteServiceBindingConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (this.ServiceBroker.RemoteServiceBindings.Contains(fullName))
            {
                RemoteServiceBinding item = this.ServiceBroker.RemoteServiceBindings[fullName];
               
                base.Urn = new Uri(base.Urn.ToString() + "RemoteServiceBinding/");

                m_Name = item.Name.Substring
                    (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);
                
                m_Owner = item.Owner;
                m_CertificateUser = item.CertificateUser;
                m_RemoteService = item.RemoteService;
                m_IsAnonymous = item.IsAnonymous;
            }

        }
        public ServiceContractConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (this.ServiceBroker.ServiceContracts.Contains(fullName))
            {
                ServiceContract item = this.ServiceBroker.ServiceContracts[fullName];

                base.Urn = new Uri(base.Urn.ToString() + "contract/");

                m_Name = item.Name.Substring
                    (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);

                foreach (MessageTypeMapping mtm in item.MessageTypeMappings)
                {
                    m_MessageTypeMappings.Add(mtm.Name, mtm.MessageSource.ToString());
                }
                
            }

        }
示例#40
0
        /// <summary>
        /// 更新订单
        /// </summary>
        /// <param name="soSysNo"></param>
        public static void UpdateSO4GroupBuying(int soSysNo)
        {
            SimpleTypeDataContract <int> SysNo = new SimpleTypeDataContract <int>
            {
                Value  = soSysNo,
                Header = ServiceAdapterHelper.ApplyMessageHeader()
            };


            IMaintainSOV31 service = ServiceBroker.FindService <IMaintainSOV31>();

            try
            {
                DefaultDataContract msg = service.UpdateSO4GroupBuying(SysNo);
                ServiceAdapterHelper.DealServiceFault(msg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IMaintainSOV31>(service);
            }
        }
示例#41
0
        public ApplicationConfiguration(ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (serviceBroker != null)
            {
                //Create internal properties list for Create method
                m_Properties.Add(BaseUrnPropertyName, m_BaseUrn);
                m_Properties.Add(ScriptPathPropertyName, m_ScriptPath);

                if (this.ServiceBroker.Parent.ExtendedProperties.Contains(BaseUrnPropertyName))
                {
                    m_BaseUrn = this.ServiceBroker.Parent.ExtendedProperties[BaseUrnPropertyName].Value.ToString();
                    m_Properties[BaseUrnPropertyName] = m_BaseUrn;
                }
                if (this.ServiceBroker.Parent.ExtendedProperties.Contains(ScriptPathPropertyName))
                {
                    m_ScriptPath = this.ServiceBroker.Parent.ExtendedProperties[ScriptPathPropertyName].Value.ToString();
                    m_Properties[ScriptPathPropertyName] = m_ScriptPath;
                }
            }
        }
示例#42
0
        public ServiceQueueConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
		{
            if (this.ServiceBroker.Queues.Contains(fullName))
            {
                ServiceQueue item = this.ServiceBroker.Queues[fullName];


                base.Urn = new Uri(base.Urn.ToString() + "queue/");

                m_Name = item.Name.Substring
                    (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);   
                
                m_IsActivationEnabled = item.IsActivationEnabled.ToString();
                m_IsRetentionEnabled = item.IsRetentionEnabled;
                m_IsEnqueueEnabled = item.IsEnqueueEnabled;
                m_ProcedureName = item.ProcedureName;               
                m_MaxReaders = item.MaxReaders;
                m_ActivationExecutionContext = item.ActivationExecutionContext;
            }
		}
示例#43
0
        public ApplicationConfiguration(ServiceBroker serviceBroker)
            : base(serviceBroker)
        {
            if (serviceBroker != null)
            {
                //Create internal properties list for Create method
                m_Properties.Add(BaseUrnPropertyName, m_BaseUrn);
                m_Properties.Add(ScriptPathPropertyName, m_ScriptPath);

                if (this.ServiceBroker.Parent.ExtendedProperties.Contains(BaseUrnPropertyName))
                {
                    m_BaseUrn = this.ServiceBroker.Parent.ExtendedProperties[BaseUrnPropertyName].Value.ToString();
                    m_Properties[BaseUrnPropertyName] = m_BaseUrn;
                }
                if (this.ServiceBroker.Parent.ExtendedProperties.Contains(ScriptPathPropertyName))
                {
                    m_ScriptPath = this.ServiceBroker.Parent.ExtendedProperties[ScriptPathPropertyName].Value.ToString();
                    m_Properties[ScriptPathPropertyName] = m_ScriptPath;
                }
            }
        }
示例#44
0
        public EndpointConfiguration(string fullName, ServiceBroker serviceBroker)
            : base(serviceBroker)
		{
            if (base.Server.Endpoints.Contains(fullName))
            {
                Endpoint item = base.Server.Endpoints[fullName];

                base.Urn = new Uri(base.Urn.ToString() + "endpoint/");

                m_Name = item.Name.Substring
                    (base.Urn.ToString().Length, item.Name.Length - base.Urn.ToString().Length);

                Certificate cert = this.Server.Databases["Master"]
                    .Certificates[item.Payload.ServiceBroker.Certificate];
                this.Certificate.Name = cert.Name;
                this.Certificate.Issuer = cert.Issuer;
                this.Certificate.Owner = cert.Owner;
                this.Certificate.StartDate = cert.StartDate;
                this.Certificate.ExpirationDate = cert.ExpirationDate;
                this.Certificate.Subject = cert.Subject;
                
            }
		}
示例#45
0
        public BrokerServiceConfiguration(ServiceBroker serviceBroker)
            : base(serviceBroker)
		{
            base.Urn = new Uri(base.Urn.ToString() + "service/");
        }
 public VSCodeEditor(IOleServiceProvider psp)
   : this()
 {
   services = new ServiceBroker(psp);
   CreateCodeWindow();
 }
示例#47
0
 public EndpointConfiguration(ServiceBroker serviceBroker)
     : base(serviceBroker)
 {
     base.Urn = new Uri(base.Urn.ToString() + "endpoint/");
     this.Name = base.Server.Name;
 }
示例#48
0
        public ServiceQueueConfiguration(ServiceBroker serviceBroker): base(serviceBroker)
		{
            base.Urn = new Uri(base.Urn.ToString() + "queue/");
		}
示例#49
0
        public CertificateConfiguration(ServiceBroker serviceBroker)
            : base(serviceBroker)
		{
            if (serviceBroker != null)
                this.database = serviceBroker.Parent;
        }
 // this method must be externally synchronized
 internal static void CreateSingleton(ServiceBroker sb)
 {
   if (Broker != null)
     throw new InvalidOperationException( "The singleton broker has alreaby been created." );
   Broker = new EditorBroker(sb);
 }
 public void Init(ServiceProvider serviceProvider, SqlEditor Editor)
 {
   SqlEditor = Editor;
   ServiceBroker sb = new ServiceBroker(serviceProvider);
   nativeWindow = new VSCodeEditorWindow(sb, this);
 }
 public RemoteServiceBindingConfiguration(ServiceBroker serviceBroker)
     : base(serviceBroker)
 {
     base.Urn = new Uri(base.Urn.ToString() + "RemoteServiceBinding/");
 }
 public void Dispose()
 {
   //Remove message filter
   //Application.RemoveMessageFilter((System.Windows.Forms.IMessageFilter)this);
   EditorBroker.UnregisterEditor(this);
   if (services != null)
   {
     // Remove this object from the list of the priority command targets.
     if (cmdTargetCookie != 0)
     {
       IVsRegisterPriorityCommandTarget register =
           services.VsRegisterPriorityCommandTarget;
       if (null != register)
       {
         int hr = register.UnregisterPriorityCommandTarget(cmdTargetCookie);
         if (hr != VSConstants.S_OK)
           Marshal.ThrowExceptionForHR(hr);
       }
       cmdTargetCookie = 0;
     }
     services = null;
   }
   if (coreEditor != null)
   {
     IVsCodeWindow win = coreEditor.CodeWindow;
     win.Close();
     coreEditor = null;
   }
 }
    public VSCodeEditorWindow(ServiceBroker sb, UserControl parent)
    {
      Parent = (VSCodeEditorUserControl)parent;
      services = sb;
      coreEditor = new VSCodeEditor(parent.Handle, services);

      //Create window            
      IVsCodeWindow win = coreEditor.CodeWindow;
      cmdTarget = win as IOleCommandTarget;

      IVsTextView textView;
      int hr = win.GetPrimaryView(out textView);
      if (hr != VSConstants.S_OK)
        Marshal.ThrowExceptionForHR(hr);

      // assign the window handle
      IntPtr commandHwnd = textView.GetWindowHandle();
      AssignHandle(commandHwnd);

      //// Register priority command target, this dispatches mappable keys like Enter, Backspace, Arrows, etc.
      //hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
      //    0, (IOleCommandTarget)CommandBroker.Broker, out cmdTargetCookie);

      //if (hr != VSConstants.S_OK)
      //  Marshal.ThrowExceptionForHR(hr);

      lock (typeof(EditorBroker))
      {
        if (EditorBroker.Broker == null) 
        {
          EditorBroker.CreateSingleton(services);
        }
        EditorBroker.RegisterEditor(this);
      }
      //Add message filter
      //Application.AddMessageFilter((System.Windows.Forms.IMessageFilter)this);
    }
示例#55
0
 public MessageTypeConfiguration(ServiceBroker serviceBroker): base(serviceBroker)
 {
     base.Urn = new Uri(base.Urn.ToString() + "messagetype/");
 }
 public ServiceContractConfiguration(ServiceBroker serviceBroker) : base(serviceBroker)
 {
     base.Urn = new Uri(base.Urn.ToString() + "contract/");
 }