IEnumerator LoadData() { Logger.Instance.WriteLog("加载化疏散区域信息"); EvacuationPlanDao epDao = new EvacuationPlanDao(); List <EvacuateArea> eAreas = epDao.Select006(areaId); if (eAreas.Count <= 0) { yield return(null); } else { EvacuateArea area = eAreas[0]; nameLabel.value = area.name; List <string> cameraIdLst = new List <string>(); if (!string.IsNullOrEmpty(area.cameraList.Trim())) { cameraIdLst.AddRange(area.cameraList.Split('|')); } Logger.Instance.WriteLog("加载化设备信息"); DeviceDao dDao = new DeviceDao(); dDao.Select001(); List <DeviceInfo> deviceInfoLst = dDao.Result; InitEvacuateAreaDeviceItems(deviceInfoLst, cameraIdLst); EvacuateAreaDeviceItemGrid.gameObject.GetComponent <UIWidget>().UpdateAnchors(); } yield return(null); }
/// <summary> /// 加载设备信息 /// </summary> public void LoadDeviceRecord() { Logger.Instance.WriteLog("加载设备信息"); List <DeviceInfo> dInfo; DeviceRecordInfo record; DeviceDao dDao = new DeviceDao(); dDao.Select001(); dInfo = dDao.Result; bool forbidden = false; Records.transform.DestroyChildren(); for (int i = 0; i < dInfo.Count; i++) { record = new DeviceRecordInfo(); record.No = "" + (i + 1); record.DInfo = dInfo[i]; forbidden = false; if (!CMSManage.Instance.HasPTZCtl(record.DInfo.Guid)) { forbidden = true; } GameObject go = Instantiate(RecordItemPrefab) as GameObject; go.GetComponent <DeviceRecordItem>().Init(record, PresetPositionWindow, forbidden); Records.AddChild(go.transform); go.transform.localScale = new Vector3(1, 1, 1); } }
public void SaveData() { DeviceDao dDao = new DeviceDao(); dDao.Update005(URLInput.value.ToString().Trim(), (UseRtsp ? "1" : "0"), PFURLInput.value, id); Close(); }
public void Draw(string title, string[] Monitors, bool drawLine = false) { Title.text = title; if (DeviceInfos == null || DeviceInfos.Count <= 0) { DeviceDao dDao = new DeviceDao(); dDao.Select001(); DeviceInfos = dDao.Result; } Clear(); foreach (string id in Monitors) { DeviceInfo info = findDeviceInfo(id); if (info.Id != id || DicMapIcos.ContainsKey(id)) { continue; } GameObject mapico = Instantiate(MapIcon) as GameObject; mapico.GetComponent <UISprite>().color = Color.yellow; mapico.transform.parent = MapTex.transform; mapico.transform.localScale = new Vector3(ScaleSize * 0.5f, ScaleSize * 0.5f, 1); mapico.transform.localPosition = new Vector3((float.Parse(info.PosX)) * ScaleSize, (float.Parse(info.PosZ)) * ScaleSize, 0); MapIcos.Add(mapico); DicMapIcos.Add(id, mapico); } if (MapIcos.Count > 0) { _StartPos = MapIcos[0].transform.localPosition; } _DrawLine = drawLine; }
public virtual void LockDevice(string id, string hour, Hashtable r) { DeviceDao dao = new DeviceDao(AppConfig.mainDbKey); Device d = dao.Get(id); d.LockTime = DateTime.Now; d.Status = 1; d.LockExpireHours = String.IsNullOrEmpty(hour) ? 0 : int.Parse(hour); dao.Update(d); r["r"] = true; SmartBox.Console.Service.ServiceReference1.ManagerServiceClient client = new SmartBox.Console.Service.ServiceReference1.ManagerServiceClient(); try { DeviceUserDao duDao = new DeviceUserDao(AppConfig.mainDbKey); List <Tuple <string, string, object> > pars = new List <Tuple <string, string, object> >(); pars.Add(new Tuple <string, string, object>("deviceid", "=", id)); List <DeviceUser> deviceUsers = duDao.QueryList(pars); var rr = from e in deviceUsers select e.UID; string[] sessionids = rr.ToArray(); client.ForceQuitUsers(sessionids); } catch (Exception e) { r["d"] += "强制用户退出失败,详细信息:" + e.Message; } }
/// <summary> /// 初始化化区域信息 /// </summary> /// <param name="_info">_info.</param> public void Init(PassengerFlowAreaInfo _info) { if (pAreaUI != null) { pAreaUI.UpdateArea(STRING(enter), STRING(sum), STRING(exit)); } if (PFURLAttrLst != null) { PFURLAttrLst.Clear(); } else { PFURLAttrLst = new List <PFURLAttr>(); } info = _info; string[] DeviceIdLst = info.CameraIdLst.Split('|'); DeviceDao dDao = new DeviceDao(); Encoding defaultEncoding = System.Text.Encoding.Default; foreach (var id in DeviceIdLst) { string[] _id = id.Split(','); dDao.Select003(_id[0]); if (dDao.Result.Count == 1) { PFURLAttr attr = new PFURLAttr(); attr.PassengerFlowUrl = dDao.Result[0].PassengerFlowUrl.Trim(); attr.InIsIn = _id[1]; attr.InIsOut = _id[2]; attr.OutIsIn = _id[3]; attr.OutIsOut = _id[4]; PFURLAttrLst.Add(attr); } } }
/// <summary> /// 加载设备信息 /// </summary> private void LoadDeviceInfo() { Logger.Instance.WriteLog("加载设备信息"); DeviceDao dDao = new DeviceDao(); dDao.Select001(); PFAInfoLst = dDao.Result; }
public void SaveData() { Logger.Instance.WriteLog("保存摄像机监控区域设置"); DeviceDao dDao = new DeviceDao(); dDao.Update004(sector.Radio.ToString(), sector.Scope.ToString(), sector.Offset.ToString(), id); Close(); }
/// <summary> /// 从数据库加载摄像头的信息 /// </summary> /// <returns>The device info record.</returns> IEnumerator LoadDeviceInfoRecord() { Logger.Instance.WriteLog("从数据库加载摄像头的信息"); DeviceDao dDao = new DeviceDao(); dDao.Select001(); MornitorInfos = dDao.Result; yield return(null); }
void Binding(CAMARE_INFO info) { List <byte> des = new List <byte>(); foreach (byte b in info.describe) { if (b == 0) { break; } des.Add(b); } List <byte> name = new List <byte>(); foreach (byte b in info.name) { if (b == 0) { break; } name.Add(b); } initDescription = System.Text.Encoding.Default.GetString(des.ToArray()); if (string.IsNullOrEmpty(Description.GetComponent <UIInput>().value)) { Description.GetComponent <UIInput>().value = initDescription; } //Description.GetComponent<UIInput>().value = initDescription; DeviceDao dDao = new DeviceDao(); dDao.Select002(CameraTag); if (dDao.Result.Count <= 0) { dDao.Insert001(CMSManage.GUIDToString(info.camareGuid), Encoding.Default.GetString(name.ToArray()), Description.GetComponent <UIInput>().value, monitor.transform.position.x.ToString(), monitor.transform.position.y.ToString(), monitor.transform.position.z.ToString(), CameraTag); //Encoding.Default.GetString (des.ToArray()) } else { dDao.Update002(CMSManage.GUIDToString(info.camareGuid), Encoding.Default.GetString(name.ToArray()), Description.GetComponent <UIInput>().value, dDao.Result[0].Id); } phyDevicePanel.SetActive(false); Configure.IsOperating = false; EditCameraManager.instance.CloseCamera(); delBind.bind = null; Description.GetComponent <BoxCollider>().enabled = true; monitorScope = Instantiate(MonitorScopePrefab, new Vector3(monitor.transform.position.x, 0.2f, monitor.transform.position.z), Quaternion.Euler(0, 0, 0)) as GameObject; monitorScope.SetActive(false); }
public void SaveDescription() { if (inputChanged) { Logger.Instance.WriteLog("保存设备名称修改"); inputChanged = false; DeviceDao dDao = new DeviceDao(); dDao.Update003(Description.GetComponent <UILabel>().text, RecordInfo.DInfo.Id); } }
public bool UpdateDevice(int id, string name, int idCate, int quantity, string nameUpdate) { var model = new DeviceDao().UpdateDevice(id, name, idCate, quantity, nameUpdate); if (model) { return(true); } else { return(false); } }
public bool InsertDevice(string name, int idCate, int quantity, string nameCreate) { var model = new DeviceDao().InsertDevice(name, idCate, quantity, nameCreate); if (model) { return(true); } else { return(false); } }
public bool DeleteDevice(int id) { var model = new DeviceDao().DeleteDevice(id); if (model) { return(true); } else { return(false); } }
public void SetValue(GameObject monitor, DelBind delBind, GameObject phyDevicePanel, GameObject SMSPanel, GameObject RTSPPanel) { Logger.Instance.WriteLog("初始化场景摄像机列表项目"); this.delBind = delBind; this.monitor = monitor; this.phyDevicePanel = phyDevicePanel; setMonitorScopePanel = SMSPanel; setRTSPPanel = RTSPPanel; BtnSetScope.SetActive(false); BtnSetRTSP.SetActive(false); CameraTag = monitor.transform.GetChild(0).name; Logger.Instance.WriteLog("从数据加载此列表项相关信息"); DeviceDao dDao = new DeviceDao(); dDao.Select002(CameraTag); if (dDao.Result.Count > 0) { Logger.Instance.WriteLog("数据加载成功"); info = dDao.Result[0]; Description.GetComponent <UIInput>().value = info.Description; Description.GetComponent <BoxCollider>().enabled = true; Existing = true; monitorScope = Instantiate(MonitorScopePrefab, new Vector3(monitor.transform.position.x, 0.2f, monitor.transform.position.z), Quaternion.Euler(0, 0, 0)) as GameObject; DrawSector ds = monitorScope.GetComponent <DrawSector>(); ds.Scope = int.Parse(info.MonitorScope); ds.Radio = int.Parse(info.MonitorRadio); ds.Offset = int.Parse(info.MonitorOffset); monitorScope.SetActive(false); monitor.GetComponent <MonitorInfoData>().Data = dDao.Result[0]; } else { Logger.Instance.WriteLog("数据加载失败"); Description.GetComponent <UIInput>().value = CameraTag; Description.GetComponent <BoxCollider>().enabled = false; Existing = false; } initDescription = Description.GetComponent <UIInput>().value; // lingxing = Instantiate(lingxingPrefab) as GameObject; // lingxing.transform.parent = monitor.transform; // lingxing.transform.localPosition = Vector3.zero; //lingxing.SetActive(false); }
//从数据库中重新加载数据 void ReloadData() { Logger.Instance.WriteLog("从数据库中重新加载此列表项相关信息"); DeviceDao dDao = new DeviceDao(); dDao.Select002(CameraTag); if (dDao.Result.Count > 0) { info = dDao.Result[0]; DrawSector ds = monitorScope.GetComponent <DrawSector>(); ds.Scope = int.Parse(info.MonitorScope); ds.Radio = int.Parse(info.MonitorRadio); ds.Offset = int.Parse(info.MonitorOffset); Description.GetComponent <UIInput>().value = info.Description; } }
/// <summary> /// 把当前摄像头视角保存到数据库中 /// </summary> public void SaveCurrentPosition() { Logger.Instance.WriteLog("把当前摄像头视角保存到数据库中"); GameObject camera = Camera.main.gameObject; GameObject point = camera.GetComponent <CameraController> ().RotatePoint; DeviceDao dDao = new DeviceDao(); dDao.Update001(point.transform.position.x, point.transform.position.y, point.transform.position.z, camera.transform.position.x, camera.transform.position.y, camera.transform.position.z, camera.transform.rotation.eulerAngles.x, camera.transform.rotation.eulerAngles.y, camera.transform.rotation.eulerAngles.z, RecordInfo.DInfo.Id); dDao.Select003(RecordInfo.DInfo.Id); if (dDao.Result.Count == 1) { RecordInfo.DInfo = dDao.Result[0]; } Select(); }
/// <summary> /// 将下拉列表选择框放到指定的位置 /// 点击选择列表是调用 /// </summary> /// <param name="go">Go.</param> // void CatchDropList(GameObject go) // { // Transform dropDown = transform.FindChild ("Drop-down List"); // if(dropDown) // { // dropDown.parent = Popuplist.transform.FindChild ("Anchor"); // dropDown.localPosition = Vector3.zero; // } // } /// <summary> /// 从数据库加载摄像头的信息 /// </summary> /// <returns>The device info record.</returns> IEnumerator LoadDeviceInfoRecord() { Logger.Instance.WriteLog("加载摄像头的信息"); DeviceDao dDao = new DeviceDao(); dDao.Select001(); MornitorInfos = dDao.Result; SelectMornitorList.transform.DestroyChildren(); for (int i = 0; i < MornitorInfos.Count; i++) { GameObject go = Instantiate(SelectMornitorItemPrefab) as GameObject; SelectMornitorList.AddChild(go.transform); go.transform.localScale = new Vector3(1, 1, 1); go.transform.FindChild("CameraDescription").GetComponentInChildren <UILabel>().text = MornitorInfos[i].Description; SelectMornitorListDictionary.Add(go, i); go.transform.FindChild("Sort").GetComponent <UILabel> ().text = (i + 1) + ""; UIEventListener.Get(go.transform.FindChild("CameraDescription").gameObject).onDoubleClick = AddToSelectedMornitorList; UIEventListener.Get(go.transform.FindChild("GotoIcon").gameObject).onDoubleClick = GotoMornitorPosition; } yield return(null); }
IEnumerator CheckMouseHover() { string CameraName = ""; DeviceDao dDao = new DeviceDao(); while (true) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000, 1 << LayerMask.NameToLayer("LingXing"))) { Logger.Instance.WriteLog("显示鼠标悬停摄像机信息"); CameraName = hit.transform.parent.GetChild(0).name; HoverObjectInfo.SetActive(true); dDao.Select002(CameraName); if (dDao.Result != null && dDao.Result.Count == 1) { HoverObjectInfo.GetComponent <HoverOverCameraInfo>().Init(dDao.Result[0].Description, string.IsNullOrEmpty(dDao.Result[0].PassengerFlowUrl.Trim())?"没有客流统计信息":"有客流统计信息"); } else { HoverObjectInfo.GetComponent <HoverOverCameraInfo>().Init(CameraName, "没有绑定物理摄像机"); } HoverObjectInfo.GetComponent <UISprite>().pivot = UIWidget.Pivot.BottomLeft; HoverObjectInfo.GetComponentInChildren <UILabel>().alignment = NGUIText.Alignment.Left; if (Input.mousePosition.x + HoverObjectInfo.GetComponent <UISprite>().width > Screen.width) { HoverObjectInfo.GetComponent <UISprite>().pivot = UIWidget.Pivot.BottomRight; HoverObjectInfo.GetComponentInChildren <UILabel>().alignment = NGUIText.Alignment.Right; } HoverObjectInfo.transform.position = UICamera.currentCamera.ScreenToWorldPoint(Input.mousePosition); } else { HoverObjectInfo.SetActive(false); } yield return(new WaitForSeconds(1f)); } }
/// <summary> /// 加载摄像头的信息 /// </summary> /// <returns>The monitor record.</returns> IEnumerator LoadMonitorRecord() { Logger.Instance.WriteLog("加载摄像头的信息"); Monitors = new Dictionary <GameObject, DeviceInfo>(); DeviceDao dDao = new DeviceDao(); dDao.Select001(); List <DeviceInfo> dInfos = dDao.Result; MornitorInfos = dDao.Result; GameObject MonitorListItem; GameObject[] MonitorObjs = GetGameObjectChild(SceneCameras); Dictionary <string, GameObject> DicMonitor = new Dictionary <string, GameObject>(); foreach (GameObject go in MonitorObjs) { DicMonitor.Add(go.transform.GetChild(0).name, go); } GameObject MonitorIcon; for (int i = 0; i < dInfos.Count; i++) { //创建新的摄像头列表项目 MonitorListItem = Instantiate(MonitorListItemPrefab) as GameObject; MonitorList.AddChild(MonitorListItem.transform); MonitorListItem.transform.localScale = new Vector3(1, 1, 1); MonitorListItem.GetComponent <MonitorListItem>().Init(dInfos[i].Id, dInfos[i].Description, dInfos[i]); MonitorIcon = DicMonitor[dInfos[i].CameraTag]; Monitors.Add(MonitorIcon, dInfos[i]); MonitorIcon.GetComponent <MonitorInfoData>().Data = dInfos[i]; MonitorIcon.GetComponent <MonitorIco>().BindMonitorListItem(MonitorListItem); MonitorListItem.GetComponent <MonitorListItem>().BindMonitorIcon(MonitorIcon); } yield return(null); }
/// <summary> /// 从数据库加载摄像头的信息 /// </summary> /// <returns>The device info record.</returns> private void LoadDeviceInfoRecord() { Logger.Instance.WriteLog("加载摄像头的信息"); DicMornitorInfos = new Dictionary <string, DeviceInfo>(); DeviceDao dDao = new DeviceDao(); dDao.Select001(); if (dDao.Result.Count <= 0) { Logger.Instance.WriteLog("加载摄像头的信息失败"); return; } for (int i = 0; i < dDao.Result.Count; i++) { DicMornitorInfos.Add(dDao.Result[i].Id, dDao.Result[i]); GameObject go = Instantiate(SelectMornitorItemPrefab) as GameObject; SelectMornitorList.AddChild(go.transform); go.transform.localScale = new Vector3(1, 1, 1); SelecteMornitorItem item = go.GetComponent <SelecteMornitorItem>(); item.Init(dDao.Result[i]); item.BindAction(AddItemToSelectedMornitorList); } }
/// <summary> /// 初始化化区域信息 /// </summary> /// <param name="_info">_info.</param> /// <param name="_PFIShowPlane">_ PFI show plane.</param> public void Init(PassengerFlowAreaInfo _info, PassengerAreaUI _PFIShowPlane) { Logger.Instance.WriteLog("初始化客流统计信息"); PFURLAttrLst = new List <PFURLAttr>(); info = _info; if (PFInfoUI != null) { PFInfoUI.grade1 = int.Parse(info.WarnLevel1); PFInfoUI.grade2 = int.Parse(info.WarnLevel2); PFInfoUI.grade3 = int.Parse(info.WarnLevel3); } //transform.position = new Vector3(FLOAT(info.PosX),FLOAT(info.PosY),FLOAT(info.PosZ)); //transform.localScale = new Vector3(FLOAT(info.ScaleX),FLOAT(info.ScaleY),FLOAT(info.ScaleZ)); PFIShowPlane = _PFIShowPlane; string[] DeviceIdLst = info.CameraIdLst.Split('|'); Logger.Instance.WriteLog("加载相关设备信息,用来初始化客流统计信息"); DeviceDao dDao = new DeviceDao(); Encoding defaultEncoding = System.Text.Encoding.Default; foreach (var id in DeviceIdLst) { string[] _id = id.Split(','); dDao.Select003(_id[0]); if (dDao.Result.Count == 1) { PFURLAttr attr = new PFURLAttr(); attr.PassengerFlowUrl = dDao.Result[0].PassengerFlowUrl.Trim(); attr.InIsIn = _id[1]; attr.InIsOut = _id[2]; attr.OutIsIn = _id[3]; attr.OutIsOut = _id[4]; PFURLAttrLst.Add(attr); } } }
void PlayEvacuationVideo() { Logger.Instance.WriteLog("播放监控视频"); if (isPlay) { Logger.Instance.WriteLog("监控视频已经播放"); return; } isPlay = true; PlayVideoPlane.SetActive(true); LingXing.SetActive(true); Logger.Instance.WriteLog("加载相关设备信息"); DeviceDao dDao = new DeviceDao(); dDao.Select002(gameObject.name); if (dDao.Result.Count == 1) { DeviceInfo info = dDao.Result[0]; cameraId = info.Id; guid = CMSManage.StringToGUID(info.Guid); CMSManage.Instance.OpenCamera(int.Parse(cameraId), guid, StartReadMem); } }
public ActionResult ExportDevice() { int idCate = 0; var data = new DeviceDao().GetAllDevice(idCate); var result = data.Select(x => new { x.NameCateDevice, x.NameDevice, x.Quantity, }).ToList(); var excelPackage = new ExcelPackage(); // Add Sheet vào file Excel excelPackage.Workbook.Worksheets.Add("Report Sheet"); var workSheet = excelPackage.Workbook.Worksheets[1]; workSheet.Cells[2, 1].LoadFromCollection(result); workSheet.Cells[1, 1].Value = "Tên thiết bị "; workSheet.Cells[1, 2].Value = "Danh mục"; workSheet.Cells[1, 3].Value = "Số lượng trong kho"; using (var range = workSheet.Cells[1, 1, 1, 3]) { // Set PatternType range.Style.Fill.PatternType = ExcelFillStyle.Solid; // Set color Background range.Style.Fill.BackgroundColor.SetColor(Color.Green); // Canh gi?a cho các text range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; // Set Font cho text trong Range hi?n t?i range.Style.Font.SetFromFont(new System.Drawing.Font("Arial", 14)); //Set Border //range.Style.Border.Bottom.Style = ExcelBorderStyle.Medium; ////// Set color Border //range.Style.Border.Bottom.Color.SetColor(Color.Blue); // Set color text range.Style.Font.Color.SetColor(Color.White); } var rowData = result.Count() + 1; workSheet.Cells[1, 1, rowData, 3].AutoFitColumns(); using (var range = workSheet.Cells[1, 1, rowData, 3]) { range.Style.Font.Size = 12; range.Style.Border.Top.Style = ExcelBorderStyle.Thin; range.Style.Border.Left.Style = ExcelBorderStyle.Thin; range.Style.Border.Right.Style = ExcelBorderStyle.Thin; range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin; range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; } excelPackage.Save(); var buffer = excelPackage.Stream as MemoryStream; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("Content-Disposition", "attachment; filename=List_Device" + DateTime.Now.ToString("-ddMMyy_hhmmss") + ".xlsx"); // Luu file excel c?a chúng ta nhu 1 m?ng byte d? tr? v? response Response.BinaryWrite(buffer.ToArray()); // Send t?t c? ouput bytes v? phía clients Response.Flush(); Response.End(); return(View()); }
public virtual SelectPagnationExDictionary GetDeviceRetryLock(string uid, string model, string u_unitcode, string u_lock_time_start, string u_lock_time_end, int deviceStatus, string orderby, int pageSize, int pageIndex) { DeviceDao dao = new DeviceDao(AppConfig.mainDbKey); return(dao.GetDeviceRetryLock(uid, model, u_unitcode, u_lock_time_start, u_lock_time_end, deviceStatus, orderby, pageSize, pageIndex)); }
/// <summary> /// 当输入框失去焦点时调用,保存修改内容到数据库 /// </summary> public void SaveDescription() { DeviceDao dDao = new DeviceDao(); dDao.Update003(Description.GetComponent <UIInput>().value, info.Id); }