Example #1
0
        public HttpResponseMessage DeleteSchoolStudents(int schoolid, [FromUri] int studentid)
        {
            if (studentid == null)
            {
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest);
                return response;
            }
            else
            {
                using (provider = new EntDAL.EFProvider())
                {
                    SchoolService service = new SchoolService(provider);

                    if (service.DeleteSchoolStudent(schoolid, studentid))
                    {
                        HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NoContent);
                        return response;
                    }
                    else
                    {
                        HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NotFound);
                        return response;
                    }
                }
            }
        }
 internal ConnectionManager(IProvider provider, DbConnection con, int maxUsers, bool disposeConnection) {
     this.provider = provider;
     this.connection = con;
     this.maxUsers = maxUsers;
     this.users = new List<IConnectionUser>(maxUsers);
     this.disposeConnection = disposeConnection;
 }
		public IExecuteResult Execute(IProvider provider, object[] parentArgs, object[] userArgs)
		{
			if(parentArgs == null && !(this.parameters == null || this.parameters.Count == 0))
			{
				throw Error.ArgumentNull("arguments");
			}

			// construct new copy of query info
			List<SqlParameterInfo> spis = new List<SqlParameterInfo>(this.queryInfo.Parameters);

			// add call arguments
			for(int i = 0, n = this.parameters.Count; i < n; i++)
			{
				spis.Add(new SqlParameterInfo(this.parameters[i], parentArgs[i]));
			}

			QueryInfo qi = new QueryInfo(
				this.queryInfo.Query,
				this.queryInfo.CommandText,
				spis.AsReadOnly(),
				this.queryInfo.ResultShape,
				this.queryInfo.ResultType
				);

			// execute query
			return provider.Execute(null, qi, this.factory, parentArgs, userArgs, subQueries, null);
		}
Example #4
0
        public MediaContainer GetStream(IProvider prov)
        {
            if (MediaContainer.Childrens.Count > 0 && MediaContainer.Childrens[0].Type == "movie")
            {
                MediaContainer.ViewGroup = null;
                MediaContainer.ViewMode = null;
            }
            bool removeandroid = false;

            if (WebOperationContext.Current != null &&
                WebOperationContext.Current.IncomingRequest.Headers.AllKeys.Contains("X-Plex-Product"))
            {
                //Fix for android hang, if the type is populated
                string kh = WebOperationContext.Current.IncomingRequest.Headers.Get("X-Plex-Product").ToUpper();
                if (kh.Contains("ANDROID"))
                    removeandroid = true;
            }
            MediaContainer.Childrens.ForEach(a =>
            {
                a.Group = null;
                if (removeandroid)
                    a.Type = null;
            });
            return MediaContainer;
        }
Example #5
0
 public UnitOfWork(IProvider dataProvider)
 {
     provider = dataProvider as Provider;
     if (provider == null)
         throw new Exception("Invalid Data Provider");
     transaction = provider.Session.BeginTransaction();
 }
