public void btnSave_Click(object sender, EventArgs e) { int num = Globals.SafeInt(this.txtLookupListId.Value, 0); Maticsoft.Model.Shop.Order.OrderLookupList model = new Maticsoft.Model.Shop.Order.OrderLookupList { SelectMode = Globals.SafeInt(this.ddlType.SelectedValue, 1), Name = this.tName.Text.Trim(), Description = this.tDesc.Text.Trim() }; if (num > 0) { model.LookupListId = num; if (this.bll.Update(model)) { this.tName.Text = ""; this.tDesc.Text = ""; this.txtLookupListId.Value = ""; this.ddlType.SelectedValue = "1"; this.gridView.OnBind(); } else { MessageBox.ShowFailTip(this, "编辑失败!请重试。"); } } else if (this.bll.Add(model) > 0) { this.gridView.OnBind(); } else { MessageBox.ShowFailTip(this, "添加失败!请重试。"); } }
public Maticsoft.Model.Shop.Order.OrderLookupList DataRowToModel(DataRow row) { Maticsoft.Model.Shop.Order.OrderLookupList list = new Maticsoft.Model.Shop.Order.OrderLookupList(); if (row != null) { if ((row["LookupListId"] != null) && (row["LookupListId"].ToString() != "")) { list.LookupListId = int.Parse(row["LookupListId"].ToString()); } if (row["Name"] != null) { list.Name = row["Name"].ToString(); } if ((row["SelectMode"] != null) && (row["SelectMode"].ToString() != "")) { list.SelectMode = int.Parse(row["SelectMode"].ToString()); } if (row["Description"] != null) { list.Description = row["Description"].ToString(); } } return list; }