コード例 #1
0
        public bool GetCustCmd(string method)
        {
            ShowCustomActions(method);
            ALS.BLL.customactions bllCust = new ALS.BLL.customactions();
            m_lstCust = bllCust.GetModelList("methodName='" + method + "'");

            if (m_lstCust.Count > 0)
            {
                m_queueCustSendCmd = new Queue <Cls.Model_CustomCMD>();
                ALS.BLL.actions bllact = new ALS.BLL.actions();
                for (int i = 0; i < m_lstCust.Count; i++)
                {
                    //重新计算时间点
                    if (i > 0)
                    {
                        m_lstCust[i].timeCount = m_lstCust[i - 1].timeCount + m_lstCust[i - 1].timeSpan;
                    }
                    //读取步骤下相应的动作列表
                    int customID = (int)m_lstCust[i].ID;
                    List <ALS.Model.actions> lstModAct  = bllact.GetModelList("customID='" + customID + "'");
                    List <Cls.Model_SendCMD> lstActions = new List <Cls.Model_SendCMD>();
                    if (lstModAct.Count > 0)
                    {
                        lstActions = GetlstActions(lstModAct);
                    }
                    Cls.Model_CustomCMD modCustCmd = new Cls.Model_CustomCMD();
                    modCustCmd._TimesCount  = (int)m_lstCust[i].timeCount;
                    modCustCmd._LstSendCMDs = lstActions;
                    modCustCmd._LastTime    = (int)m_lstCust[i].timeSpan;
                    modCustCmd._ActionName  = m_lstCust[i].actionName;
                    modCustCmd._Index       = m_queueCustSendCmd.Count;
                    //将该动作列表加入步骤里
                    m_queueCustSendCmd.Enqueue(modCustCmd);
                }
                //最后一项提取总时间
                int timefull = (int)(m_lstCust[m_lstCust.Count - 1].timeCount + m_lstCust[m_lstCust.Count - 1].timeSpan);// (int)modCust.timeCount + (int)modCust.timeSpan;
                this.lblFullTime.Text = Cls.utils.SecondsToTime(timefull);
                return(true);
            }
            else
            {
                this.lblFullTime.Text = "00:00:00";
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取自定义操作的步骤
        /// </summary>
        /// <param name="methodname"></param>
        /// <returns></returns>
        private DataTable dsCustomActions(string methodname)
        {
            DataTable dt = new DataTable();

            ALS.BLL.customactions bllcustom = new ALS.BLL.customactions();

            dt.Columns.Add("ID");
            dt.Columns.Add("描述");
            dt.Columns.Add("timespan");
            List <Model.customactions> lstCustomact = bllcustom.GetModelList(" methodname='" + methodname + "'");

            //先合并延迟时间为0的步骤
            for (int i = 0; i < lstCustomact.Count; i++)
            {
                if (lstCustomact[i].timeSpan.Value == 0)
                {
                    //如果未超过列表项数
                    if (i + 1 < lstCustomact.Count)
                    {
                        lstCustomact[i + 1].actionName = lstCustomact[i + 1].actionName + " 【" + lstCustomact[i].actionName + "】";
                    }
                    //如果最后一项是提示
                    if (i + 1 == lstCustomact.Count)
                    {
                        object[] val = new object[] { lstCustomact[i].ID, lstCustomact[i].actionName, lstCustomact[i].timeSpan };
                        dt.Rows.Add(val);
                    }
                }
                else
                {
                    object[] val = new object[] { lstCustomact[i].ID, lstCustomact[i].actionName, lstCustomact[i].timeSpan };
                    dt.Rows.Add(val);
                }
            }
            //DataSet ds = bllcustom.GetList(" methodname='" + methodname + "'", true);
            //dt = bllcustom.GetList(" methodname='" + methodname + "'", true).Tables[0];
            return(dt);
        }