Ejemplo n.º 1
0
 private static void FillTaskActor(TaskActor taskActor, DataRow dr)
 {
     if (!dr.IsNull("TaskActorCode"))
     {
         taskActor.TaskActorCode = (string)dr["TaskActorCode"];
     }
     if (!dr.IsNull("TaskCode"))
     {
         taskActor.TaskCode = (string)dr["TaskCode"];
     }
     if (!dr.IsNull("ProcedureCode"))
     {
         taskActor.ProcedureCode = (string)dr["ProcedureCode"];
     }
     if (!dr.IsNull("ActorCode"))
     {
         taskActor.ActorCode = (string)dr["ActorCode"];
     }
     if (!dr.IsNull("ActorType"))
     {
         taskActor.ActorType = (int)dr["ActorType"];
     }
     if (!dr.IsNull("IOrder"))
     {
         taskActor.IOrder = (int)dr["IOrder"];
     }
     if (!dr.IsNull("TaskActorName"))
     {
         taskActor.TaskActorName = (string)dr["TaskActorName"];
     }
     if (!dr.IsNull("TaskActorID"))
     {
         taskActor.TaskActorID = (string)dr["TaskActorID"];
     }
     if (!dr.IsNull("ActorProperty"))
     {
         taskActor.ActorProperty = (string)dr["ActorProperty"];
     }
     if (!dr.IsNull("ActorNeed"))
     {
         taskActor.ActorNeed = (string)dr["ActorNeed"];
     }
     if (!dr.IsNull("ActorModuleState"))
     {
         taskActor.ActorModuleState = (string)dr["ActorModuleState"];
     }
     if (!dr.IsNull("TaskActorType"))
     {
         taskActor.TaskActorType = (string)dr["TaskActorType"];
     }
     if (!dr.IsNull("OpinionType"))
     {
         taskActor.OpinionType = (string)dr["OpinionType"];
     }
 }
Ejemplo n.º 2
0
 private static void WriteTaskActor(TaskActor taskActor, DataRow dr)
 {
     dr["TaskActorCode"]    = taskActor.TaskActorCode;
     dr["TaskCode"]         = taskActor.TaskCode;
     dr["ProcedureCode"]    = taskActor.ProcedureCode;
     dr["ActorCode"]        = taskActor.ActorCode;
     dr["ActorType"]        = taskActor.ActorType;
     dr["IOrder"]           = taskActor.IOrder;
     dr["TaskActorName"]    = taskActor.TaskActorName;
     dr["TaskActorID"]      = taskActor.TaskActorID;
     dr["ActorProperty"]    = taskActor.ActorProperty;
     dr["ActorNeed"]        = taskActor.ActorNeed;
     dr["ActorModuleState"] = taskActor.ActorModuleState;
     dr["TaskActorType"]    = taskActor.TaskActorType;
     dr["OpinionType"]      = taskActor.OpinionType;
 }
Ejemplo n.º 3
0
        public static TaskActor NewTaskActor()
        {
            TaskActor actor2;

            try
            {
                string    newSysetmCode = InterfaceManager.iSystemCode.GetNewSysetmCode("TaskActorCode");
                TaskActor actor         = new TaskActor();
                actor.TaskActorCode = newSysetmCode;
                actor2 = actor;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message.ToString());
            }
            return(actor2);
        }
