public DataTableResponse GetFileServerInfoByEndPoint(string token, string wcfAddress, string account, string passWord) { DataTableResponse response = new DataTableResponse(); DataTable dt = new DataTable(); try { bool isPermission = token == ServerConfig.Token; if (!isPermission) { dt.TableName = "FileServer"; dt.Columns.Add("Error", typeof(string)); response.IsSuccessful = false; response.ResultMessage = "您没有访问该文件服务器接口的权限!"; response.DataTable = dt; return response; } DbCommand cmd = _dataBaseAccess.CreateCommand(); cmd.CommandText = "Proc_FileServer_GetByEndPoint"; DbParameter param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@WCFAddress"; param.DbType = DbType.String; param.Value = wcfAddress; cmd.Parameters.Add(param); param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@Account"; param.DbType = DbType.String; param.Value = account; cmd.Parameters.Add(param); param = _dataBaseAccess.CreateParameter(); param.ParameterName = "@PassWord"; param.DbType = DbType.String; param.Value = Tools.MD5Encrypt(passWord); cmd.Parameters.Add(param); dt = _dataBaseAccess.GetDataTable(cmd); dt.TableName = "FileServer"; response.DataTable = dt; if (dt != null && dt.Rows.Count > 0) { response.IsSuccessful = true; response.ResultMessage = string.Empty; } else { response.IsSuccessful = false; response.ResultMessage = string.Format("{0}从服务器信息表获取不到内容!", wcfAddress); } } catch (Exception ex) { dt = new DataTable(); dt.TableName = "FileServer"; dt.Columns.Add("Error", typeof(string)); response.IsSuccessful = false; response.ResultMessage = ex.Message; response.DataTable = dt; Tools.LogWrite(ex.ToString()); } return response; }
public DataTableResponse GetCategoryInfo(string token, int fileServerId, string account, string passWord) { DataTableResponse response = new DataTableResponse(); DataTable dt = new DataTable(); try { bool isPermission = Authentication(token, fileServerId, account, passWord); if (!isPermission) { dt.TableName = "Category"; dt.Columns.Add("Error", typeof(string)); response.IsSuccessful = false; response.ResultMessage = "您没有访问该文件服务器接口的权限!"; response.DataTable = dt; return response; } DbCommand cmd = _dataBaseAccess.CreateCommand(); cmd.CommandText = "Proc_Category_GetAll"; dt = _dataBaseAccess.GetDataTable(cmd); dt.TableName = "Category"; response.DataTable = dt; if (dt != null && dt.Rows.Count > 0) { response.IsSuccessful = true; response.ResultMessage = string.Empty; } else { response.IsSuccessful = false; response.ResultMessage = "目录信息表为空!"; } } catch (Exception ex) { dt = new DataTable(); dt.TableName = "Category"; dt.Columns.Add("Error", typeof(string)); response.IsSuccessful = false; response.ResultMessage = ex.Message; response.DataTable = dt; Tools.LogWrite(ex.ToString()); } return response; }