public testModel testApi()
        {
            var n = new testModel();

            n.name = "nghia";
            return(n);
        }
Exemplo n.º 2
0
        public ActionResult CallDisplayFrist(string values, string DivCode, string DeptCode, string SecCode)
        {
            DailyAttendanceDashboardViewModel viewModel = new DailyAttendanceDashboardViewModel();

            if (!string.IsNullOrWhiteSpace(DivCode))
            {
                viewModel.Division   = DivCode;
                viewModel.Department = string.IsNullOrWhiteSpace(DeptCode) ? null : DeptCode;
                viewModel.Section    = string.IsNullOrWhiteSpace(SecCode) ? null : SecCode;

                TempData["ADS010ViewModel"] = viewModel;
                //TempData["AlertMessage"] = "test";
                //ViewBag.TestMsg = "test";
                //return new HttpStatusCodeResult(HttpStatusCode.OK);
                testModel tem            = new testModel();
                string    strDateTimeNow = String.Format("{0:ddMMyyyyHHmmsss}", DateTime.Now);
                string    idGen          = strDateTimeNow;
                tem.id = Convert.ToBase64String(Encoding.UTF8.GetBytes(idGen));
                return(Json(tem, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        static void test1()
        {
            try
            {
                Log.WriteLine("消息内容:");
                String message = Console.ReadLine();

                testModel M = new testModel();
                M.Age  = 1;
                M.Msg  = message;
                M.Name = DateTime.Now.ToString();

                string msg = message + ",Date:" + DateTime.Now.ToString();

                var Data = new MQClient.Model.MQWebApiData();
                Data.Host = "http://192.168.18.190:10001/";
                Data.Path = "mqtest/test_0s";
                Data.Data = M;


                grpc.PushData("exchangeTopic:MQtest.Client.#", Data);
                //grpc.PushDataAsync("exchangeTopic:MQtest.Client.#", Data);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    public async Task <string> PostToAPI([FromBody] string value)
    {
        var payload = value;

        // Serialize our concrete class into a JSON String
        var stringPayload = await Task.Run(() => JsonConvert.SerializeObject(payload));

        // Wrap our JSON inside a StringContent which then can be used by the HttpClient class
        var httpContent = new StringContent(stringPayload, Encoding.UTF8, "application/json");

        using (var httpClient = new HttpClient())
        {
            // Do the actual request and await the response
            var httpResponse = await httpClient.PostAsync("https://testapi.com/prod/testapi", httpContent);

            // If the response contains content we want to read it!
            if (httpResponse.Content != null)
            {
                var responseContent = await httpResponse.Content.ReadAsStringAsync();

                // From here on you could deserialize the ResponseContent back again to a concrete C# type using Json.Net
                testModel test   = new testModel();
                object    Desobj = JsonConvert.DeserializeObject(responseContent);
                return(test.Response = Desobj.ToString());
            }
            return(string.Empty);
        }
    }
Exemplo n.º 5
0
        /// <summary>
        /// 30s 500 一批整数分钟开始
        /// </summary>
        /// <param name="message"></param>
        static void Test3_1(object message)
        {
            //MQClient.Client grpc = new MQClient.Client("http://192.168.18.36:35672");
            //MQClient.Client grpc = new MQClient.Client(ServerConn);

            int second = System.DateTime.Now.Second;

            second = 60 - second;
            if (second > 30)
            {
                second = second - 30;
            }
            System.Threading.Thread.Sleep(second * 1000);
            while (true)
            {
                for (int i = 0; i < 200; i++)
                {
                    try
                    {
                        string msg = message + ", i:" + i.ToString() + ",Date:" + DateTime.Now.ToString();

                        testModel M = new testModel();
                        M.Age  = i;
                        M.Msg  = msg;
                        M.Name = DateTime.Now.ToString();

                        var Data = new MQClient.Model.MQWebApiData();
                        Data.Host = "http://192.168.18.190:10001/";
                        Data.Path = "mqtest/test_0s";
                        //Data.Path = "mqtest/test_1s";
                        Data.Data = M;


                        grpc.PushData("exchangeTopic:MQtest.Client.#", Data);
                        //grpc.PushDataAsync("exchangeTopic:MQtest.Client.#", Data);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }


                System.Threading.Thread.Sleep(30 * 1000);
            }
        }
    static int get_tModel(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            PomeloGameManager obj = (PomeloGameManager)o;
            testModel         ret = obj.tModel;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index tModel on a nil value"));
        }
    }
Exemplo n.º 7
0
        public ActionResult Profile()
        {
            var model = new ProfileViewModel();

            using (var ctx = new testModel())
            {
                var gc   = ctx.GameCollection.ToList();
                var g    = ctx.Game.ToList();
                var cc   = ctx.Console.ToList();
                var user = ctx.User.FirstOrDefault(x => x.UserID == 1);


                model.UserID    = user.UserID;
                model.GamerName = user.Username;
                var games = user.Collection.Games.ToList();
                model.RandGames = EnumerableExtension.PickRandom(games, 5).ToList();
            }
            return(View(model));
        }
Exemplo n.º 8
0
        // psElites.Models.DAL.psElitesEntities dbContext = new Models.DAL.psElitesEntities();
        public ActionResult Index()
        {
            var model = new StartPageViewModel();

            using (var ctx = new testModel())
            {
                var gc    = ctx.GameCollection.ToList();
                var g     = ctx.Game.ToList();
                var cc    = ctx.Console.ToList();
                var users = ctx.User.ToList();
                if (users.Any())
                {
                    var user = users.First(x => x.Username.ToLower() == "radx");
                    model.User     = user;
                    model.Members  = EnumerableExtension.PickRandom(users, 2).ToList();
                    model.OurGames = EnumerableExtension.PickRandom(g, 1).ToList();
                }
            }

            return(View(model));
        }
Exemplo n.º 9
0
 public void GetAll_WhenDataInDatabase_ShouldReturnData()
 {
     var test = new testModel();
     var httpServer = new InMemoryHttpServer("http://localhost/");
     var response = httpServer.CreateGetRequest("api/school");
 }
Exemplo n.º 10
0
 public void GetAll_WhenDataInDatabase_ShouldReturnData()
 {
     var test       = new testModel();
     var httpServer = new InMemoryHttpServer("http://localhost/");
     var response   = httpServer.CreateGetRequest("api/school");
 }