Ejemplo n.º 4
0
        public static DataSet SaveAsProcedureDefinitionData(Procedure procedure, string NewProcedureCode)
        {
            DataSet set2;

            try
            {
                DataTable  table   = new DataTable();
                DataColumn column  = new DataColumn("OldCode", Type.GetType("System.String"));
                DataColumn column2 = new DataColumn("NewCode", Type.GetType("System.String"));
                DataColumn column3 = new DataColumn("CodeType", Type.GetType("System.String"));
                table.Columns.Add(column);
                table.Columns.Add(column2);
                table.Columns.Add(column3);
                DataSet set = InterfaceManager.iDefinition.InputDefinition(procedure.ProcedureCode);
                DeleteAllTableRow(set.Tables["WorkFlowCondition"]);
                DeleteAllTableRow(set.Tables["WorkFlowTaskActor"]);
                DeleteAllTableRow(set.Tables["WorkFlowTask"]);
                DeleteAllTableRow(set.Tables["WorkFlowRouter"]);
                DeleteAllTableRow(set.Tables["WorkFlowRole"]);
                DeleteAllTableRow(set.Tables["WorkFlowRoleComprise"]);
                DeleteAllTableRow(set.Tables["WorkFlowProcedureProperty"]);
                DeleteAllTableRow(set.Tables["WorkFlowProcedure"]);
                DataRow dr = set.Tables["WorkFlowProcedure"].NewRow();
                procedure.ProcedureCode      = NewProcedureCode;
                procedure.VersionNumber     += 1M;
                procedure.VersionDescription = "";
                procedure.Activity           = 0;
                procedure.Description        = procedure.Description + DateTime.Now.ToShortDateString();
                WriteProcedure(procedure, dr);
                set.Tables["WorkFlowProcedure"].Rows.Add(dr);
                IDictionaryEnumerator roleEnumerator = procedure.GetRoleEnumerator();
                while (roleEnumerator.MoveNext())
                {
                    Role roleCase = (Role)roleEnumerator.Value;
                    if (roleCase.RoleType == "0")
                    {
                        DataRow row2 = set.Tables["WorkFlowRole"].NewRow();
                        DataRow row  = table.NewRow();
                        row["CodeType"]           = "RoleCode";
                        row["OldCode"]            = roleCase.WorkFlowRoleCode;
                        roleCase.WorkFlowRoleCode = InterfaceManager.iSystemCode.GetNewSysetmCode("RoleCode");
                        roleCase.ProcedureCode    = procedure.ProcedureCode;
                        row["NewCode"]            = roleCase.WorkFlowRoleCode;
                        table.Rows.Add(row);
                        WriteRole(roleCase, row2);
                        set.Tables["WorkFlowRole"].Rows.Add(row2);
                        IDictionaryEnumerator roleCompriseEnumerator = roleCase.GetRoleCompriseEnumerator();
                        while (roleCompriseEnumerator.MoveNext())
                        {
                            RoleComprise roleCompriseCase = (RoleComprise)roleCompriseEnumerator.Value;
                            DataRow      row4             = set.Tables["WorkFlowRoleComprise"].NewRow();
                            roleCompriseCase.WorkFlowRoleCompriseCode = InterfaceManager.iSystemCode.GetNewSysetmCode("RoleCompriseCode");
                            roleCompriseCase.ProcedureCode            = procedure.ProcedureCode;
                            roleCompriseCase.RoleCode = roleCase.WorkFlowRoleCode;
                            WriteRoleComprise(roleCompriseCase, row4);
                            set.Tables["WorkFlowRoleComprise"].Rows.Add(row4);
                        }
                    }
                }
                IDictionaryEnumerator propertyEnumerator = procedure.GetPropertyEnumerator();
                while (propertyEnumerator.MoveNext())
                {
                    Property propertyCase = (Property)propertyEnumerator.Value;
                    DataRow  row5         = set.Tables["WorkFlowProcedureProperty"].NewRow();
                    DataRow  row6         = table.NewRow();
                    row6["CodeType"] = "PropertyCode";
                    row6["OldCode"]  = propertyCase.WorkFlowProcedurePropertyCode;
                    propertyCase.WorkFlowProcedurePropertyCode = InterfaceManager.iSystemCode.GetNewSysetmCode("PropertyCode");
                    propertyCase.ProcedureCode = procedure.ProcedureCode;
                    row6["NewCode"]            = propertyCase.WorkFlowProcedurePropertyCode;
                    table.Rows.Add(row6);
                    WriteProperty(propertyCase, row5);
                    set.Tables["WorkFlowProcedureProperty"].Rows.Add(row5);
                }
                IDictionaryEnumerator taskEnumerator = procedure.GetTaskEnumerator();
                while (taskEnumerator.MoveNext())
                {
                    Task    task = (Task)taskEnumerator.Value;
                    DataRow row7 = set.Tables["WorkFlowTask"].NewRow();
                    DataRow row8 = table.NewRow();
                    row8["CodeType"]   = "TaskCode";
                    row8["OldCode"]    = task.TaskCode;
                    task.TaskCode      = InterfaceManager.iSystemCode.GetNewSysetmCode("TaskCode");
                    task.ProcedureCode = procedure.ProcedureCode;
                    task.TaskProperty  = (task.TaskProperty == "") ? "" : table.Select("OldCode='" + task.TaskProperty + "' and CodeType='PropertyCode'")[0]["NewCode"].ToString();
                    foreach (DataRow row9 in table.Select("OldCode='" + task.TaskRole + "' and CodeType='RoleCode'"))
                    {
                        task.TaskRole = row9["NewCode"].ToString();
                    }
                    row8["NewCode"] = task.TaskCode;
                    table.Rows.Add(row8);
                    WriteTask(task, row7);
                    set.Tables["WorkFlowTask"].Rows.Add(row7);
                    IDictionaryEnumerator taskActorEnumerator = task.GetTaskActorEnumerator();
                    while (taskActorEnumerator.MoveNext())
                    {
                        TaskActor taskActor = (TaskActor)taskActorEnumerator.Value;
                        DataRow   row10     = set.Tables["WorkFlowTaskActor"].NewRow();
                        taskActor.TaskActorCode = InterfaceManager.iSystemCode.GetNewSysetmCode("TaskActorCode");
                        taskActor.ProcedureCode = procedure.ProcedureCode;
                        taskActor.TaskCode      = task.TaskCode;
                        taskActor.ActorProperty = (taskActor.ActorProperty == "") ? "" : table.Select("OldCode='" + taskActor.ActorProperty + "' and CodeType='PropertyCode'")[0]["NewCode"].ToString();
                        foreach (DataRow row11 in table.Select("OldCode='" + taskActor.ActorCode + "' and CodeType='RoleCode'"))
                        {
                            taskActor.ActorCode = row11["NewCode"].ToString();
                        }
                        WriteTaskActor(taskActor, row10);
                        set.Tables["WorkFlowTaskActor"].Rows.Add(row10);
                    }
                }
                IDictionaryEnumerator routerEnumerator = procedure.GetRouterEnumerator();
                while (routerEnumerator.MoveNext())
                {
                    Router  router = (Router)routerEnumerator.Value;
                    DataRow row12  = set.Tables["WorkFlowRouter"].NewRow();
                    router.RouterCode    = InterfaceManager.iSystemCode.GetNewSysetmCode("RouterCode");
                    router.ProcedureCode = procedure.ProcedureCode;
                    router.FromTaskCode  = table.Select("OldCode='" + router.FromTaskCode + "' and CodeType='TaskCode'")[0]["NewCode"].ToString();
                    router.ToTaskCode    = table.Select("OldCode='" + router.ToTaskCode + "' and CodeType='TaskCode'")[0]["NewCode"].ToString();
                    WriteRouter(router, row12);
                    set.Tables["WorkFlowRouter"].Rows.Add(row12);
                    IDictionaryEnumerator conditionEnumerator = router.GetConditionEnumerator();
                    while (conditionEnumerator.MoveNext())
                    {
                        Condition condition = (Condition)conditionEnumerator.Value;
                        DataRow   row13     = set.Tables["WorkFlowCondition"].NewRow();
                        condition.ConditionCode = InterfaceManager.iSystemCode.GetNewSysetmCode("ConditionCode");
                        condition.ProcedureCode = procedure.ProcedureCode;
                        condition.RouterCode    = router.RouterCode;
                        WriteCondition(condition, row13);
                        set.Tables["WorkFlowCondition"].Rows.Add(row13);
                    }
                }
                set2 = set;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message.ToString());
            }
            return(set2);
        }
