Example #1
0
        /// <summary>
        /// 没用
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="id"></param>
        /// <param name="updateT"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public static bool updateSingleInfo <T>(int id, T updateT, string url) where T : class
        {
            try
            {
                Type   type            = typeof(T);
                string className       = type.Name;
                string strSerialResult = JsonConvert.SerializeObject(updateT);//序列化结果

                //string uri = Config.globalServiceURL + "service/updateSingleInfoByTableName/?tableName=" + className + "&id=" + id;
                string uri = url + "updateSingleInfoByTableName/?tableName=" + className + "&id=" + id;
                Dictionary <string, string> dict = new Dictionary <string, string>();
                dict.Add(className, strSerialResult);

                string responseStr = HttpWebResponseUtility.PostWebResponse(uri, dict, null, null, Encoding.UTF8, null);
                string flagStr     = HttpWebResponseUtility.getValueByKeyName(responseStr, "data"); //reader.ReadToEnd为响应信息,这里为键值对,格式为 "data":5


                if (!flagStr.Equals("success"))
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ce)
            {
                LogUtil.WriteLog(null, ce.Message);
                return(false);
            }
        }
Example #2
0
        public static bool getFormSave(string uri, Dictionary <string, object> dict2)
        {
            string          userAgent   = "Someone";
            HttpWebResponse webResponse = FormUpload.MultipartFormDataPost(uri, userAgent, dict2);

            StreamReader responseReader = new StreamReader(webResponse.GetResponseStream());
            string       fullResponse   = responseReader.ReadToEnd();
            bool         successFlag;
            string       val_first = HttpWebResponseUtility.getValueByKeyName(fullResponse, out successFlag);

            return(successFlag);
        }
Example #3
0
        public static bool addManyInfoReturnBool <T>(List <T> list, string url) where T : class
        {
            try
            {
                string strSerialResult = JsonConvert.SerializeObject(list);//序列化结果
                Type   type            = typeof(T);
                string className       = type.Name;

                // string uri_add = Config.globalServiceURL + "service/addManyData/?tableName=" + className;
                string uri_add = url + "addManyData/?tableName=" + className;
                Dictionary <string, string> dict_add = new Dictionary <string, string>();
                dict_add.Add(className, strSerialResult);
                string responseStr_add = HttpWebResponseUtility.PostWebResponse(uri_add, dict_add, null, null, Encoding.UTF8, null);
                string flag_add        = HttpWebResponseUtility.getValueByKeyName(responseStr_add, "data");
                return(flag_add.Equals("success"));
            }
            catch (Exception ce)
            {
                LogUtil.WriteLog(null, ce.Message);
                return(false);
            }
        }