Пример #1
0
        private void GetRemoteModule()
        {
            EEPRemoteModule module = Activator.GetObject(typeof(EEPRemoteModule)
                     , string.Format("http://{0}:{1}/InfoRemoteModule.rem", IP, Port)) as EEPRemoteModule;
            try
            {
                module.ToString();
                Module = module;
            }
            catch (ThreadAbortException)
            {

            }
            catch (Exception e)
            {
                ListenerService service = Activator.GetObject(typeof(ListenerService)
                     , string.Format("http://{0}:{1}/Srvtools.rem", IP, 8000)) as ListenerService;
                try
                {
                    if (service.StartServer())
                    {
                        GetRemoteModule();
                        return;
                    }
                }
                catch { }
                MessageBox.Show(e.Message);
            }
        }
Пример #2
0
        public FLInstance DepersistenceFL(Guid flInstanceId, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            String DBAlias = (clientInfo[0] as object[])[2].ToString();
            object[] myRet = remoteModule.CallMethod(clientInfo, "GLModule", "GetDataBaseType", new object[] { DBAlias });

            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);

            if (myRet[1].ToString() == "2")
            {
                String strSet = "SET TEXTSIZE 70000 ";
                remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { strSet });
            }
            string sql = string.Format(GET_FLINSTANCESTATE, flInstanceId.ToString());
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            MemoryStream stream = null;
            if (objs != null && (int)objs[0] == 0 && objs[1] is DataSet)
            {
                DataSet ds = (DataSet)objs[1];
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    byte[] buffer = (byte[])ds.Tables[0].Rows[0]["STATE"];
                    stream = new MemoryStream(buffer);
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new Exception(objs[1].ToString());
            }

            if (stream != null)
            {
                BinaryFormatter formatter = new BinaryFormatter();
                try
                {
                    object o = formatter.Deserialize(stream);

                    if (o != null)
                    {
                        return (FLInstance)o;
                    }
                    else
                    {
                        return null;
                    }
                }
                catch (Exception ex)
                {
                    return null;
                }
            }
            else
            {
                return null;
            }
        }
Пример #3
0
        public void DeleteFL(Guid flInstanceId, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string sql = string.Format(DELETE_FLINSTANCESTATE, flInstanceId.ToString());

            //object[] objs = remoteModule.ExecuteSql(clientInfo, "GLModule", "cmdWorkflow", sql, false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs[0].ToString() == "1")
            {
                throw new Exception(objs[1].ToString());
            }
        }
Пример #4
0
        public static void ClearFLFlag(FLInstance flInstance, object[] keyValues, object[] clientInfo)
        {
            string hostTable = ((IFLRootActivity)flInstance.RootFLActivity).TableName;
            if (hostTable == null || hostTable == string.Empty || keyValues.Length == 0)
            {
                String message = string.Format(SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(clientInfo[0]))[0]), "FLRuntime", "HostTable", "HostTableNotContainRecord"), hostTable, keyValues[1].ToString());
                throw new FLException(message);
            }

            var eepAlias = ((IFLRootActivity)flInstance.RootFLActivity).EEPAlias;
            var alias = string.Empty;
            if (!string.IsNullOrEmpty(eepAlias))
            {
                alias = (string)((object[])clientInfo[0])[2];
                ((object[])clientInfo[0])[2] = eepAlias;
            }

            string where = string.Empty;
            string s = keyValues[1].ToString();
            string[] ss = s.Split(";".ToCharArray());
            foreach (object o in ss)
            {
                where += (o.ToString()).Replace("''", "'");
                where += " and ";
            }
            where += " 1=1 ";

            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(CLEAR_HOSTTABLE, Qutoe(clientInfo, hostTable), where);
            object[] objs = remoteModule.ExecuteSql(clientInfo, "GLModule", "cmdWorkflow", sql, false);
            if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
            if (!string.IsNullOrEmpty(alias))
            {
                ((object[])clientInfo[0])[2] = alias;
            }
        }
