public ActionResult AffiliApply() { Affiliate af = new Affiliate(); Pan.Model.Affiliate model = new Pan.Model.Affiliate(); model.mobile_num = Request.Form["shouji"]; model.enterprise_type = Request.Form["txt_type"]; model.enterprise = Request.Form["txt_corp"]; model.time = DateTime.Now.ToString(); model.person = Request.Form["txt_name"]; model.person_post = Request.Form["txt_office"]; af.Add(model); loan.Models.common.MailSender ms = new Models.common.MailSender(); StringBuilder body = new StringBuilder(); body.Append("<div>企业类型:"); body.Append(model.enterprise_type); body.Append("</div>"); body.Append("<div>企业名称:"); body.Append(model.enterprise); body.Append("</div>"); body.Append("<div>联系人:"); body.Append(model.person); body.Append("</div>"); body.Append("<div>联系人职务:"); body.Append(model.person_post); body.Append("</div>"); body.Append("<div>手机号码:"); body.Append(model.mobile_num); body.Append("</div>"); body.Append("<div>申请日期:"); body.Append(model.time); body.Append("</div>"); ms.send("加盟申请", body.ToString()); return Content("<script>alert('申请成功,我们的工作人员会尽快跟您联系。');window.location='/Partner.html';</script>"); }
/// <summary> /// 得到一个对象实体 /// </summary> public Pan.Model.Affiliate DataRowToModel(DataRow row) { Pan.Model.Affiliate model=new Pan.Model.Affiliate(); if (row != null) { if(row["id"]!=null && row["id"].ToString()!="") { model.id=int.Parse(row["id"].ToString()); } if(row["enterprise"]!=null) { model.enterprise=row["enterprise"].ToString(); } if(row["enterprise_type"]!=null) { model.enterprise_type=row["enterprise_type"].ToString(); } if(row["person"]!=null) { model.person=row["person"].ToString(); } if(row["person_post"]!=null) { model.person_post=row["person_post"].ToString(); } if(row["mobile_num"]!=null) { model.mobile_num=row["mobile_num"].ToString(); } if(row["time"]!=null) { model.time=row["time"].ToString(); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Pan.Model.Affiliate GetModel(int id) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 id,enterprise,enterprise_type,person,person_post,mobile_num,time from Affiliate "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; Pan.Model.Affiliate model=new Pan.Model.Affiliate(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }