Esempio n. 1
0
        //-----------------------------------------------------------------------------------------------------
        private void m_menuCreateStep_Click(object sender, EventArgs e)
        {
            CEtapeWorkflow etape = EtapeSelectionnee;

            if (etape == null)
            {
                using (CContexteDonnee ctx = new CContexteDonnee(m_workflowRacine.ContexteDonnee.IdSession, true, false))
                {
                    CWorkflow wkf = m_stackWorkflows.Peek();
                    if (wkf != null)
                    {
                        wkf = wkf.GetObjetInContexte(ctx) as CWorkflow;
                        CResultAErreurType <CEtapeWorkflow> res = wkf.CreateOrGetEtapeInCurrentContexte(TypeEtapeSelectionnee);
                        if (!res)
                        {
                            CFormAlerte.Afficher(res.Erreur);
                            return;
                        }
                        CResultAErreur result = ctx.SaveAll(true);
                        if (!result)
                        {
                            CFormAlerte.Afficher(result.Erreur);
                            return;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 private void StartWorkflow(CTypeEtapeWorkflow typeEtape)
 {
     if (MessageBox.Show(I.T("Start workflow \"@1\"|20571", Workflow.Libelle), "",
                         MessageBoxButtons.YesNo,
                         MessageBoxIcon.Question) == DialogResult.Yes)
     {
         using (CContexteDonnee ctx = new CContexteDonnee(Workflow.ContexteDonnee.IdSession, true, false))
         {
             CWorkflow workflow = Workflow.GetObjetInContexte(ctx) as CWorkflow;
             if (typeEtape != null)
             {
                 typeEtape = typeEtape.GetObjetInContexte(ctx) as CTypeEtapeWorkflow;
             }
             CResultAErreur result = workflow.DémarreWorkflow(typeEtape, true);
             if (!result)
             {
                 CFormAlerte.Afficher(result.Erreur);
             }
             else
             {
                 InitChamps();
             }
         }
     }
 }
Esempio n. 3
0
        private void m_lnkTest_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //Cherche le workflow de test
            CWorkflow wkf = new CWorkflow(TypeWorkflow.ContexteDonnee);

            if (!wkf.ReadIfExists(new CFiltreData(
                                      CTypeWorkflow.c_champId + "=@1",
                                      TypeWorkflow.Id)))
            {
                wkf.CreateNew();
                wkf.TypeWorkflow = TypeWorkflow;
                foreach (CTypeEtapeWorkflow typeEtape in TypeWorkflow.Etapes)
                {
                    CEtapeWorkflow etape = new CEtapeWorkflow(wkf.ContexteDonnee);
                    etape.CreateNewInCurrentContexte();
                    etape.Workflow  = wkf;
                    etape.TypeEtape = typeEtape;
                }
                CResultAErreur result = wkf.CommitEdit();
                if (!result)
                {
                    CFormAlerte.Afficher(result.Erreur);
                }
            }
            foreach (CEtapeWorkflow etape in wkf.Etapes)
            {
                if (etape.TypeEtape.Bloc is CBlocWorkflowFormulaire)
                {
                    CGestionnaireWorkflowsEnCours.Instance.AfficheEtape(etape);
                }
            }
        }
Esempio n. 4
0
        //---------------------------------------------------
        public CWorkflow GetOrCreateWorkflowInCurrentContexte(CEtapeWorkflow etape)
        {
            CResultAErreur result = CResultAErreur.True;

            if (DbKeyTypeWorkflow == null)
            {
                return(null);
            }
            //Lance le démarrage du workflow
            if (etape.WorkflowLancé != null)
            {
                if (etape.WorkflowLancé.IdEtapeAppelante != etape.Id)
                {
                    etape.WorkflowLancé.EtapeAppelante = etape;//Pour pallier aux soucis d'id négatifs stockés parfois
                }
                return(etape.WorkflowLancé);
            }
            else
            {
                CTypeWorkflow typeWorkflow = new CTypeWorkflow(etape.ContexteDonnee);
                if (typeWorkflow.ReadIfExists(DbKeyTypeWorkflow))
                {
                    CWorkflow workflow = new CWorkflow(etape.ContexteDonnee);
                    workflow.CreateNewInCurrentContexte();
                    workflow.TypeWorkflow   = typeWorkflow;
                    workflow.Libelle        = etape.Libelle;
                    workflow.EtapeAppelante = etape;
                    etape.WorkflowLancé     = workflow;
                    return(workflow);
                }
            }
            return(null);
        }
Esempio n. 5
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);
    }
Esempio n. 6
0
        //---------------------------------------------------
        public override CResultAErreur RunAndSaveIfOk(CEtapeWorkflow etape)
        {
            CResultAErreur result = CResultAErreur.True;

            if (DbKeyTypeWorkflow == null)
            {
                return(EndAndSaveIfOk(etape));
            }
            CTypeEtapeWorkflow typeEtapeDémarrage = null;

            if (m_dbKeyTypeEtapeDemarrage != null)
            {
                typeEtapeDémarrage = new CTypeEtapeWorkflow(etape.ContexteDonnee);
                if (!typeEtapeDémarrage.ReadIfExists(m_dbKeyTypeEtapeDemarrage))
                {
                    typeEtapeDémarrage = null;
                }
            }
            CWorkflow workflow = GetOrCreateWorkflowInCurrentContexte(etape);

            if (workflow != null && !workflow.IsRunning)
            {
                result = PrepareToStartWorkflow(etape);
                if (workflow.TypeWorkflow.Etapes.Count == 0)
                {
                    return(EndAndSaveIfOk(etape));
                }
                result = workflow.DémarreWorkflow(typeEtapeDémarrage, false);
            }
            return(etape.ContexteDonnee.SaveAll(true));
        }
Esempio n. 7
0
        //-----------------------------------------------------------------------------------------------------
        private void m_menuStartStep_Click(object sender, EventArgs e)
        {
            CEtapeWorkflow etape = EtapeSelectionnee;
            CWorkflow      wkf   = m_stackWorkflows.Peek();

            using (CContexteDonnee ctx = new CContexteDonnee(wkf.ContexteDonnee.IdSession, true, false))
            {
                wkf = wkf.GetObjetInContexte(ctx) as CWorkflow;
                CTypeEtapeWorkflow typeEtape = TypeEtapeSelectionnee;
                if (etape != null)
                {
                    typeEtape = etape.TypeEtape;
                }

                CResultAErreurType <CEtapeWorkflow> resEtape = wkf.CreateOrGetEtapeInCurrentContexte(typeEtape);
                if (!resEtape)
                {
                    CFormAlerte.Afficher(resEtape.Erreur);
                    return;
                }
                etape = resEtape.DataType;



                etape = etape.GetObjetInContexte(ctx) as CEtapeWorkflow;
                etape.InternalSetInfosDemarrageInCurrentContext();
                CResultAErreur result = ctx.SaveAll(true);
                if (!result)
                {
                    CFormAlerte.Afficher(result.Erreur);
                }
                Refresh();
            }
        }
        //--------------------------------------------------------------------------
        public static CResultAErreur CreateSqueletteProjetsInCurrentContext(
            CWorkflow workflow,
            CTypeEtapeWorkflow typeEtapeDebut,
            CProjet projetParent)
        {
            CResultAErreur result = CResultAErreur.True;

            CTypeWorkflow typeWorkflow = workflow.TypeWorkflow;

            //Récupére le type d'étape de base
            CTypeEtapeWorkflow typeEtape = typeEtapeDebut;

            if (typeEtape == null)
            {
                typeEtape = typeWorkflow.EtapeDemarrageDefaut;
            }
            if (typeEtape == null)
            {
                return(result);
            }

            //règle de création : on ne suit que les liens systèmatiques (sans CodeRetour et sans formule)
            result = CreateProjets(workflow, typeEtape, projetParent);
            return(result);
        }
        /// ///////////////////////////////////////////
        public override object Invoke(object objetAppelle, params object[] parametres)
        {
            CWorkflow workflow = objetAppelle as CWorkflow;

            if (workflow == null || parametres.Length == 0 || parametres[0] == null)
            {
                return(null);
            }
            string        strIdType   = parametres[0].ToString();
            CTypeWorkflow typeWorkfow = workflow.TypeWorkflow;

            if (typeWorkfow == null)
            {
                return(null);
            }
            CListeObjetsDonnees etapes = typeWorkfow.Etapes;

            etapes.Filtre = new CFiltreData(CObjetDonnee.c_champIdUniversel + "=@1",
                                            strIdType);
            if (etapes.Count == 0)
            {
                return(null);
            }
            CTypeEtapeWorkflow typeEtape = etapes[0] as CTypeEtapeWorkflow;
            CEtapeWorkflow     etape     = workflow.GetEtapeForType(typeEtape);

            if (etape != null)
            {
                return(CGestionnaireProjetsDeWorkflow.GetProjetDirectementAssocie(etape));
            }
            return(null);
        }
Esempio n. 10
0
        public async Task <ActionResult <CWorkflow> > PostCWorkflow(CWorkflow cWorkflow)
        {
            _context.CWorkflow.Add(cWorkflow);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCWorkflow", new { id = cWorkflow.Id }, cWorkflow));
        }
Esempio n. 11
0
        private void tbtCancel_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择工作流!");
                return;
            }
            CWorkflow wf = (CWorkflow)dataGridView.CurrentRow.Tag;

            //只有启动者或管理员才能撤销
            if (wf.Creator != Program.User.Id &&
                !Program.User.IsRole("管理员"))
            {
                MessageBox.Show("没有权限撤销!");
                return;
            }

            if (MessageBox.Show("是否确认撤销?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }

            if (!m_BaseObjectMgr.WorkflowMgr.CancelWorkflow(wf))
            {
                MessageBox.Show("撤销失败!");
                return;
            }
            dataGridView.CurrentRow.Cells[2].Value = wf.GetStateString();
            MessageBox.Show("撤销成功!");
        }
Esempio n. 12
0
        public async Task <IActionResult> PutCWorkflow(int id, CWorkflow cWorkflow)
        {
            if (id != cWorkflow.Id)
            {
                return(BadRequest());
            }

            _context.Entry(cWorkflow).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CWorkflowExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 13
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;
            }
        }
        //--------------------------------------------------------------------------
        public static CResultAErreur LinkProjetToWorkflowStep(CProjet projet,
                                                              CWorkflow workflow,
                                                              string strTypeEtape,
                                                              bool bSynchronizeStarts)
        {
            CResultAErreur     result    = CResultAErreur.True;
            CTypeEtapeWorkflow typeEtape = new CTypeEtapeWorkflow(projet.ContexteDonnee);

            if (!typeEtape.ReadIfExists(new CFiltreData(CObjetDonnee.c_champIdUniversel + "=@1",
                                                        strTypeEtape)))
            {
                result.EmpileErreur(I.T("Workflow step type @1 doesn't exists|20196", strTypeEtape));
                return(result);
            }
            if (typeEtape.Workflow.Id != workflow.TypeWorkflow.Id)
            {
                result.EmpileErreur(I.T("Workflow step type @1 doesn't belong to workflow type @2|20197"),
                                    strTypeEtape, workflow.TypeWorkflow.Libelle);
                return(result);
            }
            CBlocWorkflowProjet blocProjet = typeEtape.Bloc as CBlocWorkflowProjet;

            if (blocProjet == null)
            {
                result.EmpileErreur(I.T("Step type @1 is not a valid project step|20198",
                                        typeEtape.Libelle));
                return(result);
            }
            CResultAErreurType <CEtapeWorkflow> resEtape = workflow.CreateOrGetEtapeInCurrentContexte(typeEtape);

            if (!resEtape)
            {
                result.EmpileErreur(resEtape.Erreur);
                return(result);
            }
            if (resEtape.DataType == null)
            {
                result.EmpileErreur(I.T("Erreur while creating step for type '@1'|20199",
                                        typeEtape.Libelle));
                return(result);
            }
            CWorkflow sousWkf = blocProjet.GetOrCreateWorkflowInCurrentContexte(resEtape.DataType);

            if (sousWkf == null)
            {
                result.EmpileErreur(I.T("Erreur while creating workflow for stef @1|20200",
                                        resEtape.DataType.Libelle));
                return(result);
            }
            sousWkf.SetValeurChamp(blocProjet.IdChampProjet.Value, projet);
            projet.GanttId = blocProjet.GetGanttId(resEtape.DataType);
            return(SynchroniseWorkflow(
                       sousWkf,
                       projet,
                       projet.DateDebutReel != null && projet.DateFinRelle == null,
                       bSynchronizeStarts));
        }
        /// ////////////////////////////////////////////////////////
        protected override CResultAErreur MyExecute(CContexteExecutionAction contexte)
        {
            CResultAErreur result = CResultAErreur.True;

            CContexteEvaluationExpression ctxEval = new CContexteEvaluationExpression(Process);

            if (FormuleProjetParent == null)
            {
                result.EmpileErreur(I.T("Invalid project formula|20147"));
                return(result);
            }
            result = FormuleProjetParent.Eval(ctxEval);
            if (!result)
            {
                return(result);
            }
            CProjet projetParent = result.Data as CProjet;

            if (FormuleWorkflow == null)
            {
                result.EmpileErreur(I.T("Invalid workflow formula|20147"));
                return(result);
            }
            result = FormuleWorkflow.Eval(ctxEval);
            if (!result)
            {
                return(result);
            }
            CWorkflow workflow = result.Data as CWorkflow;

            if (workflow == null)
            {
                result.EmpileErreur(I.T("Invalid workflow|20149"));
                return(result);
            }

            CTypeEtapeWorkflow typeEtapeDebut = null;

            if (FormuleTypeEtapeDebut != null)
            {
                result = FormuleTypeEtapeDebut.Eval(ctxEval);
                if (!result)
                {
                    result.EmpileErreur(I.T("Invalid Start step formula|20155"));
                    return(result);
                }
                typeEtapeDebut = result.Data as CTypeEtapeWorkflow;
            }

            result = CGestionnaireProjetsDeWorkflow.CreateSqueletteProjetsInCurrentContext(
                workflow,
                typeEtapeDebut,
                projetParent);

            return(result);
        }
Esempio n. 16
0
 private void ViewWorkflow_Load(object sender, EventArgs e)
 {
     LoadWorkflow();
     if (dataGridView.Rows.Count > 0)
     {
         dataGridView.Rows[0].Selected = true;
         CWorkflow wf = (CWorkflow)dataGridView.Rows[0].Tag;
         LoadActives(wf);
     }
 }
        public static object GetWorkflowCurrentProject(object source)
        {
            CWorkflow wkf = source as CWorkflow;

            if (wkf != null && wkf.EtapeAppelante != null)
            {
                return(CGestionnaireProjetsDeWorkflow.FindProjetAssocie(wkf.EtapeAppelante));
            }
            return(null);
        }
Esempio n. 18
0
        private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= dataGridView.Rows.Count)
            {
                return;
            }
            CWorkflow wf = (CWorkflow)dataGridView.Rows[e.RowIndex].Tag;

            LoadActives(wf);
        }
