/// <summary> /// 获取学生数据 /// </summary> /// <param name="context"></param> /// <returns></returns> public ResponeDataEntity GetStudentData(HttpContext context, JObject ob) { string user = Convert.ToString(context.Session["UserName"]); string pagesize = ob["pageSize"].ToString(); string pageindex = ob["pageIndex"].ToString(); string mPhone = ob["mPhone"].ToString(); ResponeDataEntity entity = new ResponeDataEntity(); entity.Status = 1; StudentViewModel svmodel = new StudentViewModel(); try { logHelper.logInfo(" GetStudentData params:pagesize:" + pagesize + " pageindex:" + pageindex + " mPhone:" + mPhone); IList <Hashtable> list = stubll.List(Convert.ToInt32(pageindex), Convert.ToInt32(pagesize), mPhone); List <Entity.ContactEntity> contactList = null; MechanicalEntity mechEntity = new BLL.MechanicalBLL().GetEntityByImei(mPhone); Entity.GradeEntity gEntity = new BLL.GradeBLL().GetEntity(mechEntity.Gid); if (gEntity == null) { throw new Exception("请检查设备所在班级,无此设备的班级数据!"); } if (list != null && list.Count > 0) { contactList = new BLL.ContactBLL().GetEntitysBySids(list.Select(l => Convert.ToInt32(l["Sid"])).ToArray()); List <object> reuslts = new List <object>(); List <Entity.ContactEntity> temp = null; foreach (var item in list) { temp = contactList.Where(c => c.Sid == Convert.ToInt32(item["Sid"])).ToList(); if (temp == null) { temp = new List <ContactEntity>(); } reuslts.Add( new { Sname = item["Sname"].ToString(), Snumber = item["Snumber"].ToString(), Gid = item["Gid"].ToString(), Cphone = temp.Select(t => new { name = t.CPhoneName, phone = t.Cphone }) }); } //entity.Data = reuslts; svmodel.Student = reuslts; svmodel.MechPhone = mechEntity.MechPhone; svmodel.ClassName = gEntity.Gname; } } catch (Exception ex) { entity.Status = 0; entity.Msg = ex.Message; } entity.Data = svmodel; return(entity); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string schoolnumber = HttpContext.Current.Request.QueryString["schoolnumber"]; string datetime = HttpContext.Current.Request.QueryString["datetime"]; string pageindex = HttpContext.Current.Request.QueryString["pageindex"]; string pagesize = HttpContext.Current.Request.QueryString["pagesize"]; if (string.IsNullOrEmpty(schoolnumber) && string.IsNullOrEmpty(datetime)) { try { JObject ob = StreamToString(HttpContext.Current.Request.InputStream); if (ob["schoolnumber"] != null && ob["datetime"] != null) { schoolnumber = ob["schoolnumber"].ToString(); datetime = ob["datetime"].ToString(); } } catch (Exception ex) { } } logHelper.logInfo(" phonelist params:schoolnumber:" + schoolnumber + " datetime:" + datetime); //获取情亲号 BLL.ContactBLL cbll = new BLL.ContactBLL(); IList <Hashtable> list = cbll.GetPhoneListBySchoolAndDate(schoolnumber, datetime, pageindex, pagesize); List <string> resultList = new List <string>(); if (list != null && list.Count > 0) { resultList.Add("[" + list[0]["Total"] + "]"); resultList.Add("[" + list[0]["MaxDate"] + "]"); foreach (var item in list) { resultList.Add("[" + item["Cphone"].ToString() + "]"); } resultList.Add("[END]"); } else { //如果没查询结果,则查询情亲号最大的修改时间。 Hashtable ht = cbll.GetMaxCreatTime(); if (ht != null && ht["CreatDate"] != null) { resultList.Add("[" + ht["CreatDate"].ToString() + "]"); } resultList.Add("[NO RECORD]"); } context.Response.Write(string.Join(",", resultList)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string schoolnumber = HttpContext.Current.Request.QueryString["schoolnumber"]; string phonenum = HttpContext.Current.Request.QueryString["phonenum"]; if (string.IsNullOrEmpty(schoolnumber) && string.IsNullOrEmpty(phonenum)) { try { JObject ob = StreamToString(HttpContext.Current.Request.InputStream); if (ob["schoolnumber"] != null && ob["phonenum"] != null) { schoolnumber = ob["schoolnumber"].ToString(); phonenum = ob["phonenum"].ToString(); } } catch (Exception ex) { } } logHelper.logInfo(" phonelist params:schoolnumber:" + schoolnumber + " phonenum:" + phonenum); //获取情亲号 BLL.ContactBLL cbll = new BLL.ContactBLL(); Hashtable list = cbll.GetPhoneListBySchoolAndPhonenum(schoolnumber, phonenum); List <string> resultList = new List <string>(); if (list != null && !string.IsNullOrEmpty(list["Cphone"].ToString())) { resultList.Add("Result:True"); } else { resultList.Add("Result:False"); } context.Response.Write(string.Join(",", resultList)); }