Exemplo n.º 1
0
        /// <summary>
        /// 获取客户详情
        /// </summary>
        private void GetAccDetail(HttpContext context)
        {
            var accountId = context.Request.QueryString["account_id"];

            if (!string.IsNullOrEmpty(accountId))
            {
                var thisAcc = new CompanyBLL().GetCompany(long.Parse(accountId));
                if (thisAcc != null)
                {
                    // 返回客户Id,名称,地址信息
                    var    location   = new LocationBLL().GetLocationByAccountId(thisAcc.id);
                    string city       = "";
                    string provice    = "";
                    string quXian     = "";
                    string address1   = "";
                    string address2   = "";
                    string postalCode = "";
                    int    ticketNum  = 0; // 所有打开的工单的数量
                    int    monthNum   = 0; // 近三十天工单的数量
                    if (location != null)
                    {
                        var thisCity = new d_district_dal().FindById(location.city_id);
                        if (thisCity != null)
                        {
                            city = thisCity.name;
                        }
                        var thisprovice = new d_district_dal().FindById(location.province_id);
                        if (thisprovice != null)
                        {
                            provice = thisprovice.name;
                        }
                        if (location.district_id != null)
                        {
                            var thisquXian = new d_district_dal().FindById((long)location.district_id);
                            if (thisquXian != null)
                            {
                                quXian = thisquXian.name;
                            }
                        }
                        address1 = location.address;
                        address2 = location.additional_address;
                        if (!string.IsNullOrEmpty(location.postal_code))
                        {
                            postalCode = location.postal_code;
                        }
                    }

                    var ticketList = new sdk_task_dal().GetTicketByAccount(thisAcc.id);
                    if (ticketList != null && ticketList.Count > 0)
                    {
                        ticketNum = ticketList.Count;
                    }
                    context.Response.Write(new Tools.Serialize().SerializeJson(new { id = thisAcc.id, name = thisAcc.name, phone = thisAcc.phone, city = city, provice = provice, quXian = quXian, address1 = address1, address2 = address2, ticketNum = ticketNum, monthNum = monthNum, postalCode = postalCode }));
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var accountId = Request.QueryString["accountId"];

            if (!string.IsNullOrEmpty(accountId))
            {
                account = comBll.GetCompany(long.Parse(accountId));
            }
            if (account == null)
            {
                Response.Write("<script>alert('为获取到客户信息');window.close();</script>");
                return;
            }
            accLocation = new crm_location_dal().GetLocationByAccountId(account.id);
            if (accLocation != null)
            {
                var disDal = new d_district_dal();
                if (accLocation.country_id != null)
                {
                    var country = new DAL.d_country_dal().FindById((long)accLocation.country_id);
                    countryName = country != null?country.country_name_display:"";
                }
                var province = disDal.FindById((long)accLocation.province_id);
                provinceName = province != null ? province.name : "";
                var city = disDal.FindById((long)accLocation.city_id);
                cityName = city != null ? city.name : "";
                var district = disDal.FindById((long)accLocation.district_id);
                districtName = district != null ? district.name : "";
            }
            subAccountList      = new crm_account_dal().GetSubsidiariesById(account.id);
            contactList         = new crm_contact_dal().GetContactByAccountId(account.id);
            oppoList            = new crm_opportunity_dal().FindOpHistoryByAccountId(account.id);
            companyUdfList      = udfBLL.GetUdf(DicEnum.UDF_CATE.COMPANY);
            companyUdfValueList = udfBLL.GetUdfValue(DicEnum.UDF_CATE.COMPANY, account.id, companyUdfList);
            insProList          = new crm_installed_product_dal().GetInsProAccoByProName(account.id);
            todoList            = new com_activity_dal().GetNoCompleteTodo(account.id);
            noteList            = new com_activity_dal().GetNoteByAccount(account.id);
            oppoUdfList         = udfBLL.GetUdf(DicEnum.UDF_CATE.OPPORTUNITY);


            //var arr = new string[][] { new string[] { "上海", "张耀", "1" }, new string[] { "北京", "张耀", "1" }, new string[] { "上海", "朱飞", "1" } };
            //var test = from i in Enumerable.Range(0, (int)arr.GetLongLength(0))
            //           from j in Enumerable.Range(0, (int)arr.GetLongLength(1))
            //           from k in Enumerable.Range(0, (int)arr.GetLongLength(2))
            //           select arr[i,j,k];
        }