Exemplo n.º 1
0
        public static string InsertQuery(Query1 Query)
        {
            try
            {
                //string QueryDate = DateTime.Now.ToString();
                SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
                SqlCommand    cmd = new SqlCommand("Insert Into Requestquery(Name,Email,Subject,[Description],QueryDate) values(@Name,@Email,@Subject,@Description,getdate())", con);
                cmd.Parameters.AddWithValue("@Name", Query.name);
                cmd.Parameters.AddWithValue("@Email", Query.email);
                cmd.Parameters.AddWithValue("@Subject", Query.Sub);
                cmd.Parameters.AddWithValue("@Description", Query.discription);
                // cmd.Parameters.AddWithValue("@QueryDate", QueryDate);
                con.Open();
                cmd.ExecuteNonQuery();
                con.Close();

                string Msg = "Name : " + Query.name + ", Email id : " + Query.email + ", Message : " + Query.discription + "";
                Gen    obj = new Gen();
                // obj.SendEmail("*****@*****.**", Msg, "Contact us Query", "*****@*****.**");
            }
            catch (Exception ex)
            {
            }
            return("success");
        }
Exemplo n.º 2
0
        public virtual void Test1()
        {
            string baseName = GetBaseName();

            NeoDatis.Odb.ODB odb  = Open(baseName);
            bool[]           bbs1 = new bool[2];
            bbs1[0] = true;
            bbs1[1] = false;
            bool[] bbs2 = new bool[2];
            bbs2[0] = true;
            bbs2[1] = false;
            ClassWithArrayOfBoolean o = new ClassWithArrayOfBoolean("test", bbs1, bbs2);

            odb.Store(o);
            odb.Close();
            odb = Open(baseName);
            IQuery query = new Query1();
            Objects <ClassWithArrayOfBoolean> objects = odb.GetObjects <ClassWithArrayOfBoolean>(new Query1());

            AssertEquals(1, objects.Count);
            ClassWithArrayOfBoolean o2 = objects.GetFirst();

            AssertEquals("test", o2.GetName());
            AssertEquals(true, o2.GetBools1()[0]);
            AssertEquals(false, o2.GetBools1()[1]);
            AssertEquals(true, o2.GetBools2()[0]);
            AssertEquals(false, o2.GetBools2()[1]);
        }
Exemplo n.º 3
0
        public virtual void Test1()
		{
			
			string baseName = GetBaseName();
			NeoDatis.Odb.ODB odb = Open(baseName);
			bool[] bbs1 = new bool[2];
			bbs1[0] = true;
			bbs1[1] = false;
			bool[] bbs2 = new bool[2];
			bbs2[0] = true;
			bbs2[1] = false;
			ClassWithArrayOfBoolean o = new ClassWithArrayOfBoolean("test", bbs1, bbs2);
			odb.Store(o);
			odb.Close();
			odb = Open(baseName);
            IQuery query = new Query1();
			Objects<ClassWithArrayOfBoolean> objects = odb.GetObjects<ClassWithArrayOfBoolean>(new Query1());
			AssertEquals(1, objects.Count);
			ClassWithArrayOfBoolean o2 = objects.GetFirst();
			AssertEquals("test", o2.GetName());
			AssertEquals(true, o2.GetBools1()[0]);
			AssertEquals(false, o2.GetBools1()[1]);
			AssertEquals(true, o2.GetBools2()[0]);
			AssertEquals(false, o2.GetBools2()[1]);
		}