Example #6
0
		public void Connect(IProvider provider)
		{
			if (provider.IsConnected)
				return;
			if (this.useMessageLoop)
			{
				this.form.BeginInvoke((Action)(() => provider.Connect()));
				if ((int)provider.Id == 1 || (int)provider.Id == 2)
				{
					ProviderManager.WaitConnected(provider, (int)this.ConnectionTimeout.TotalMilliseconds);
				}
				else
				{
					ProviderHelperForm f = new ProviderHelperForm();
					f.Init(provider, (int)this.ConnectionTimeout.TotalSeconds);
					MethodInvoker methodInvoker = (MethodInvoker)(() =>
					{
						int temp_75 = (int)f.ShowDialog((IWin32Window)this.parentForm);
						f.Dispose();
					});
					if (this.parentForm.InvokeRequired)
						this.parentForm.Invoke((Delegate)methodInvoker);
					else
						methodInvoker();
				}
			}
			else
				provider.Connect((int)this.ConnectionTimeout.TotalMilliseconds);
		}
    private HtmlGenericControl constructControl(IProvider provider)
    {
        string iconPath = Utility.GetSocialAuthConfiguration().IconFolder.Path ;
        if (string.IsNullOrEmpty(iconPath))
            iconPath = "images/socialauthicons/";
        iconPath += provider.ProviderType.ToString() + ".png";
        bool isconnected = SocialAuthUser.IsConnectedWith(provider.ProviderType);
        bool iscurrent = (SocialAuthUser.CurrentProvider == provider.ProviderType);
        HtmlGenericControl providerDiv = new HtmlGenericControl("div");
        providerDiv.Attributes.Add("class", "provider");
        ImageButton imgB = new ImageButton()
        {
            ID = "img" + provider.ProviderType,
            CommandArgument = provider.ProviderType.ToString(),
            ImageUrl = iconPath
        };
        if (isconnected)
        {
            HtmlGenericControl tickspan = new HtmlGenericControl("span");
            tickspan.InnerHtml = "<img src='images/socialauthicons/" + (iscurrent ? "currentyes" : "yes") + ".png' style='top:0px;left:0px;z-index:100'/>";
            tickspan.Style.Add("position", "absolute");

            providerDiv.Controls.Add(tickspan);
        }
        //if (iscurrent)
        //    imgB.Style.Add("border", "1px solid yellow");
        imgB.Command += new CommandEventHandler(imgB_Command);
        providerDiv.Controls.Add(imgB);
        return providerDiv;
    }
Example #8
0
        static Provider()
        {
            lock (typeof (Provider)) {
                if (provider != null) {
                    return;
                }

                var extensions = GetOrderedExtensions (
                    "/Banshee/Platform/IOProvider",
                    ProviderConfiguration.ProviderSchema.Get (),
                    "Banshee.IO.Gio.Provider", "Banshee.IO.Unix.Provider", "Banshee.IO.SystemIO.Provider"
                );

                foreach (var node in extensions) {
                    try {
                        provider = (IProvider)node.CreateInstance (typeof (IProvider));
                        break;
                    } catch (Exception e) {
                        Log.Warning ("IO provider extension failed to load", e.Message);
                    }
                }

                if (provider == null) {
                    provider = new Banshee.IO.SystemIO.Provider ();
                }

                Log.DebugFormat ("IO provider extension loaded ({0})", provider.GetType ().FullName);

                directory = (IDirectory)Activator.CreateInstance (provider.DirectoryProvider);
                file = (IFile)Activator.CreateInstance (provider.FileProvider);
            }
        }
Example #9
0
        public static bool Register(IProvider provider)
        {
            bool retval = false;
            if (provider != null)
            {
                object o = null;
                if (provider.GetItem(typeof(IUserDao), out o))
                {
                    _userDao = o as IUserDao;
                    retval = true;
                }

                if (provider.GetItem(typeof(IQueueDao), out o))
                {
                    _queueDao = o as IQueueDao;
                    retval = true;
                }

                if (!retval)
                {
                    Trace.WriteLine("AdminRegistry.Register(" + provider + "): no daos found");
                }
            }
            else
            {
                Trace.WriteLine("QuestionaireRegistry.Register(" + provider + "): provider was null");
            }
            return retval;
        }
Example #10
0
File: Layer.cs Project: jbrwn/tc
        public Layer(string name, string title, IGridSet gridset,IProvider provider, ICache cache = null, ITileFilter cacheFilter = null)
        {
            // Set name
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("Layer Name cannot be null");
            this._name = name;

            // Set title
            this._title = title;

            // Set GridSet
            if (gridset == null)
                throw new ArgumentNullException("Layer GridSet cannot be null");
            this._gridSet = gridset;

            // Set Cache
            this._cache = cache;

            // Set Provider
            if (provider == null)
                throw new ArgumentNullException("Layer Provider cannot be null");
            this._provider = provider;

            this._cacheFitler = cacheFilter;
        }
Example #11
0
 public ProviderNode(IProvider provider)
 {
   this.provider = provider;
   this.Text = provider.Name;
   this.ToolTipText = string.Format("{0}{1}{2}", provider.Title, Environment.NewLine, provider.URL);
   this.UpdateStatus();
 }
