コード例 #1
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");
    }
コード例 #2
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("更新视频巡航方案名称失败,数据库更新失败");
        }
    }