예제 #1
0
    /// <summary>
    /// 创建新的巡逻方案
    /// </summary>
    public void AddVideoPatrolPlan()
    {
        Logger.Instance.WriteLog("创建新的巡逻方案");
        VideoPatrolPlanInfo info = new VideoPatrolPlanInfo();
        int i = 1;
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        while (true)
        {
            vppDao.Select004("新建方案" + i);
            if (vppDao.Result.Count <= 0)
            {
                break;
            }
            i++;
        }
        info.Name         = "新建方案" + i;
        info.MonitorList  = "";
        info.PlayTimeList = "";

        Logger.Instance.WriteLog("保存新建巡逻方案");
        vppDao.Insert001(info.Name, info.MonitorList, info.PlayTimeList, DataStore.UserInfo.UserName);
        Logger.Instance.WriteLog("加载新建巡逻方案");
        vppDao.Select002();
        if (vppDao.Result.Count <= 0 || vppDao.Result[0].Name != info.Name)
        {
            Logger.Instance.WriteLog("新建巡逻方案失败");
            return;
        }
        info = vppDao.Result [0];
        AddItemToVideoPatrolPlanGrid(info);
        ShowPlanDetail(VideoPatrolPlanGrid.GetChild(VideoPatrolPlanGrid.transform.childCount - 1).gameObject);
    }
예제 #2
0
    /// <summary>
    /// Loads the record.
    /// </summary>
    /// <returns>The record.</returns>
    IEnumerator LoadRecord()
    {
        Logger.Instance.WriteLog("加载巡逻方案的数据");
        if (VideoPatrolPlanInfos == null)
        {
            VideoPatrolPlanInfos = new List <VideoPatrolPlanInfo> ();
        }
        VideoPatrolPlanGrid.transform.DestroyChildren();
        VideoPatrolPlanInfos.Clear();

        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Select001();
        VideoPatrolPlanInfos = vppDao.Result;

        for (int i = 0; i < VideoPatrolPlanInfos.Count; i++)
        {
            AddItemToVideoPatrolPlanGrid(VideoPatrolPlanInfos[i]);
        }

        if (VideoPatrolPlanInfos.Count > 0)
        {
            ShowPlanDetail(VideoPatrolPlanGrid.GetChild(0).gameObject);
        }
        if (VideoPatrolPlanInfos.Count == 0)
        {
            VideoPatrolPlanEditPanel.SetActive(false);
        }
        yield return(null);
    }
예제 #3
0
    /// <summary>
    /// 创建新的巡逻方案
    /// </summary>
    public void AddVideoPatrolPlan()
    {
        Logger.Instance.WriteLog("创建新的巡逻方案");
        VideoPatrolPlanInfo info = new VideoPatrolPlanInfo();
        int i = 1;

        while (PlanNameList.Contains("新建方案" + i))
        {
            i++;
        }
        info.Name         = "新建方案" + i;
        info.MonitorList  = "";
        info.PlayTimeList = "";
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        Logger.Instance.WriteLog("保存新建巡逻方案");
        vppDao.Insert001(info.Name, info.MonitorList, info.PlayTimeList, DataStore.UserInfo.UserName);
        Logger.Instance.WriteLog("加载新建巡逻方案");
        vppDao.Select002();
        if (vppDao.Result.Count <= 0 || vppDao.Result[0].Name != info.Name)
        {
            Logger.Instance.WriteLog("新建巡逻方案失败");
            return;
        }
        info = vppDao.Result [0];
        VideoPatrolPlanInfos.Add(info);
        PlanNameList.Add(info.Name);
        PlanName.GetComponentInChildren <UIInput> ().value = info.Name;
        ShowDetailList(PlanName.GetComponentInChildren <UIInput> ().value);

        VideoPatrolPlanViewPanel.SendMessage("ReloadRecord");
    }
예제 #4
0
    /// <summary>
    /// 保存巡航方案修改的信息
    /// </summary>
    public void SaveVideoPatrolPlan()
    {
        Logger.Instance.WriteLog("保存巡航方案修改的信息");
        string idList   = "";
        string timeList = "";

        foreach (GameObject go in SelectedMornitorDictionary.Keys)
        {
            idList   += MornitorInfos[SelectedMornitorDictionary[go]].Id + "|";
            timeList += go.transform.FindChild("Time").GetComponent <UIInput>().value + "|";
        }
        int idListLength   = idList.Length;
        int timeListLength = timeList.Length;

        if (idList.Length > 0)
        {
            timeList = timeList.Remove(timeListLength - 1);
            idList   = idList.Remove(idListLength - 1);
        }
        string planName          = PlanName.GetComponentInChildren <UIInput> ().value;
        int    PlaninfosIndex    = FindVideoPatrolPlanInfoIndex(planName);
        VideoPatrolPlanInfo info = VideoPatrolPlanInfos[PlaninfosIndex];

        info.MonitorList  = idList;
        info.PlayTimeList = timeList;
        VideoPatrolPlanEditMapPanel.GetComponent <DrawMap> ().Draw(planName, idList.Split('|'));
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Update001(info.Id, idList, timeList);
        VideoPatrolPlanInfos[PlaninfosIndex] = info;

        VideoPatrolPlanViewPanel.SendMessage("ReloadRecord");
    }