Example #12
0
 public MigrationStep(IMigration migration, IScheduledMigrationMetadata metadata, ConnectionInfo connectionInfo, IProvider provider, IProviderMetadata providerMetadata, IDbConnectionFactory connectionFactory, ISqlDispatcher sqlDispatcher)
     : base(migration, provider, providerMetadata)
 {
     _metadata = metadata;
     _connectionInfo = connectionInfo;
     _connectionFactory = connectionFactory;
     _sqlDispatcher = sqlDispatcher;
 }
 public StackedLabelProvider(IProvider provider, LabelStyle labelStyle, Pen rectangleLine = null,
     Brush rectangleFill = null)
 {
     _provider = provider;
     _labelStyle = labelStyle;
     _rectangleLine = rectangleLine ?? new Pen(Color.Gray);
     _rectangleFill = rectangleFill;
 }
 // used only for testing
 internal async Task AddAndInitProvider(string name, IProvider provider, IProviderConfiguration config = null)
 {
     if (provider != null)
     {
         await provider.Init(name, this, config);
         statisticsProviderLoader.AddProvider(name, provider, config);
     }
 }
Example #15
0
 public ProviderProxy(IProvider provider)
 {
     if (provider == null)
     {
         throw new ArgumentNullException("provider");
     }
     _provider = provider;
 }
Example #16
0
 public FeatureFetcher(BoundingBox extent, double resolution, IProvider provider, DataArrivedDelegate dataArrived, long timeOfRequest = default(long))
 {
     _dataArrived = dataArrived;
     _extent = extent;
     _provider = provider;
     _resolution = resolution;
     _timeOfRequest = timeOfRequest;
 }
 public static Layer CreateCountryLayer(IProvider countrySource)
 {
     var countries = new Layer("Countries");
     countries.DataSource = countrySource;
     countries.DataSource.SRID = 3785;
     countries.Styles.Add(CreateCountryTheme());
     return countries;
 }
Example #18
0
 /// <summary>
 /// Construcor, initializes the Connector object.
 /// </summary>
 internal Connector(IProvider provider, bool Shared)
 {
     Provider = provider;
     _Shared = Shared;
     Pooled = true;
     InstanceCounter++;
     InstanceNumber = InstanceCounter;
 }
Example #19
0
 public EventMonitorWindow()
 {
     this.InitializeComponent();
     this.counter = new TotalCounter();
     this.providerCounterRows = new Dictionary<IProvider, ProviderCounterViewRow>();
     this.instrumentCounterRows = new Dictionary<IFIXInstrument, InstrumentCounterViewRow>();
     this.selectedProvider = (IProvider)null;
 }
Example #20
0
        public Tabel(string number, DateTime date)
        {
            Driver = DriverList.getInstance().getItemByNumber(number);
            Date = date;
            Comment = string.Empty;

            provider = Provider.GetProvider();
        }
        public Organization(TypeOrg typeOrg)
        {
            _provider = Provider.GetProvider();

            TypeOrg = typeOrg;
            NumberSF = string.Empty;
            ShortName = string.Empty;
        }
Example #22
0
        public override bool Subscribe(IProvider provider, Hashtable parameterMap)
#endif
 {
			bool success = base.Subscribe(provider, parameterMap);
			if (success)
				FireProviderConnectionEvent(provider, PipeConnectionEvent.PROVIDER_CONNECT_PUSH, parameterMap);
			return success;
		}
Example #23
0
 /// <summary>
 /// Creates an instance of this class
 /// </summary>
 /// <param name="provider">The provider</param>
 /// <param name="heatValueColumn">The name of the column that contains the heat value</param>
 /// <param name="heatValueScale">A value that is responsible to scale the heat value to the range &#x211d;[0, 1f]</param>
 public HeatLayer(IProvider provider, string heatValueColumn, float heatValueScale = 1f)
     : this()
 {
     DataSource = provider;
     HeatValueComputer = GetHeatValueFromColumn;
     HeatValueColumn = heatValueColumn;
     HeatValueScale = heatValueScale;
 }
