void LoadDataList(Organization category) { DataEntityQuery <Account> query = new DataEntityQuery <Account>(); var v = from c in query where c.OrganID == category.Guid select c; EAS.Controls.Window.ShowLoading("请求数据..."); DataPortal <Account> dp = new DataPortal <Account>(); dp.BeginExecuteCountQuery(v).Completed += (s, e2) => { QueryTask <Account> task = s as QueryTask <Account>; if (task.Error != null) { EAS.Controls.Window.HideLoading(); MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.iCount = task.Count; int mod = iCount % PageSize; int pages = mod == 0 ? iCount / PageSize : (iCount / PageSize) + 1; this.pager.PageCount = pages; this.pager.ReBind(pages); this.GetPageList(1); } }; }
void LoadInstanceList() { this.btnTrack.IsEnabled = this.btnExecute.IsEnabled = this.btnKill.IsEnabled = false; DateTime startTime = this.dtpStart.SelectedDate.HasValue == true ? dtpStart.SelectedDate.Value.Date : DateTime.Now.Date; DateTime endTime = this.dtpEnd.SelectedDate.HasValue == true ? this.dtpEnd.SelectedDate.Value.Date : DateTime.Now.Date; string flowID = this.tbKey.Tag.ToString(); int isComplate = this.checkBox1.IsChecked.HasValue ? (this.checkBox1.IsChecked.Value ?1 : 0) :0; DataEntityQuery <WFInstance> query = new DataEntityQuery <WFInstance>(); var v = from c in query where c.CreateTime >= startTime && c.CreateTime <= endTime.AddDays(1) select new WFInstance { ID = c.ID, FlowID = c.FlowID, FlowName = c.FlowName, Handler = c.Handler, Subject = c.Subject, CreateTime = c.CreateTime, ProcessTime = c.ProcessTime, ComplateTime = c.ComplateTime, Sender = c.Sender, CurrentState = c.CurrentState, IsComplate = c.IsComplate }; if (flowID.Length > 0) { v = v.Where(p => p.FlowID == flowID); } if (isComplate > 0) { v = v.Where(p => p.IsComplate != 0); } else { v = v.Where(p => p.IsComplate == 0); } v = v.OrderByDescending(p => p.CreateTime); this.vList = v as IQueryable <WFInstance>; DataPortal <WFInstance> dataPortal = new DataPortal <WFInstance>(); dataPortal.BeginExecuteCountQuery(this.vList).Completed += (s, e) => { QueryTask <WFInstance> task = s as QueryTask <WFInstance>; if (task.Error != null) { MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); } else { this.dataPager.RecordCount = task.Count; } }; }
void LoadDataList() { DataEntityQuery <Role> query = new DataEntityQuery <Role>(); var v = from c in query where c.Name.StartsWith(this.tbSeach.Text) || c.Description.StartsWith(this.tbSeach.Text) select c; EAS.Controls.Window.ShowLoading("请求数据..."); DataPortal <Role> dp = new DataPortal <Role>(); dp.BeginExecuteCountQuery(v).Completed += (s, e2) => { QueryTask <Role> task = s as QueryTask <Role>; if (task.Error != null) { EAS.Controls.Window.HideLoading(); MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK); return; } else { this.iCount = task.Count; int mod = iCount % PageSize; int pages = mod == 0 ? iCount / PageSize : (iCount / PageSize) + 1; this.pager.PageCount = pages; this.pager.ReBind(pages); this.GetPageList(1); } }; }
private void Apply() { if (this.tbName.Text.Trim() == string.Empty) { MessageBox.Show("机构名称必须输入", "提示", MessageBoxButton.OK); this.tcMain.SelectedIndex = 0; this.tbName.Focus(); return; } DataPortal <Organization> dp = new DataPortal <Explorer.Entities.Organization>(); IQueryable v = null; Organization organ = this.Organization; if (organ == null) { v = new DataEntityQuery <Organization>().Where(p => p.Name == this.tbName.Text.Trim()); } else { if (this.tbName.Text.Trim() != organ.Name) { v = new DataEntityQuery <Organization>().Where(p => p.Name == this.tbName.Text.Trim()); } } if (v != null) { dp.BeginExecuteCountQuery(v).Completed += (s, e2) => { QueryTask <Organization> task = s as QueryTask <Organization>; int count = task.Count; if (count > 0) { this.tbName.Focus(); MessageBox.Show(string.Format("已经存在名称为{0}的组织机构!", this.tbName.Text), "操作提示", MessageBoxButton.OK); return; } else { this.Save(); } }; } else { this.Save(); } }