Exemplo n.º 4
0
        public ActionResult Query1Answear(string date)
        {
            if (ModelState.IsValid)
            {
                string g = date;

                DateTime myDate = DateTime.ParseExact(date + "-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss", null);

                var query1 =
                    (from order in db.OrderSet
                     join orderDetails in db.OrderDetailSet on order.Id equals orderDetails.Order_id
                     join product in db.ProductSet on orderDetails.Product_id equals product.Id
                     where order.OrderDate >= myDate
                     select new { order.OrderDate, order.Id, orderDetails.OrderDetail_id, product.Name, orderDetails.Quantity }).ToList().ToList();



                List <Query1> temp = new List <Query1>();

                foreach (var a in query1)
                {
                    Query1 t = new Query1(a.OrderDate, a.Id, a.OrderDetail_id, a.Name, a.Quantity);
                    temp.Add(t);
                }


                return(View(temp));
            }

            return(HttpNotFound());
        }
        public async Task PostFilterAsync_DoesNotCommitForQueries()
        {
            var query = new Query1();
            await sut.PreFilterAsync(query);

            await sut.PostFilterAsync(query, null);

            unitOfWorkFactory.Received(1).CreateUnitOfWork();
            unitOfWork.DidNotReceive().CommitAsync();
        }
        public async Task HandleAsync_ReturnsResult()
        {
            var query = new Query1();
            CommandBusMiddlewareDelegate next = async paramCommand => 42;

            var result = await sut.HandleAsync(query, CommandExecutionOptions.Default,
                                               next, CancellationToken.None);

            result.Should().Be(42);
        }
        public async Task HandleAsync_DoesNotCommitForQueries()
        {
            var query = new Query1();
            CommandBusMiddlewareDelegate next = async paramCommand =>
            {
                commandContextStack.UnitOfWork.Should().BeNull();
                return(null);
            };

            await sut.HandleAsync(query, CommandExecutionOptions.Default,
                                  next, CancellationToken.None);

            unitOfWorkFactory.DidNotReceive().CreateUnitOfWork();
        }
        public async Task HandleAsync_CommitsWhenConfigured()
        {
            var query = new Query1();
            CommandBusMiddlewareDelegate next = async paramCommand =>
            {
                commandContextStack.UnitOfWork.Should().Be(unitOfWork);
                return(null);
            };

            await sut.HandleAsync(query, new CommandExecutionOptions(true, null),
                                  next, CancellationToken.None);

            unitOfWorkFactory.Received(1).CreateUnitOfWork();
            unitOfWork.Received(1).CommitAsync();
        }
Exemplo n.º 9
0
 public Resource1 get_query1_Name(Query1 query)
 {
     return(new Resource1 {
         Name = query.Name
     });
 }
        public IEnumerable <Query1> Get()
        {
            //Initialisation de la collection
            var collection = MongoDBInstance.GetMongoDatabase;


            //Query 1
            var pipelineQ1 = new BsonDocument[]
            {
                new BsonDocument("$project", new BsonDocument()
                                 .Add("first_name", 1.0)
                                 .Add("last_name", 1.0)
                                 .Add("myField", new BsonDocument()
                                      .Add("$slice", new BsonArray()
                                           .Add("$titles.from_date")
                                           .Add(-1.0)
                                           )
                                      )),
                new BsonDocument("$project", new BsonDocument()
                                 .Add("first_name", 1.0)
                                 .Add("last_name", 1.0)
                                 .Add("Entre_post", new BsonDocument()
                                      .Add("$arrayElemAt", new BsonArray()
                                           .Add("$myField")
                                           .Add(0.0)
                                           )
                                      )),
                new BsonDocument("$project", new BsonDocument()
                                 .Add("first_name", 1.0)
                                 .Add("last_name", 1.0)
                                 .Add("Entre_post", 1.0)
                                 .Add("slice_EP", new BsonDocument()
                                      .Add("$substr", new BsonArray()
                                           .Add("$Entre_post")
                                           .Add(0.0)
                                           .Add(4.0)
                                           )
                                      )),
                new BsonDocument("$project", new BsonDocument()
                                 .Add("Entre_post", 1.0)
                                 .Add("first_name", 1.0)
                                 .Add("last_name", 1.0)
                                 .Add("cvtEntre_post", new BsonDocument()
                                      .Add("$toInt", "$slice_EP")
                                      )),
                new BsonDocument("$project", new BsonDocument()
                                 .Add("Entre_post", 1.0)
                                 .Add("first_name", 1.0)
                                 .Add("last_name", 1.0)
                                 .Add("cvtEntre_post", 1.0)
                                 .Add("Post", new BsonDocument()
                                      .Add("$subtract", new BsonArray()
                                           .Add(2002.0)
                                           .Add("$cvtEntre_post")
                                           )
                                      ))
            };
            var resultBsonDocumentQ1 = collection.Aggregate <BsonDocument>(pipelineQ1).ToList();

            Query1[] resultQuery1 = new Query1[resultBsonDocumentQ1.Count];
            for (int i = 0; i < resultBsonDocumentQ1.Count; ++i)
            {
                resultQuery1[i] = BsonSerializer.Deserialize <Query1>(resultBsonDocumentQ1[i]);
            }

            return(resultQuery1);
        }