Example #24
0
        /// <summary>
        /// Creates an instance of this class
        /// </summary>
        /// <param name="layername">The layer name</param>
        /// <param name="datasource">The data source</param>
        public SharpDXVectorLayer(string layername, IProvider datasource)
            : base(layername, datasource)
        {
            _syncRoot = new object();

            _d2d1Factory = new D2D1.Factory(D2D1.FactoryType.SingleThreaded);
            AntialiasMode = D2D1.AntialiasMode.PerPrimitive;
        }
 public IEnumerable<string> ToSql(IProvider provider, IRuntimeContext context)
 {
     return provider.AlterColumn(Parent.Parent.TableName, new Column(
         Parent.ColumnName,
         new DataType(_type, Size, Scale),
         _isNullable,
         DefaultValue));
 }
Example #26
0
        /// <summary>
        /// Maps array of customer data transfer objects to customer model objects.
        /// </summary>
        /// <param name="customers">Array of customer data transfer objects.</param>
        /// <param name="provider">Provider.</param>
        /// <returns>Observable collection of customer models.</returns>
        internal static ObservableCollection<CustomerModel> FromDataTransferObjects(Customer[] customers, IProvider provider)
        {
            if (customers == null)
                return null;

            List<CustomerModel> list = customers.Select(c => FromDataTransferObject(c, provider)).ToList();
            return new ObservableCollection<CustomerModel>(list);
        }
Example #27
0
        public ProviderInfo(IProvider provider, IProviderMetadata metadata)
        {
            if (provider == null) throw new ArgumentNullException("provider");
            if (metadata == null) throw new ArgumentNullException("metadata");

            Provider = provider;
            Metadata = metadata;
        }
 internal SqlConnectionManager(IProvider provider, DbConnection con, int maxUsers, bool disposeConnection) {
     this.provider = provider;
     this.connection = con;
     this.maxUsers = maxUsers;
     this.infoMessagehandler = new SqlInfoMessageEventHandler(this.OnInfoMessage);
     this.users = new List<IConnectionUser>(maxUsers);
     this.disposeConnection = disposeConnection;
 }
Example #29
0
        protected MyDictionary()
        {
            dictionary = new Dictionary<int, string>();

            provider = Provider.GetProvider();

            loadFromSql();
        }
        public void Add(IProvider provider)
        {
            provider.CreateThread = false;
            provider.Disposed += provider_Disposed;

            lock (_providers)
                _providers.Add(provider);
        }
Example #31
0
 public void RegisterProvider(IProvider provider)
 {
     AddNewProviderRegistration(provider);
 }
Example #32
0
 public HostService(IProvider <PSCommand> psProvider)
 {
     this.psProvider = psProvider;
 }
Example #33
0
 public CommandsToSqlTranslator(IProvider provider)
 {
     _provider = provider;
 }
        public void TestCreateAmqpProvider()
        {
            IProvider provider = ProviderFactory.Create(new Uri("amqp://localhost:5672"));

            Assert.That(provider, Is.InstanceOf <AmqpProvider>());
        }
Example #35
0
 public OnProviderAdded(IProvider provider)
 {
     Provider   = provider;
     ProviderId = Provider.Id;
 }
Example #36
0
 public OAuth1_0Hybrid(IProvider provider)
 {
     this.provider = provider;
 }
Example #37
0
        public ViewTemplateProvider(ViewTemplateRegistrator registrator, ViewTemplateAnalyzer analyzer, ContentActivator activator, DefinitionBuilder builder, IProvider <HttpContextBase> httpContextProvider, IProvider <VirtualPathProvider> vppProvider)
        {
            this.registrator         = registrator;
            this.analyzer            = analyzer;
            this.activator           = activator;
            this.builder             = builder;
            this.httpContextProvider = httpContextProvider;
            this.vppProvider         = vppProvider;

            registrator.RegistrationAdded += (s, a) => rebuild = true;
        }