Пример #5
0
        private void ReviewPrevious()
        {
            //从todohis中取
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(SELECT_TODOHIS_SQL, Instance.FLInstanceId);
            object[] objs = remoteModule.CallMethod(ClientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });
            if (objs[0].ToString() == "0")
            {
                DataSet dataSet = (DataSet)objs[1];
                if (dataSet.Tables.Count > 0)
                {
                    DataTable table = dataSet.Tables[0];
                    //计算退回和取回
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        DataRow row = table.Rows[i];
                        if (row["STATUS"].Equals(StatusType.NF.ToString()) || row["STATUS"].Equals(StatusType.NR.ToString()))
                        {
                            //string activityName = row["STATUS"].Equals(StatusType.NR.ToString()) ? row["D_STEP_ID"].ToString() : row["S_STEP_ID"].ToString();//退回或取回到哪一步

                            string activityName = row["D_STEP_ID"].ToString();
                            //找到那一步
                            int returnIndex = -1;
                            for (int j = 0; j < i; j++)
                            {
                                DataRow previousRow = table.Rows[j];
                                if (previousRow.RowState != DataRowState.Deleted)
                                {
                                    if (previousRow["S_STEP_ID"].Equals(activityName))
                                    {
                                        returnIndex = j;
                                    }
                                }
                            }
                            if (returnIndex == -1)
                            {
                                for (int j = 0; j < i; j++)
                                {
                                    DataRow previousRow = table.Rows[j];
                                    if (previousRow.RowState != DataRowState.Deleted)
                                    {
                                        if (previousRow["S_STEP_ID"].Equals(CurrentAcitivity))
                                        {
                                            returnIndex = j;
                                        }
                                    }
                                }
                            }
                            if (returnIndex != -1) //删除那一步以后的资料
                            {
                                for (int j = returnIndex; j < i; j++)
                                {
                                    DataRow previousRow = table.Rows[j];
                                    if (previousRow.RowState != DataRowState.Deleted)
                                    {
                                        previousRow.Delete();
                                    }
                                }
                            }
                        }
                    }
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        DataRow row = table.Rows[i];
                        if (row.RowState != DataRowState.Deleted)
                        {
                            if (row["STATUS"].Equals(StatusType.N.ToString()) || row["STATUS"].Equals(StatusType.Z.ToString()))
                            {
                                string activityName = row["S_STEP_ID"].ToString();
                                //string sender = row["S_USER_ID"].ToString();
                                string role = row["S_ROLE_ID"].ToString();
                                if (!string.IsNullOrEmpty(role))//加签也是N 为了跳过
                                {
                                    AddSendTo(activityName, new SendTo(row["S_ROLE_ID"].ToString(), row["S_USER_ID"].ToString()), AcitivityStatus.Approved);
                                }
                                else //加签
                                {
                                    AddSendTo(activityName, new SendTo(row["ROLE_ID"].ToString(), row["USER_ID"].ToString()), AcitivityStatus.Approved);
                                }
                            }
                            else if (row["STATUS"].Equals(StatusType.A.ToString()) )
                            {
                                string activityName = row["S_STEP_ID"].ToString();
                                AddSendTo(activityName, new SendTo(row["S_ROLE_ID"].ToString(), row["S_USER_ID"].ToString()), AcitivityStatus.PlusApproved);
                            }
                        }
                    }
                }
            }
        }
Пример #6
0
        public static string ShowParallelMessage(string sendToIds, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            List<string> sendToUsers = new List<string>();
            List<string> sendToRoles = new List<string>();
            string[] toIds = sendToIds.Split(';');
            for (int i = 0; i < toIds.Length; i++)
            {
                if (toIds[i].IndexOf(':') != -1)
                {
                    sendToUsers.Add(toIds[i].Substring(0, toIds[i].IndexOf(':')));
                }
                else
                {
                    sendToRoles.Add(toIds[i]);
                }
            }

            Hashtable dicGroups = new Hashtable();
            Hashtable dicUsers = new Hashtable();

            // 1.ȡ�����е�RoleId��RoleName��Role���µ�UserID����sendToUsers
            string sqlRoles = "";
            foreach (string role in sendToRoles)
            {
                sqlRoles += "'" + role + "',";
            }
            if (sqlRoles != "")
            {
                sqlRoles = sqlRoles.Substring(0, sqlRoles.LastIndexOf(','));

                DataTable tGroups = null;

                object[] ret1 = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { "SELECT GROUPID, GROUPNAME, ISROLE FROM GROUPS WHERE GROUPID in(" + sqlRoles + ") AND ISROLE='Y'" });
                if (ret1 != null && (int)ret1[0] == 0)
                {
                    tGroups = ((DataSet)ret1[1]).Tables[0];
                }
                foreach (DataRow row in tGroups.Rows)
                {
                    dicGroups.Add(row["GROUPID"].ToString(), row["GROUPNAME"].ToString());

                    DataTable tHoldUsers = null;

                    object[] ret2 = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { "SELECT USERID, USERNAME FROM USERS WHERE USERID IN (SELECT USERID FROM USERGROUPS WHERE GROUPID='" + row["GROUPID"].ToString() + "')" });
                    if (ret2 != null && (int)ret2[0] == 0)
                    {
                        tHoldUsers = ((DataSet)ret2[1]).Tables[0];
                    }
                    if (tHoldUsers != null && tHoldUsers.Rows.Count > 0)
                    {
                        foreach (DataRow holdRow in tHoldUsers.Rows)
                        {
                            sendToUsers.Add(holdRow["USERID"].ToString());
                        }
                    }
                }
            }
            // 2.ȡ�����е�UserId��UserName
            string sqlUsers = "";
            foreach (string user in sendToUsers)
            {
                sqlUsers += "'" + user + "',";
            }
            if (sqlUsers != "")
            {
                sqlUsers = sqlUsers.Substring(0, sqlUsers.LastIndexOf(','));
                DataTable tUsers = null;

                object[] ret3 = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { "SELECT USERID, USERNAME FROM USERS WHERE USERID in(" + sqlUsers + ")" });
                if (ret3 != null && (int)ret3[0] == 0)
                {
                    tUsers = ((DataSet)ret3[1]).Tables[0];
                }

                foreach (DataRow row in tUsers.Rows)
                {
                    dicUsers.Add(row["USERID"].ToString(), row["USERNAME"].ToString());
                }
            }
            // 3.��Message
            string allRoles = "";
            IEnumerator enumerRoles = dicGroups.GetEnumerator();
            while (enumerRoles.MoveNext())
            {
                allRoles += ((DictionaryEntry)enumerRoles.Current).Key.ToString() + "(" + ((DictionaryEntry)enumerRoles.Current).Value.ToString() + ") ";
            }
            if (allRoles != "")
                allRoles = allRoles.Substring(0, allRoles.LastIndexOf(' '));
            else
                allRoles = "null";

            string allUsers = "";
            IEnumerator enumerUsers = dicUsers.GetEnumerator();
            while (enumerUsers.MoveNext())
            {
                allUsers += ((DictionaryEntry)enumerUsers.Current).Key.ToString() + "(" + ((DictionaryEntry)enumerUsers.Current).Value.ToString() + ") ";
            }
            if (allUsers != "")
                allUsers = allUsers.Substring(0, allUsers.LastIndexOf(' '));
            else
                allUsers = "null";

            string message = "";
            SYS_LANGUAGE lan = (SYS_LANGUAGE)(clientInfo[0] as object[])[0];
            string m = SysMsg.GetSystemMessage(lan, "FLTools", "GloFix", "WaitMessage", false);
            message += string.Format(m, allRoles, allUsers);

            return message;
        }
