public void ProcessRequest(HttpContext context) { HttpRequest Request = context.Request; string func = RequestHelper.string_transfer(Request, "func"); try { //全局初始化 Constant.Fill_All_Data(context); //当前用户ID string guid = RequestHelper.string_transfer(Request, "guid"); if (Data_check_helper.check_Self(handertype, guid)) { switch (func) { case "get_workplan_today": get_workplan_today(context, guid); break; case "get_workplan_list": get_workplan_list(context, guid); break; case "get_workplan_info": get_workplan_info(context, guid); break; case "edit_workplan": edit_workplan(context, guid); break; case "update_workplan_isopen": update_workplan_isopen(context, guid); break; case "update_workplan_isdelete": update_workplan_isdelete(context, guid); break; default: jsonModel = Constant.get_jsonmodel(5, "没有此方法", ""); context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); break; } } else { jsonModel = Constant.get_jsonmodel(5, "请到首页进行刷新", ""); } } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取客户列表 /// </summary> /// <param name="context"></param> public void get_cust_list(HttpContext context, string guid) { HttpRequest Request = context.Request; try { //我的跟进GUID string is_self_guid = RequestHelper.string_transfer(Request, "is_self_guid"); string riqi = RequestHelper.string_transfer(Request, "riqi"); string departmentID = RequestHelper.string_transfer(Request, "departmentID"); string memmberID = RequestHelper.string_transfer(Request, "memmberID"); if (Data_check_helper.check_Self(handertype, guid)) { //对象集合转为dic集合列表 List <cust_customer> cust_customers = null; //客户列表,当前用户 List <cust_customer> cust_customer_selfs = cust_customer_handle.dic_Self[guid]; //跟进列表 IEnumerable <follow_up> follow_selfs = GetPage_Helper(dic_Self[guid], 0, 0, riqi, is_self_guid); follow_selfs = Check_And_Get_List_dep(departmentID, memmberID, follow_selfs); if (!string.IsNullOrEmpty(is_self_guid)) { //对象集合转为dic集合列表 cust_customers = (from t in cust_customer_selfs join c in follow_selfs on t.id equals c.follow_cust_id where c.follow_userid == is_self_guid select t ).Distinct().ToList(); } else { //对象集合转为dic集合列表 cust_customers = (from t in cust_customer_selfs join c in follow_selfs on t.id equals c.follow_cust_id where c.follow_cust_id == t.id select t ).Distinct().ToList(); } jsonModel = Constant.get_jsonmodel(0, "success", cust_customers); } } catch (Exception ex) { jsonModel = Constant.ErrorGetData(ex); } finally { //时间转换 string jsonString = Constant.bbc.ConverDatetime(Constant.jss.Serialize(jsonModel)); context.Response.Write("{\"result\":" + jsonString + "}"); } }
/// <summary> /// /中心入口点 /// </summary> /// <param name="context"></param> public void ProcessRequest(HttpContext context) { HttpRequest Request = context.Request; string func = RequestHelper.string_transfer(Request, "func"); try { //全局初始化 Constant.Fill_All_Data(context); //当前用户ID string guid = RequestHelper.string_transfer(Request, "guid"); if (Data_check_helper.check_Self(handertype, guid)) { switch (func) { case "get_follow_up_list": get_follow_up_list(context, guid); break; case "get_follow_up": get_follow_up(context, guid); break; case "add_follow_up": add_follow_up(context, guid); break; case "get_cust_list": get_cust_list(context, guid); break; default: jsonModel = Constant.get_jsonmodel(5, "没有此方法", ""); context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); break; } } else { jsonModel = Constant.get_jsonmodel(5, "请到首页进行刷新", ""); } } catch (Exception ex) { jsonModel = Constant.ErrorGetData(ex); context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取跟进记录列表 /// </summary> /// <param name="context"></param> public void get_follow_up_list(HttpContext context, string guid) { HttpRequest Request = context.Request; try { //缓存应用 if (Data_check_helper.check_Self(handertype, guid)) { //是否分页 bool ispage = RequestHelper.bool_transfer(Request, "ispage"); //每一页包含的数量 int PageSize = RequestHelper.int_transfer(Request, "PageSize"); //第几页 int PageIndex = RequestHelper.int_transfer(Request, "PageIndex"); //封装到PagedDataModel的元数据 List <follow> follow_List = new List <follow>(); //跟进客户的客户ID int follow_cust_id = RequestHelper.int_transfer(Request, "follow_cust_id"); //跟进客户的联系人ID int link_l_id = RequestHelper.int_transfer(Request, "link_id"); //筛选日期 string riqi = RequestHelper.string_transfer(Request, "riqi"); //我的跟进GUID string is_self_guid = RequestHelper.string_transfer(Request, "is_self_guid"); //部门的ID号【传参 】 string departmentID = RequestHelper.string_transfer(Request, "departmentID"); string memmberID = RequestHelper.string_transfer(Request, "memmberID"); var data_list = from t in dic_Self[guid] select t; data_list = Check_And_Get_List_dep(departmentID, memmberID, data_list); List <follow_up> follow_ups = GetPage_Helper(data_list, follow_cust_id, link_l_id, riqi, is_self_guid).ToList(); int follow_count = follow_ups.Count; follow_ups = follow_ups.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList(); //数据对应 foreach (var fp in follow_ups) { //跟进记录(对应页面的实体类型) follow follow = new follow(); //评论数量 int list_praise_count = praise_handle.list_All.Count(t => t.praise_table_id == (long)fp.id && t.praise_userid == guid && t.praise_type == "1"); //是否包含评论 string is_praise = list_praise_count > 0 ? "1" : "0"; //附件跟进记录(对应页面的实体类型【通过数据库映射填充实体所需部分信息】) int picture_count = 0; if (Constant.list_picture_All != null) { //获取指定的图片【类型 和ID】 picture_count = Constant.list_picture_All.Count(t => t.pic_en_table == "follow_up" && t.pic_table_id == Convert.ToInt32(fp.id)); } follow.follow_up_info = new follow_up_info() { follow_content = fp.follow_content, follow_cust_id = (long)fp.follow_cust_id, follow_date = ((DateTime)fp.follow_date).ToString("yyyy-MM-dd"), follow_link_id = (long)fp.follow_link_id, follow_username = fp.follow_username, is_praise = is_praise, id = (long)fp.id, picture_count = picture_count, follow_createdate = Convert.ToString(fp.follow_createdate), }; //获取跟进类型 string type_string = Convert.ToString(fp.follow_type); if (!string.IsNullOrEmpty(type_string) && pub_param_handle.dic_follow_Level.ContainsKey(type_string)) { follow.follow_up_info.follow_type = pub_param_handle.dic_follow_Level[type_string]; } //获取客户和联系人 get_customer_linkman(guid, fp, follow); //获取图片评论和点赞 get_picture_praise_comment(fp, follow); follow_List.Add(follow); } //返回数据 PagedDataModel <follow> psd = new PagedDataModel <follow>() { PagedData = follow_List, PageIndex = PageIndex, PageSize = PageSize, RowCount = follow_count }; //数据包(json格式) jsonModel = new JsonModel() { errNum = 0, errMsg = "success", retData = psd }; } } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex.Message); } finally { if (Constant.dicLimit_P.ContainsKey(guid)) { jsonModel.status = "IsAdmin"; } string result = Constant.jss.Serialize(jsonModel); context.Response.Write("{\"result\":" + result + "}"); } }