Example #38
0
 public static void InitSQLProvider()
 {
     _provider = new ProviderSQL();
 }
 public DrugsApiController(IProvider drugprov)
 {
     _prov = drugprov;
 }
Example #40
0
        private ISearchService GetTestSearchService()
        {
            IProvider provider = GetTestProvider();

            return(new ProviderCatalogSearchService(() => provider));
        }
Example #41
0
 public CommandBuilder(IProvider provider)
     : base(provider)
 {
 }
Example #42
0
 protected void RegisterProvider <TContract>(
     DiContainer container, IProvider provider)
 {
     RegisterProvider(container, typeof(TContract), provider);
 }
Example #43
0
 public static void InitWebServiceProvider()
 {
     _provider = new ProviderWebService();
 }
Example #44
0
 public Task OnConnectionRecovery(IProvider provider)
 {
     return(Task.CompletedTask);
 }
Example #45
0
 public HtmlHelperProvider(IWebContext webContext, IProvider <RouteCollection> routeCollectionProvider)
 {
     this.webContext = webContext;
     this.routeCollectionProvider = routeCollectionProvider;
 }
Example #46
0
 public static void SetProvider(IProvider customProvider)
 {
     provider = customProvider;
 }
Example #47
0
        public FormSchema Build(IProvider provider, string tblName)
        {
            FormSchema schema = new FormSchema(CID.New("WinForm"));

            schema.Name = tblName;

            ControlSchema feeder = new ControlSchema(CID.New("RowFeeder"));

            schema.Controls.Add("Feeder1", feeder);


            DBField[] fields = provider.GetFieldsInfo(tblName);

            foreach (DBField field in fields)
            {
                ControlSchema ctl = new ControlSchema(CID.New("TextBox"));
                ctl.Properties.Add("Text", field.name);
                ctl.Bindings.Add("Text", new BindingSchema(field.name));
                schema.Controls.Add(field.name, ctl);

                if (field.name == "PK_ID")
                {
                    ctl.AddServiceEventHandler("TextChanged", "Feeder1", "FeedRowStr");
                }
            }

            ControlSchema req = new ControlSchema(CID.New("RequiredFieldValidator"));

            req.Bindings.Add("FieldToValidate", new BindingSchema(fields[0].name));

            ControlSchema reqLabel = new ControlSchema(CID.New("Label"));

            reqLabel.Properties.Add("Text", "id is required");
            req.Controls.Add("ReqLbl1", reqLabel);

            schema.Controls.Add("Req1", req);


            ControlSchema saver = new ControlSchema(CID.New("DataSaver"));

            schema.Controls.Add("Saver1", saver);

            ControlSchema ok = new ControlSchema(CID.New("Button"));

            ok.Properties.Add("Text", "Save");

            ok.AddConnectorEventHandler("Click", null, "FormSubmit"); //null means form
            ok.AddServiceEventHandler("Click", "Saver1", "SaveData");

            schema.Controls.Add("OKButton", ok);

            ControlSchema grid = new ControlSchema(CID.New("DataGrid"));

            grid.Properties.Add("TableName", "TABLE1");
            grid.Properties.Add("Columns", new string[] { "PK_ID", "USER_NAME", "USER_SCORE" });
            grid.Properties.Add("ColumnHeaders", new string[] { "ID", "User Name", "User Score" });
            schema.Controls.Add("Grid1", grid);

            //schema.WriteForm("form.xml");

            //XmlSerializer xml = new XmlSerializer(typeof(FormSchema));
            //FileStream fs = new FileStream("a.xml", FileMode.Create);
            //xml.Serialize(fs, schema);

            return(schema);
        }
Example #48
0
 public abstract void SetUniqueID(IProvider <string, string, string> sentProvider);
Example #49
0
 public void Setup()
 {
     _provider = EmbedlurContext.Resolver.ResolveByName("Ted");
 }
