/// <summary> /// 身份认证 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, RoutedEventArgs e) { //string logStr = "select count(*) from UserInfo where UserName='******' and PassWord='******'"; //int result = SqlHelper.cmdExecuteScalar(logStr); //if (result == 0) //{ // MessageBox.Show("登陆失败!"); // return; //} //this.Title = "欢迎【" + this.txtUserName.Text.Trim() + "】登陆!"; //var dt = SqlHelper.GetLocalDataTable("select * from keywords where isown='" + this.txtUserName.Text.Trim() + "' and isuse=0 order by search_total"); //var list = ModelConvertHelper<keyWordDto>.ConvertToModel(dt); Entity.EFOperation.TitleInfo titleInfo = new Entity.EFOperation.TitleInfo(); TitleInfoRequest request = new TitleInfoRequest(); request.PageIndex = 0; request.PageSize = 10; request.IsOccupy = 0; //request.UserNo = No; TitleInfoListResponse str = titleInfo.SelectUserTitleInfoList(request); var tList = new List <MainWindowModel>(); if (str.RowCount > 0) { //PageMax = str.PageMax; tList = str.mainWindowModels.ToList(); //ObservableCollection<MainWindowModel> oc = new ObservableCollection<MainWindowModel>(); //tList.ForEach(x => oc.Add(x)); //Items = oc; } else { return; } foreach (var l in tList) { Button btn = new Button() { BorderThickness = new Thickness(2), FontSize = Convert.ToDouble(15.0) }; btn.Click += Btn_Click; btn.Content = l.NewTitle; this.warpPanelKeys.Children.Add(btn); } }
public void LoadData() { warpPanelKeys.Children.Clear(); Entity.EFOperation.TitleInfo titleInfo = new Entity.EFOperation.TitleInfo(); TitleInfoRequest request = new TitleInfoRequest(); request.PageIndex = 0; request.PageSize = 10; request.IsOccupy = 0; request.UserNo = ViewModel.No; TitleInfoListResponse str = titleInfo.SelectUserTitleInfoList(request); var tList = new List <MainWindowModel>(); if (str.RowCount > 0) { //PageMax = str.PageMax; tList = str.mainWindowModels.ToList(); //ObservableCollection<MainWindowModel> oc = new ObservableCollection<MainWindowModel>(); //tList.ForEach(x => oc.Add(x)); //Items = oc; } else { return; } foreach (var l in tList) { Button btn = new Button() { BorderThickness = new Thickness(2), FontSize = Convert.ToDouble(15.0) }; //FontSize = "24" btn.FontSize = 20; btn.Margin = new Thickness(10); btn.Click += Btn_Click; btn.Content = l.NewTitle; this.warpPanelKeys.Children.Add(btn); } }
/// <summary> /// 加载数据 /// </summary> public async void Init() { await Task.Run(() => { try { Entity.EFOperation.TitleInfo titleInfo = new Entity.EFOperation.TitleInfo(); TitleInfoRequest request = new TitleInfoRequest(); request.PageIndex = 0; request.PageSize = 500; request.IsOccupy = 0; request.UserNo = No; request.IsStep = 2; TitleInfoListResponse str = titleInfo.SelectUserTitleInfoList(request); if (str.RowCount > 0) { //PageMax = str.PageMax; var tList = str.mainWindowModels.ToList(); ObservableCollection <MainWindowModel> oc = new ObservableCollection <MainWindowModel>(); tList.ForEach(x => oc.Add(x)); Items = oc; } else { return; } //var result = new ActionResult(); //result.Result = true; } catch (Exception) { } finally { } }); }