protected void EBtnSubmit_Click(object sender, EventArgs e) { if (this.Page.IsValid) { string str = this.TxtUrl.Text.Trim(); if (string.IsNullOrEmpty(str)) { AdminPage.WriteErrMsg("采集URL地址不能为空!"); } else if (str.Length < 8) { AdminPage.WriteErrMsg("采集URL不是有效的URL地址!"); } else if (str.Substring(0, 7) != "http://") { AdminPage.WriteErrMsg("采集URL不是有效的URL地址!"); } else { bool flag; CollectionItemInfo collectionItemInfo = new CollectionItemInfo(); collectionItemInfo.ItemName = this.TxtItemName.Text; collectionItemInfo.NodeId = DataConverter.CLng(this.NodeType1.FieldValue); collectionItemInfo.InfoNodeId = this.NodeType1.InfoNodeId; collectionItemInfo.Url = str; collectionItemInfo.UrlName = this.TxtWebSite.Text; collectionItemInfo.CodeType = this.RadlCodeType.SelectedValue; collectionItemInfo.MaxNum = DataConverter.CLng(this.TxtMaxNum.Text); collectionItemInfo.OrderType = DataConverter.CLng(this.RadlOrder.SelectedValue); collectionItemInfo.Intro = this.TxtIntro.Text; collectionItemInfo.SpecialId = this.SpecialId.FieldValue; collectionItemInfo.AutoCreateHtml = DataConverter.CBoolean(this.RadlAutoCreateHtml.SelectedValue); bool flag2 = false; if (this.HdnAction.Value == "Modify") { collectionItemInfo.ItemId = BasePage.RequestInt32("ItemID"); collectionItemInfo.ModelId = DataConverter.CLng(this.HiddenModel.Value); collectionItemInfo.Detection = DataConverter.CBoolean(this.HdnDetection.Value); if (collectionItemInfo.ItemName == this.HdnItemName.Value) { flag = false; } else { flag = CollectionItem.Exists(collectionItemInfo.ItemName); } } else { collectionItemInfo.Detection = false; collectionItemInfo.ModelId = DataConverter.CLng(this.DropModelId.SelectedValue); flag = CollectionItem.Exists(collectionItemInfo.ItemName); } if (flag) { AdminPage.WriteErrMsg("<li>数据库中已经存在此采集项目!</li>"); } if (this.HdnAction.Value == "Modify") { flag2 = CollectionItem.Update(collectionItemInfo); } else { flag2 = CollectionItem.Add(collectionItemInfo); } if (flag2) { BasePage.ResponseRedirect("ConfigStep2.aspx?Action=" + this.HdnAction.Value + "&ItemId=" + collectionItemInfo.ItemId.ToString()); } else { AdminPage.WriteErrMsg("保存采集配置第一步失败!"); } } } }