/// <summary> /// 推送数据到目标地址 /// </summary> public void Push() { //取出设置 String QueryString = BPM.Settings["PowerForms_Push_QueryString"] != null && !string.IsNullOrEmpty(BPM.Settings["PowerForms_Push_QueryString"].ToString()) ? Convert.ToString(BPM.Settings["PowerForms_Push_QueryString"]) : ""; Boolean Asynchronous = BPM.Settings["PowerForms_Push_Asynchronous"] != null && !string.IsNullOrEmpty(BPM.Settings["PowerForms_Push_Asynchronous"].ToString()) ? Convert.ToBoolean(BPM.Settings["PowerForms_Push_Asynchronous"]) : true; Int32 FormMethod = BPM.Settings["PowerForms_Push_FormMethod"] != null && !string.IsNullOrEmpty(BPM.Settings["PowerForms_Push_FormMethod"].ToString()) ? Convert.ToInt32(BPM.Settings["PowerForms_Push_FormMethod"]) : (Int32)EnumFormMethod.POST; if (!String.IsNullOrEmpty(TransferUrl))//推送的目标地址不能为空 { //构造查询的字符串 QueryStrings = CreateQueryStrings(); //将值转换到键值对中存储 if (ContentList != null && ContentList.Count > 0) { TemplateFormat xf = new TemplateFormat(BPM); foreach (DNNGo_PowerForms_ContentItem item in ContentList) { if (String.IsNullOrEmpty(QueryStrings.Get(item.FieldName)))//不存在该键值时才能进入 { QueryStrings.Add(item.FieldName, xf.ViewContentValue2(item)); } } } //设置中设置的查询参数 if (!String.IsNullOrEmpty(QueryString)) { List <String> ListQuery = WebHelper.GetList(QueryString, "\r\n"); foreach (String query in ListQuery) { List <String> nvs = WebHelper.GetList(query, "="); if (nvs != null && nvs.Count == 2 && !String.IsNullOrEmpty(nvs[0]) && !String.IsNullOrEmpty(nvs[1])) { if (String.IsNullOrEmpty(QueryStrings.Get(nvs[0])))//不存在该键值时才能进入 { QueryStrings.Add(nvs[0], nvs[1]); } } } } //将提交的表单实体转换 Type t = typeof(DNNGo_PowerForms_Content); PropertyInfo[] Propertys = t.GetProperties(); //循环字段列表 foreach (PropertyInfo Property in Propertys) { if (String.IsNullOrEmpty(_QueryStrings.Get(Property.Name)))//不存在该键值时才能进入 { if (Property.Name != "Item" && Property.Name != "ContentValue") { object o = Property.GetValue(SubmitContent, null); if (Property.Name == "UserName") { _QueryStrings.Add("DisplayName", o.ToString()); } else { _QueryStrings.Add(Property.Name, o.ToString()); } } } } //移除模块编号和页面编号 if (_QueryStrings[DNNGo_PowerForms_Content._.ModuleId] != null) { _QueryStrings.Remove(DNNGo_PowerForms_Content._.ModuleId); } if (_QueryStrings[DNNGo_PowerForms_Content._.PortalId] != null) { _QueryStrings.Remove(DNNGo_PowerForms_Content._.PortalId); } if (Asynchronous) { //异步推送 ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadUploadValues), this); } else { //webX.UploadValues(new Uri(TransferUrl), EnumHelper.GetEnumTextVal(FormMethod, typeof(EnumFormMethod)), QueryStrings); PushData(); } } }