Exemplo n.º 11
0
 public Resource1 get_query1_Name(Query1 query)
 {
     return new Resource1 { Name = query.Name };
 }
Exemplo n.º 12
0
 public static void ReadQuery1Data(string str)
 {
     IEnumerable<string> lines = File.ReadLines(Path.GetFullPath(str));
       var line = lines.Where(x => (x != ""));
       object lock_query = new object();
       Parallel.ForEach(line, l =>
       {
     try
     {
       string[] datas = l.Split('\t', ',');
       int k1 = Convert.ToInt32(datas[0].Trim('"'));
       int p = Convert.ToInt32(datas[1].Trim('"'));
       double lkp = Convert.ToDouble(datas[2].Trim('"'));
       double pagerank = Convert.ToDouble(datas[3].Trim('"'));
       double ukp = Convert.ToDouble(datas[4].Trim('"'));
       double rcm = CalculateRCM(k1, p);
       lock (lock_query)
       {
     if (dicQuery1.Keys.Contains(k1))
     {
       dicQuery1[k1].dicResultsLKP.Add(p, lkp);
       dicQuery1[k1].dicResultsUKP.Add(p, ukp);
       dicQuery1[k1].dicResultsPagerank.Add(p, pagerank);
       dicQuery1[k1].dicResultsRCM.Add(p, rcm);
     }
     else
     {
       Query1 q = new Query1(k1);
       q.dicResultsLKP.Add(p, lkp);
       q.dicResultsUKP.Add(p, ukp);
       q.dicResultsPagerank.Add(p, pagerank);
       q.dicResultsRCM.Add(p, rcm);
       dicQuery1.Add(k1, q);
     }
       }
     }
     catch (Exception ex)
     {
       Console.WriteLine("Error {0} at line:{1}", ex.Message, line);
     }
       });
 }
Exemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Onboard.Api.Client.CSharp.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="query"> (optional)</param>
        /// <returns>Task of ApiResponse (InlineResponse2001)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <InlineResponse2001> > PeopleByIdGetAsyncWithHttpInfo(string id, Query1 query = null)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling PeopleApi->PeopleByIdGet");
            }

            var    localVarPath         = "./people/People/{Id}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json-patch+json",
                "application/json",
                "text/json",
                "application/_*+json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (id != null)
            {
                localVarPathParams.Add("Id", this.Configuration.ApiClient.ParameterToString(id));             // path parameter
            }
            if (query != null && query.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(query); // http body (model) parameter
            }
            else
            {
                localVarPostBody = query; // byte array
            }

            // authentication (Bearer) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (Subscription_Key) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key")))
            {
                localVarHeaderParams["Ocp-Apim-Subscription-Key"] = this.Configuration.GetApiKeyWithPrefix("Ocp-Apim-Subscription-Key");
            }
            // authentication (Tenant_Id) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("X-Onboard-Tenant-Id")))
            {
                localVarHeaderParams["X-Onboard-Tenant-Id"] = this.Configuration.GetApiKeyWithPrefix("X-Onboard-Tenant-Id");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("PeopleByIdGet", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <InlineResponse2001>(localVarStatusCode,
                                                        localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()),
                                                        (InlineResponse2001)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse2001))));
        }
