void GetActivesData() { string WF_Workflow_id = Request["WF_Workflow_id"]; CWorkflow wf = (CWorkflow)m_BaseObjectMgr.WorkflowMgr.Find(new Guid(WF_Workflow_id)); string sData = ""; CWorkflowDef WorkflowDef = wf.GetWorkflowDef(); List <CBaseObject> lstObj = wf.ActivesMgr.GetList(); foreach (CBaseObject obj in lstObj) { CActives Actives = (CActives)obj; CActivesDef ActivesDef = (CActivesDef)WorkflowDef.ActivesDefMgr.Find(Actives.WF_ActivesDef_id); CUser User = (CUser)Global.GetCtx(Session["TopCompany"].ToString()).UserMgr.Find(Actives.B_User_id); CRole Role = (CRole)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.FindTopCompany().RoleMgr.Find(Actives.B_Role_id); string UserName = "", RoleName = ""; UserName = (User != null) ? User.Name : ""; RoleName = (Role != null) ? Role.Name : ""; sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\", \"Result\":\"{2}\", \"Comment\":\"{3}\", \"UserName\":\"{4}\", \"RoleName\":\"{5}\" }}," , Actives.Id , ActivesDef.Name , Actives.GetResultString() , Actives.Comment , UserName , RoleName); } sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, lstObj.Count); Response.Write(sJson); }
void GetData() { string sData = ""; int iCount = 0; List <CWorkflow> lstWF = m_BaseObjectMgr.WorkflowMgr.FindByRowid(m_BaseObject.Id); foreach (CWorkflow wf in lstWF) { CWorkflowDef WorkflowDef = wf.GetWorkflowDef(); if (WorkflowDef == null) { continue; } sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\",\"Created\":\"{2}\", \"State\":\"{3}\"}}," , wf.Id , WorkflowDef.Name , wf.Created , wf.GetStateString()); iCount++; } sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, iCount); Response.Write(sJson); }
void LoadWorkflow() { if (m_BaseObjectMgr == null) { return; } if (m_BaseObject == null) { return; } dataGridView.Rows.Clear(); List <CWorkflow> lstWF = m_BaseObjectMgr.WorkflowMgr.FindByRowid(m_BaseObject.Id); foreach (CWorkflow wf in lstWF) { CWorkflowDef WorkflowDef = wf.GetWorkflowDef(); if (WorkflowDef == null) { continue; } dataGridView.Rows.Add(1); DataGridViewRow row = dataGridView.Rows[dataGridView.Rows.Count - 1]; row.Cells[0].Value = WorkflowDef.Name; row.Cells[1].Value = wf.Created.ToString(); row.Cells[2].Value = wf.GetStateString(); row.Tag = wf; } }
void LoadActives(CWorkflow wf) { dataGridView2.Rows.Clear(); CWorkflowDef WorkflowDef = wf.GetWorkflowDef(); List <CBaseObject> lstObj = wf.ActivesMgr.GetList(); foreach (CBaseObject obj in lstObj) { CActives Actives = (CActives)obj; dataGridView2.Rows.Add(1); DataGridViewRow row = dataGridView2.Rows[dataGridView2.Rows.Count - 1]; CActivesDef ActivesDef = (CActivesDef)WorkflowDef.ActivesDefMgr.Find(Actives.WF_ActivesDef_id); row.Cells[0].Value = ActivesDef.Name; row.Cells[1].Value = Actives.GetResultString(); row.Cells[2].Value = Actives.Comment; CUser user = (CUser)Program.Ctx.UserMgr.Find(Actives.B_User_id); if (user != null) { row.Cells[3].Value = user.Name; } row.Tag = Actives; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("../Login.aspx"); Response.End(); } string B_Company_id = Request["B_Company_id"]; if (string.IsNullOrEmpty(B_Company_id)) { m_Company = Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.FindTopCompany(); } else { m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); } string wfid = Request["wfid"]; if (string.IsNullOrEmpty(wfid)) { Response.End(); return; } m_WorkflowDef = (CWorkflowDef)m_Company.WorkflowDefMgr.Find(new Guid(wfid)); if (m_WorkflowDef == null) //可能是新建的 { if (Session["AddWorkflowDef"] == null) { Response.End(); return; } m_WorkflowDef = (CWorkflowDef)Session["AddWorkflowDef"]; } string PreActives = Request["PreActives"]; m_PreActives = (CActivesDef)m_WorkflowDef.ActivesDefMgr.Find(new Guid(PreActives)); m_LinkMgr = m_WorkflowDef.LinkMgr; m_Table = m_LinkMgr.Table; if (Request.Params["Action"] == "Cancel") { m_LinkMgr.Cancel(); Response.End(); } else if (Request.Params["Action"] == "PostData") { PostData(); Response.End(); } else if (Request.Params["Action"] == "GetCondiction") { GetCondiction(); Response.End(); } }
void LoadData() { if (m_WorkflowDef == null) { m_bIsNew = true; m_WorkflowDef = new CWorkflowDef(); m_WorkflowDef.Ctx = Program.Ctx; m_WorkflowDef.WF_WorkflowCatalog_id = m_Catalog_id; CActivesDef startActivesDef = new CActivesDef(); startActivesDef.Ctx = Program.Ctx; startActivesDef.WF_WorkflowDef_id = m_WorkflowDef.Id; startActivesDef.WType = ActivesType.Start; startActivesDef.Name = "启动"; startActivesDef.Idx = 0; m_WorkflowDef.ActivesDefMgr.AddNew(startActivesDef); CActivesDef SuccessActivesDef = new CActivesDef(); SuccessActivesDef.Ctx = Program.Ctx; SuccessActivesDef.WF_WorkflowDef_id = m_WorkflowDef.Id; SuccessActivesDef.WType = ActivesType.Success; SuccessActivesDef.Name = "成功结束"; SuccessActivesDef.Idx = -1; m_WorkflowDef.ActivesDefMgr.AddNew(SuccessActivesDef); CActivesDef FailureActivesDef = new CActivesDef(); FailureActivesDef.Ctx = Program.Ctx; FailureActivesDef.WF_WorkflowDef_id = m_WorkflowDef.Id; FailureActivesDef.WType = ActivesType.Failure; FailureActivesDef.Name = "失败结束"; FailureActivesDef.Idx = -2; m_WorkflowDef.ActivesDefMgr.AddNew(FailureActivesDef); CLink Link = new CLink(); Link.Ctx = Program.Ctx; Link.WF_WorkflowDef_id = m_WorkflowDef.Id; Link.Result = enumApprovalResult.Accept; Link.PreActives = startActivesDef.Id; Link.NextActives = SuccessActivesDef.Id; m_WorkflowDef.LinkMgr.AddNew(Link); } txtName.Text = m_WorkflowDef.Name; CTable Table = (CTable)Program.Ctx.TableMgr.Find(m_WorkflowDef.FW_Table_id); if (Table != null) { txtTable.Text = Table.Name; } LoadActives(); if (dataGridView.Rows.Count > 0) { CActivesDef ActivesDef = (CActivesDef)dataGridView.Rows[0].Tag; LoadLink(ActivesDef); } }
public CWorkflowDef GetWorkflowDef() { if (Session["AddWorkflowDef"] == null) { CUser user = (CUser)Session["User"]; CWorkflowDef WorkflowDef = new CWorkflowDef(); WorkflowDef.Ctx = Global.GetCtx(Session["TopCompany"].ToString()); Guid Catalog_id = Guid.Empty; if (!string.IsNullOrEmpty(Request["catalog_id"])) { Catalog_id = new Guid(Request["catalog_id"]); } WorkflowDef.WF_WorkflowCatalog_id = Catalog_id; WorkflowDef.B_Company_id = m_Company.Id; WorkflowDef.Creator = user.Id; CActivesDef startActivesDef = new CActivesDef(); startActivesDef.Ctx = Global.GetCtx(Session["TopCompany"].ToString()); startActivesDef.WF_WorkflowDef_id = WorkflowDef.Id; startActivesDef.WType = ActivesType.Start; startActivesDef.Name = "启动"; startActivesDef.Idx = 0; startActivesDef.Creator = user.Id; WorkflowDef.ActivesDefMgr.AddNew(startActivesDef); CActivesDef SuccessActivesDef = new CActivesDef(); SuccessActivesDef.Ctx = Global.GetCtx(Session["TopCompany"].ToString()); SuccessActivesDef.WF_WorkflowDef_id = WorkflowDef.Id; SuccessActivesDef.WType = ActivesType.Success; SuccessActivesDef.Name = "成功结束"; SuccessActivesDef.Idx = -1; SuccessActivesDef.Creator = user.Id; WorkflowDef.ActivesDefMgr.AddNew(SuccessActivesDef); CActivesDef FailureActivesDef = new CActivesDef(); FailureActivesDef.Ctx = Global.GetCtx(Session["TopCompany"].ToString()); FailureActivesDef.WF_WorkflowDef_id = WorkflowDef.Id; FailureActivesDef.WType = ActivesType.Failure; FailureActivesDef.Name = "失败结束"; FailureActivesDef.Idx = -2; FailureActivesDef.Creator = user.Id; WorkflowDef.ActivesDefMgr.AddNew(FailureActivesDef); CLink Link = new CLink(); Link.Ctx = Global.GetCtx(Session["TopCompany"].ToString()); Link.WF_WorkflowDef_id = WorkflowDef.Id; Link.Result = enumApprovalResult.Accept; Link.PreActives = startActivesDef.Id; Link.NextActives = SuccessActivesDef.Id; Link.Creator = user.Id; WorkflowDef.LinkMgr.AddNew(Link); Session["AddWorkflowDef"] = WorkflowDef; } return((CWorkflowDef)Session["AddWorkflowDef"]); }
private void btOk_Click(object sender, EventArgs e) { if (dataGridView.CurrentRow == null) { MessageBox.Show("请选择工作流!"); return; } m_SelWorkflowDef = (CWorkflowDef)dataGridView.CurrentRow.Tag; this.DialogResult = DialogResult.OK; this.Close(); }
void GetData() { string B_Company_id = Request["B_Company_id"]; string FW_Table_id = Request["FW_Table_id"]; if (string.IsNullOrEmpty(B_Company_id) || string.IsNullOrEmpty(FW_Table_id)) { return; } CCompany Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); if (Company == null) { return; } string sData = ""; List <CBaseObject> lstObj = Company.WorkflowDefMgr.GetList(); int iCount = 0; foreach (CBaseObject obj in lstObj) { CWorkflowDef WorkflowDef = (CWorkflowDef)obj; if (WorkflowDef.FW_Table_id != new Guid(FW_Table_id)) { continue; } sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\"}}," , WorkflowDef.Id, WorkflowDef.Name); iCount++; } sData = sData.TrimEnd(",".ToCharArray()); sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, iCount); Response.Write(sJson); }
void GetLinkData() { string ActivesId = Request["ActivesId"]; if (string.IsNullOrEmpty(ActivesId)) { return; } Guid guidActivesId = new Guid(ActivesId); CWorkflowDef WorkflowDef = GetWorkflowDef(); List <CBaseObject> lstObj = WorkflowDef.LinkMgr.GetList(); string sData = ""; int iCount = 0; foreach (CBaseObject obj in lstObj) { CLink Link = (CLink)obj; if (Link.PreActives != guidActivesId) { continue; } CActivesDef next = (CActivesDef)WorkflowDef.ActivesDefMgr.Find(Link.NextActives); sData += string.Format("{{ \"id\": \"{0}\",\"Result\":\"{1}\",\"ResultName\":\"{2}\", \"Condiction\":\"{3}\", \"NextActives\":\"{4}\", \"NextActivesName\":\"{5}\"}}," , Link.Id , Link.Result , (Link.Result == enumApprovalResult.Accept)?"接受":"拒绝" , Link.Condiction , Link.NextActives , (next != null)?next.Name:""); iCount++; } sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, iCount); Response.Write(sJson); }
private void tbtDel_Click(object sender, EventArgs e) { if (dataGridView.CurrentRow == null) { MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("是否确认删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } for (int i = dataGridView.SelectedRows.Count - 1; i >= 0; i--) { CWorkflowDef obj = (CWorkflowDef)dataGridView.SelectedRows[i].Tag; obj.m_ObjectMgr.Delete(obj); if (!obj.m_ObjectMgr.Save(true)) { MessageBox.Show("删除失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } dataGridView.Rows.Remove(dataGridView.SelectedRows[i]); } }
public void LoadData() { if (Company == null) { return; } if (dataGridView == null) { return; } if (dataGridView.Columns.Count == 0) { return; } dataGridView.Rows.Clear(); CBaseObjectMgr BaseObjectMgr = Company.WorkflowDefMgr; List <CBaseObject> lstObj = BaseObjectMgr.GetList(); foreach (CBaseObject obj in lstObj) { CWorkflowDef WorkflowDef = (CWorkflowDef)obj; if (m_Table != null) { if (WorkflowDef.FW_Table_id != m_Table.Id) { continue; } } dataGridView.Rows.Add(1); int nRowIdx = dataGridView.Rows.Count - 1; DataGridViewRow row = dataGridView.Rows[nRowIdx]; row.Tag = obj; foreach (DataGridViewColumn column in dataGridView.Columns) { CColumn col = (CColumn)column.Tag; if (col.ColType == ColumnType.object_type) { if (obj.GetColValue(col) != null) { row.Cells[column.Name].Value = "long byte"; } } else if (col.ColType == ColumnType.ref_type) { CTable table = (CTable)Program.Ctx.TableMgr.Find(col.RefTable); if (table == null) { continue; } CColumn RefCol = (CColumn)table.ColumnMgr.Find(col.RefCol); CColumn RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol); object objVal = obj.GetColValue(col); Guid guidParentId = Guid.Empty; if (BaseObjectMgr.m_Parent != null && BaseObjectMgr.m_Parent.Id == (Guid)objVal) { row.Cells[column.Name].Value = BaseObjectMgr.m_Parent.GetColValue(RefShowCol); } else { CBaseObjectMgr objMgr = Program.Ctx.FindBaseObjectMgrCache(table.Code, Guid.Empty); if (objMgr != null) { CBaseObject objCache = objMgr.FindByValue(RefCol, objVal); if (objCache != null) { row.Cells[column.Name].Value = objCache.GetColValue(RefShowCol); } } else { objMgr = new CBaseObjectMgr(); objMgr.TbCode = table.Code; objMgr.Ctx = Program.Ctx; string sWhere = string.Format(" {0}=?", RefCol.Code); List <DbParameter> cmdParas = new List <DbParameter>(); cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col))); List <CBaseObject> lstObj2 = objMgr.GetList(sWhere, cmdParas); if (lstObj2.Count > 0) { CBaseObject obj2 = lstObj2[0]; row.Cells[column.Name].Value = obj2.GetColValue(RefShowCol); } } } } else { row.Cells[column.Name].Value = obj.GetColValue(col); } } } }
void GetActivesData() { CWorkflowDef WorkflowDef = GetWorkflowDef(); List <CBaseObject> lstObj = WorkflowDef.ActivesDefMgr.GetList(); //按序号排序 SortedList <int, CActivesDef> sortObj = new SortedList <int, CActivesDef>(); foreach (CBaseObject obj in lstObj) { CActivesDef ActivesDef = (CActivesDef)obj; sortObj.Add(ActivesDef.Idx, ActivesDef); } CActivesDef SuccessActivesDef = null; CActivesDef FailureActivesDef = null; string sData = ""; foreach (KeyValuePair <int, CActivesDef> pair in sortObj) { CActivesDef ActivesDef = pair.Value; if (ActivesDef.WType == ActivesType.Success) { SuccessActivesDef = ActivesDef; continue; } if (ActivesDef.WType == ActivesType.Failure) { FailureActivesDef = ActivesDef; continue; } CUser User = (CUser)Global.GetCtx(Session["TopCompany"].ToString()).UserMgr.Find(ActivesDef.B_User_id); CRole Role = (CRole)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.FindTopCompany().RoleMgr.Find(ActivesDef.B_Role_id); string AType = "", UserName = "", RoleName = ""; AType = ActivesDef.AType; UserName = (User != null) ? User.Name : ""; RoleName = (Role != null) ? Role.Name : ""; sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\", \"Idx\":\"{2}\", \"WType\":\"{3}\", \"AType\":\"{4}\", \"UserName\":\"{5}\", \"RoleName\":\"{6}\" }}," , ActivesDef.Id , ActivesDef.Name , ActivesDef.Idx , ActivesDef.WType , AType , UserName , RoleName); } //成功/失败结束活动放最后 if (SuccessActivesDef != null) { sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\", \"Idx\":\"{2}\", \"WType\":\"{3}\", \"B_User_id\":\"{4}\", \"UserName\":\"{5}\" }}," , SuccessActivesDef.Id , SuccessActivesDef.Name , SuccessActivesDef.Idx , SuccessActivesDef.WType , SuccessActivesDef.B_User_id , ""); } if (FailureActivesDef != null) { sData += string.Format("{{ \"id\": \"{0}\",\"Name\":\"{1}\", \"Idx\":\"{2}\", \"WType\":\"{3}\", \"B_User_id\":\"{4}\", \"UserName\":\"{5}\" }}," , FailureActivesDef.Id , FailureActivesDef.Name , FailureActivesDef.Idx , FailureActivesDef.WType , FailureActivesDef.B_User_id , ""); } sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, lstObj.Count); Response.Write(sJson); }
void GetData() { int page = Convert.ToInt32(Request.Params["page"]); int pageSize = Convert.ToInt32(Request.Params["pagesize"]); string catalog_id = Request["catalog_id"]; string sData = ""; List <CBaseObject> lstObj = new List <CBaseObject>(); CBaseObjectMgr BaseObjectMgr = m_Company.WorkflowDefMgr; List <CBaseObject> lstWF = BaseObjectMgr.GetList(); foreach (CBaseObject objWF in lstWF) { CWorkflowDef WorkflowDef = (CWorkflowDef)objWF; if (!string.IsNullOrEmpty(catalog_id)) { Guid guid = new Guid(catalog_id); if (WorkflowDef.WF_WorkflowCatalog_id == guid) { lstObj.Add(WorkflowDef); } } else { //所有目录不存在的都放置根目录 CBaseObject objCatalog = m_Company.WorkflowCatalogMgr.Find(WorkflowDef.WF_WorkflowCatalog_id); if (objCatalog == null) { lstObj.Add(WorkflowDef); } } } int totalPage = lstObj.Count % pageSize == 0 ? lstObj.Count / pageSize : lstObj.Count / pageSize + 1; // 计算总页数 int index = (page - 1) * pageSize; // 开始记录数 for (int i = index; i < pageSize + index && i < lstObj.Count; i++) { CBaseObject obj = (CBaseObject)lstObj[i]; string sRow = ""; foreach (CBaseObject objC in m_Table.ColumnMgr.GetList()) { CColumn col = (CColumn)objC; if (col.ColType == ColumnType.object_type) { string sVal = ""; if (obj.GetColValue(col) != null) { sVal = "long byte"; } sRow += string.Format("\"{0}\":\"{1}\",", col.Code, sVal); } else if (col.ColType == ColumnType.ref_type) { CTable RefTable = (CTable)Global.GetCtx(Session["TopCompany"].ToString()).TableMgr.Find(col.RefTable); if (RefTable == null) { continue; } CColumn RefCol = (CColumn)RefTable.ColumnMgr.Find(col.RefCol); CColumn RefShowCol = (CColumn)RefTable.ColumnMgr.Find(col.RefShowCol); object objVal = obj.GetColValue(col); string sVal = ""; Guid guidParentId = Guid.Empty; if (BaseObjectMgr.m_Parent != null && BaseObjectMgr.m_Parent.Id == (Guid)objVal) { object objVal2 = BaseObjectMgr.m_Parent.GetColValue(RefShowCol); if (objVal2 != null) { sVal = objVal2.ToString(); } } else { CBaseObjectMgr objRefMgr = Global.GetCtx(Session["TopCompany"].ToString()).FindBaseObjectMgrCache(RefTable.Code, guidParentId); if (objRefMgr != null) { CBaseObject objCache = objRefMgr.FindByValue(RefCol, objVal); if (objCache != null) { object objVal2 = objCache.GetColValue(RefShowCol); if (objVal2 != null) { sVal = objVal2.ToString(); } } } else { objRefMgr = new CBaseObjectMgr(); objRefMgr.TbCode = RefTable.Code; objRefMgr.Ctx = Global.GetCtx(Session["TopCompany"].ToString()); string sWhere = string.Format(" {0}=?", RefCol.Code); List <DbParameter> cmdParas = new List <DbParameter>(); cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col))); List <CBaseObject> lstObj2 = objRefMgr.GetList(sWhere, cmdParas); if (lstObj2.Count > 0) { CBaseObject obj2 = lstObj2[0]; object objVal2 = obj2.GetColValue(RefShowCol); if (objVal2 != null) { sVal = objVal2.ToString(); } } } } sRow += string.Format("\"{0}\":\"{1}\",", col.Code, sVal); } else { string sVal = ""; object objVal = obj.GetColValue(col); if (objVal != null) { sVal = objVal.ToString(); } Util.ConvertJsonSymbol(ref sVal); sRow += string.Format("\"{0}\":\"{1}\",", col.Code, sVal); } } sRow = sRow.TrimEnd(",".ToCharArray()); sRow = "{" + sRow + "},"; sData += sRow; } sData = sData.TrimEnd(",".ToCharArray()); sData = "[" + sData + "]"; string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}" , sData, lstObj.Count); Response.Write(sJson); }
private void tbtEdit_Click(object sender, EventArgs e) { if (dataGridView.CurrentRow == null) { MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } CWorkflowDef obj = (CWorkflowDef)dataGridView.CurrentRow.Tag; WorkflowDefInfo frm = new WorkflowDefInfo(); Guid Catalog_id = (catalog == null) ? Guid.Empty : catalog.Id; frm.m_Catalog_id = Catalog_id; frm.m_Company = Company; frm.m_WorkflowDef = obj; if (frm.ShowDialog() != DialogResult.OK) { return; } CBaseObjectMgr BaseObjectMgr = Company.WorkflowDefMgr; DataGridViewRow row = dataGridView.CurrentRow; foreach (DataGridViewColumn column in dataGridView.Columns) { CColumn col = (CColumn)column.Tag; if (col.ColType == ColumnType.object_type) { if (obj.GetColValue(col) != null) { row.Cells[column.Name].Value = "long byte"; } } else if (col.ColType == ColumnType.ref_type) { CTable table = (CTable)Program.Ctx.TableMgr.Find(col.RefTable); if (table == null) { continue; } CColumn RefCol = (CColumn)table.ColumnMgr.Find(col.RefCol); CColumn RefShowCol = (CColumn)table.ColumnMgr.Find(col.RefShowCol); object objVal = obj.GetColValue(col); Guid guidParentId = Guid.Empty; if (BaseObjectMgr.m_Parent != null && BaseObjectMgr.m_Parent.Id == (Guid)objVal) { row.Cells[column.Name].Value = BaseObjectMgr.m_Parent.GetColValue(RefShowCol); } else { CBaseObjectMgr objMgr = Program.Ctx.FindBaseObjectMgrCache(table.Code, Guid.Empty); if (objMgr != null) { CBaseObject objCache = objMgr.FindByValue(RefCol, objVal); if (objCache != null) { row.Cells[column.Name].Value = objCache.GetColValue(RefShowCol); } } else { objMgr = new CBaseObjectMgr(); objMgr.TbCode = table.Code; objMgr.Ctx = Program.Ctx; string sWhere = string.Format(" {0}=?", RefCol.Code); List <DbParameter> cmdParas = new List <DbParameter>(); cmdParas.Add(new DbParameter(RefCol.Code, obj.GetColValue(col))); List <CBaseObject> lstObj2 = objMgr.GetList(sWhere, cmdParas); if (lstObj2.Count > 0) { CBaseObject obj2 = lstObj2[0]; row.Cells[column.Name].Value = obj2.GetColValue(RefShowCol); } } } } else { row.Cells[column.Name].Value = obj.GetColValue(col); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("../Login.aspx"); Response.End(); } string B_Company_id = Request["B_Company_id"]; if (string.IsNullOrEmpty(B_Company_id)) { m_Company = Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.FindTopCompany(); } else { m_Company = (CCompany)Global.GetCtx(Session["TopCompany"].ToString()).CompanyMgr.Find(new Guid(B_Company_id)); } string id = Request["id"]; if (string.IsNullOrEmpty(id)) { Response.End(); return; } m_BaseObject = (CWorkflowDef)m_Company.WorkflowDefMgr.Find(new Guid(id)); if (m_BaseObject == null) { Response.End(); return; } //保存到编辑对象 EditObject.Add(Session.SessionID, m_BaseObject); if (Request.Params["Action"] == "Cancel") { m_BaseObject.Cancel(); Response.End(); } else if (Request.Params["Action"] == "GetActivesData") { GetActivesData(); Response.End(); } else if (Request.Params["Action"] == "GetLinkData") { GetLinkData(); Response.End(); } else if (Request.Params["Action"] == "DeleteActivesDef") { DeleteActivesDef(); Response.End(); } else if (Request.Params["Action"] == "SelectTable") { SelectTable(); Response.End(); } else if (Request.Params["Action"] == "DeleteLink") { DeleteLink(); Response.End(); } else if (Request.Params["Action"] == "PostData") { PostData(); //从编辑对象移除 EditObject.Remove(Session.SessionID, m_BaseObject); Response.End(); } }