Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["id"];

            if (id != null)
            {
                if (AuthBLL.GetUserCompanyAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanDelete == false)  // 权限验证
                {
                    Response.End();
                    return;
                }
                crm_account = new CompanyBLL().GetCompany(Convert.ToInt64(id));
                dic         = companyBll.GetField();
                if (crm_account != null)
                {
                    contactList     = new ContactBLL().GetContactByCompany(crm_account.id);
                    opportunityList = new OpportunityBLL().GetOpportunityByCompany(crm_account.id);
                    todoList        = new DAL.com_activity_dal().GetNoteByAccount(crm_account.id, (int)DicEnum.ACTIVITY_CATE.TODO);
                    noteList        = new DAL.com_activity_dal().GetNoteByAccount(crm_account.id);
                    insProList      = new DAL.crm_installed_product_dal().FindByAccountId(crm_account.id);
                }
                else
                {
                    Response.End();
                }
            }
            else
            {
                Response.End();
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var id = Request.QueryString["id"];
                type = Request.QueryString["type"];
                if (id != null)
                {
                    thisBookMark = new IndexBLL().GetSingBook(Request.Url.LocalPath + "?id=" + id, LoginUserId);
                    var src = Request.QueryString["src"];
                    if (!string.IsNullOrEmpty(src))
                    {
                        crm_account = companyBll.GetCompanyByOtherId(Convert.ToInt64(id), src);
                    }
                    else
                    {
                        crm_account = companyBll.GetCompanyByOtherId(Convert.ToInt64(id));
                    }
                    if (crm_account != null)
                    {
                        if (AuthBLL.GetUserCompanyAuth(LoginUserId, LoginUser.security_Level_id, crm_account.id).CanView == false)     // 权限验证
                        {
                            Response.End();
                            return;
                        }
                        #region 记录浏览历史
                        var history = new sys_windows_history()
                        {
                            title = "客户:" + crm_account.name,
                            url   = Request.Url.LocalPath + "?id=" + id,
                        };
                        new IndexBLL().BrowseHistory(history, LoginUserId);
                        #endregion
                        dic = new CompanyBLL().GetField();    // 获取字典
                        if (string.IsNullOrEmpty(type))
                        {
                            type = "activity";
                        }
                        if (type == "activity" || type == "note" || type == "todo")
                        {
                            isHide.Value = "show";
                            //  Response.Write("<script>document.getElementById('showCompanyGeneral').style.display='none';</script>");
                        }
                        switch (type)    // 根据传过来的不同的类型,为页面中的iframe控件选择不同的src
                        {
                        case "activity":
                            var typeList = new ActivityBLL().GetCRMActionType();
                            noteType.DataSource     = typeList;
                            noteType.DataTextField  = "name";
                            noteType.DataValueField = "id";
                            noteType.DataBind();
                            actType = "活动";
                            break;

                        case "todo":                // 待办
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.TODOS + "&type=" + (int)QueryType.Todos + "&group=112&con658=" + crm_account.id + "&param1=accountId&param2=" + crm_account.id;
                            actType   = "待办";
                            break;

                        case "note":                // 备注
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CRM_NOTE_SEARCH + "&type=" + (int)QueryType.CRMNote + "&group=110&con645=" + crm_account.id + "&param1=accountId&param2=" + crm_account.id;
                            actType   = "备注";
                            break;

                        case "opportunity":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.OPPORTUNITY_COMPANY_VIEW + "&type=" + (int)QueryType.OpportunityCompanyView + "&id=" + id;
                            actType   = "商机";
                            break;    //

                        case "contact":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.CONTACT_COMPANY_VIEW + "&type=" + (int)QueryType.ContactCompanyView + "&id=" + id; // 联系人
                            actType   = "联系人";
                            break;                                                                                                                                                         //

                        case "Subsidiaries":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.SUBCOMPANY_COMPANY_VIEW + "&type=" + (int)QueryType.SubcompanyCompanyView + "&id=" + id; // 子公司
                            actType   = "子客户";
                            break;                                                                                                                                                               //Subsidiaries

                        case "saleOrder":                                                                                                                                                        // 销售订单
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.SALEORDER + "&type=" + (int)QueryType.SaleOrder + "&group=42&con385=" + id;
                            actType   = "销售订单";
                            break;

                        case "contract":            // 合同
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.COMPANY_VIEW_CONTRACT + "&type=" + (int)QueryType.CompanyViewContract + "&con933=" + id;
                            actType   = "合同";
                            break;

                        case "confirgItem":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.INSTALLEDPRODUCT + "&type=" + (int)QueryType.InstalledProductView + "&con358=" + id;
                            actType   = "配置项";
                            break;

                        case "invoice":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.COMPANY_VIEW_INVOICE + "&type=" + (int)QueryType.CompanyViewInvoice + "&con934=" + id;
                            actType   = "发票";
                            break;

                        case "attachment":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.COMPANY_VIEW_ATTACHMENT + "&type=" + (int)QueryType.CompanyViewAttachment + "&con674=" + id;
                            actType   = "附件";
                            break;

                        case "project":
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)DicEnum.QUERY_CATE.PROJECT_SEARCH + "&type=" + (int)QueryType.PROJECT_SEARCH + "&con630=" + crm_account.id;
                            actType   = "项目";
                            break;

                        case "finance":
                            actType = "财务";
                            break;

                        case "ticket":
                            actType   = "工单";
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.MY_QUEUE_ACTIVE + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.MY_QUEUE_ACTIVE + "&group=215&con2627=" + crm_account.id + "&param1=ShowPara";
                            break;

                        case "contactGroup":
                            actType   = "联系人组";
                            iframeSrc = "../Common/SearchBodyFrame.aspx?cat=" + (int)EMT.DoneNOW.DTO.DicEnum.QUERY_CATE.ACCOUNT_CONTACT_GROUP_SEARCH + "&type=" + (int)EMT.DoneNOW.DTO.QueryType.ACCOUNT_CONTACT_GROUP_SEARCH + "&con3961=" + crm_account.id.ToString();
                            break;

                        default:
                            iframeSrc = "";      // 默认  project_search
                            actType   = "活动";

                            break;
                        }
                        //viewCompany_iframe.Src = "";  //
                    }
                    else
                    {
                        Response.Write("<script>alert('未获取到客户信息');window.close();</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('未获取到客户信息');window.close();</script>");
                }
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alert('{msg.Message}');window.close();</script>");
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
            var company_id = Convert.ToInt64(Request.QueryString["id"]);

            if (AuthBLL.GetUserCompanyAuth(LoginUserId, LoginUser.security_Level_id, company_id).CanEdit == false)  // 权限验证
            {
                Response.End();
                return;
            }
            try
            {
                company_udfList      = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.COMPANY);
                company_udfValueList = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.COMPANY, company_id, company_udfList);
                site_udfList         = new UserDefinedFieldsBLL().GetUdf(DicEnum.UDF_CATE.SITE);
                site_udfValueList    = new UserDefinedFieldsBLL().GetUdfValue(DicEnum.UDF_CATE.SITE, company_id, site_udfList);
                account       = new CompanyBLL().GetCompany(company_id);
                location_list = new LocationBLL().GetLocationByCompany(company_id);
                // defaultLocation = new LocationBLL().GetLocationByAccountId(company_id);
                //if (!IsPostBack)
                //{
                // var company_id = Convert.ToInt64(Request.QueryString["id"]);

                if (account != null)
                {
                    subCompanyList = new crm_account_dal().GetMyCompany(account.id);
                    //searchCompany = new crm_account_dal().GetSubCompanys();
                    #region 为下拉框获取数据源
                    dic = new CompanyBLL().GetField();

                    // 分类类别
                    classification.DataTextField  = "show";
                    classification.DataValueField = "val";
                    classification.DataSource     = dic.FirstOrDefault(_ => _.Key == "classification").Value;
                    classification.DataBind();
                    classification.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 公司类型
                    CompanyType.DataTextField  = "show";
                    CompanyType.DataValueField = "val";
                    CompanyType.DataSource     = dic.FirstOrDefault(_ => _.Key == "company_type").Value;
                    CompanyType.DataBind();
                    CompanyType.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });

                    // 市场领域
                    MarketSegment.DataTextField  = "show";
                    MarketSegment.DataValueField = "val";
                    MarketSegment.DataSource     = dic.FirstOrDefault(_ => _.Key == "market_segment").Value;
                    MarketSegment.DataBind();
                    MarketSegment.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 销售区域
                    TerritoryName.DataTextField  = "show";
                    TerritoryName.DataValueField = "val";
                    TerritoryName.DataSource     = dic.FirstOrDefault(_ => _.Key == "territory").Value;
                    TerritoryName.DataBind();
                    TerritoryName.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 客户经理
                    AccountManger.DataTextField  = "show";
                    AccountManger.DataValueField = "val";
                    AccountManger.DataSource     = dic.FirstOrDefault(_ => _.Key == "sys_resource").Value;
                    AccountManger.DataBind();
                    AccountManger.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 税区
                    TaxRegion.DataTextField  = "show";
                    TaxRegion.DataValueField = "val";
                    TaxRegion.DataSource     = dic.FirstOrDefault(_ => _.Key == "taxRegion").Value;
                    TaxRegion.DataBind();
                    TaxRegion.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    // 竞争对手
                    Competitor.DataTextField  = "show";
                    Competitor.DataValueField = "val";
                    Competitor.DataSource     = dic.FirstOrDefault(_ => _.Key == "competition").Value;
                    Competitor.DataBind();
                    Competitor.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    #endregion

                    company_name.Text = account.name;
                    //isactive.Checked = account.is_active == 1;

                    CompanyNumber.Text          = account.no;
                    Phone.Text                  = account.phone;
                    AlternatePhone1.Text        = account.alternate_phone1;
                    AlternatePhone2.Text        = account.alternate_phone2;
                    Fax.Text                    = account.fax;
                    WebSite.Text                = account.web_site;
                    is_optoutSurvey.Checked     = account.is_optout_survey == 1;
                    mileage.Text                = account.mileage == null ? "" : account.mileage.ToString();// todo decmail? 保留两位小数点??
                    stock_symbol.Text           = account.stock_symbol;
                    sic_code.Text               = account.sic_code;
                    stock_market.Text           = account.stock_market;
                    weibo_url.Text              = account.weibo_url;
                    wechat_mp_service.Text      = account.wechat_mp_service;
                    wechat_mp_subscription.Text = account.wechat_mp_subscription;

                    CompanyType.SelectedValue    = account.type_id == null ? "0" : account.type_id.ToString();
                    AccountManger.SelectedValue  = account.resource_id == null ? "0" : account.resource_id.ToString();
                    TerritoryName.SelectedValue  = account.territory_id == null ? "0" : account.territory_id.ToString();
                    MarketSegment.SelectedValue  = account.market_segment_id == null ? "0" : account.market_segment_id.ToString();
                    Competitor.SelectedValue     = account.competitor_id == null ? "0" : account.competitor_id.ToString();
                    Tax_Exempt.Checked           = account.is_tax_exempt == 1;
                    TaxRegion.SelectedValue      = account.tax_region_id == null ? "0" : account.tax_region_id.ToString();
                    classification.SelectedValue = account.classification_id == null ? "0" : account.classification_id.ToString();

                    if (Tax_Exempt.Checked)
                    {
                        TaxRegion.Enabled = true;
                    }
                    TaxId.Text = account.tax_identification;
                    if (account.parent_id != null)
                    {
                        var parCompany = new CompanyBLL().GetCompany((long)this.account.parent_id);
                        ParentComoanyName.Text = parCompany == null ? "" : parCompany.name;  //父客户
                    }
                    asset_value.Text = account.asset_value.ToString();

                    location = new LocationBLL().GetLocationByAccountId(account.id);
                    if (location != null)        // 如果该客户的地址是默认地址,不可更改为非默认,只能通过添加别的地址设置为默认这种方式去更改默认地址
                    {
                        country_idInit.Value   = location.country_id.ToString();
                        province_idInit.Value  = location.province_id.ToString();
                        city_idInit.Value      = location.city_id.ToString();
                        district_idInit.Value  = location.district_id.ToString();
                        address.Text           = location.address;
                        AdditionalAddress.Text = location.additional_address;
                    }

                    var company_detail_alert = new EMT.DoneNOW.DAL.crm_account_alert_dal().FindAlert(account.id, EMT.DoneNOW.DTO.DicEnum.ACCOUNT_ALERT_TYPE.COMPANY_DETAIL_ALERT);
                    var new_ticket_alert     = new EMT.DoneNOW.DAL.crm_account_alert_dal().FindAlert(account.id, EMT.DoneNOW.DTO.DicEnum.ACCOUNT_ALERT_TYPE.NEW_TICKET_ALERT);
                    var ticket_detail_alert  = new EMT.DoneNOW.DAL.crm_account_alert_dal().FindAlert(account.id, EMT.DoneNOW.DTO.DicEnum.ACCOUNT_ALERT_TYPE.TICKET_DETAIL_ALERT);

                    if (company_detail_alert != null)
                    {
                        Company_Detail_Alert.Text = company_detail_alert.alert_text;
                    }
                    if (new_ticket_alert != null)
                    {
                        New_Ticket_Alert.Text = new_ticket_alert.alert_text;
                    }
                    if (ticket_detail_alert != null)
                    {
                        Ticket_Detail_Alert.Text = ticket_detail_alert.alert_text;
                    }
                }
                else
                {
                    Response.End();
                }
                //}
            }
            catch (Exception)
            {
                Response.End();
            }
        }