Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
        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;
            }
        }