Esempio n. 19
0
        private void MenuItem_StartWorkflow_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择一项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            CBaseObject obj = (CBaseObject)dataGridView.CurrentRow.Tag;

            SelWorkflowDef frm = new SelWorkflowDef();

            frm.m_Table = BaseObjectMgr.Table;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            //只能存在一个运行的工作流实例
            List <CWorkflow> lstWF = BaseObjectMgr.WorkflowMgr.FindLastByRowid(obj.Id);

            foreach (CWorkflow wf in lstWF)
            {
                if (wf.WF_WorkflowDef_id == frm.m_SelWorkflowDef.Id &&
                    wf.State == enumApprovalState.Running)
                {
                    MessageBox.Show("该工作流已经启动!");
                    return;
                }
            }
            //创建工作流实例并运行
            CWorkflow Workflow = new CWorkflow();

            Workflow.Ctx = Program.Ctx;
            Workflow.WF_WorkflowDef_id = frm.m_SelWorkflowDef.Id;
            Workflow.State             = enumApprovalState.Init;
            Workflow.Row_id            = obj.Id;
            Workflow.Creator           = Program.User.Id;
            Workflow.B_Company_id      = Program.User.B_Company_id;
            string sErr = "";

            if (!BaseObjectMgr.WorkflowMgr.StartWorkflow(Workflow, out sErr))
            {
                MessageBox.Show(string.Format("启动工作流失败:{0}", sErr));
                return;
            }
            BaseObjectMgr.WorkflowMgr.AddNew(Workflow);
            if (!BaseObjectMgr.WorkflowMgr.Save(true))
            {
                MessageBox.Show("创建工作流失败!");
                return;
            }

            UpdateRowWorkflow(dataGridView.CurrentRow);
            MessageBox.Show(string.Format("启动成功!"));
        }
 /// <summary>
 /// Trouve le projet parent d'une étape , c'est à dire qu'on demande à l'étape parente de trouver le projet associé
 /// </summary>
 /// <param name="etape"></param>
 /// <returns></returns>
 public static CProjet FindProjetParent(CEtapeWorkflow etape)
 {
     if (etape != null)
     {
         CWorkflow workflowParent = etape.Workflow;
         if (workflowParent.EtapeAppelante != null)
         {
             return(FindProjetAssocie(workflowParent.EtapeAppelante));
         }
     }
     return(null);
 }
 //---------------------------------------------------------------------------
 public void Init(CWorkflow workflow)
 {
     if (workflow == null || workflow.TypeWorkflow == null)
     {
         Visible = false;
         return;
     }
     Visible          = true;
     m_workflowRacine = workflow;
     m_panelWorkflow.Init(workflow);
     RefreshTrackZoom();
 }
