//GET: transfer/releasewarningdata /// <summary> /// 放行警报数据 /// </summary> /// <returns></returns> public ActionResult releasewarningdata() { string station8Id, type; DateTime time; decimal data; //deal with params try { station8Id = Request.Params.Get("station8id"); type = Request.Params.Get("type"); time = DateTime.Parse(Request.Params.Get("time")); data = Decimal.Parse(Request.Params.Get("data")); if (station8Id.Length != 8 || type != "R" || type != "W") { throw new Exception(); } } catch (Exception e) { return(Json(helper.DBHelper.SerializeDBReturnCode(helper.DBReturnCode.BAD_REQUEST), JsonRequestBehavior.AllowGet)); } Models.Maintain db = new Models.Maintain(); helper.DBReturnCode code = DAL.TransferDataService.ReleaseWarningData(db, station8Id, time, type, data); string json = helper.DBHelper.SerializeDBReturnCode(code); return(Json(json, JsonRequestBehavior.AllowGet)); }
public ActionResult saveDataBase() { helper.DBReturnCode code = helper.DBReturnCode.NOT_EXIST; try { int uID = int.Parse(Request.Params.Get("UID")); string stationID = Request.Params.Get("stationID"); bool rtype = Request.Params.Get("ReportType") == "Rain" ? true : false; bool trans = Request.Params.Get("TransType") == "ByDay" ? true : false; string stime = Request.Params.Get("startTime"); string etime = Request.Params.Get("endTime"); BatchList record = BatchService.FindBatchRecord(uID); List <rain> rainList = new List <rain>(); for (int i = 0; i < record.Bdata.Count; i++) { rainList.Add(new rain { //stationid = record.Bdata[i]. }); } //TODO:暂时搁置 //code = DAL.RainService.SaveBatchData(record); } catch (Exception) { return(Json(helper.DBHelper.SerializeDBReturnCode(helper.DBReturnCode.BAD_REQUEST), JsonRequestBehavior.AllowGet)); } string json = helper.DBHelper.SerializeDBReturnCode(code); return(Json(json, JsonRequestBehavior.AllowGet)); }
// GET: transfer/alterDatabase /// <summary> /// 修改数据库配置 /// </summary> /// <returns></returns> public ActionResult alterdatabase() { string type = Request.Params.Get("type"); string serverName = Request.Params.Get("servername"); string databaseName = Request.Params.Get("databasename"); string username = Request.Params.Get("username"); string password = Request.Params.Get("password"); //参数异常 if (serverName == null || databaseName == null || username == null || password == null || serverName == "" || databaseName == "" || username == "" || password == "" || (type != "target" && type != "source")) { return(Json(helper.DBHelper.SerializeDBReturnCode(helper.DBReturnCode.BAD_REQUEST), JsonRequestBehavior.AllowGet)); } //init a model object Models.DK_DB obj = new Models.DK_DB(); obj.database_type = type; obj.database_name = databaseName; obj.server_name = serverName; obj.username = username; obj.password = password; Models.Maintain db = new Models.Maintain(); helper.DBReturnCode code = DAL.TransferDbConfigService.AlterDbConfig(db, obj); return(Json(helper.DBHelper.SerializeDBReturnCode(code), JsonRequestBehavior.AllowGet)); }
//GET: transfer/deleteerrordata /// <summary> /// 删除错误数据 /// </summary> /// <returns></returns> public ActionResult deleteerrordata() { string station8Id, type; DateTime time; //deal with params try { station8Id = Request.Params.Get("station8id"); type = Request.Params.Get("type"); time = DateTime.Parse(Request.Params.Get("time")); if (station8Id.Length != 8 || (type != "R" && type != "W")) { throw new Exception(); } } catch (Exception e) { return(Json(helper.DBHelper.SerializeDBReturnCode(helper.DBReturnCode.BAD_REQUEST), JsonRequestBehavior.AllowGet)); } Models.Maintain db = new Models.Maintain(); helper.DBReturnCode code = DAL.TransferDataService.DeleteErrorData(db, station8Id, time, type); string json = helper.DBHelper.SerializeDBReturnCode(code); return(Json(json, JsonRequestBehavior.AllowGet)); }
//GET:transfer/alterstation /// <summary> /// 修改一个站点的信息 /// </summary> /// <returns></returns> public ActionResult alterstation() { string station8Id, stationId, stationType, stationName, dayRain, dayWater, xunRain, xunWater, monthRain, monthWater, sendFlag; decimal?waterMax, waterMin, waterChange, rainChange, rainAdditional; //检查参数 try { station8Id = Request.Params.Get("station8id"); stationId = Request.Params.Get("stationid"); stationType = Request.Params.Get("stationtype"); stationName = Request.Params.Get("stationname"); waterMax = Decimal.Parse(Request.Params.Get("watermax")); waterMin = Decimal.Parse(Request.Params.Get("watermin")); waterChange = Decimal.Parse(Request.Params.Get("waterchange")); rainChange = Decimal.Parse(Request.Params.Get("rainchange")); rainAdditional = Decimal.Parse(Request.Params.Get("rainadditional")); dayRain = Request.Params.Get("dayrain"); dayWater = Request.Params.Get("daywater"); xunRain = Request.Params.Get("xunrain"); xunWater = Request.Params.Get("xunwater"); monthRain = Request.Params.Get("monthrain"); monthWater = Request.Params.Get("monthwater"); sendFlag = Request.Params.Get("sendflag"); if (station8Id.Length != 8 || stationId.Length != 4 || dayRain.Length != 1 || dayWater.Length != 1 || xunRain.Length != 1 || xunWater.Length != 1 || monthRain.Length != 1 || monthWater.Length != 1 || sendFlag.Length != 1) { throw new Exception(); } } catch (Exception e) { return(Json(helper.DBHelper.SerializeDBReturnCode(helper.DBReturnCode.BAD_REQUEST), JsonRequestBehavior.AllowGet)); } //init a station object Models.ID_TO_STCD_DK station = new Models.ID_TO_STCD_DK(); station.ID = stationId; station.STCD = station8Id; station.CNAME = stationName; station.STTYPE = stationType; station.WATERMAX = waterMax; station.WATERMIN = waterMin; station.WATERCHANGE = waterChange; station.RAINCHANGE = rainChange; station.BRAIN = rainAdditional; station.DAYRAINTJ = dayRain; station.DAYWATERTJ = dayWater; station.XUNRAINTJ = xunRain; station.XUNWATERTJ = xunWater; station.MONTHRAINTJ = monthRain; station.MONTHWATERTJ = monthWater; station.sendflag = sendFlag; Models.Maintain db = new Models.Maintain(); helper.DBReturnCode code = DAL.TransferStationService.AlterStation(db, station); string json = helper.DBHelper.SerializeDBReturnCode(code); return(Json(json, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 放行报警信息,数据使用用户指定。 /// </summary> /// <param name="stationid"></param> /// <param name="time"></param> /// <param name="type"></param> /// <param name="data"></param> /// <returns></returns> public static helper.DBReturnCode ReleaseWarningData(Models.Maintain db, string station8Id, DateTime time, string type, decimal data) { helper.DBReturnCode code = WriteStandardDatabase(station8Id, time, type, data); if (code == helper.DBReturnCode.SUCCESS) { return(DeleteWarningData(db, station8Id, time, type)); } else { return(code); } }
//GET:transfer/deleteStation /// <summary> /// 删除一个站点 /// </summary> /// <returns></returns> public ActionResult deleteStation() { string station8Id, stationId; try { //deal with params station8Id = Request.Params.Get("station8id"); stationId = Request.Params.Get("stationid"); if (station8Id.Length != 8 || stationId.Length != 4) { throw new Exception(); } } catch (Exception e) { return(Json(helper.DBHelper.SerializeDBReturnCode(helper.DBReturnCode.BAD_REQUEST), JsonRequestBehavior.AllowGet)); } Models.Maintain db = new Models.Maintain(); helper.DBReturnCode code = DAL.TransferStationService.DeleteStation(db, station8Id, stationId); string json = helper.DBHelper.SerializeDBReturnCode(code); return(Json(json, JsonRequestBehavior.AllowGet)); }