public void get_praise(HttpContext context) { HttpRequest Request = context.Request; long tabelID = RequestHelper.long_transfer(Request, "id"); try { //指定的一个客户 List <praise> list1 = (from t in list_All where t.id == tabelID && t.praise_isdelete == "0" select t).ToList(); if (list1.Count > 0) { jsonModel = Constant.get_jsonmodel(0, "success", ConverList <praise> .ListToDic(list1)); } } catch (Exception ex) { LogHelper.Error(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 get_remind_list(HttpContext context) { Hashtable ht = new Hashtable(); HttpRequest Request = context.Request; try { string guid = Request["guid"]; //获取当前人的联系人(进行分页) if (dic_Self.ContainsKey(guid)) { int page_Index = Convert.ToInt32(Request["PageIndex"]); int page_Size = Convert.ToInt32(Request["PageSize"]); //进行分页 List <remind> list2 = GetPageByLinq(dic_Self[guid], page_Index, page_Size); //对象集合转为dic集合列表 List <Dictionary <string, object> > dicList = ConverList <remind> .ListToDic(list2); foreach (var item in dicList) { } //返回数据 PagedDataModel <Dictionary <string, object> > psd = new PagedDataModel <Dictionary <string, object> >() { PagedData = dicList, PageIndex = page_Index, PageSize = page_Size, RowCount = list2.Count }; //数据库包(json格式) jsonModel = new JsonModel() { errNum = 0, errMsg = "success", retData = psd }; } else { bool ispage = false; if (!string.IsNullOrEmpty(context.Request["ispage"])) { ispage = Convert.ToBoolean(context.Request["ispage"]); } ht.Add("PageIndex", context.Request["PageIndex"] ?? "1"); ht.Add("PageSize", context.Request["PageSize"] ?? "10"); ht.Add("TableName", "remind"); //(select dbo.getlink_name(1) 这个是在数据库中建的函数 string fileds = "id,dbo.get_convert_date(rem_date)as rem_date,rem_content,rem_status,rem_isopen,dbo.get_am_pm(rem_date) as am_pm,dbo.get_hour_min(rem_date) as hour_min"; //新加字段fileds,主要是为了方便使用 jsonModel = Constant.remind_S.GetPage(ht, fileds, ispage, GetWhere(context)); } } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); } finally { context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取评论 /// </summary> /// <param name="context"></param> public void get_comment(HttpContext context) { HttpRequest Request = context.Request; //获取评论 long id = RequestHelper.long_transfer(Request, "id"); string type = RequestHelper.string_transfer(Request, "type"); try { //指定的一个客户 List <comment> list1 = (from t in list_All where t.com_table_id == id && t.com_type == type && t.com_isdelete == "0" select t).ToList(); if (list1.Count > 0) { jsonModel = Constant.get_jsonmodel(0, "success", ConverList <comment> .ListToDic(list1)); } } catch (Exception ex) { LogHelper.Error(ex); } finally { context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// more签到记录[2] /// </summary> /// <param name="guid"></param> /// <param name="link_list"></param> /// <param name="li"></param> private static void more_sign(string guid, linkman link_list, cust_linkman li) { try { //签到列表 List <sign_in> sign_in_selfs = sign_in_handle.dic_Self[guid]; //获取指定的客户【在自己的客户列表里获取】 List <sign_in> sign_ins = (from t in sign_in_selfs where t.sign_cust_id == li.link_cust_id orderby t.sign_date descending select t).Take(2).ToList(); List <Dictionary <string, object> > dic_sign_ins = ConverList <sign_in> .ListToDic(sign_ins); foreach (var item in dic_sign_ins) { //填入客户名称(签到) item["sign_cust_name"] = li.link_cust_name; } link_list.sign = dic_sign_ins; } catch (Exception ex) { LogHelper.Error(ex); } }
/// <summary> /// 获取提醒设置实例 /// </summary> /// <param name="context"></param> public void get_remind_setting_info(HttpContext context) { HttpRequest Request = context.Request; Hashtable ht = new Hashtable(); try { string guid = Request["guid"]; //获取当前人的联系人(进行分页) if (dic_Self.ContainsKey(guid)) { int page_Index = Convert.ToInt32(Request["PageIndex"]); int page_Size = Convert.ToInt32(Request["PageSize"]); //对象集合转为dic集合列表 List <Dictionary <string, object> > dicList = ConverList <remind_setting> .ListToDic(dic_Self[guid]); //返回数据 PagedDataModel <Dictionary <string, object> > psd = new PagedDataModel <Dictionary <string, object> >() { PagedData = dicList, PageIndex = page_Index, PageSize = page_Size, RowCount = dicList.Count }; //数据库包(json格式) jsonModel = new JsonModel() { errNum = 0, errMsg = "success", retData = psd }; } else { ht.Add("TableName", "remind_setting"); //(select dbo.getlink_name(1) 这个是在数据库中建的函数 string fileds = "*"; //新加字段fileds,主要是为了方便使用 jsonModel = Constant.remind_setting_S.GetPage(ht, fileds, false, GetWhere(context)); } } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); } finally { context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取提醒信息 /// </summary> /// <param name="context"></param> public void get_remind_info(HttpContext context) { Hashtable ht = new Hashtable(); HttpRequest Request = context.Request; string id = Request["id"]; string guid = Request["guid"]; try { //缓存应用 if (dic_Self.ContainsKey(guid)) { //指定的一个客户 List <remind> list1 = (from t in dic_Self[guid] where t.id == Convert.ToInt64(id) select t).ToList <remind>(); if (list1.Count > 0) { jsonModel = new JsonModel() { errNum = 0, errMsg = "success", retData = ConverList <remind> .ListToDic(list1) }; } } else { ht.Add("TableName", "remind"); //(select dbo.getlink_name(1) 这个是在数据库中建的函数 string fileds = "[id] ,[rem_userid],convert(varchar(100),rem_date,20) as rem_date,[rem_content],[rem_status],[rem_isopen],[rem_createdate],[rem_creator],[rem_updatedate],[rem_updateuser],[rem_isdelete],[rem_remark]"; //新加字段fileds,主要是为了方便使用 jsonModel = Constant.remind_S.GetPage(ht, fileds, false, " and id=" + id + ""); } } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); } finally { context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取图片评论和点赞 /// </summary> /// <param name="fp"></param> /// <param name="follow"></param> private static void get_picture_praise_comment(follow_up fp, follow follow) { try { #region 获取图片 if (Constant.list_picture_All != null) { //获取指定的图片【类型 和ID】 List <picture> list_picture = (from t in Constant.list_picture_All where t.pic_en_table == "follow_up" && t.pic_table_id == (int)fp.id select t).ToList(); follow.picture = ConverList <picture> .ListToDic(list_picture); } #endregion #region 获取评论 //获取指定的评论 List <comment> list_comment = (from t in comment_handle.list_All where t.com_table_id == (int)fp.id && t.com_isdelete == "0" && t.com_type == "1" select t).ToList(); follow.comment = ConverList <comment> .ListToDic(list_comment); #endregion #region 获取点赞人 List <praise> list_praise = (from t in praise_handle.list_All where t.praise_table_id == (int)fp.id && t.praise_type == "1" select t).ToList(); follow.praise = ConverList <praise> .ListToDic(list_praise); #endregion } catch (Exception ex) { LogHelper.Error(ex); } finally { } }
/// <summary> /// more跟进记录[2] /// </summary> /// <param name="guid"></param> /// <param name="link_list"></param> /// <param name="li"></param> private static void more_follow(string guid, linkman link_list, cust_linkman li) { try { //跟进记录 List <follow_up> follow_ups_selfs = follow_up_handle.dic_Self[guid]; //获取指定的跟进记录【在自己的跟进记录列表里获取,通过跟进时间做降序排列,只选取最上面的两条记录】 List <follow_up> follow_ups = (from t in follow_ups_selfs where t.follow_cust_id == li.link_cust_id && t.follow_link_id == li.id orderby t.follow_date descending select t).Take(2).ToList(); link_list.follow_up = ConverList <follow_up> .ListToDic(follow_ups); } catch (Exception ex) { LogHelper.Error(ex); } }
/// <summary> /// 获取今日工作计划(不分页) /// </summary> /// <param name="context"></param> public void get_workplan_today(HttpContext context, string guid) { HttpRequest Request = context.Request; try { DateTime now = DateTime.Now; //工作计划,当前用户 List <workplan> workplan_selfs = workplan_handle.dic_Self[guid]; //指定今日的工作计划 List <workplan> list_workplan = (from t in workplan_selfs where (Convert.ToDateTime(t.wp_plandate)).Year == now.Year && (Convert.ToDateTime(t.wp_plandate)).DayOfYear == now.DayOfYear select t).ToList(); List <Dictionary <string, object> > dic_workplan = ConverList <workplan> .ListToDic(list_workplan); //数据对应 foreach (var item in dic_workplan) { DateTime datetime_P = Convert.ToDateTime(item["wp_plandate"]); int pc = datetime_P.Hour; if (pc > 12) { item["wp_plandate"] = datetime_P.ToString("yyyy年MM月dd日"); } else { item["wp_plandate"] = datetime_P.ToString("yyyy年MM月dd日"); } } jsonModel = Constant.get_jsonmodel(0, "success", dic_workplan); } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); } finally { context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取共享圈内容 /// </summary> /// <param name="context"></param> public void get_share_list(HttpContext context) { HttpRequest Request = context.Request; //当前用户ID string guid = RequestHelper.string_transfer(Request, "guid"); try { //请求参数 bool ispage = RequestHelper.bool_transfer(Request, "ispage"); //每一页包含的数量 int PageSize = RequestHelper.int_transfer(Request, "PageSize"); //第几页 int PageIndex = RequestHelper.int_transfer(Request, "PageIndex"); //封装到PagedDataModel的元数据 List <report> report_List = new List <report>(); //进行分页 List <share> list2 = GetPageByLinq(list_All, PageIndex, PageSize); //数据对应 foreach (var fp in list2) { List <workreport> list1 = (from t in workreport_handle.list_All where t.id == Convert.ToInt64(fp.table_id) select t).ToList(); //跟进记录(对应页面的实体类型) report report = new report(); List <praise> list_praise = (from t in praise_handle.list_All where t.praise_table_id == Convert.ToInt64(fp.id) && t.praise_userid == guid && t.praise_type == "2" select t).ToList(); string is_praise = ""; if (list_praise.Count > 0) { is_praise = "1"; } else { is_praise = "0"; } //附件跟进记录(对应页面的实体类型【通过数据库映射填充实体所需部分信息】) foreach (var work_report in list1) { report.report_info = new report_info() { report_content = work_report.report_content, report_username = work_report.report_username, report_createdate = Convert.ToDateTime(work_report.report_createdate).ToString("yyyy-MM-dd"), work_report_id = Convert.ToInt64(work_report.id), report_startdate = Convert.ToDateTime(work_report.report_startdate).ToString("yyyy-MM-dd"), report_enddate = Convert.ToDateTime(work_report.report_enddate).ToString("yyyy-MM-dd"), report_plan = work_report.report_plan, is_praise = is_praise, id = Convert.ToInt32(fp.id), report_type = (int)work_report.report_type, }; } #region 获取图片 if (Constant.list_picture_All != null) { //获取指定的图片【类型 和ID】 List <picture> list_picture = (from t in Constant.list_picture_All where t.pic_en_table == "workreport" && t.pic_table_id == Convert.ToInt32(fp.id) select t).ToList <picture>(); List <Dictionary <string, object> > list_picture_1 = ConverList <picture> .ListToDic(list_picture); report.picture = list_picture_1; } #endregion #region 获取评论 var d = comment_handle.list_All.Where(i => i.com_type == "3").ToList(); //获取指定的图片【类型 和ID】 List <comment> list_p = (from t in comment_handle.list_All where t.com_table_id == Convert.ToInt32(fp.id) && t.com_isdelete == "0" && t.com_type == "3" select t).ToList <comment>(); List <Dictionary <string, object> > list = ConverList <comment> .ListToDic(list_p); report.comment = list; #endregion #region 获取点赞人 List <praise> list_praises = (from t in praise_handle.list_All where t.praise_table_id == Convert.ToInt32(fp.id) && t.praise_type == "2" select t).ToList <praise>(); List <Dictionary <string, object> > list_p1 = ConverList <praise> .ListToDic(list_praises); report.praise = list_p1; #endregion report_List.Add(report); } //返回数据 PagedDataModel <report> psd = new PagedDataModel <report>() { PagedData = report_List, PageIndex = PageIndex, PageSize = PageSize, RowCount = list_All.Count }; //数据包(json格式) jsonModel = new JsonModel() { errNum = 0, errMsg = "success", retData = psd }; } catch (Exception ex) { jsonModel = Constant.ErrorGetData(ex.Message); } finally { #region 没有缓存机制的情况下用的 //string jsonString = Constant.bbc.ConverDatetime(Constant.jss.Serialize(jsonModel)); //context.Response.Write("{\"result\":" + jsonString + "}"); #endregion string result = Constant.jss.Serialize(jsonModel); context.Response.Write("{\"result\":" + result + "}"); } }
/// <summary> /// 签到列表 /// </summary> /// <param name="context"></param> public void get_sign_list(HttpContext context, string guid) { HttpRequest Request = context.Request; try { //分页信息 int page_Index = RequestHelper.int_transfer(Request, "PageIndex"); int page_Size = RequestHelper.int_transfer(Request, "PageSize"); //開始日期 DateTime stardate = RequestHelper.DateTime_transfer(Request, "stardate"); //結束日期 DateTime enddate = RequestHelper.DateTime_transfer(Request, "enddate").AddDays(1); //部门的ID号【传参 】 string departmentID = RequestHelper.string_transfer(Request, "departmentID"); string memmberID = RequestHelper.string_transfer(Request, "memmberID"); var sign_in_selfs = from t in dic_Self[guid] select t; //指定签到客户 long sign_cust_id = RequestHelper.long_transfer(Request, "sign_cust_id"); //获取签到列表【筛选】 sign_in_selfs = get_signs_helper(stardate, enddate, sign_in_selfs, sign_cust_id); sign_in_selfs = Check_And_Get_List_dep(departmentID, memmberID, sign_in_selfs); int sign_count = sign_in_selfs.Count(); //进行分页 List <sign_in> list_sign_in_page = GetPageByLinq(sign_in_selfs.ToList(), page_Index, page_Size); //对象集合转为dic集合列表 List <Dictionary <string, object> > dicList = ConverList <sign_in> .ListToDic(list_sign_in_page); //客户列表,当前用户 List <cust_customer> cust_customer_selfs = cust_customer_handle.dic_Self[guid]; foreach (var item in dicList) { item["sign_date"] = Convert.ToDateTime(item["sign_date"]).ToString("yyyy-MM-dd HH:mm"); long sign_cust_id_c = Convert.ToInt64(item["sign_cust_id"]); cust_customer _cust_customer = (from t in cust_customer_selfs where sign_cust_id_c == (long)t.id select t).FirstOrDefault(); if (_cust_customer != null) { item.Add("cust_name", _cust_customer.cust_name); } } string status = string.Empty; //返回数据 PagedDataModel <Dictionary <string, object> > psd = new PagedDataModel <Dictionary <string, object> >() { PagedData = dicList, PageIndex = page_Index, PageSize = page_Size, RowCount = sign_count }; //数据包(json格式) jsonModel = new JsonModel() { errNum = 0, errMsg = "success", retData = psd, status = status }; } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); } finally { //管理者 if (Constant.dicLimit_P.ContainsKey(guid)) { jsonModel.status = "IsAdmin"; } context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取报告列表 /// </summary> /// <param name="context"></param> public void get_workreport_list(HttpContext context, string guid) { HttpRequest Request = context.Request; try { int page_Index = RequestHelper.int_transfer(Request, "PageIndex"); int page_Size = RequestHelper.int_transfer(Request, "PageSize"); int type = RequestHelper.int_transfer(Request, "type"); string report_reader = RequestHelper.string_transfer(Request, "report_reader"); int report_type = RequestHelper.int_transfer(Request, "report_type"); //用户ID【指定自己下属的】 string report_userid = RequestHelper.string_transfer(Request, "report_userid"); //部门的ID号【传参 】 string departmentID = RequestHelper.string_transfer(Request, "departmentID"); string memmberID = RequestHelper.string_transfer(Request, "memmberID"); //筛选报告 var workreports = select_report_list(guid, type, report_type, report_userid); workreports = Check_And_Get_List_dep(departmentID, memmberID, workreports); int workreport_count = workreports.Count(); //进行分页 List <workreport> list_workreport = GetPageByLinq(workreports.ToList(), page_Index, page_Size); //对象集合转为dic集合列表 List <Dictionary <string, object> > dicList = ConverList <workreport> .ListToDic(list_workreport); foreach (var item in dicList) { item["report_startdate"] = Convert.ToDateTime(item["report_startdate"]).ToString("yyyy-MM-dd"); item["report_enddate"] = Convert.ToDateTime(item["report_enddate"]).ToString("yyyy-MM-dd"); item["report_createdate"] = Convert.ToDateTime(item["report_createdate"]).ToString("yyyy-MM-dd"); } //返回数据 PagedDataModel <Dictionary <string, object> > psd = new PagedDataModel <Dictionary <string, object> >() { PagedData = dicList, PageIndex = page_Index, PageSize = page_Size, RowCount = workreport_count }; //数据库包(json格式) jsonModel = Constant.get_jsonmodel(0, "success", psd); } catch (Exception ex) { jsonModel = Constant.ErrorGetData(ex); } finally { //管理者 若为1 代表当前人为管理员 若为0则为普通员工 if (Constant.dicLimit_P.ContainsKey(guid)) { jsonModel.status = "IsAdmin"; } context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取联系人列表 /// </summary> /// <param name="context"></param> public void get_cust_linkman_list(HttpContext context, string guid) { HttpRequest Request = context.Request; try { int page_Index = RequestHelper.int_transfer(Request, "PageIndex"); int page_Size = RequestHelper.int_transfer(Request, "PageSize"); //通过客户信息ID号获取对应的联系人 long link_cust_id = RequestHelper.long_transfer(Request, "link_cust_id"); ////指定客户ID获取联系人【获取所有联系人】 //List<cust_linkman> list_linkman = null; //按联系人名称进行模糊搜索 string link_name = RequestHelper.string_transfer(Request, "link_name"); //部门的ID号【传参 】 string departmentID = RequestHelper.string_transfer(Request, "departmentID"); string memmberID = RequestHelper.string_transfer(Request, "memmberID"); //联系人列表,当前用户 var cust_linkman_selfs = from t in dic_Self[guid] select t; cust_linkman_selfs = Check_And_Get_List_dep(departmentID, memmberID, cust_linkman_selfs); if (link_cust_id > 0) { cust_linkman_selfs = (from t in cust_linkman_selfs where t.link_cust_id == link_cust_id && t.link_name.Contains(link_name) orderby t.id descending select t); } else { cust_linkman_selfs = (from t in cust_linkman_selfs where t.link_name.Contains(link_name) orderby t.id descending select t); } List <cust_linkman> list_linkmans = cust_linkman_selfs.ToList(); int all_count = list_linkmans.Count; //是否为页面 bool ispage = RequestHelper.bool_transfer(Request, "ispage"); if (ispage) { //进行分页 List <cust_linkman> list_linkman_page = GetPageByLinq(list_linkmans, page_Index, page_Size); //对象集合转为dic集合列表 List <Dictionary <string, object> > dic_list_linkman_page = ConverList <cust_linkman> .ListToDic(list_linkman_page); foreach (var item in dic_list_linkman_page) { string link_level = Convert.ToString(item["link_level"]); item["link_level_name"] = LevelHelper.Getlink_level(link_level); } //返回数据 PagedDataModel <Dictionary <string, object> > psd = new PagedDataModel <Dictionary <string, object> >() { PagedData = dic_list_linkman_page, PageIndex = page_Index, PageSize = page_Size, RowCount = all_count }; //数据库包(json格式) jsonModel = Constant.get_jsonmodel(0, "success", psd); } else { //数据库包(json格式)item["link_levelName"] = pub_param_handle.dic_linkMan_Grade[Convert.ToString(item["link_level"])]; jsonModel = Constant.get_jsonmodel(0, "success", list_linkmans); } } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); } finally { context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }
/// <summary> /// 获取工作计划(分页) /// </summary> /// <param name="context"></param> public void get_workplan_list(HttpContext context, string guid) { HttpRequest Request = context.Request; try { //分页信息 int page_Index = RequestHelper.int_transfer(Request, "PageIndex"); int page_Size = RequestHelper.int_transfer(Request, "PageSize"); long wp_link_id = RequestHelper.long_transfer(Request, "wp_link_id"); //部门的ID号【传参 】 string departmentID = RequestHelper.string_transfer(Request, "departmentID"); string memmberID = RequestHelper.string_transfer(Request, "memmberID"); //工作计划,当前用户 List <workplan> workplan_selfs = workplan_handle.dic_Self[guid]; //通过部门获取数据【或者纯粹获取某个成员的工作计划】 workplan_selfs = Check_And_Get_List_dep(departmentID, memmberID, workplan_selfs).ToList(); int workplan_count = workplan_selfs.Count; //进行分页 List <workplan> workplans = GetPageByLinq(workplan_selfs, page_Index, page_Size); //对象集合转为dic集合列表 List <Dictionary <string, object> > dicList = ConverList <workplan> .ListToDic(workplans); if (workplans.Count > 0) { //数据对应 foreach (var item in dicList) { DateTime datetime_P = Convert.ToDateTime(item["wp_plandate"]); int pc = datetime_P.Hour; //工作计划具体时间 下午hh:mm 上午hh:mm if (pc > 12) { item["wp_plandate"] = datetime_P.ToString("yyyy年 MM月dd日"); } else { item["wp_plandate"] = datetime_P.ToString("yyyy年 MM月dd日"); } //联系人列表,当前用户 List <cust_linkman> cust_linkman_selfs = cust_linkman_handle.dic_Self[guid]; //联系人和职位 cust_linkman linkman = (from t in cust_linkman_selfs where t.id == wp_link_id select t).FirstOrDefault(); if (linkman != null) { item["link_name"] = linkman.link_name; item["link_position"] = linkman.link_position; item["cust_name"] = linkman.link_cust_name; } } } //返回数据 PagedDataModel <Dictionary <string, object> > psd = new PagedDataModel <Dictionary <string, object> >() { PagedData = dicList, PageIndex = page_Index, PageSize = page_Size, RowCount = workplan_count }; //数据包(json格式) jsonModel = Constant.get_jsonmodel(0, "success", psd); } catch (Exception ex) { LogHelper.Error(ex); jsonModel = Constant.ErrorGetData(ex); } finally { string status = string.Empty; //管理者 if (Constant.dicLimit_P.ContainsKey(guid)) { jsonModel.status = "IsAdmin"; } context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}"); } }