Esempio n. 22
0
 //---------------------------------------------------------------------------
 public void UpLevel()
 {
     if (m_stackWorkflows.Count > 1)
     {
         m_stackWorkflows.Pop();
         CWorkflow workflow = m_stackWorkflows.Peek();
         ObjetEdite = workflow.TypeWorkflow.Dessin;
         if (WorkflowAfficheChanged != null)
         {
             WorkflowAfficheChanged(workflow, null);
         }
     }
 }
Esempio n. 23
0
 //---------------------------------------------------------------------------
 private void AfficheWorkflow(CWorkflow workflow)
 {
     if (workflow == null)
     {
         return;
     }
     m_stackWorkflows.Push(workflow);
     ObjetEdite = workflow.TypeWorkflow.Dessin;
     if (WorkflowAfficheChanged != null)
     {
         WorkflowAfficheChanged(workflow, null);
     }
     Refresh();
 }
Esempio n. 24
0
        /// //////////////////////////////////////////////////
        public override CResultAErreur VerifieDonnees(sc2i.data.CObjetDonnee objet)
        {
            CResultAErreur result   = CResultAErreur.True;
            CWorkflow      workflow = objet as CWorkflow;

            if (workflow != null)
            {
                if (workflow.TypeWorkflow == null)
                {
                    result.EmpileErreur(I.T("Select a workflow type for the workflow @1|20005", workflow.Libelle));
                }
            }
            return(result);
        }
