Esempio n. 1
0
        /// <summary>
        /// 获取联系人信息
        /// </summary>
        /// <param name="context"></param>
        public void get_cust_linkman_info(HttpContext context, string guid)
        {
            HttpRequest Request = context.Request;
            long        id      = RequestHelper.int_transfer(Request, "id");

            try
            {
                //联系人列表,当前用户
                List <cust_linkman> cust_linkman_selfs = dic_Self[guid];
                //指定的一个联系人
                cust_linkman select_linkman = (from t in cust_linkman_selfs
                                               where t.id == id
                                               select t).FirstOrDefault();
                if (select_linkman != null)
                {
                    Dictionary <string, object> item = ConverList <cust_linkman> .T_ToDic(select_linkman);

                    //联系人名称
                    string link_levelName = Convert.ToString(item["link_level"]);
                    item["link_levelName"] = LevelHelper.Getlink_level(link_levelName);
                    //生日
                    DateTime datetime_P = Convert.ToDateTime(item["link_birthday"]);
                    item["link_birthday"] = datetime_P.ToString("yyyy-MM-dd") == "1800-01-01" ? "" : datetime_P.ToString("yyyy-MM-dd");

                    jsonModel = Constant.get_jsonmodel(0, "success", item);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
                jsonModel = Constant.ErrorGetData(ex);
            }
            finally
            {
                context.Response.Write("{\"result\":" + Constant.jss.Serialize(jsonModel) + "}");
            }
        }
Esempio n. 2
0
        /// <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) + "}");
            }
        }