Exemplo n.º 1
0
 public override void VariablesInit()
 {
     btnSearchStaff = _data.getElementById <dom.HTMLButtonElement>("btnSearchStaff");
     btnAddStaff    = _data.getElementById <dom.HTMLButtonElement>("btnAddStaff");
     txtEmail1      = _data.getElementById <dom.HTMLInputElement>("Email1");
     txtEmail2      = _data.getElementById <dom.HTMLInputElement>("Email2");
 }
Exemplo n.º 2
0
        /// <summary>
        /// Gán từ khóa tìm kiếm vào session
        /// </summary>
        /// <param name="ev"></param>
        private async void setSearchKeyword(dom.KeyboardEvent ev)
        {
            //Trong hàm async thì từ khóa this vẫn giữ nguyên ý nghĩa.
            string requestUrl = string.Empty;

            dom.HTMLInputElement sourceTextBox = ev.srcElement.As <dom.HTMLInputElement>();


            if (sourceTextBox.value.Length < Const.Search.MinKeywordLength)
            {
                return;
            }

            switch (sourceTextBox.id)
            {
            case Const.StaffManager.txtEmail1Id:
            case Const.StaffManager.txtEmail2Id:

                requestUrl = "/Admin/SetKeywordForSearchStaff";
                break;

            default:
                return;
            }

            //Chờ người dùng thêm 0.2 giây
            await Task.Delay(200);

            if (ev.type == "keypress" || ev.keyCode == Functions.Const.Keyboard.Enter)
            {
                var SetKeywordFortxtEmailAutoComplete = new AjaxTask()
                {
                    Url    = requestUrl,
                    Method = HttpMethod.POST,
                    data   = new Search()
                    {
                        Keyword = sourceTextBox.value
                    }.ToDynamic()
                };
                await SetKeywordFortxtEmailAutoComplete.Execute();
            }
        }