Пример #7
0
        /// <summary>
        /// 通过管理角色取得角色
        /// </summary>
        /// <param name="sendToField">管理角色字段</param>
        /// <param name="tableName">表名</param>
        /// <param name="wherePart">筛选条件/param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static string GetRoleIdByRefRole(FLInstance flInstance, string sendToField, string tableName, string wherePart, object[] clientInfo, bool isUser)
        {
            if (sendToField == null || sendToField == string.Empty)
            {
                String message = SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(clientInfo[0]))[0]), "FLRuntime", "Logic", "SendToIdIsNull");
                throw new FLException(2, message);
            }

            var eepAlias = ((IFLRootActivity)flInstance.RootFLActivity).EEPAlias;
            var alias = string.Empty;
            if (!string.IsNullOrEmpty(eepAlias))
            {
                alias = (string)((object[])clientInfo[0])[2];
                ((object[])clientInfo[0])[2] = eepAlias;
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string where = string.Empty;
            string s = wherePart.ToString();
            string[] ss = s.Split(';');
            foreach (string o in ss)
            {
                where += o.Replace("''", "'");
                where += " and ";
            }
            wherePart = where + " 1=1 ";

            //wherePart = wherePart.Replace("''", "'");

            string sql = string.Format(GET_ROLE_ID_BY_ERF_ROLE, tableName, wherePart);
            clientInfo[3] = sql;//modify by ccm hosttable sql use login db
            object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            //object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            string refRoleId = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    refRoleId = ds.Tables[0].Rows[0][sendToField].ToString();
                    if (string.IsNullOrEmpty(refRoleId.Trim()))
                    {
                        String message = SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(clientInfo[0]))[0]), "FLRuntime", "Logic", "SendToIdNotExist");
                        throw new FLException(2, message);
                    }

                    if (!isUser)
                    {
                        int i = GetGroupCount(refRoleId, clientInfo);
                        if (i == 0)
                        {
                            String message = SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(clientInfo[0]))[0]), "FLRuntime", "Logic", "SendToIdNotExist");
                            throw new FLException(2, message);
                        }
                    }
                }
                else
                {
                    String message = SysMsg.GetSystemMessage((SYS_LANGUAGE)(((object[])(clientInfo[0]))[0]), "FLRuntime", "Logic", "SendToIdIsNull");
                    throw new FLException(2, message);
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }

            if (!string.IsNullOrEmpty(alias))
            {
                ((object[])clientInfo[0])[2] = alias;
            }

            return refRoleId;
        }
Пример #8
0
        public static string GetAgent(string roleId, string userId, string flowDescription, object[] clientInfo)
        {
            string date = DateTime.Now.ToString("yyyyMMddhhmmss");

            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string connectMark = "";

            String dbAlias = ((object[])clientInfo[0])[2].ToString();
            String developerID = "";
            if (clientInfo != null && clientInfo.Length > 0)
            {
                object[] info = (object[])clientInfo[0];
                if (info != null && info.Length > 17)
                {
                    developerID = (string)info[17];
                }
            }
            dbAlias = GetSplitSysDBSD(dbAlias, developerID);
            IDbConnection conn1 = AllocateConnection(dbAlias, true, clientInfo);
            if (conn1.GetType().Name == "SqlConnection")
                connectMark = "+";
            else if (conn1.GetType().Name == "OleDbConnection")
                connectMark = "+";
            else if (conn1.GetType().Name == "OracleConnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "OdbcConnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "MySqlConnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "Ifxonnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "AseConnection")
                connectMark = "||";
            //String dbType = String.Empty;
            //object[] xx = CliUtils.CallMethod("GLModule", "GetSplitSysDB2", new object[] { dbAlias });
            //if (xx[0].ToString() == "0")
            //    dbAlias = xx[1].ToString();
            //object[] myRet = CliUtils.CallMethod("GLModule", "GetDataBaseType", new object[] { dbAlias });

            //if (myRet != null && myRet[0].ToString() == "0")
            //{
            //    switch (myRet[1].ToString())
            //    {
            //        case "1":
            //        case "2":
            //            connectMark = "+"; break;
            //        case "3":
            //        case "4":
            //        case "5":
            //        case "6":
            //            connectMark = "||"; break;
            //    }
            //}
            string sql = string.Format(GET_AGENTED, roleId, userId, date, flowDescription, connectMark);

            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    string agent = ds.Tables[0].Rows[0][PARM_AGENT_AGENT].ToString();
                    if (!string.IsNullOrEmpty(agent))
                    {
                        return agent;
                    }
                }
            }

            return null;
        }