Ejemplo n.º 5
0
        private static Procedure LoadProcedureDefinition(string procedureCode)
        {
            Procedure procedure2;

            try
            {
                DataSet   set   = InterfaceManager.iDefinition.InputDefinition(procedureCode);
                DataTable table = set.Tables["WorkFlowProcedure"];
                if (table.Rows.Count == 0)
                {
                    return(null);
                }
                DataRow   dr        = table.Rows[0];
                Procedure procedure = new Procedure();
                FillProcedure(procedure, dr);
                foreach (DataRow row2 in set.Tables["WorkFlowTask"].Rows)
                {
                    Task task = new Task();
                    FillTask(task, row2);
                    foreach (DataRow row3 in set.Tables["WorkFlowTaskActor"].Select(string.Format("TaskCode='{0}'", task.TaskCode)))
                    {
                        TaskActor taskActor = new TaskActor();
                        FillTaskActor(taskActor, row3);
                        task.AddNewTaskActor(taskActor);
                    }
                    procedure.AddNewTask(task);
                }
                foreach (DataRow row4 in set.Tables["WorkFlowRouter"].Rows)
                {
                    Router router = new Router();
                    FillRouter(router, row4);
                    foreach (DataRow row5 in set.Tables["WorkFlowCondition"].Select(string.Format("RouterCode='{0}'", router.RouterCode)))
                    {
                        Condition condition = new Condition();
                        FillCondition(condition, row5);
                        router.AddNewCondition(condition);
                    }
                    procedure.AddNewRouter(router);
                }
                foreach (DataRow row6 in set.Tables["WorkFlowRole"].Rows)
                {
                    Role roleCase = new Role();
                    FillRole(roleCase, row6);
                    foreach (DataRow row7 in set.Tables["WorkFlowRoleComprise"].Select(string.Format(" WorkFlowRoleCode='{0}'", roleCase.WorkFlowRoleCode)))
                    {
                        RoleComprise roleCompriseCase = new RoleComprise();
                        FillRoleComprise(roleCompriseCase, row7);
                        roleCase.AddNewRoleComprise(roleCompriseCase);
                    }
                    procedure.AddNewRole(roleCase);
                }
                foreach (DataRow row8 in set.Tables["WorkFlowProcedureProperty"].Rows)
                {
                    Property propertyCase = new Property();
                    FillProperty(propertyCase, row8);
                    procedure.AddNewProperty(propertyCase);
                }
                procedure2 = procedure;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message.ToString());
            }
            return(procedure2);
        }
