/// <summary> /// 添加Address表行数据(如主键为非自增型字段,则自行修改代码) /// </summary> /// <param name="addressdata">数据集对象</param> /// <param name="address">实体对象</param> public void AddRow(ref AddressData addressdata, EntityAddress address) { #region DataRow dr = addressdata.Tables[0].NewRow(); addressdata.Assign(dr, AddressData.addrId, address.addrId); addressdata.Assign(dr, AddressData.addrName, address.addrName); addressdata.Assign(dr, AddressData.parentId, address.parentId); addressdata.Assign(dr, AddressData.usable, address.usable); addressdata.Tables[0].Rows.Add(dr); #endregion }
/// <summary> /// 编辑addressdata数据集中指定的行数据 /// </summary> /// <param name="addressdata">数据集对象</param> /// <param name="address">实体对象</param> public void EditRow(ref AddressData addressdata, EntityAddress address) { #region if (addressdata.Tables[0].Rows.Count <= 0) { addressdata = this.getData(address.addrId); } DataRow dr = addressdata.Tables[0].Rows.Find(new object[1] { address.addrId }); addressdata.Assign(dr, AddressData.addrId, address.addrId); addressdata.Assign(dr, AddressData.addrName, address.addrName); addressdata.Assign(dr, AddressData.parentId, address.parentId); addressdata.Assign(dr, AddressData.usable, address.usable); #endregion }