Exemplo n.º 1
0
 public FortViewData(String gvType)
 {
     this.gvType = gvType;
     this.mapper = new FortMapper();
     this.setting = Setting.Load(this.GvType);
 }
Exemplo n.º 2
0
 public static Setting Load(String gvType)
 {
     var set = new Setting();
     if (gvType == "FE")
     {
         set.TargetPath = Properties.Settings.Default.TargetPath;
         set.FileHeader = Properties.Settings.Default.FileHeader;
         set.ServerUrl = Properties.Settings.Default.ServerUrl;
         set.ServerKey = Properties.Settings.Default.ServerKey;
         set.AuthId = Properties.Settings.Default.AuthId;
         set.AuthPass = Properties.Settings.Default.AuthPass;
         set.GvType = gvType;
     }
     else if (gvType == "TE")
     {
         set.TargetPath = Properties.Settings.Default.TargetPathTe;
         set.FileHeader = Properties.Settings.Default.FileHeaderTe;
         set.ServerUrl = Properties.Settings.Default.ServerUrlTe;
         set.ServerKey = Properties.Settings.Default.ServerKeyTe;
         set.AuthId = Properties.Settings.Default.AuthIdTe;
         set.AuthPass = Properties.Settings.Default.AuthPassTe;
         set.GvType = gvType;
     }
     else
     {
         throw new Exception("Unknown Type");
     }
     return set;
 }
Exemplo n.º 3
0
        private String PostServer(String path, String data, String method, Setting set)
        {
            if (set == null)
            {
                throw new System.Net.WebException();
            }

            Uri uri = new Uri(set.ServerUrl + path);
            client.Credentials = new NetworkCredential(set.AuthId, set.AuthPass);

            NameValueCollection vc = new NameValueCollection();
            vc.Add("k", set.ServerKey);
            vc.Add("d", data);
            if (method == "put" || method == "delete")
            {
                vc.Add("_method", method);
            }

            return Encoding.UTF8.GetString(client.UploadValues(uri, vc));
        }