/// <summary> /// 得到一个对象实体 /// </summary> public Pan.Model.Investment DataRowToModel(DataRow row) { Pan.Model.Investment model=new Pan.Model.Investment(); if (row != null) { if(row["id"]!=null && row["id"].ToString()!="") { model.id=int.Parse(row["id"].ToString()); } if(row["name"]!=null) { model.name=row["name"].ToString(); } if(row["sex"]!=null) { model.sex=row["sex"].ToString(); } if(row["mobile_num"]!=null) { model.mobile_num=row["mobile_num"].ToString(); } if(row["i_num"]!=null && row["i_num"].ToString()!="") { model.i_num=int.Parse(row["i_num"].ToString()); } if(row["limit_date"]!=null) { model.limit_date=row["limit_date"].ToString(); } if(row["time"]!=null) { model.time=row["time"].ToString(); } } return model; }
public ActionResult InvesApply() { Investment i = new Investment(); Pan.Model.Investment inves = new Pan.Model.Investment(); inves.mobile_num = Request.Form["shouji"]; inves.name = Request.Form["chengwei"]; inves.sex = Request.Form["gender"]; inves.time = DateTime.Now.ToString(); inves.limit_date = Request.Form["qixian"]; inves.i_num = int.Parse(Request.Form["amount"]); i.Add(inves); loan.Models.common.MailSender ms = new Models.common.MailSender(); StringBuilder body = new StringBuilder(); body.Append("<div>姓名:"); body.Append(Request.Form["chengwei"]); body.Append("</div>"); body.Append("<div>性别:"); body.Append(Request.Form["gender"]); body.Append("</div>"); body.Append("<div>联系方式:"); body.Append(Request.Form["shouji"]); body.Append("</div>"); body.Append("<div>贷款金额:"); body.Append(Request.Form["amount"]); body.Append("</div>"); body.Append("<div>贷款期限:"); body.Append(Request.Form["qixian"]); body.Append("</div>"); body.Append("<div>申请日期:"); body.Append(inves.time); body.Append("</div>"); ms.send("理财申请", body.ToString()); return Content("<script>alert('申请成功,我们的工作人员会尽快跟您联系。');window.location='/Zhiyingbao.html';</script>"); }
/// <summary> /// 得到一个对象实体 /// </summary> public Pan.Model.Investment GetModel(int id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 id,name,sex,mobile_num,i_num,limit_date,time from Investment "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; Pan.Model.Investment model=new Pan.Model.Investment(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }