public List <REPAY_HIS> DataToRepay(DataTable dt) { List <REPAY_HIS> list = new List <REPAY_HIS>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { REPAY_HIS r = new REPAY_HIS(); r.B_SYSID = dt.Rows[i]["B_SYSID"].ToString(); r.R_AMOUNT = dt.Rows[i]["R_AMOUNT"].ToString(); r.R_TYPE = dt.Rows[i]["R_TYPE"].ToString(); r.R_FINE = dt.Rows[i]["R_FINE"].ToString(); r.R_DATE = dt.Rows[i]["R_DATE"].ToString(); r.R_ISDEL = dt.Rows[i]["R_ISDEL"].ToString(); r.R_SYSID = dt.Rows[i]["R_SYSID"].ToString(); r.R_INTEREST = dt.Rows[i]["R_INTEREST"].ToString(); List <BORROW> lb = new T_BORROW_SQL(connstring).Get_Borrow(dt.Rows[i]["B_SYSID"].ToString()); if (lb.Count > 0) { r.BORROW = lb[0]; } else { r.BORROW = new BORROW(); } r.NUM = dt.Rows[i]["NUM"].ToString(); list.Add(r); } } return(list); }