| | |
| | | |
| | | public static int InsertMeta(SysMeta meta) |
| | | { |
| | | List<DbParameter> list = Tool.GetParams<SysMeta>(insertMeta, meta); |
| | | List<DbParameter> list = Tools.GetParams<SysMeta>(insertMeta, meta); |
| | | |
| | | object obj = Helper.GetScalar(insertMeta, list.ToArray()); |
| | | |
| | |
| | | vd.Meta.depid = 1; |
| | | vd.Meta.verid = 0; |
| | | vd.Meta.type = fi.Extension.ToLower().Replace(".", ""); |
| | | vd.Meta.sizes = Tool.SizeToMb(fi.Length); |
| | | vd.Meta.sizes = Tools.SizeToMb(fi.Length); |
| | | vd.Meta.create_user = Tool.UserId; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace DataLoader.CS |
| | | { |
| | | public class MetaHelper |
| | | { |
| | | |
| | | } |
| | | } |
| | |
| | | public readonly static String OSGB = ".osgb"; |
| | | |
| | | /// <summary> |
| | | /// æ
æ ¼æ°æ®æ©å±å |
| | | /// </summary> |
| | | public static readonly List<String> RASTER_EXT = new List<String> { ".img", ".tif", ".tiff", "jpg", "jp2" }; |
| | | |
| | | /// <summary> |
| | | /// 16è¿å¶ |
| | | /// </summary> |
| | | public static readonly char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¢ç®ä¸ºMB |
| | | /// </summary> |
| | | public static double SizeToMb(long size) |
| | | { |
| | | if (size < 1050) |
| | | { |
| | | return 0.001; |
| | | } |
| | | |
| | | String str = string.Format("{0:F3}", size / 1024.0 / 1024.0); |
| | | |
| | | return Double.Parse(str); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·å设置 |
| | | /// </summary> |
| | | public static string GetSetting(string key) |
| | | { |
| | | if (!ConfigurationManager.AppSettings.AllKeys.Contains(key)) return null; |
| | | |
| | | return ConfigurationManager.AppSettings[key]; |
| | | } |
| | | |
| | |
| | | <Compile Include="CS\Importor.cs" /> |
| | | <Compile Include="CS\LogOut.cs" /> |
| | | <Compile Include="CS\MD5Helper.cs" /> |
| | | <Compile Include="CS\MetaHelper.cs" /> |
| | | <Compile Include="CS\StaticData.cs" /> |
| | | <Compile Include="CS\Tools.cs" /> |
| | | <Compile Include="Model\Tool.cs" /> |
| | | <Compile Include="CS\ModelHandler.cs" /> |
| | | <Compile Include="Model\NtstWeb.cs" /> |
| | | <Compile Include="CS\NtstWeb.cs" /> |
| | | <Compile Include="CS\PostgreHelper.cs" /> |
| | | <Compile Include="Model\ViewData.cs" /> |
| | | <Compile Include="LoginWin.xaml.cs"> |
| | |
| | | using CefSharp; |
| | | using DataLoader.CS; |
| | | using DataLoader.Model; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | |
| | | private void Window_Loaded(object sender, RoutedEventArgs e) |
| | | { |
| | | web.Address = Tool.BaseDir + "htmls\\login.html"; |
| | | web.Address = Tools.BaseDir + "htmls\\login.html"; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | public static string Token = ""; |
| | | |
| | | public static char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
| | | |
| | | public static string FormatBytes(long bytes) |
| | | { |
| | | string[] Suffix = { "Byte", "KB", "MB", "GB", "TB" }; |
| | | |
| | | int i = 0; |
| | | double dblSByte = bytes; |
| | | if (bytes > 1024) |
| | | for (i = 0; (bytes / 1024) > 0; i++, bytes /= 1024) |
| | | dblSByte = bytes / 1024.0; |
| | | |
| | | return String.Format("{0:0.##}{1}", dblSByte, Suffix[i]); |
| | | } |
| | | |
| | | public static string GetSetting(string key) |
| | | { |
| | | if (!ConfigurationManager.AppSettings.AllKeys.Contains(key)) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | return ConfigurationManager.AppSettings[key]; |
| | | } |
| | | |
| | | public static List<DbParameter> GetParams<T>(string sql, T t) |
| | | { |
| | | List<DbParameter> list = new List<DbParameter>(); |
| | | Type tType = typeof(T); |
| | | BindingFlags flags = BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance; |
| | | |
| | | int start = sql.IndexOf("@"); |
| | | while (start != -1) |
| | | { |
| | | int end = sql.IndexOf(",", start); |
| | | if (end == -1) end = sql.IndexOf(")", start); |
| | | if (end == -1) end = sql.IndexOf(" ", start); |
| | | if (end == -1) end = sql.Length; |
| | | |
| | | string name = sql.Substring(start + 1, end - start - 1); |
| | | PropertyInfo pi = tType.GetProperty(name, flags); |
| | | if (pi != null) |
| | | { |
| | | object value = pi.GetValue(t, null); |
| | | DbParameter dp = new NpgsqlParameter("@" + name, value); |
| | | list.Add(dp); |
| | | } |
| | | |
| | | start = sql.IndexOf("@", end); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | public static double SizeToMb(long size) |
| | | { |
| | | if (size < 1050) |
| | | { |
| | | return 0.001; |
| | | } |
| | | |
| | | String str = string.Format("{0:F3}", size / 1024.0 / 1024.0); |
| | | |
| | | return Double.Parse(str); |
| | | } |
| | | } |
| | | } |