public Maticsoft.Model.Ms.ThumbnailSize DataRowToModel(DataRow row) { Maticsoft.Model.Ms.ThumbnailSize size = new Maticsoft.Model.Ms.ThumbnailSize(); if (row != null) { if (row["ThumName"] != null) { size.ThumName = row["ThumName"].ToString(); } if ((row["ThumWidth"] != null) && (row["ThumWidth"].ToString() != "")) { size.ThumWidth = int.Parse(row["ThumWidth"].ToString()); } if ((row["ThumHeight"] != null) && (row["ThumHeight"].ToString() != "")) { size.ThumHeight = int.Parse(row["ThumHeight"].ToString()); } if ((row["Type"] != null) && (row["Type"].ToString() != "")) { size.Type = int.Parse(row["Type"].ToString()); } if (row["Remark"] != null) { size.Remark = row["Remark"].ToString(); } if (row["CloudSizeName"] != null) { size.CloudSizeName = row["CloudSizeName"].ToString(); } if ((row["CloudType"] != null) && (row["CloudType"].ToString() != "")) { size.CloudType = int.Parse(row["CloudType"].ToString()); } if ((row["ThumMode"] != null) && (row["ThumMode"].ToString() != "")) { size.ThumMode = int.Parse(row["ThumMode"].ToString()); } if ((row["IsWatermark"] != null) && (row["IsWatermark"].ToString() != "")) { if ((row["IsWatermark"].ToString() == "1") || (row["IsWatermark"].ToString().ToLower() == "true")) { size.IsWatermark = true; } else { size.IsWatermark = false; } } if (row["Theme"] != null) { size.Theme = row["Theme"].ToString(); } } return size; }
public void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.tName.Text)) { MessageBox.ShowSuccessTip(this, "请填写缩略图尺寸名称"); } else if (this.thumBll.Exists(this.tName.Text.Trim())) { MessageBox.ShowSuccessTip(this, "已存在该缩略图尺寸名称,请重新填写"); } else { Maticsoft.Model.Ms.ThumbnailSize model = new Maticsoft.Model.Ms.ThumbnailSize { Type = Globals.SafeInt(this.ddlType.SelectedValue, 0), ThumName = this.tName.Text.Trim(), ThumWidth = Globals.SafeInt(this.tWidth.Text, 1), ThumHeight = Globals.SafeInt(this.tHeight.Text, 1), Remark = this.tDesc.Text.Trim(), CloudSizeName = this.tCloudSizeName.Text, CloudType = 0, Theme = this.ddlTheme.SelectedValue.Trim(), ThumMode = Globals.SafeInt(this.ddlThumMode.SelectedValue, 0), IsWatermark = false }; if (this.thumBll.Add(model)) { base.Response.Redirect("ThumSizeList.aspx"); } else { MessageBox.ShowFailTip(this, "添加失败!请重试。"); } } }