Esempio n. 1
0
 /// <summary>
 /// 获取数据源
 /// </summary>
 /// <param name="dbName"></param>
 /// <param name="sql"></param>
 /// <returns></returns>
 public DataTable GetDataSource(string dbName, string sql)
 {
     DataTable dt = new DataTable();
     // 根据m_SQL获取
     using (BaseDB dbHelper = CreateDBHelper(dbName))
     {
         try
         {
             dt = dbHelper.ExecuteDataTable(sql, null);
         }
         catch
         {
             dt = null;
         }
     }
     return dt;
 }
Esempio n. 2
0
        void _setReceivers(string configReceivers)
        {
            var list = JsonHelper.ToList(configReceivers);

            foreach (var item in list)
            {
                var type = item.GetValue("Type");
                if (type == "User")
                {
                    _addUser(this.ConfigReceivers, item.GetValue("ID"), item.GetValue("Name"));
                }
                else if (type == "SysRole" || type == "OrgRole")
                {
                    string sql    = @"SELECT UserID,Name FROM  S_A__RoleUser LEFT JOIN S_A_User ON UserID=S_A_USER.ID WHERE RoleID ='" + item.GetValue("ID") + "'";
                    var    userDt = BaseDB.ExecuteDataTable(sql);
                    foreach (DataRow userRow in userDt.Rows)
                    {
                        _addUser(this.ConfigReceivers, userRow["UserID"].ToString(), userRow["Name"].ToString());
                    }
                }
            }
        }