Esempio n. 25
0
    void CanApproval()
    {
        string WF_Workflow_id = Request["WF_Workflow_id"];

        CWorkflow wf = (CWorkflow)m_BaseObjectMgr.WorkflowMgr.Find(new Guid(WF_Workflow_id));

        if (wf.State != enumApprovalState.Running)
        {
            Response.Write("只有进行中的工作流才能审批!");
            return;
        }
        CActives Actives = wf.ActivesMgr.FindNotApproval();

        if (Actives == null)
        {
            Response.Write("没有审批的活动!");
            return;
        }

        if (Actives.AType == "按用户")
        {
            if (Actives.B_User_id != m_User.Id)
            {
                Response.Write("没有权限审批!");
                return;
            }
        }
        else //按角色
        {
            CRole Role = (CRole)m_Company.RoleMgr.Find(Actives.B_Role_id);
            if (Role == null)
            {
                Response.Write("角色不存在!");
                return;
            }
            CUserInRole UserInRole = Role.UserInRoleMgr.FindByUserid(m_User.Id);
            if (UserInRole == null)
            {
                Response.Write("没有权限审批!");
                return;
            }
        }
    }
Esempio n. 26
0
    void CancelWF()
    {
        string WF_Workflow_id = Request["WF_Workflow_id"];

        CWorkflow wf = (CWorkflow)m_BaseObjectMgr.WorkflowMgr.Find(new Guid(WF_Workflow_id));

        //只有启动者或管理员才能撤销
        if (wf.Creator != m_User.Id &&
            !m_User.IsRole("管理员"))
        {
            Response.Write("没有权限撤销!");
            return;
        }

        if (!m_BaseObjectMgr.WorkflowMgr.CancelWorkflow(wf))
        {
            Response.Write("撤销失败!");
            return;
        }
    }
