Esempio n. 1
0
 public RecOprFrm(GlobalVar.ActionType act)
 {
     Init();
     m_action = act;
 }
Esempio n. 2
0
        /// <summary>
        /// 查看快捷名称是否存在,如果为修改,检查列表,如果为增加,多检查缓冲区.
        /// </summary>
        /// <param name="sct">快捷名.</param>
        /// <param name="type">当前操作类型.</param>
        /// <returns></returns>
        private bool CheckShortcut(string sct, GlobalVar.ActionType type)
        {
            bool bRst = true;

            if (sct.Trim().Equals(String.Empty))
            {
                toolTip.SetToolTip(tbSct, "命令不能为空");
                tbSct.Focus();
                tbSct.SelectAll();
                return false;
            }
            if (CheckFirstForbiden(sct) == false)
            {
                toolTip.SetToolTip(tbSct, "命令: [ " + sct + " ]不能以 " + sct[0] + " 开头");
                tbSct.Focus();
                tbSct.SelectAll();
                return false;
            }
            //判断快捷名的有效性
            //if (type == GlobalVar.ActionType.Modify)
            //{
            //    foreach (ListViewItem item in m_lvRecords.Items)
            //    {
            //        if (sct.Equals(item.SubItems[2].Text))
            //        {
            //            if (type == GlobalVar.ActionType.Modify)
            //                bRst = item == m_lvRecords.SelectedItems[0];
            //            else
            //                bRst = false;
            //            break;
            //        }
            //    }
            //}else if (bRst == true && m_action == GlobalVar.ActionType.Add)
            //{
            //    //if (sct != null &&
            //    //    !sct.Equals(String.Empty) &&
            //    //    GlobalVar.Instanse.DataBuffer.ContainsKey(sct))
            //    //    bRst = false;
            //    GlobalVar.Helper.AddCustomParam("shortcut",sct);
            //    long count = (long)GlobalVar.Helper.ExcuteForUnique<object>("select count(*) from programs where shortcut=@shortcut");

            //    bRst = count == 0;
            //}

            //if (bRst == false)
            //{
            //    toolTip.SetToolTip(tbSct, "命令: [ " + sct + " ] 已存在!");
            //    tbSct.Focus();
            //    tbSct.SelectAll();
            //}
            //return bRst;
            return true;
        }