Пример #1
0
        public List <FileUploadInfo> QueryFileUploadInfo(QueryConditionBase queryInfo)
        {
            int res = 0;
            List <FileUploadInfo> tempFileUploadInfoList = new List <FileUploadInfo>();

            String quserSql = GenerateQuerySql(queryInfo);

            MySqlConnectHelper mysqlCnn = MySqlConnectPoolHelper.getPool().getConnection();

            res = mysqlCnn.SelectDB(dbName);

            MySqlDataReader dataReader = mysqlCnn.ExecuteReader(CommandType.Text, quserSql, null);

            while (dataReader.Read())
            {
                FileUploadInfo tempFileUploadInfo = new FileUploadInfo();

                tempFileUploadInfo.ID       = (int)dataReader["ID"];
                tempFileUploadInfo.DateTime = (string)dataReader["DateTime"];
                tempFileUploadInfo.Content  = (string)dataReader["Content"];
                tempFileUploadInfo.UserName = (string)dataReader["UserName"];
                string tempDeviceList = (string)dataReader["FilePathList"];
                tempFileUploadInfo.FilePathList = tempDeviceList.Split(',');

                tempFileUploadInfoList.Add(tempFileUploadInfo);
            }

            dataReader.Close();
            MySqlConnectPoolHelper.getPool().closeConnection(mysqlCnn);
            mysqlCnn = null;

            return(tempFileUploadInfoList);
        }
Пример #2
0
        private String GenerateQuerySql(QueryConditionBase queryInfo)
        {
            String querySql = null;

            if (String.IsNullOrEmpty(queryInfo.StartDate) || String.IsNullOrEmpty(queryInfo.EndDate))
            {
                querySql = $"select top 20 * from `{tableName}`";
            }
            else
            {
                querySql = $"select * from `{tableName}` where between `DataTime` between  '{queryInfo.StartDate}' and '{queryInfo.EndDate}'";
            }



            return(querySql);
        }
        public HttpResponseMessage DeleteData([FromBody] QueryConditionBase QueryParams)
        {
            ResultMsg             resultMsg = null;
            List <FileUploadInfo> queryFileUploadInfoList = null;
            bool res = true;


            FileUploadInfoQueryHelper tempQueryHelper = new FileUploadInfoQueryHelper();

            tempQueryHelper.Initialize(QueryParams.CompanyCode, QueryParams.DeviceCode);

            queryFileUploadInfoList = tempQueryHelper.QueryFileUploadInfo(QueryParams);



            resultMsg            = new ResultMsg();
            resultMsg.StatusCode = (int)StatusCodeEnum.Success;
            resultMsg.Info       = "";
            resultMsg.Data       = queryFileUploadInfoList;

            return(HttpResponseExtension.toJson(JsonConvert.SerializeObject(resultMsg)));
        }