Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public ResponseSet <UploadFile> GetList(string sql)
        {
            Response <DataTable> result = SqLiteHelper.ExecuteDataTable(sql);

            if (!result.Success)
            {
                return(new ResponseSet <UploadFile> {
                    Errors = result.Errors
                });
            }
            if (result.Data == null || result.Data.Rows.Count <= 0)
            {
                return(new ResponseSet <UploadFile> {
                    Errors = "No Data"
                });
            }

            ObservableCollection <UploadFile> datas = new ObservableCollection <UploadFile>();

            result.Data.Rows.Cast <DataRow>().ToList().ForEach(x => datas.Add(x));

            return(new ResponseSet <UploadFile> {
                Datas = datas
            });
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public Response <UploadFile> SingleOrDefault(string sql)
        {
            Response <DataTable> result = SqLiteHelper.ExecuteDataTable(sql);

            if (!result.Success)
            {
                return(new Response <UploadFile> {
                    Errors = result.Errors
                });
            }
            if (result.Data == null || result.Data.Rows.Count <= 0)
            {
                return(new Response <UploadFile> {
                    Errors = "No Data"
                });
            }


            return(new Response <UploadFile> {
                Data = result.Data.Rows.Cast <DataRow>().FirstOrDefault()
            });
        }