Ejemplo n.º 6
0
        public static DataSet SaveProcedureDefinitionData(Procedure procedure)
        {
            DataSet set2;

            try
            {
                DataSet set = InterfaceManager.iDefinition.InputDefinition(procedure.ProcedureCode);
                DeleteAllTableRow(set.Tables["WorkFlowCondition"]);
                DeleteAllTableRow(set.Tables["WorkFlowTaskActor"]);
                DeleteAllTableRow(set.Tables["WorkFlowTask"]);
                DeleteAllTableRow(set.Tables["WorkFlowRouter"]);
                DeleteAllTableRow(set.Tables["WorkFlowRole"]);
                DeleteAllTableRow(set.Tables["WorkFlowRoleComprise"]);
                DeleteAllTableRow(set.Tables["WorkFlowProcedureProperty"]);
                DeleteAllTableRow(set.Tables["WorkFlowProcedure"]);
                DataRow dr = set.Tables["WorkFlowProcedure"].NewRow();
                WriteProcedure(procedure, dr);
                set.Tables["WorkFlowProcedure"].Rows.Add(dr);
                IDictionaryEnumerator taskEnumerator = procedure.GetTaskEnumerator();
                while (taskEnumerator.MoveNext())
                {
                    Task    task = (Task)taskEnumerator.Value;
                    DataRow row2 = set.Tables["WorkFlowTask"].NewRow();
                    WriteTask(task, row2);
                    set.Tables["WorkFlowTask"].Rows.Add(row2);
                    IDictionaryEnumerator taskActorEnumerator = task.GetTaskActorEnumerator();
                    while (taskActorEnumerator.MoveNext())
                    {
                        TaskActor taskActor = (TaskActor)taskActorEnumerator.Value;
                        DataRow   row3      = set.Tables["WorkFlowTaskActor"].NewRow();
                        WriteTaskActor(taskActor, row3);
                        set.Tables["WorkFlowTaskActor"].Rows.Add(row3);
                    }
                }
                IDictionaryEnumerator routerEnumerator = procedure.GetRouterEnumerator();
                while (routerEnumerator.MoveNext())
                {
                    Router  router = (Router)routerEnumerator.Value;
                    DataRow row4   = set.Tables["WorkFlowRouter"].NewRow();
                    WriteRouter(router, row4);
                    set.Tables["WorkFlowRouter"].Rows.Add(row4);
                    IDictionaryEnumerator conditionEnumerator = router.GetConditionEnumerator();
                    while (conditionEnumerator.MoveNext())
                    {
                        Condition condition = (Condition)conditionEnumerator.Value;
                        DataRow   row5      = set.Tables["WorkFlowCondition"].NewRow();
                        WriteCondition(condition, row5);
                        set.Tables["WorkFlowCondition"].Rows.Add(row5);
                    }
                }
                IDictionaryEnumerator roleEnumerator = procedure.GetRoleEnumerator();
                while (roleEnumerator.MoveNext())
                {
                    Role    roleCase = (Role)roleEnumerator.Value;
                    DataRow row6     = set.Tables["WorkFlowRole"].NewRow();
                    WriteRole(roleCase, row6);
                    set.Tables["WorkFlowRole"].Rows.Add(row6);
                    IDictionaryEnumerator roleCompriseEnumerator = roleCase.GetRoleCompriseEnumerator();
                    while (roleCompriseEnumerator.MoveNext())
                    {
                        RoleComprise roleCompriseCase = (RoleComprise)roleCompriseEnumerator.Value;
                        DataRow      row7             = set.Tables["WorkFlowRoleComprise"].NewRow();
                        WriteRoleComprise(roleCompriseCase, row7);
                        set.Tables["WorkFlowRoleComprise"].Rows.Add(row7);
                    }
                }
                IDictionaryEnumerator propertyEnumerator = procedure.GetPropertyEnumerator();
                while (propertyEnumerator.MoveNext())
                {
                    Property propertyCase = (Property)propertyEnumerator.Value;
                    DataRow  row8         = set.Tables["WorkFlowProcedureProperty"].NewRow();
                    WriteProperty(propertyCase, row8);
                    set.Tables["WorkFlowProcedureProperty"].Rows.Add(row8);
                }
                set2 = set;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message.ToString());
            }
            return(set2);
        }
Ejemplo n.º 7
0
 public void AddNewTaskActor(TaskActor taskActor)
 {
     this.m_TaskActors.Add(taskActor.TaskActorCode, taskActor);
 }