/// <summary> /// 根据MID构造实体 /// </summary> /// <param name="MID">MID</param> protected EntityMID(int mid) { this.SetValByKey(EntityMIDAttr.MID, MID); QueryObject qo = new QueryObject(this); qo.AddWhere(EntityMIDAttr.MID, mid); if (qo.DoQuery() == 0) { throw new Exception("没有查询到MID=" + mid + "的实例。"); } //this.Retrieve(); }
public override int Retrieve() { if (this.MID == 0) { return(base.Retrieve()); } else { QueryObject qo = new QueryObject(this); qo.AddWhere("MID", this.MID); if (qo.DoQuery() == 0) { throw new Exception("没有此记录:MID=" + this.MID); } else { return(1); } } }
/// <summary> /// 取回 审批 /// </summary> /// <returns></returns> public string Gettask() { Flows fls = new Flows(); BP.En.QueryObject qo = new BP.En.QueryObject(fls); qo.addOrderBy(FlowAttr.FK_FlowSort); qo.DoQuery(); //将集合 转换为datatable DataTable dt = new DataTable("Flows"); DataColumn dc0 = new DataColumn("No", Type.GetType("System.String")); //编号 DataColumn dc1 = new DataColumn("FK_FlowSortText", Type.GetType("System.String")); //流程类别 DataColumn dc2 = new DataColumn("Name", Type.GetType("System.String")); //名称 DataColumn dc3 = new DataColumn("FlowImage", Type.GetType("System.String")); //流程图 DataColumn dc4 = new DataColumn("Note", Type.GetType("System.String")); //描述 dt.Columns.Add(dc0); dt.Columns.Add(dc1); dt.Columns.Add(dc2); dt.Columns.Add(dc3); dt.Columns.Add(dc4); foreach (Flow fl in fls) { DataRow dr = dt.NewRow(); dr["No"] = fl.No; dr["FK_FlowSortText"] = fl.FK_FlowSortText; dr["Name"] = fl.Name; dr["FlowImage"] = fl.No; dr["Note"] = fl.Note; dt.Rows.Add(dr); } //将dt以json的格式 返回 return(CommonDbOperator.GetJsonFromTable(dt)); }