private List <ClaimSparePartBillDetailClass> GetTPDetail() { ClaimSparePartBillDetailClass CSPBDClass = null; List <ClaimSparePartBillDetailClass> list = new List <ClaimSparePartBillDetailClass>(); try { foreach (DataGridViewRow dgvr in dgvDetail.Rows) { CSPBDClass = new ClaimSparePartBillDetailClass(); CSPBDClass.No = dgvr.Cells["no"].Value.ToString(); CSPBDClass.Sort = dgvr.Cells["sort"].Value.ToString(); CSPBDClass.Name = dgvr.Cells["name"].Value.ToString(); CSPBDClass.Model = dgvr.Cells["model"].Value.ToString(); CSPBDClass.Unit = dgvr.Cells["unit"].Value.ToString(); CSPBDClass.UnitPrice = double.Parse(dgvr.Cells["unitPrice"].Value.ToString()); CSPBDClass.Count = int.Parse(dgvr.Cells["count"].Value.ToString()); CSPBDClass.Sum = double.Parse(dgvr.Cells["sum"].Value.ToString()); CSPBDClass.InputDate = DateTime.Parse(dgvr.Cells["inputDate"].Value.ToString()); CSPBDClass.InputMan = dgvr.Cells["inputMan"].Value.ToString(); list.Add(CSPBDClass); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { } return(list); }
/* * 方法名称:FrmSparePartClaimDetailAddNew * 方法功能描述:给新建领料单的datagridview添加行 * * 创建人:夏阳明 * 创建时间:20090323 * * 修改人: * 修改时间: * 修改内容: * */ public void FrmSparePartClaimDetailAddNew(ClaimSparePartBillDetailClass CSPBDClass, DataTable dt) { DataRow dr = dt.NewRow(); dr["no"] = CSPBDClass.No; dr["sort"] = CSPBDClass.Sort; dr["name"] = CSPBDClass.Name; dr["model"] = CSPBDClass.Model; dr["unit"] = CSPBDClass.Unit; dr["unitPrice"] = CSPBDClass.UnitPrice; dr["count"] = CSPBDClass.Count; dr["sum"] = CSPBDClass.Sum; dr["inputDate"] = CSPBDClass.InputDate; dr["inputMan"] = CSPBDClass.InputMan; dt.Rows.Add(dr); }