Esempio n. 27
0
        //---------------------------------------------------------------------------
        public void Init(CWorkflow workflowRacine)
        {
            if (workflowRacine == null)
            {
                Visible = false;
                return;
            }
            Visible          = true;
            m_stackWorkflows = new Stack <CWorkflow>();
            m_workflowRacine = workflowRacine;
            AfficheWorkflow(m_workflowRacine);

            //TESTDBKEYOK
            CDonneesActeurUtilisateur user = CUtilSession.GetUserForSession(workflowRacine.ContexteDonnee);

            m_bCanManage = user != null && (
                user.GetDonneeDroit(CDroitDeBase.c_droitBaseGestionWorkflows) != null ||
                user.DbKey == workflowRacine.KeyManager);
            Refresh();
        }
        //-------------------------------------------------------------------------------------
        private static CResultAErreur CreateProjets(CWorkflow workflow, CTypeEtapeWorkflow typeEtape, CProjet projetParent)
        {
            CResultAErreur result = CResultAErreur.True;

            if (workflow == null || typeEtape == null)
            {
                return(result);
            }
            CBlocWorkflowProjet blocProjet = typeEtape.Bloc as CBlocWorkflowProjet;

            if (blocProjet != null)
            {
                CResultAErreurType <CEtapeWorkflow> resEtape = workflow.CreateOrGetEtapeInCurrentContexte(typeEtape);
                if (!resEtape)
                {
                    result.EmpileErreur(resEtape.Erreur);
                    return(result);
                }
                if (resEtape.DataType != null)
                {
                    CResultAErreurType <CProjet> resProjet = blocProjet.GetOrCreateProjetInCurrentContexte(resEtape.DataType, projetParent, FindPredecesseurs(resEtape.DataType));
                    if (!resProjet)
                    {
                        result.EmpileErreur(resProjet.Erreur);
                        return(result);
                    }
                    CWorkflow workflowDuProjet = blocProjet.GetOrCreateWorkflowInCurrentContexte(resEtape.DataType);
                    result = CreateSqueletteProjetsInCurrentContext(workflowDuProjet, null, resProjet.DataType);
                    if (!result)
                    {
                        return(result);
                    }
                }
            }
            foreach (CLienEtapesWorkflow lien in LiensSuivantsPourProjet(typeEtape))
            {
                result += CreateProjets(workflow, lien.EtapeDestination, projetParent);
            }
            return(result);
        }
