Ejemplo n.º 1
0
        public IActionResult Movies_Form(MovieFormModel movieFormModel)
        {
            if (movieFormModel.Title != "Independence Day")
            {
                TempModel.AddMovie(movieFormModel);
            }

            return(View());
        }
Ejemplo n.º 2
0
        public JsonResult meanTempAll()
        {
            TempModel tm = new TempModel();

            tm.mean_JFK = db.getDailyTempFromOrigin("JFK");
            tm.mean_EWR = db.getDailyTempFromOrigin("EWR");
            tm.mean_LGA = db.getDailyTempFromOrigin("LGA");
            return(Json(tm));
        }
 public ActionResult Edit([Bind(Include = "Id")] TempModel tempModel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tempModel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tempModel));
 }
 public ActionResult SYS_CODE_OnChange(string SYS_CODE)
 {
     var da = new SEC007P001DA();
     SetStandardErrorLog(da.DTO);
     da.DTO.Execute.ExecuteType = SEC007P001ExecuteType.GetUsgPriv;
     da.DTO.Model = TempModel.CloneObject();
     da.DTO.Model.SYS_CODE = SYS_CODE;
     da.SelectNoEF(da.DTO);
     return JsonAllowGet(da.DTO.Model.PRIV_MODEL);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Will send the infomation to clients on the monitor controller that has templimit set to a value lower than obj/amb
 /// </summary>
 /// <param name="model"></param>
 public void IrTempChange(TempModel model)
 {
     //set last know value so that new monitoring clients can get the information
     this.SensorInfo.lastValue = model;
     
     //Send only the clients mathching the expression
     this.InvokeTo<Monitor>(p => p.TempLimit <= model.obj || p.TempLimit <= model.amb, this.SensorInfo,"irtempchange");     
     //POC - Notify MQTT clients that subscribe for "irtempchange"...
     this.InvokeToAll<MqttController>(this.SensorInfo, "irtempchange");
 }
Ejemplo n.º 6
0
        private void SetTempData(int key)
        {
            TempModel tempModel = new TempModel()
            {
                Key       = key,
                IsSuccess = true
            };

            TempData["para"] = tempModel;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Will send the infomation to clients on the monitor controller that has templimit set to a value lower than obj/amb
        /// </summary>
        /// <param name="model"></param>
        public void IrTempChange(TempModel model)
        {
            //set last know value so that new monitoring clients can get the information
            this.SensorInfo.lastValue = model;

            //Send only the clients mathching the expression
            this.InvokeTo <Monitor>(p => p.TempLimit <= model.obj || p.TempLimit <= model.amb, this.SensorInfo, "irtempchange");
            //POC - Notify MQTT clients that subscribe for "irtempchange"...
            this.InvokeToAll <MqttController>(this.SensorInfo, "irtempchange");
        }
        public ActionResult Create([Bind(Include = "Id")] TempModel tempModel)
        {
            if (ModelState.IsValid)
            {
                db.TempModels.Add(tempModel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tempModel));
        }
        public ActionResult GetSysSeq(string SYS_GROUP_NAME)
        {
            var da = new SEC007P001DA();
            SetStandardErrorLog(da.DTO);
            da.DTO.Execute.ExecuteType = SEC007P001ExecuteType.GetSysSeq;
            da.DTO.Model = TempModel.CloneObject();
            da.DTO.Model.SYS_GROUP_NAME = SYS_GROUP_NAME;
            da.SelectNoEF(da.DTO);

            return JsonAllowGet(da.DTO.Model.PRIV_MODEL);
        }
Ejemplo n.º 10
0
        public void temp_controller_get_paginated_list()
        {
            var tempController = new TempController(_dbConnectionString);

            var addEntity = new TempModel
            {
                Id       = 1,
                Value    = 1f,
                DateTime = new DateTime(2018, 12, 1, 12, 0, 0)
            };
            var addSuccess = tempController.AddTemp(addEntity);

            Assert.IsTrue(addSuccess);

            var addEntity2 = new TempModel
            {
                Id       = 2,
                Value    = 2f,
                DateTime = new DateTime(2019, 12, 1, 12, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity2);
            Assert.IsTrue(addSuccess);

            var addEntity3 = new TempModel
            {
                Id       = 3,
                Value    = 3f,
                DateTime = new DateTime(2019, 12, 1, 18, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity3);
            Assert.IsTrue(addSuccess);

            var getPaginatedList = tempController.GetTempsAsPaginatedList(1, 2);

            Assert.IsNotNull(getPaginatedList);
            Assert.AreEqual(getPaginatedList.PageSize, getPaginatedList.Items.ToArray().Length);
            Assert.AreEqual(3, getPaginatedList.Items.ToArray()[0].Id);
            Assert.AreEqual(2, getPaginatedList.Items.ToArray()[1].Id);

            getPaginatedList = tempController.GetTempsAsPaginatedList(2, 1);
            Assert.IsNotNull(getPaginatedList);
            Assert.AreEqual(getPaginatedList.PageSize, getPaginatedList.Items.ToArray().Length);
            Assert.AreEqual(2, getPaginatedList.Items.ToArray()[0].Id);

            getPaginatedList = tempController.GetTempsAsPaginatedList(5, 1);
            Assert.IsNotNull(getPaginatedList);
            Assert.AreEqual(0, getPaginatedList.Items.ToArray().Length);

            Assert.IsTrue(tempController.RemoveTemp((int)addEntity.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity2.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity3.Id));
        }
Ejemplo n.º 11
0
 public IActionResult SubmissionsForm(Submission submission)
 {
     if (ModelState.IsValid)
     {
         TempModel.AddSubmission(submission);
         return(View("Submissions", TempModel.Submissions));
     }
     else
     {
         return(View());
     }
 }
Ejemplo n.º 12
0
        public string Temperature2(string ttt_aver,string ttt_min,string ttt_max,string beginDateTime, string endDateTime)
        {
            TempModel temp = new TempModel();
            string ret = "";

            var begindate = temp.DateTimeTotenDay(beginDateTime);
            var enddate = temp.DateTimeTotenDay(endDateTime);

            ret = temp.only_pull_temp(ttt_aver,ttt_max,ttt_min,begindate, enddate);

            return ret;
        }
Ejemplo n.º 13
0
        public void TestValidTrue()
        {
            var model = new TempModel {
                name = "123"
            };
            // Set some properties here
            var context           = new ValidationContext(model, null, null);
            var results           = new List <ValidationResult>();
            var isModelStateValid = Validator.TryValidateObject(model, context, results, true);

            // Assert here
            Assert.True(isModelStateValid);
        }
Ejemplo n.º 14
0
        public string soil(string tx_aver, string tx_max, string tx_min, string beginDateTime, string endDateTime)
        {
            TempModel temp = new TempModel();

            string ret = "";

            var begindate = temp.DateTimeTotenDay(beginDateTime);
            var enddate = temp.DateTimeTotenDay(endDateTime);

            ret = temp.only_pull_soil(tx_aver,tx_max,tx_min,begindate, enddate);

            return ret;
        }
Ejemplo n.º 15
0
        public async Task <JsonResult> DeleteUserRole([FromBody] TempModel model)
        {
            try
            {
                await _userRoleService.DeleteUserRole(int.Parse(model.data));

                return(Json(new { status = "success", message = "success" }));
            }
            catch (System.Exception)
            {
                return(Json(new { status = "fail", message = "fail" }));
            }
        }
Ejemplo n.º 16
0
        public string irimhe_temp_date(string beginDateTime,string endDateTime)
        {
            //
            TempModel temp = new TempModel();
            string ret = "";

            var begindate = temp.DateTimeTotenDay(beginDateTime);
            var enddate = temp.DateTimeTotenDay(endDateTime);

            ret = temp.PullData_begin_end(begindate,enddate);

            return ret;
        }
        // GET: TempModels/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TempModel tempModel = db.TempModels.Find(id);

            if (tempModel == null)
            {
                return(HttpNotFound());
            }
            return(View(tempModel));
        }
Ejemplo n.º 18
0
        public void temp_controller_get_all_temps_of_date()
        {
            var tempController = new TempController(_dbConnectionString);

            var addEntity = new TempModel
            {
                Id       = 1,
                Value    = 1f,
                DateTime = new DateTime(2018, 12, 1, 12, 0, 0)
            };
            var addSuccess = tempController.AddTemp(addEntity);

            Assert.IsTrue(addSuccess);

            var addEntity2 = new TempModel
            {
                Id       = 2,
                Value    = 2f,
                DateTime = new DateTime(2019, 12, 1, 12, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity2);
            Assert.IsTrue(addSuccess);

            var addEntity3 = new TempModel
            {
                Id       = 3,
                Value    = 3f,
                DateTime = new DateTime(2019, 12, 1, 18, 0, 0)
            };

            addSuccess = tempController.AddTemp(addEntity3);
            Assert.IsTrue(addSuccess);

            var temps = tempController.GetTempsByDate(new DateTime(2019, 12, 1)).ToArray();

            Assert.IsNotNull(temps);
            Assert.AreEqual(2, temps.Length);

            Assert.AreEqual(addEntity3.Id, temps[0].Id);
            Assert.AreEqual(addEntity3.DateTime, temps[0].DateTime);
            Assert.AreEqual(addEntity3.Value, temps[0].Value);
            Assert.AreEqual(addEntity2.Id, temps[1].Id);
            Assert.AreEqual(addEntity2.DateTime, temps[1].DateTime);
            Assert.AreEqual(addEntity2.Value, temps[1].Value);

            Assert.IsTrue(tempController.RemoveTemp((int)addEntity.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity2.Id));
            Assert.IsTrue(tempController.RemoveTemp((int)addEntity3.Id));
        }
Ejemplo n.º 19
0
 public HttpResponseMessage UpdateCardRequest([FromBody] TempModel model)
 {
     try
     {
         bool result = CustomerPL.UpdateCardRequest(model.CardRequestID, model.RequestType, model.LoggedInUsername);
         return(result.Equals(true) ? Request.CreateResponse(HttpStatusCode.OK, "Customer card request approved successfully") : Request.CreateResponse(HttpStatusCode.BadRequest, "Request failed"));
     }
     catch (Exception ex)
     {
         ErrorHandler.WriteError(ex);
         var response = Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
         return(response);
     }
 }
Ejemplo n.º 20
0
        public string percipitation(string sum_rrr_max, string beginDateTime, string endDateTime)
        {
            TempModel temp = new TempModel();

            string ret = "";

            var begindate = temp.DateTimeTotenDay(beginDateTime);
            var enddate = temp.DateTimeTotenDay(endDateTime);

            ret = temp.only_pull_percipitation(sum_rrr_max, begindate, enddate);

            return ret;

        }
Ejemplo n.º 21
0
        public string wind(string windmax,string beginDateTime, string endDateTime)
        {
            TempModel temp = new TempModel();

            string ret = "";

            var begindate = temp.DateTimeTotenDay(beginDateTime);
            var enddate = temp.DateTimeTotenDay(endDateTime);

            ret = temp.only_pull_wind(windmax, begindate, enddate);

            return ret;

        }
Ejemplo n.º 22
0
        public async Task <JsonResult> SearchDocsByFolderId(TempModel model)
        {
            try
            {
                System.Security.Claims.ClaimsPrincipal currentUser = this.User;
                var role     = currentUser.Claims.Where(x => x.Type == System.Security.Claims.ClaimTypes.Role).Select(x => x.Value);
                var listDocs = await _documentService.GetDocsByFolderId(model.data);

                return(Json(new { status = "success", message = "success !", listDocs, role }));
            }
            catch (Exception e)
            {
                return(Json(new { status = "fail", message = e }));
            }
        }
Ejemplo n.º 23
0
        // GET: Home
        public ActionResult Index(int Page = 1)
        {
            List <TempModel> tempData = new List <TempModel>();

            for (int i = 0; i < 20; i++)
            {
                TempModel temp = new TempModel()
                {
                    id   = i,
                    Name = "Deneme" + i + 1
                };
                tempData.Add(temp);
            }

            return(View(tempData.ToPagedList(Page, 4)));
        }
Ejemplo n.º 24
0
        public ActionResult Create(TempModel model)
        {
            try
            {
                model.Id = Startup.ModelList.Max(m => m.Id) + 1;
                Startup.ModelList.Add(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                ViewBag.ErrorMessage = ex.Message;
                return(View("Error"));
            }
        }
Ejemplo n.º 25
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                TempModel model = Startup.ModelList.FirstOrDefault(m => m.Id == id);
                Startup.ModelList.Remove(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                ViewBag.ErrorMessage = ex.Message;
                return(View("Error"));
            }
        }
Ejemplo n.º 26
0
        public ActionResult Index(TempModel tempModel)
        {
            string    sqlQuery;
            TempModel output_tempModel = new TempModel();
            //string connectionString = "server=127.0.0.1; uid=root; pwd=admin; database=sys; port=3306";
            //using (SqlConnection sqlConnection = new SqlConnection(connectionString))
            //using (SqlCommand sqlCommand = new SqlCommand("", sqlConnection))
            //{
            //    sqlConnection.Open();
            //    sqlCommand.CommandText = "select Test_Num from testtable;";
            //    sqlCommand.Parameters.AddWithValue("@value", tempModel.value);
            //    SqlDataReader reader = sqlCommand.ExecuteReader();
            //    output_tempModel.value = reader["Test_Num"].ToString();
            //}


            MySqlConnectionStringBuilder conn_string = new MySqlConnectionStringBuilder();

            conn_string.Server   = "127.0.0.1";
            conn_string.UserID   = "root";
            conn_string.Password = "******";
            conn_string.Database = "sys";

            using (MySqlConnection conn = new MySqlConnection(conn_string.ToString()))
                using (MySqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "select Test_Num from testtable where Test_ID = 2;";
                    conn.Open();
                    //cmd.Parameters.AddWithValue("@value", tempModel.value);
                    int value = (int)cmd.ExecuteScalar();
                    //MySqlDataReader reader = cmd.ExecuteScalar();
                    //while (reader.Read())
                    //{
                    //    int a = 0;
                    //    a = a + 1;
                    //    var b = reader.GetString(0);
                    //}
                    output_tempModel.value = Convert.ToString(value);
                }

            //output_tempModel.value = "1";

            ViewBag.ErrorMessage = output_tempModel.value;

            return(View(output_tempModel));
        }
        /// <summary>
        /// 发送外部消息
        /// </summary>
        /// <param name="token"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public OpenApiResult SendTempMessage(string token, TempModel model)
        {
            var url = string.Format("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}", token);

            try
            {
                var res = SendHelp.Send <OpenApiResult>(token, url, model);
                return(res);
            }
            catch (Exception e)
            {
                return(new OpenApiResult()
                {
                    error_code = -1, error_msg = e.Message
                });
            }
        }
Ejemplo n.º 28
0
        public ActionResult Edit(TempModel model)
        {
            try
            {
                TempModel curr_model = Startup.ModelList.FirstOrDefault(m => m.Id == model.Id);
                curr_model.Name   = model.Name;
                curr_model.TypeId = model.TypeId;

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                ViewBag.ErrorMessage = ex.Message;
                return(View("Error"));
            }
        }
Ejemplo n.º 29
0
        public string multi_station([System.Web.Http.FromBody]string[] sindex)
        {
            string ret = "";

            TempModel temp = new TempModel();
            
            if( sindex.Length != 0 )
            {
                ret = temp.multi_station(sindex);
            }
            else
            {
                ret = "error";
            }

            return ret;
        }
Ejemplo n.º 30
0
        public ActionResult PassChanger2(TempModel passedModel)
        {
            var       jwtToken    = new JwtSecurityToken(passedModel.token);
            UserModel userToCheck = new UserModel();

            userToCheck.UserPass  = passedModel.oldPass;
            userToCheck.UserLogin = jwtToken.Subject;

            UserModel user = AuthenticateUser(userToCheck);

            if (user != null)
            {
                FinallyChangePass(user, passedModel.userPass);
                return(Ok());
            }

            return(Unauthorized());
        }
Ejemplo n.º 31
0
        public ActionResult FindUserTargetsByToken(TempModel passedTempModel)
        {
            UserModel userModel = UserHandler.GetUserDataByToken(passedTempModel.token);

            userModel = UserHandler.GetUserDataFromDbByLogin(userModel.UserLogin);
            List <TargetModel> targetList = new List <TargetModel>();

            try
            {
                targetList = ReadTargetFromDB(creator: userModel.Id);
            }catch (Exception e)
            {
                return(NotFound());
            }
            TargetModel[] targets = targetList.ToArray();
            //UnpackTargets(targets);
            return(Ok(targets));
        }