Exemplo n.º 14
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Onboard.Api.Client.CSharp.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="query"> (optional)</param>
        /// <returns>Task of InlineResponse2001</returns>
        public async System.Threading.Tasks.Task <InlineResponse2001> PeopleByIdGetAsync(string id, Query1 query = null)
        {
            ApiResponse <InlineResponse2001> localVarResponse = await PeopleByIdGetAsyncWithHttpInfo(id, query);

            return(localVarResponse.Data);
        }
Exemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <exception cref="Onboard.Api.Client.CSharp.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id"></param>
        /// <param name="query"> (optional)</param>
        /// <returns>InlineResponse2001</returns>
        public InlineResponse2001 PeopleByIdGet(string id, Query1 query = null)
        {
            ApiResponse <InlineResponse2001> localVarResponse = PeopleByIdGetWithHttpInfo(id, query);

            return(localVarResponse.Data);
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            sqlConnection.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["academiaADBConnection"].ConnectionString;

            command.Connection = sqlConnection;

            command.CommandType = System.Data.CommandType.Text;



            SqlDataAdapter reader = new SqlDataAdapter("SELECT r.firstName+' '+r.lastName as 'Full Name',a.ArticalName  ,a.ArticalPublishDate,m.MagazineName,r.AcademicRank FROM Researchers r join ResearcherArticals ra on ra.ResearcherId = r.ResearcherId join Articals a on a.ArticalId = ra.ArticalId join Magazine m on m.MagazineId = ra.MagazineId", sqlConnection);
            DataTable      dbtl   = new DataTable();

            reader.Fill(dbtl);
            Query1.DataSource = dbtl;
            Query1.DataBind();


            SqlDataAdapter reader1 = new SqlDataAdapter("SELECT  r.firstName+' '+r.lastName as 'Full Name',a.ArticalName  ,a.ArticalPublishDate,m.MagazineName,r.AcademicRank FROM Researchers r join ResearcherArticals ra on ra.ResearcherId = r.ResearcherId join Articals a on a.ArticalId = ra.ArticalId join Magazine m on m.MagazineId = ra.MagazineId ORDER BY r.AcademicRank", sqlConnection);
            DataTable      dbtl2   = new DataTable();

            reader1.Fill(dbtl2);
            Query2.DataSource = dbtl2;
            Query2.DataBind();


            string         strQuery = "SELECT  * FROM Researchers ";
            SqlCommand     cmd      = new SqlCommand(strQuery, sqlConnection);
            SqlDataAdapter d        = new SqlDataAdapter(cmd);

            DataSet dataTable = new DataSet();

            d.Fill(dataTable, "Researchers");
            DropDownList1.DataSource = dataTable.Tables["Researchers"];
            if (!IsPostBack)
            {
                DropDownList1.DataTextField  = "ResearcherId";
                DropDownList1.DataValueField = "ResearcherId";
                RemoveDuplicateItems(DropDownList1);
            }
            DropDownList1.DataBind();


            SqlDataAdapter reader2 = new SqlDataAdapter("SELECT  * FROM  Articals", sqlConnection);
            DataSet        dbtl1   = new DataSet();

            reader2.Fill(dbtl1, "Articals");
            ArticalDropdwon.DataSource = dbtl1.Tables["Articals"];
            if (!IsPostBack)
            {
                ArticalDropdwon.DataTextField  = "ArticalId";
                ArticalDropdwon.DataValueField = "ArticalId";
                RemoveDuplicateItems(ArticalDropdwon);
            }
            ArticalDropdwon.DataBind();

            SqlDataAdapter reader3 = new SqlDataAdapter("SELECT  *  FROM  Magazine", sqlConnection);
            DataSet        dbtl3   = new DataSet();

            reader3.Fill(dbtl3, "Magazine");
            mgDropDownList.DataSource = dbtl3.Tables["Magazine"];
            if (!IsPostBack)
            {
                mgDropDownList.DataTextField  = "MagazineId";
                mgDropDownList.DataValueField = "MagazineId";
                RemoveDuplicateItems(mgDropDownList);
            }
            mgDropDownList.DataBind();

            sqlConnection.Close();
        }