예제 #1
0
        public IActionResult LocatorBoardDeviceViewSave(LocatorDeviceModel model)
        {
            string sql = @"UPDATE eboards.Locatorboarddevice SET
                        Locatorboarddevicename = @Locatorboarddevicename, Locatorboard_id = @Locatorboard_id, deviceipaddress = @deviceipaddress, locationid = @locationid
	                    WHERE Locatorboarddevice_id = @Locatorboarddevice_id;"    ;

            var paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("Locatorboarddevice_id", model.DeviceId),
                new KeyValuePair <string, string>("Locatorboarddevicename", model.DeviceName),
                new KeyValuePair <string, string>("Locatorboard_id", model.LocatorBoardId),
                new KeyValuePair <string, string>("deviceipaddress", model.IPAddress),
                new KeyValuePair <string, string>("locationid", model.LocationCode)
            };

            DataServices.ExcecuteNonQueryFromSQL(sql, paramList);
            return(Json("OK"));
        }
예제 #2
0
        public IActionResult LocatorBoardDeviceNewSave(LocatorDeviceModel model)
        {
            string sql = @"INSERT INTO eboards.Locatorboarddevice(
                        Locatorboarddevice_id, Locatorboarddevicename, Locatorboard_id, deviceipaddress, locationid)
	                    VALUES(@Locatorboarddevice_id, @Locatorboarddevicename, @Locatorboard_id, @deviceipaddress, @locationid);"    ;


            var paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("Locatorboarddevice_id", System.Guid.NewGuid().ToString()),
                new KeyValuePair <string, string>("Locatorboarddevicename", model.DeviceName),
                new KeyValuePair <string, string>("Locatorboard_id", model.LocatorBoardId),
                new KeyValuePair <string, string>("deviceipaddress", model.IPAddress),
                new KeyValuePair <string, string>("locationid", model.LocationCode)
            };

            DataServices.ExcecuteNonQueryFromSQL(sql, paramList);
            return(Json("OK"));
        }
예제 #3
0
        public IActionResult LocatorBoardDeviceView(string id)
        {
            DataSet dsLocatorBoard = DataServices.DataSetFromSQL("SELECT Locatorboard_id, Locatorboardname FROM eboards.Locatorboard;");

            ViewBag.LocatorBoard = ToSelectList(dsLocatorBoard.Tables[0], "Locatorboard_id", "Locatorboardname");
            string  sql       = "SELECT * FROM eboards.locatorboarddevice WHERE locatorboarddevice_id = @locatorboarddevice_id;";
            DataSet ds        = new DataSet();
            var     paramList = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("locatorboarddevice_id", id)
            };

            ds = DataServices.DataSetFromSQL(sql, paramList);
            DataTable          dt    = ds.Tables[0];
            LocatorDeviceModel model = new LocatorDeviceModel();

            model.DeviceId = id;
            try
            {
                model.DeviceName = dt.Rows[0]["Locatorboarddevicename"].ToString();
            }
            catch { }

            try
            {
                model.IPAddress = dt.Rows[0]["deviceipaddress"].ToString();
            }
            catch { }
            model.LocatorBoardId = dt.Rows[0]["Locatorboard_id"].ToString();
            try
            {
                model.LocationCode = dt.Rows[0]["locationid"].ToString();
            }
            catch { }

            return(View(model));
        }