Пример #9
0
        /// <summary>
        /// 取得管理者
        /// </summary>
        /// <param name="roleId">�角色Id</param>
        /// <param name="orgKind">OrgKind</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static string GetManagerRoleId(string roleId, string orgKind, object[] clientInfo)
        {
            if (roleId == null || roleId == string.Empty)
            {
                return string.Empty;
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string sql = string.Format(GET_MANAGER_ROLEID, roleId, orgKind);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            string managerRoleId = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    managerRoleId = ds.Tables[0].Rows[0][PARM_MANAGER_ROLEID].ToString();
                }

                if (managerRoleId.Length == 0)  // add by andy for upper manager
                {
                    sql = string.Format(GET_MANAGER_ROLEID2, roleId, orgKind);
                    //clientInfo[3] = sql;
                    //objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
                    objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

                    if (objs[0].ToString() == "0")
                    {
                        ds = (DataSet)objs[1];
                        if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                        {
                            managerRoleId = ds.Tables[0].Rows[0][PARM_MANAGER_ROLEID].ToString();
                        }
                    }
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }

            return managerRoleId;
        }
Пример #10
0
        /// <summary>
        /// 取得群组名
        /// </summary>
        /// <param name="roleId">�角色Id</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static string GetGroupName(string roleId, object[] clientInfo)
        {
            if (string.IsNullOrEmpty(roleId))
            {
                return string.Empty;
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(GET_GROUP_NAME, roleId);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            string groupName = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    groupName = ds.Tables[0].Rows[0][PARM_GROUP_NAME].ToString();
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
            sql = string.Format(GET_USER_NAME, roleId);
            objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });
            string userName = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    userName = ds.Tables[0].Rows[0][PARM_USERNAME].ToString();
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
            if (string.IsNullOrEmpty(userName))
            {
                return groupName;
            }
            else
            {
                return groupName + "/" + userName;
            }
        }
Пример #11
0
        public string PersistenceFLDefinition(Guid flDefinitionId, string flTypeName, string flDefinitionString, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string flTypeId = string.Empty;
            int version = -1;
            string sql = string.Format(GET_FLDEFINITION, flTypeName);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs != null && (int)objs[0] == 0 && objs[1] is DataSet)
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        object obj = row["FLDEFINITION"];
                        if (obj != null && obj != DBNull.Value && obj.ToString() == flDefinitionString)
                        {
                            flTypeId = row["FLTYPEID"].ToString();
                            break;
                        }

                        version = (row[3] == null || row[3] == DBNull.Value) ? -1 : Convert.ToInt32(row[3]);
                    }
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new Exception(objs[1].ToString());
            }

            if (flTypeId == string.Empty)
            {
                flTypeId = flDefinitionId.ToString();
                version++;

                object[] parms = new object[] { flTypeId, flTypeName, flDefinitionString, version.ToString() };

                sql = string.Format(INSERT_FLDEFINITION, parms);
                //remoteModule.ExecuteSql(clientInfo, "GLModule", "cmdWorkflow", sql, false);
                remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });
            }

            return flTypeId;
        }
Пример #12
0
        public void PersistenceFL(FLInstance flInstance, object[] clientInfo)
        {
            //string sql = sql1 + ";\n" + sql2;
            string sql1 = string.Format(DELETE_FLINSTANCESTATE, flInstance.FLInstanceId);

            String param = "";
            String DBAlias = (clientInfo[0] as object[])[2].ToString();
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            object[] myRet = remoteModule.CallMethod(clientInfo, "GLModule", "GetDataBaseType", new object[] { DBAlias });
            if (myRet != null && myRet[0].ToString() == "0")
            {
                switch (myRet[1].ToString())
                {
                    case "1":
                        param = "@State";
                        break;
                    case "2":
                        param = "?";
                        break;
                    case "3":
                        param = ":State";
                        break;
                    case "4":
                        param = "?";
                        break;
                    case "5":
                        param = "@State";
                        break;
                    case "6":
                        param = "?";
                        break;
                }
            }
            String strSet = "SET TEXTSIZE 70000 ";
            String str = "INSERT INTO SYS_FLINSTANCESTATE(FLINSTANCEID,STATE,STATUS) VALUES('{0}'," + param + ",{1})";
            string sql2 = string.Format(str, flInstance.FLInstanceId, 0);

            MemoryStream stream = new MemoryStream();
            BinaryFormatter formatter = new BinaryFormatter();
            formatter.Serialize(stream, flInstance);

            object o = clientInfo[0];
            object[] os = (object[])o;
            string dbAlias = os[2].ToString();

            DbConnectionType dbConnectionType = DbConnectionType.SqlClient;
            string connString = GetConnectionString(dbAlias, out dbConnectionType, true);

            IDbConnection conn = AllocateConnection(dbAlias, true);
            //IDbConnection conn = AllocateConnection(dbConnectionType, connString);
            IDbCommand command = AllocateCommand(conn, sql1);

            command.ExecuteNonQuery();
            conn.Close();

            if (myRet[1].ToString() == "2")
            {
                conn.Open();
                command.CommandText = strSet;
                command.ExecuteNonQuery();
            }

            command.CommandText = sql2;
            IDataParameter state = AllocateParameter(command, param, DbType.Binary);
            if (myRet[1].ToString() == "2")
            {
                (state as OleDbParameter).OleDbType = OleDbType.LongVarBinary;
            }
            state.Value = stream.GetBuffer();
            command.Parameters.Add(state);
            if (conn.State != ConnectionState.Open)
                conn.Open();
            command.ExecuteNonQuery();
            conn.Close();
        }