Example #50
0
 /// <summary>
 /// Indicates that the service should be bound to the specified provider.
 /// </summary>
 /// <typeparam name="TImplementation">The type of the implementation.</typeparam>
 /// <param name="provider">The provider.</param>
 /// <returns>The fluent syntax.</returns>
 public IBindingWhenInNamedWithOrOnSyntax <TImplementation> ToProvider <TImplementation>(IProvider <TImplementation> provider)
     where TImplementation : T1
 {
     return(this.InternalToProvider(provider));
 }
 void IResultWriter.Begin(IProvider provider) => _beginTimestamp = Stopwatch.GetTimestamp();
Example #52
0
 public static void InitMockProvider()
 {
     _provider = new MockProvider();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProviderFactory"/> class.
 /// </summary>
 /// <param name="provider">The provider.</param>
 public ProviderFactory(IProvider provider)
 {
     Provider = provider;
 }
Example #54
0
        public static Task AuditAsync(this IDurableOrchestrationContext functionContext, ICommand command, ICommandResult commandResult = default, IProvider provider = default)
        {
            if (command is null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            return(functionContext.CallActivityWithRetryAsync(nameof(CommandAuditActivity), (command, commandResult, provider?.Id)));
        }
 public static SchedulerUtility Create(IProvider provider)
 {
     return(new SchedulerUtility(provider));
 }
Example #56
0
 protected abstract bool Filter(IProvider provider);
 public CachedProvider(IProvider creator)
 {
     _creator = creator;
 }
Example #58
0
 public RequestHandler(IProvider provider)
 {
     _provider = provider;
 }
Example #59
0
        public override System.Net.WebResponse ExecuteFeed(string feedURL, IProvider provider, BusinessObjects.Token connectionToken, BusinessObjects.TRANSPORT_METHOD transportMethod, byte[] content = null, Dictionary <string, string> headers = null)
        {
            string      signature   = "";
            OAuthHelper oauthHelper = new OAuthHelper();


            string          timestamp   = oauthHelper.GenerateTimeStamp();
            QueryParameters oauthParams = new QueryParameters();

            oauthParams.Add("oauth_consumer_key", provider.Consumerkey);
            oauthParams.Add("oauth_nonce", oauthHelper.GenerateNonce());
            oauthParams.Add("oauth_signature_method", provider.SignatureMethod.ToString());
            oauthParams.Add("oauth_timestamp", timestamp);
            oauthParams.Add("oauth_token", connectionToken.AccessToken);
            oauthParams.Add("oauth_version", "1.0");
            signature = oauthHelper.GenerateSignature(new Uri(feedURL), oauthParams, provider.Consumerkey, provider.Consumersecret, provider.SignatureMethod, TRANSPORT_METHOD.POST, connectionToken.TokenSecret);
            oauthParams.Add("oauth_signature", signature);
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(feedURL);

            request.Method = transportMethod.ToString();
            if (headers != null)
            {
                foreach (var header in headers)
                {
                    switch (header.Key)
                    {
                    case "ContentLength":
                    {
                        request.ContentLength = long.Parse(header.Value);
                        break;
                    }

                    case "ContentType":
                    {
                        request.ContentType = header.Value;
                        break;
                    }

                    default:
                    {
                        request.Headers[header.Key] = header.Value;
                        break;
                    }
                    }
                }
            }

            request.ContentLength = (content == null) ? 0 : content.Length;
            request.Headers.Add("Authorization", oauthHelper.GetAuthorizationHeader(oauthParams));
            request.GetRequestStream().Write(content, 0, content.Length);
            WebResponse wr = null;

            try
            {
                logger.Debug("Executing " + feedURL + " using " + transportMethod.ToString() + Environment.NewLine + "Request Parameters: " + oauthParams.ToString());
                wr = (WebResponse)request.GetResponse();
                logger.Info("Successfully executed  " + feedURL + " using " + transportMethod.ToString());
            }
            catch (Exception ex)
            {
                logger.Error(ErrorMessages.CustomFeedExecutionError(feedURL, oauthParams), ex);
                throw new OAuthException(ErrorMessages.CustomFeedExecutionError(feedURL, oauthParams), ex);
            }
            return(wr);
        }
 private SchedulerUtility(IProvider provider)
 {
     Provider = provider;
 }