public ActionResult OnSetKanyuanData(string kindergartenName, string name, string gender, string birth, string relateName, string relation, string phoneNumber, string address, string isYoueryuan, string desire, string joinLottery, string ruyuanDate, string isAppointment, string appointmentDate, string relateGender, string haveReceiver, string receiverName, string needSchoolBus, string sessionId) { StatusReport sr = new StatusReport(); //如果未指定幼儿园,返回错误信息 if (string.IsNullOrEmpty(kindergartenName)) { sr.status = "Fail"; sr.result = "未指定幼儿园"; return(Json(sr)); } //如果姓名或联系方式为空,返回错误信息 if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(phoneNumber)) { sr.status = "Fail"; sr.result = "姓名和联系电话不能为空"; return(Json(sr)); } if (string.IsNullOrEmpty(sessionId)) { sr.status = "Fail"; sr.result = "sessionId不存在"; sr.parameters = sessionId; return(Json(sr)); } SessionBag sessionBag = null; sessionBag = SessionContainer.GetSession(sessionId); if (sessionBag == null) { sr.status = "Fail"; sr.result = "session已失效"; return(Json(sr)); } string openId = sessionBag.OpenId; sr = WXUserDal.SetUserInfo(openId, relateName, phoneNumber, kindergartenName, name, relation); //如果提交的数据满足条件,调用KanyuanDataDal.SetKanyuanData方法,将数据存入数据库中 sr = KanyuanDataDal.SetKanyuanData(kindergartenName, name, gender, birth, relateName, relation, phoneNumber, address, isYoueryuan, desire, joinLottery, ruyuanDate, isAppointment, appointmentDate, relateGender, haveReceiver, receiverName, needSchoolBus, openId); return(Json(sr)); }
public ActionResult OnGetKanyuanData(string kindergartenName, string sessionId) { StatusReport sr = new StatusReport(); //如果未指定幼儿园,返回错误信息 if (string.IsNullOrEmpty(kindergartenName)) { sr.status = "Fail"; sr.result = "未指定幼儿园"; return(Json(sr)); } //如果姓名或联系方式为空,返回错误信息 //if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(phoneNumber)) //{ // sr.status = "Fail"; // sr.result = "姓名和联系电话不能为空"; // return Json(sr); //} if (string.IsNullOrEmpty(sessionId)) { sr.status = "Fail"; sr.result = "sessionId不存在"; sr.parameters = sessionId; return(Json(sr)); } SessionBag sessionBag = null; sessionBag = SessionContainer.GetSession(sessionId); if (sessionBag == null) { sr.status = "Fail"; sr.result = "session已失效"; return(Json(sr)); } string openId = sessionBag.OpenId; //如果提交的数据满足条件,调用KanyuanDataDal.GetKanyuanData方法,在数据库中获取满足条件的数据 sr = KanyuanDataDal.GetKanyuanData(kindergartenName, openId); return(Json(sr)); }