public List <MESSAGE> DataToMessage(DataTable dt) { List <MESSAGE> list = new List <MESSAGE>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { MESSAGE m = new MESSAGE(); m.S_TELEPHONE = dt.Rows[i]["S_TELEPHONE"].ToString(); m.S_SYSID = dt.Rows[i]["S_SYSID"].ToString(); m.U_SYSID = dt.Rows[i]["U_SYSID"].ToString(); m.S_SENDDATE = dt.Rows[i]["S_SENDDATE"].ToString(); m.S_MESSAGE = dt.Rows[i]["S_MESSAGE"].ToString(); List <USER> lu = new T_USER_SQL(connstring).Get_User(dt.Rows[i]["U_SYSID"].ToString()); if (lu.Count > 0) { m.USER = lu[0]; } else { USER u = new USER(); u.U_NAME = "测试"; m.USER = u; } m.S_COMMIT = dt.Rows[i]["S_COMMIT"].ToString(); m.NUM = dt.Rows[i]["NUM"].ToString(); m.S_FLAG = dt.Rows[i]["S_FLAG"].ToString(); m.S_NUM = dt.Rows[i]["S_NUM"].ToString(); list.Add(m); } } return(list); }
public List <PREPAID_HIS> DataToPrepaid(DataTable dt) { List <PREPAID_HIS> list = new List <PREPAID_HIS>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { List <USER> lu = new T_USER_SQL(connstring).Get_User(dt.Rows[i]["U_SYSID"].ToString()); PREPAID_HIS p = new PREPAID_HIS { U_SYSID = dt.Rows[i]["U_SYSID"].ToString(), USER = lu.Count > 0 ? lu[0] : new USER(), P_AMOUNT = dt.Rows[i]["P_AMOUNT"].ToString(), P_FREEMESSAGE = dt.Rows[i]["P_FREEMESSAGE"].ToString(), P_DATE = dt.Rows[i]["P_DATE"].ToString(), P_SYSID = dt.Rows[i]["P_SYSID"].ToString(), P_TYPE = dt.Rows[i]["P_TYPE"].ToString(), P_ISDEL = dt.Rows[i]["P_ISDEL"].ToString(), NUM = dt.Rows[i]["NUM"].ToString() }; list.Add(p); } } return(list); }
public List <DEBIT_HIS> DataToDebit(DataTable dt) { List <DEBIT_HIS> list = new List <DEBIT_HIS>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { List <USER> lu = new T_USER_SQL(connstring).Get_User(dt.Rows[i]["U_SYSID"].ToString()); DEBIT_HIS d = new DEBIT_HIS { U_SYSID = dt.Rows[i]["U_SYSID"].ToString(), D_AMOUNT = dt.Rows[i]["D_AMOUNT"].ToString(), D_REASON = dt.Rows[i]["D_REASON"].ToString(), D_ISDEL = dt.Rows[i]["D_ISDEL"].ToString(), D_DATE = dt.Rows[i]["D_DATE"].ToString(), D_SYSID = dt.Rows[i]["D_SYSID"].ToString(), USER = lu.Count > 0 ? lu[0] : new USER(), NUM = dt.Rows[i]["NUM"].ToString() }; list.Add(d); } } return(list); }
public List <BORROW> DataToCustomer(DataTable dt, bool flag) { List <BORROW> list = new List <BORROW>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { BORROW b = new BORROW(); b.NUM = dt.Rows[i]["NUM"].ToString(); b.B_SYSID = dt.Rows[i]["B_SYSID"].ToString(); b.U_SYSID = dt.Rows[i]["U_SYSID"].ToString(); b.C_NAME = dt.Rows[i]["C_NAME"].ToString(); b.C_ID = dt.Rows[i]["C_ID"].ToString(); if (flag) { if (dt.Rows[i]["C_PIC"].ToString() == "") { b.C_PIC = null; } else { b.C_PIC = (byte[])dt.Rows[i]["C_PIC"]; } } b.C_CONTACT = dt.Rows[i]["C_CONTACT"].ToString(); b.C_EMERGENCY = dt.Rows[i]["C_EMERGENCY"].ToString(); b.C_ADDRESS = dt.Rows[i]["C_ADDRESS"].ToString(); b.C_SEX = dt.Rows[i]["C_SEX"].ToString(); b.G_NAME1 = dt.Rows[i]["G_NAME1"].ToString(); b.G_ID1 = dt.Rows[i]["G_ID1"].ToString(); b.G_JOB1 = dt.Rows[i]["G_JOB1"].ToString(); b.G_NAME2 = dt.Rows[i]["G_NAME2"].ToString(); b.G_ID2 = dt.Rows[i]["G_ID2"].ToString(); b.G_JOB2 = dt.Rows[i]["G_JOB2"].ToString(); b.G_NAME3 = dt.Rows[i]["G_NAME3"].ToString(); b.G_ID3 = dt.Rows[i]["G_ID3"].ToString(); b.G_JOB3 = dt.Rows[i]["G_JOB3"].ToString(); b.G_NAME4 = dt.Rows[i]["G_NAME4"].ToString(); b.G_ID4 = dt.Rows[i]["G_ID4"].ToString(); b.G_JOB4 = dt.Rows[i]["G_JOB4"].ToString(); b.B_AMOUNT = dt.Rows[i]["B_AMOUNT"].ToString(); b.B_REPAYMENT = dt.Rows[i]["B_REPAYMENT"].ToString(); //b.B_REPAYMENT = new T_REPAY_HIS_SQL(connstring).GetRepayAmount(b.B_SYSID); b.B_INTEREST = dt.Rows[i]["B_INTEREST"].ToString(); b.B_TYPE = dt.Rows[i]["B_TYPE"].ToString(); b.B_REPAYDATE = dt.Rows[i]["B_REPAYDATE"].ToString(); b.B_REMINDDATE = dt.Rows[i]["B_REMINDDATE"].ToString(); b.B_DATE = dt.Rows[i]["B_DATE"].ToString(); b.B_DATETMP = dt.Rows[i]["B_DATETMP"].ToString(); b.B_ISDEL = dt.Rows[i]["B_ISDEL"].ToString(); b.B_TERM = dt.Rows[i]["B_TERM"].ToString(); List <USER> lu = new T_USER_SQL(connstring).Get_User(dt.Rows[i]["U_SYSID"].ToString()); if (lu.Count > 0) { b.USER = lu[0]; } else { b.USER = new USER(); } b.C_EMERGENCYNAME = dt.Rows[i]["C_EMERGENCYNAME"].ToString(); b.B_REPAYTYPE = dt.Rows[i]["B_REPAYTYPE"].ToString(); list.Add(b); } } return(list); }