Пример #13
0
        private static String GetDBType(object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            String dbAlias = (clientInfo[0] as object[])[2].ToString();
            String dbType = String.Empty;
            object[] xx = remoteModule.CallMethod(clientInfo, "GLModule", "GetSplitSysDB2", new object[] { dbAlias });
            if (xx[0].ToString() == "0")
                dbAlias = xx[1].ToString();
            object[] myRet = remoteModule.CallMethod(clientInfo, "GLModule", "GetDataBaseType", new object[] { dbAlias });
            if (myRet != null && myRet[0].ToString() == "0")
                dbType = myRet[1].ToString();

            return dbType;
        }
Пример #14
0
 private static object CreateModuleInstance(string assemblyName, object[] clientInfo)
 {
     object[] ClientInfo = clientInfo[0] as object[];
     EEPRemoteModule remoteModule = new EEPRemoteModule();
     string sql = String.Format("SELECT * FROM SYS_WEBPAGES WHERE PageType='{0}' and PageName='{1}' and UserID='{2}' and SolutionID='{3}'", "S", assemblyName, ClientInfo[17], ClientInfo[6]);
     //object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });
     string dbName = Srvtools.DbConnectionSet.GetSystemDatabase(null);
     using (IDbConnection conn = Srvtools.DbConnectionSet.GetDbConn(dbName).CreateConnection())
     {
         IDbCommand comm = conn.CreateCommand();
         comm.CommandText = sql;
         if (conn.State != ConnectionState.Open) conn.Open();
         IDataReader idr = comm.ExecuteReader();
         if (!idr.Read())
         {
             throw new Exception(string.Format("Package: {0} not active", assemblyName));
         }
         var content = (byte[])idr["SERVERDLL"];
         var assembly = System.Reflection.Assembly.Load(content);
         var componentType = assembly.GetType(string.Format("{0}.Component", assemblyName));
         return Activator.CreateInstance(componentType);
     }
 }
Пример #15
0
        /// <summary>
        /// 取消通知
        /// </summary>
        /// <param name="flInstance">流程</param>
        /// <param name="currentFLActivity">当前Activity</param>
        /// <param name="flNotifyActivity">通知Activity</param>
        /// <param name="flInstanceParms">流程参数</param>
        /// <param name="keyValues">宿主表的筛选条件</param>
        /// <param name="clientInfo">ClientInfo</param>
        public static void InsertToDo4RejectNotify(FLInstance flInstance, IEventWaiting currentFLActivity, FLNotifyActivity flNotifyActivity, object[] flInstanceParms, object[] keyValues, object[] clientInfo)
        {
            string insertToDoListSQL4Notify = GetInsertToDoListSQL4RejectNotify(flInstance, currentFLActivity, flNotifyActivity, flInstanceParms, keyValues, clientInfo);

            string sql = insertToDoListSQL4Notify;
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            String dbType = GetDBType(clientInfo);
            if (dbType == "3" && sql.EndsWith(";"))
                sql = "BEGIN " + sql + "END;";

            //object[] objs = remoteModule.ExecuteSql(clientInfo, "GLModule", "cmdWorkflow", sql, false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "UpdateWorkFlow", new object[] { sql });
            if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
        }
Пример #16
0
        public static List<string> GetExtApproveRoles(string approveID, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            List<string> roles = new List<string>();
            string sql = string.Format(GET_EXTAPPROVE2, approveID);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        string role = row[PARM_EXT_ROLE_ID].ToString();
                        if (role.Length > 0)
                        {
                            roles.Add(role);
                        }
                    }
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
            return roles;
        }
Пример #17
0
        /// <summary>
        /// �取得PresentCT
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="keys">筛选条件</param>
        /// <param name="values">�筛选值</param>
        /// <param name="presentFields">PresentCT�字段</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static string GetFormPresentCT(FLInstance flInstance, string keys, string values, string presentFields, object[] clientInfo, bool sqluse)
        {
            if (!string.IsNullOrEmpty(presentFields))
            {

                DataSet dataSet = HostTable.GetHostDataSet(flInstance, new object[] { keys, values }, clientInfo);
                if (dataSet != null && dataSet.Tables.Count != 0 && dataSet.Tables[0].Rows.Count != 0)
                {
                    DataRow row = dataSet.Tables[0].Rows[0];

                    string[] fields = presentFields.Split(",".ToCharArray());
                    foreach (string field in fields)
                    {
                        if (string.IsNullOrEmpty(field))
                            continue;

                        if (!string.IsNullOrEmpty(keys) && row.Table.Columns.Contains(field))
                        {
                            keys += string.Format(";{0}", field);
                            string value = string.Empty;

                            if (row.Table.Columns[field].DataType == typeof(DateTime) && row[field] != DBNull.Value)
                            {
                                value = ((DateTime)row[field]).ToString("yyyy/MM/dd");
                            }
                            else
                            {
                                value = row[field].ToString();
                                if (sqluse)
                                {
                                    value = value.Replace("'", "''");
                                }
                            }

                            values += string.Format(";{0}={1}", field, value);
                        }
                    }
                }
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string tableName = ((IFLRootActivity)flInstance.RootFLActivity).TableName;
            string presentCT = values;
            string sql = "select * from COLDEF where TABLE_NAME = '" + tableName + "'";

            var eepAlias = ((IFLRootActivity)flInstance.RootFLActivity).EEPAlias;
            var alias = string.Empty;
            if (!string.IsNullOrEmpty(eepAlias))
            {
                alias = (string)((object[])clientInfo[0])[2];
                ((object[])clientInfo[0])[2] = eepAlias;
            }

            clientInfo[3] = sql;
            object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdDDUse", "", false);

            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count != 0)
                {
                    string[] dataKeys = keys.Split(';');
                    foreach (string key in dataKeys)
                    {
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            if (row["FIELD_NAME"].ToString().ToLower() == key.ToLower())
                            {
                                //presentCT = presentCT.Replace(key, row["CAPTION"].ToString());
                                presentCT = presentCT.Replace(key + "=", row["CAPTION"].ToString() + "=");
                                break;
                            }
                        }
                    }
                    presentCT.Replace("'", "");
                }

            }
            if (!string.IsNullOrEmpty(alias))
            {
                ((object[])clientInfo[0])[2] = alias;
            }
            return presentCT;
        }