예제 #5
0
//	void SetInitPlanName()
//	{
//		if(VideoPatrolPlanInfos.Count <= 0) return;
//		VideoPatrolPlanInfo info = VideoPatrolPlanInfos [selectPlanInfosIndex];
//		Popuplist.GetComponentInChildren<UIInput> ().value = info.Name;
//	}
    /// <summary>
    /// 当项目名称改变时调用
    /// </summary>
    void PlanNameChanged()
    {
        Logger.Instance.WriteLog("视频巡航方案名称被改变");
        //UIPopupList PopuList = Popuplist.GetComponent<UIPopupList> ();
        VideoPatrolPlanInfo info = VideoPatrolPlanInfos [selectPlanInfosIndex];
        string currentName       = info.Name;
        string newName           = PlanName.GetComponentInChildren <UIInput> ().value;

        if (newName.Trim() == "")
        {
            PlanName.GetComponentInChildren <UIInput> ().value = currentName;
            return;
        }
        if (currentName == newName)
        {
            return;
        }

        if (PlanNameList.Contains(newName))
        {
            PlanName.GetComponentInChildren <UIInput> ().value = currentName;
            return;
        }
        PlanNameList [selectPlanInfosIndex] = newName;
        info.Name = newName;
        VideoPatrolPlanInfos [selectPlanInfosIndex]        = info;
        PlanName.GetComponentInChildren <UIInput> ().value = newName;
        Logger.Instance.WriteLog("更新视频巡航方案名称");
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Update002(info.Id, info.Name);

        VideoPatrolPlanEditMapPanel.GetComponent <DrawMap> ().Title.text = info.Name;
        VideoPatrolPlanViewPanel.SendMessage("ReloadRecord");
    }
예제 #6
0
    /// <summary>
    /// 删除选定的巡逻方案
    /// </summary>
    public void DeleteVideoPatrolPlan()
    {
        Logger.Instance.WriteLog("删除选定的巡逻方案");
        if (VideoPatrolPlanInfos.Count <= 0)
        {
            return;
        }
        string planName            = PlanName.GetComponentInChildren <UIInput> ().value;
        int    PlaninfosIndex      = FindVideoPatrolPlanInfoIndex(planName);
        VideoPatrolPlanInfo info   = VideoPatrolPlanInfos[PlaninfosIndex];
        VideoPatrolPlanDao  vppDao = new VideoPatrolPlanDao();

        vppDao.Delete001(info.Id);
        VideoPatrolPlanInfos.RemoveAt(PlaninfosIndex);
        PlanNameList.Remove(planName);
        if (VideoPatrolPlanInfos.Count > 0)
        {
            PlanName.GetComponentInChildren <UIInput> ().value = VideoPatrolPlanInfos[0].Name;
        }
        else
        {
            PlanName.GetComponentInChildren <UIInput> ().value = "";
        }
        if (VideoPatrolPlanInfos.Count <= 0)
        {
            AddVideoPatrolPlan();
        }
        ShowDetailList(PlanName.GetComponentInChildren <UIInput> ().value);
        VideoPatrolPlanViewPanel.SendMessage("ReloadRecord");
    }
예제 #7
0
    /// <summary>
    /// 删除选定的巡逻方案
    /// </summary>
    public void DeleteVideoPatrolPlan()
    {
        Logger.Instance.WriteLog("删除选定的巡逻方案");
        if (VideoPatrolPlanInfos.Count <= 0)
        {
            return;
        }

        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();
        int ret = vppDao.Delete001(SelectedItem.info.Id);

        if (ret == 0)
        {
            Logger.Instance.WriteLog("删除选定的巡逻方案失败");
            return;
        }

        UIScrollView uiScrollView = SelectedItem.GetComponentInParent <UIScrollView> ();
        UIScrollBar  scrollBar    = (UIScrollBar)uiScrollView.verticalScrollBar;
        float        offset       = scrollBar.value;

        uiScrollView.ResetPosition();
        uiScrollView.verticalScrollBar.value = offset;
        VideoPatrolPlanGrid.RemoveChild(SelectedItem.transform);
        Destroy(SelectedItem.gameObject);

        if (VideoPatrolPlanGrid.transform.childCount > 1)
        {
            if (VideoPatrolPlanGrid.GetChild(0).transform == SelectedItem.transform)
            {
                SelectedItem = null;
                ShowPlanDetail(VideoPatrolPlanGrid.GetChild(1).gameObject);
            }
            else
            {
                SelectedItem = null;
                ShowPlanDetail(VideoPatrolPlanGrid.GetChild(0).gameObject);
            }
        }
        else
        {
            VideoPatrolPlanEditPanel.SetActive(false);
        }
    }
