public ActionResult SearchLocation() { OTSClient _oTSClient = OTSHelper.GetOTSClientLocation(_tableStoreModel); PrimaryKey pk = new PrimaryKey(); pk.Add("d", new ColumnValue(Convert.ToInt64(Request.Form["d"]))); pk.Add("t", new ColumnValue(TimeHelper.ConvertDateTimeToInt(Convert.ToDateTime(Request.Form["t"])))); GetRowRequest getRowRequest = new GetRowRequest("L_100000000", pk); GetRowResponse response = _oTSClient.GetRow(getRowRequest); StringBuilder sbAttributeColumns = new StringBuilder(); foreach (var item in response.Attribute) { if (item.Key == "l") { byte[] lbyte = item.Value.BinaryValue; Dictionary <string, int> dictionary = ByteIntHelper.GetLocationByByte(lbyte); foreach (var dic in dictionary) { sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; "); } } } ViewData["pk"] = "设备:" + Request.Form["d"] + " 时间:" + Request.Form["t"]; ViewData["att"] = sbAttributeColumns.ToString(); return(View("Search", ViewBag)); }
public ActionResult SearchRoute() { OTSClient _oTSClient = OTSHelper.GetOTSClientRoute(_tableStoreModel); PrimaryKey pk = new PrimaryKey(); pk.Add("d", new ColumnValue(Convert.ToInt64(Request.Form["d"]))); pk.Add("s", new ColumnValue(TimeHelper.ConvertDateTimeToInt(Convert.ToDateTime(Request.Form["s"])))); GetRowRequest getRowRequest = new GetRowRequest("Route", pk); GetRowResponse response = _oTSClient.GetRow(getRowRequest); StringBuilder sbAttributeColumns = new StringBuilder(); foreach (var item in response.Attribute) { switch (item.Key) { case "e": sbAttributeColumns.Append(item.Key + ":" + item.Value.IntegerValue + "【" + TimeHelper.ConvertStringToDateTime(item.Value.IntegerValue.ToString()).ToString("yyyy-MM-dd HH:mm:ss fff") + "】;"); break; case "r": byte[] lbyte = item.Value.BinaryValue; Dictionary <string, int> dictionary = ByteIntHelper.GetRouteByByte(lbyte); foreach (var dic in dictionary) { sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; "); } break; case "ds": byte[] ds = item.Value.BinaryValue; Dictionary <string, int> dsDic = ByteIntHelper.GetDurationstatsByByte(ds); foreach (var dic in dsDic) { sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; "); } break; case "es": byte[] es = item.Value.BinaryValue; Dictionary <string, int> esDic = ByteIntHelper.GetEventStatsByByte(es); foreach (var dic in esDic) { sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; "); } break; } } ViewData["pk"] = "设备:" + Request.Form["d"] + " 开始时间:" + Request.Form["s"]; ViewData["att"] = sbAttributeColumns.ToString(); return(View("Search", ViewBag)); }
public ActionResult SearchEvent() { OTSClient _oTSClient = OTSHelper.GetOTSClientEvent(_tableStoreModel); PrimaryKey pk = new PrimaryKey(); pk.Add("d", new ColumnValue(Convert.ToInt64(Request.Form["d"]))); pk.Add("et", new ColumnValue(TimeHelper.ConvertDateTimeToInt(Convert.ToDateTime(Request.Form["et"])))); pk.Add("ei", new ColumnValue(ByteIntHelper.intToBytes2(Convert.ToInt64(Request.Form["ei"]), 1))); GetRowRequest getRowRequest = new GetRowRequest("E_100000000", pk); GetRowResponse response = _oTSClient.GetRow(getRowRequest); StringBuilder sbAttributeColumns = new StringBuilder(); foreach (var item in response.Attribute) { switch (item.Key) { case "ep": //事件参数字段暂不做处理 //byte[] ep = item.Value.BinaryValue; break; case "t": sbAttributeColumns.Append(item.Key + ":" + item.Value.IntegerValue + "【" + TimeHelper.ConvertStringToDateTime(item.Value.IntegerValue.ToString()).ToString("yyyy-MM-dd HH:mm:ss fff") + "】;"); break; case "l": byte[] lbyte = item.Value.BinaryValue; Dictionary <string, int> dictionary = ByteIntHelper.GetLocationByByte(lbyte); foreach (var dic in dictionary) { sbAttributeColumns.Append(dic.Key + ":" + dic.Value + "; "); } break; } } ViewData["pk"] = "设备:" + Request.Form["d"] + " 事件时间:" + Request.Form["et"] + " 事件ID:" + Request.Form["ei"]; ViewData["att"] = sbAttributeColumns.ToString(); return(View("Search", ViewBag)); }