Пример #18
0
        /// <summary>
        /// 取得用户Email
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static string GetUserEmail(string userId, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(GET_USER, userId);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            string email = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    email = ds.Tables[0].Rows[0][PARM_EMAIL].ToString();
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }

            return email;
        }
Пример #19
0
        /// <summary>
        /// 取得职级
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <param name="orgKind">OrgKind</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static string GetLevelNo(string roleId, string orgKind, object[] clientInfo)
        {
            if (roleId == null || roleId == string.Empty)
            {
                return string.Empty;
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string sql = string.Format(GET_LEVELNO, roleId, orgKind);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            string levelNo = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    levelNo = ds.Tables[0].Rows[0][PARM_UPPER_ORG] == null || ds.Tables[0].Rows[0][PARM_UPPER_ORG] == DBNull.Value
                        ? string.Empty : ds.Tables[0].Rows[0][PARM_UPPER_ORG].ToString();
                }
                else
                {
                    levelNo = "900cae2f-6266-4b7f-ba8c-483a94e01e93";
                }
            }
            else
            {
                levelNo = "900cae2f-6266-4b7f-ba8c-483a94e01e93";
            }

            return levelNo;
        }
Пример #20
0
        public static string GetUserName(string userId, object[] clientInfo, string role)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(GET_USER, userId);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            string userName = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    userName = ds.Tables[0].Rows[0][PARM_USERNAME].ToString();
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
            if (!string.IsNullOrEmpty(role))
            {
                var roles = GetRoleIdsByUserId(userId, clientInfo);
                if (roles.IndexOf(role) < 0)
                {
                    userName += "(*)";
                }
            }
            return userName;
        }
Пример #21
0
        /// <summary>
        /// 取得代理者
        /// </summary>
        /// <param name="flowDesc">�流程描述</param>
        /// <param name="userId">用户Id</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static object GetPARAGENT(string flowDesc, string userId, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string now = DateTime.Now.ToString("yyyyMMddHHmmss");
            string connectMark = "";

            String dbAlias = ((object[])clientInfo[0])[2].ToString();
            String dbType = String.Empty;
            String developerID = "";
            if (clientInfo != null && clientInfo.Length > 0)
            {
                object[] info = (object[])clientInfo[0];
                if (info != null && info.Length > 17)
                {
                    developerID = (string)info[17];
                }
            }
            dbAlias = GetSplitSysDBSD(dbAlias, developerID);
            IDbConnection conn1 = AllocateConnection(dbAlias, true, clientInfo);
            if (conn1.GetType().Name == "SqlConnection")
                connectMark = "+";
            else if (conn1.GetType().Name == "OleDbConnection")
                connectMark = "+";
            else if (conn1.GetType().Name == "OracleConnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "OdbcConnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "MySqlConnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "Ifxonnection")
                connectMark = "||";
            else if (conn1.GetType().Name == "AseConnection")
                connectMark = "||";
            //object[] xx = CliUtils.CallMethod("GLModule", "GetSplitSysDB2", new object[] { dbAlias });
            //if (xx[0].ToString() == "0")
            //    dbAlias = xx[1].ToString();
            //object[] myRet = CliUtils.CallMethod("GLModule", "GetDataBaseType", new object[] { dbAlias });

            //if (myRet != null && myRet[0].ToString() == "0")
            //{
            //    switch (myRet[1].ToString())
            //    {
            //        case "1":
            //        case "2":
            //            connectMark = "+"; break;
            //        case "3":
            //        case "4":
            //        case "5":
            //        case "6":
            //            connectMark = "||"; break;
            //    }
            //}
            string sql = string.Format(GET_PAR_AGENT, flowDesc, userId, now, connectMark);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    object temp = ds.Tables[0].Rows[0][PARM_PAR_AGENT];
                    if (temp == DBNull.Value || temp == null)
                    {
                        return null;
                    }
                    else
                    {
                        if (temp.ToString().ToUpper() == "Y")
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }

            return null;
        }