예제 #8
0
    public void Init(string _PlanName, DelVideoPatrolPlanNameChanged _VideoPatrolPlanNameChanged)
    {
        Logger.Instance.WriteLog("加载巡逻方案的数据");
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Select004(_PlanName);
        if (vppDao.Result.Count > 0)
        {
            VPPlaninfo = vppDao.Result[0];
        }
        PlanName.value             = VPPlaninfo.Name;
        VideoPatrolPlanNameChanged = _VideoPatrolPlanNameChanged;

        if (DicMornitorInfos == null)
        {
            LoadDeviceInfoRecord();
        }
        ShowDetailList();
    }
예제 #9
0
    /// <summary>
    /// 当项目名称改变时调用
    /// </summary>
    public void PlanNameChanged()
    {
        Logger.Instance.WriteLog("视频巡航方案名称被改变");
        PlanNameInputBox.enabled = false;
        if (PlanName.value.Trim() == "")
        {
            PlanName.value = VPPlaninfo.Name;
            Logger.Instance.WriteLog("更新视频巡航方案名称失败,名称为空");
            return;
        }
        if (PlanName.value == VPPlaninfo.Name)
        {
            return;
        }
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Select004(PlanName.value);
        if (vppDao.Result.Count > 0)
        {
            PlanName.value = VPPlaninfo.Name;
            Logger.Instance.WriteLog("更新视频巡航方案名称失败,名称已存在");
            return;
        }

        Logger.Instance.WriteLog("更新视频巡航方案名称");
        int ret = vppDao.Update002(VPPlaninfo.Id, PlanName.value);

        if (ret > 0)
        {
            VPPlaninfo.Name = PlanName.value;
            if (VideoPatrolPlanNameChanged != null)
            {
                VideoPatrolPlanNameChanged.Invoke(VPPlaninfo.Name);
            }
            Logger.Instance.WriteLog("更新视频巡航方案名称成功");
        }
        else
        {
            PlanName.value = VPPlaninfo.Name;
            Logger.Instance.WriteLog("更新视频巡航方案名称失败,数据库更新失败");
        }
    }
예제 #10
0
    /// <summary>
    /// 从数据库加载巡逻方案的数据
    /// </summary>
    /// <returns>The video patrol plan record.</returns>
    IEnumerator LoadVideoPatrolPlanRecord()
    {
        Logger.Instance.WriteLog("从数据库加载巡逻方案的数据");
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Select001();
        VideoPatrolPlanInfos = vppDao.Result;
        UIPopupList PopuList = PatrolPlanPopuplist.GetComponent <UIPopupList>();

        PopuList.Clear();
        foreach (VideoPatrolPlanInfo info in VideoPatrolPlanInfos)
        {
            PopuList.AddItem(info.Name);
        }
        if (VideoPatrolPlanInfos.Count > 0)
        {
            PopuList.value = VideoPatrolPlanInfos[0].Name;
        }
        yield return(null);
    }
예제 #11
0
    /// <summary>
    /// 从数据库加载巡逻方案的数据
    /// </summary>
    /// <returns>The video patrol plan record.</returns>
    IEnumerator LoadVideoPatrolPlanRecord()
    {
        Logger.Instance.WriteLog("加载巡逻方案的数据");
        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Select001();
        VideoPatrolPlanInfos = vppDao.Result;
//		UIPopupList PopuList = Popuplist.GetComponent<UIPopupList> ();
        PlanNameList.Clear();
        foreach (VideoPatrolPlanInfo info in VideoPatrolPlanInfos)
        {
            PlanNameList.Add(info.Name);
        }
        if (VideoPatrolPlanInfos.Count <= 0)
        {
            AddVideoPatrolPlan();
        }
        if (VideoPatrolPlanInfos.Count > 0)
        {
            ShowDetailList(VideoPatrolPlanInfos [0].Name);
        }
        yield return(null);
    }
예제 #12
0
    /// <summary>
    /// 保存巡航方案修改的信息
    /// </summary>
    public void SaveVideoPatrolPlan()
    {
        Logger.Instance.WriteLog("保存巡航方案修改的信息");
        string idList   = "";
        string timeList = "";

        foreach (GameObject go in SelectedMornitorItemLst)
        {
            idList   += go.GetComponent <SelectedMornitorItem>().MornitorInfo.Id + "|";
            timeList += go.GetComponent <SelectedMornitorItem>().PatrolTimeInput.value + "|";
        }
        int idListLength   = idList.Length;
        int timeListLength = timeList.Length;

        if (idList.Length > 0)
        {
            timeList = timeList.Remove(timeListLength - 1);
            idList   = idList.Remove(idListLength - 1);
        }

        VideoPatrolPlanDao vppDao = new VideoPatrolPlanDao();

        vppDao.Update001(VPPlaninfo.Id, idList, timeList);
    }