Esempio n. 29
0
        private void tbtApproval_Click(object sender, EventArgs e)
        {
            if (dataGridView.CurrentRow == null)
            {
                MessageBox.Show("请选择工作流!");
                return;
            }
            CWorkflow wf = (CWorkflow)dataGridView.CurrentRow.Tag;

            if (wf.State != enumApprovalState.Running)
            {
                MessageBox.Show("只有进行中的工作流才能审批!");
                return;
            }
            CActives Actives = wf.ActivesMgr.FindNotApproval();

            if (Actives == null)
            {
                MessageBox.Show("没有审批的活动!");
                return;
            }
            if (Actives.B_User_id != Program.User.Id)
            {
                MessageBox.Show("没有权限审批!");
                return;
            }
            ApprovalActives frm = new ApprovalActives();

            frm.m_Workflow = wf;
            frm.m_Actives  = Actives;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            dataGridView.CurrentRow.Cells[2].Value = wf.GetStateString();
            LoadActives(wf);
            MessageBox.Show("审批完成!");
        }
Esempio n. 30
0
        //-----------------------------------------------------------------------------------------------------
        private void m_menuAfficheDetailWorkflow_Click(object sender, EventArgs e)
        {
            CEtapeWorkflow etape = EtapeSelectionnee;
            CWorkflow      wkf   = etape != null ? etape.WorkflowLancé : null;

            if (wkf != null)
            {
                CFormNavigateur navigateur = CFormNavigateur.FindNavigateur(this);
                if (navigateur != null)
                {
                    CReferenceTypeForm refForm = CFormFinder.GetRefFormToEdit(typeof(CWorkflow));
                    if (refForm != null)
                    {
                        CFormEditionStandard frm = refForm.GetForm(wkf) as CFormEditionStandard;
                        if (frm != null)
                        {
                            navigateur.AffichePage(frm);
                        }
                    }
                }
            }
        }