Пример #22
0
        /// <summary>
        /// 通过角色取得用户
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static List<string> GetUsersIdsByRoleId(string roleId, object[] clientInfo)
        {
            List<string> userIds = new List<string>();
            if (roleId == null || roleId == string.Empty)
            {
                return userIds;
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string sql = string.Format(GET_USER_IDS_BY_ROLEID, roleId);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        userIds.Add(row[PARM_USERID].ToString());
                    }
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }

            return userIds;
        }
Пример #23
0
        /// <summary>
        /// 取得加签角色
        /// </summary>
        /// <param name="flInstanceId">流程Id</param>
        /// <param name="step">当前Step</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static string GetPlusRoles(string flInstanceId, string step, object[] clientInfo)
        {
            string plusRoles = string.Empty;
            if (flInstanceId == null || flInstanceId == string.Empty || step == null || step == string.Empty)
            {
                return plusRoles;
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string sql = string.Format(GET_PLUS_ROLES, flInstanceId, step);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    plusRoles = ds.Tables[0].Rows[0][PARM_PLUS_ROLES].ToString();
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }

            return plusRoles;
        }
Пример #24
0
        /// <summary>
        /// 取得签核角色及当前流程的位置
        /// </summary>
        /// <param name="flInstanceId">流程Id</param>
        /// <param name="step">当前Step</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        internal static string[] GetSendTo(string flInstanceId, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(GET_SEND_TO, flInstanceId);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    string kind = ds.Tables[0].Rows[0][PARM_SENDTO_KIND].ToString();
                    string id = ds.Tables[0].Rows[0][PARM_SENDTO_ID].ToString();
                    string[] flowpath = ds.Tables[0].Rows[0][PARM_FLOWPATH].ToString().Split(';');

                    if (!string.IsNullOrEmpty(id))
                    {

                        return new string[] { id, kind, flowpath[0], flowpath[1] };
                        //if (kind == "1")
                        //{
                        //    //role
                        //    List<string> users = Global.GetUsersIdsByRoleId(id, clientInfo);
                        //    if (users.Count > 0)
                        //    {
                        //        return new string[] { users[0], id, flowpath[0], flowpath[1] };
                        //    }
                        //    else
                        //    {
                        //        throw new Exception("找不到用户");
                        //    }
                        //}
                        //else
                        //{
                        //    List<string> roles = Global.GetRoleIdsByUserId(id, clientInfo);
                        //    if (roles.Count > 0)
                        //    {
                        //        return new string[] { id, roles[0], flowpath[0], flowpath[1] };
                        //    }
                        //    else
                        //    {
                        //        throw new Exception("找不到角色");
                        //    }
                        //}
                    }
                    else
                    {
                        throw new Exception("ID为空");
                    }

                }
                else
                {
                    return null;
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
            throw new Exception();
        }
Пример #25
0
        public static string ShowMessage(string sendToIds, bool isWeb, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            string message = "";//��󷵻ص���Ϣ
            string[] toIds = sendToIds.Split(';');
            SYS_LANGUAGE lan = (SYS_LANGUAGE)(clientInfo[0] as object[])[0];
            string messageModule = SysMsg.GetSystemMessage(lan, "FLClientControls", "FLWizard", "SendToMan", isWeb);
            string messageModule1 = SysMsg.GetSystemMessage(lan, "FLClientControls", "FLWizard", "SendToMan1", isWeb);
            string sign = isWeb ? "</br>" : "\r\n";
            for (int i = 0; i < toIds.Length; i++)
            {
                string[] parts = toIds[i].Split('|');
                string role = "", users = "";
                if (parts[1].IndexOf(':') != -1) //U001:UserId
                {
                    role = "null";
                    string userid = parts[1].Substring(0, parts[1].IndexOf(':'));
                    DataTable tUsers = null;

                    object[] ret1 = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { "SELECT USERID, USERNAME FROM USERS WHERE USERID='" + userid + "'" });

                    if (ret1 != null && (int)ret1[0] == 0)
                    {
                        tUsers = ((DataSet)ret1[1]).Tables[0];
                    }
                    if (ret1 != null && (int)ret1[0] == 1)
                    {
                        throw new Exception((string)ret1[1]);
                    }
                    if (tUsers.Rows.Count > 0)
                    {
                        users = tUsers.Rows[0]["USERID"].ToString() + "(" + tUsers.Rows[0]["USERNAME"].ToString() + ")";
                    }
                }
                else //R01
                {
                    string groupid = parts[1];
                    DataTable tGroups = null;

                    object[] ret1 = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { "SELECT GROUPID, GROUPNAME, ISROLE FROM GROUPS WHERE GROUPID='" + groupid + "' AND ISROLE='Y'" });

                    if (ret1 != null && (int)ret1[0] == 0)
                    {
                        tGroups = ((DataSet)ret1[1]).Tables[0];
                    }
                    else if (ret1 != null && (int)ret1[0] == 1)
                    {
                        throw new Exception((string)ret1[1]);
                    }
                    if (tGroups.Rows.Count > 0)
                    {
                        role = tGroups.Rows[0]["GROUPID"].ToString() + "(" + tGroups.Rows[0]["GROUPNAME"].ToString() + ")";
                    }

                    DataTable tHoldUsers = null;

                    object[] ret2 = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { "SELECT USERID, USERNAME FROM USERS WHERE USERID IN (SELECT USERID FROM USERGROUPS WHERE GROUPID='" + groupid + "')" });

                    if (ret2 != null && (int)ret2[0] == 0)
                    {
                        tHoldUsers = ((DataSet)ret2[1]).Tables[0];
                    }
                    else if (ret2 != null && (int)ret2[0] == 1)
                    {
                        throw new Exception((string)ret2[1]);
                    }
                    if (tHoldUsers != null && tHoldUsers.Rows.Count > 0)
                    {
                        foreach (DataRow holdRow in tHoldUsers.Rows)
                        {
                            users += holdRow["USERID"].ToString() + "(" + holdRow["USERNAME"].ToString() + ") ";
                        }
                    }
                }
                if (role == "null")
                {
                    message += string.Format(messageModule1, parts[0], users) + sign;
                }
                else
                {
                    message += string.Format(messageModule, parts[0], role, users) + sign;
                }
            }
            if (message.EndsWith("\n"))
                message = message.Remove(message.LastIndexOf("\n"));
            return message;
        }
