public void btnSave_Click(object sender, EventArgs e) { string msg = ""; if (this.txtWebSiteName.Text.Trim().Length == 0) { msg = msg + @"商品来源网站的名称不能为空!\n"; } if (this.txtWebSiteUrl.Text.Trim().Length == 0) { msg = msg + @"商品来源网站的url不能为空!\n"; } if (this.txtWebSiteLogo.Text.Trim().Length == 0) { msg = msg + @"网站的log,在单品也链接到此不能为空!\n"; } if (this.txtCategoryTags.Text.Trim().Length == 0) { msg = msg + @"采集时商品类别匹配的正则表达式不能为空!\n"; } if (this.txtPriceTags.Text.Trim().Length == 0) { msg = msg + @"采集时商品价格匹配的正则表达式不能为空!\n"; } if (this.txtImagesTag.Text.Trim().Length == 0) { msg = msg + @"采集时图片匹配的正则表达式不能为空!\n"; } if (!PageValidate.IsNumber(this.txtStatus.Text)) { msg = msg + @"状态格式错误!\n"; } if (msg != "") { MessageBox.Show(this, msg); } else { int num = int.Parse(this.lblID.Text); string text = this.txtWebSiteName.Text; string str3 = this.txtWebSiteUrl.Text; string str4 = this.txtWebSiteLogo.Text; string str5 = this.txtCategoryTags.Text; string str6 = this.txtPriceTags.Text; string str7 = this.txtImagesTag.Text; int num2 = int.Parse(this.txtStatus.Text); Maticsoft.Model.SNS.ProductSources model = new Maticsoft.Model.SNS.ProductSources { ID = num, WebSiteName = text, WebSiteUrl = str3, WebSiteLogo = str4, CategoryTags = str5, PriceTags = str6, ImagesTag = str7, Status = num2 }; new Maticsoft.BLL.SNS.ProductSources().Update(model); MessageBox.ShowSuccessTip(this, "保存成功!", "list.aspx"); } }
public Maticsoft.Model.SNS.ProductSources DataRowToModel(DataRow row) { Maticsoft.Model.SNS.ProductSources sources = new Maticsoft.Model.SNS.ProductSources(); if (row != null) { if ((row["ID"] != null) && (row["ID"].ToString() != "")) { sources.ID = int.Parse(row["ID"].ToString()); } if (row["WebSiteName"] != null) { sources.WebSiteName = row["WebSiteName"].ToString(); } if (row["WebSiteUrl"] != null) { sources.WebSiteUrl = row["WebSiteUrl"].ToString(); } if (row["WebSiteLogo"] != null) { sources.WebSiteLogo = row["WebSiteLogo"].ToString(); } if (row["CategoryTags"] != null) { sources.CategoryTags = row["CategoryTags"].ToString(); } if (row["PriceTags"] != null) { sources.PriceTags = row["PriceTags"].ToString(); } if (row["ImagesTag"] != null) { sources.ImagesTag = row["ImagesTag"].ToString(); } if ((row["Status"] != null) && (row["Status"].ToString() != "")) { sources.Status = int.Parse(row["Status"].ToString()); } } return sources; }