Пример #26
0
        /// <summary>
        /// 取得群组数
        /// </summary>
        /// <param name="roleId">�角色Id</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        private static int GetGroupCount(string roleId, object[] clientInfo)
        {
            if (string.IsNullOrEmpty(roleId))
            {
                return 0;
            }

            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(GET_GROUP_COUNT, roleId);
            //clientInfo[3] = sql;
            //object[] objs = remoteModule.GetSqlCommand(clientInfo, "GLModule", "cmdWorkflow", "", false);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    return Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return 0;
            }
        }
Пример #27
0
 private void MarkCurrent()
 {
     EEPRemoteModule remoteModule = new EEPRemoteModule();
     string sql = string.Format(SELECT_TODOLIST_SQL, Instance.FLInstanceId);
     object[] objs = remoteModule.CallMethod(ClientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });
     if (objs[0].ToString() == "0")
     {
         DataSet dataSet = (DataSet)objs[1];
         if (dataSet.Tables.Count > 0)
         {
             DataTable table = dataSet.Tables[0];
             for (int i = 0; i < table.Rows.Count; i++)
             {
                 string flowpath = (string)table.Rows[i]["FLOWPATH"];
                 string[] paths = flowpath.Split(';');
                 if (paths.Length == 2)
                 {
                     string id = (string)table.Rows[i]["SENDTO_ID"];
                     string type = (string)table.Rows[i]["SENDTO_KIND"];
                     if (type == "1")
                     {
                         AddSendTo(paths[1], new SendTo(id, ""), AcitivityStatus.Current);
                     }
                     else
                     {
                         AddSendTo(paths[1], new SendTo("", id), AcitivityStatus.Current);
                     }
                     //return;
                 }
             }
         }
     }
     //     string useid = (string)(((object[])ClientInfo[0])[(int)ClientInfoType.LoginUser]);
     //AddSendTo(CurrentAcitivity, new SendTo(Role, User), AcitivityStatus.Current);
 }
Пример #28
0
        /// <summary>
        /// 取得签核意见
        /// </summary>
        /// <param name="flInstanceId">流程Id</param>
        /// <param name="clientInfo">ClientInfo</param>
        /// <returns></returns>
        public static DataSet GetComments(string flInstanceId, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();
            string sql = string.Format(GET_COMMENTS, flInstanceId);

            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });

            string userName = string.Empty;
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    return ds;
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return null;
            }
        }
Пример #29
0
        public string[] GetValues(string sKind)
        {
            if (sKind.Equals("RemoteName"))
            {
                string s = EditionDifference.ActiveSolutionName();

                EEPRemoteModule remoteObject = new EEPRemoteModule();
                object[] myRet = remoteObject.GetSqlCommandList(new object[] { (object)"", (object)"", (object)"", (object)"", (object)"", (object)"", (object)s });
                if ((null != myRet))
                {
                    if (0 == (int)(myRet[0]))
                    {
                        string[] sList = (string[])(myRet[1]);
                        return sList;
                    }
                    else
                    {
                        return new string[0] { };
                    }
                } else
                    return new string[0] { };
            }
            else
                return new string[0] { };
        }
Пример #30
0
        public static List<string> GetExtApproveRoles(string approveID, string groupID, object value, object[] clientInfo)
        {
            EEPRemoteModule remoteModule = new EEPRemoteModule();

            List<string> roles = new List<string>();
            if (value.Equals(DBNull.Value))
            {
                return roles;
            }

            string sql = string.Format(GET_EXTAPPROVE, approveID, groupID);
            object[] objs = remoteModule.CallMethod(clientInfo, "GLModule", "ExcuteWorkFlow", new object[] { sql });
            if (objs[0].ToString() == "0")
            {
                DataSet ds = (DataSet)objs[1];
                if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        string role = row[PARM_EXT_ROLE_ID].ToString();
                        if (role.Length > 0)
                        {
                            object min = row[PARM_MINIMUM];
                            object max = row[PARM_MAXIMUM];
                            Type type = value.GetType();

                            if (!min.Equals(DBNull.Value) && ((IComparable)value).CompareTo(Convert.ChangeType(min, type)) < 0)
                            {
                                continue;
                            }
                            if (!max.Equals(DBNull.Value) && ((IComparable)value).CompareTo(Convert.ChangeType(max, type)) >= 0)
                            {
                                continue;
                            }
                            roles.Add(role);
                        }
                    }
                }
            }
            else if (objs[0].ToString() == "1")
            {
                throw new FLException(objs[1].ToString());
            }
            return roles;
        }