示例#1
0
    protected string setmap(int id)
    {
        CM_ClientBLL     client = new CM_ClientBLL(id);
        CM_ClientGeoInfo info   = CM_ClientGeoInfoBLL.GetGeoInfoByClient(id);

        if (info == null)
        {
            return("showmap('',0,0)");
        }
        else
        {
            return(string.Format("showmap(\"{0}\",{1},{2})", client.Model.FullName, info.Longitude, info.Latitude));
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["ClientID"] = Request.QueryString["ClientID"] == null ? 0 : int.Parse(Request.QueryString["ClientID"]);

            if ((int)ViewState["ClientID"] == 0 && int.Parse(Session["AccountType"].ToString()) == 2)
            {
                ViewState["ClientID"] = Int32.Parse(Session["UserID"].ToString());
            }

            if (!Right_Assign_BLL.GetAccessRight((string)Session["Username"], 1101, "SetMapPosition") &&
                !Right_Assign_BLL.GetAccessRight((string)Session["Username"], 6101, "SetMapPosition"))
            {
                btn_snyc.Visible     = false;
                btn_addpoint.Visible = false;
                btn_OK.Visible       = false;
            }
        }
        CM_ClientBLL cm_client = new CM_ClientBLL((int)ViewState["ClientID"]);

        if (cm_client.Model != null)
        {
            lb_FullName.Text = cm_client.Model.FullName;
            lb_Address.Text  = cm_client.Model.Address;
            CM_ClientGeoInfo info = CM_ClientGeoInfoBLL.GetGeoInfoByClient((int)ViewState["ClientID"]);
            if (info != null)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "addComplexMarker(" + info.Longitude + ", " + info.Latitude + ",\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\");mapInit();initmethod(\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\")", true);
                ViewState["InfoID"] = info.ID;
            }
            else if (lngX.Value != "" && latY.Value != "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "addComplexMarker(" + lngX.Value + ", " + latY.Value + ",\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\");mapInit();initmethod(\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\")", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "mapInit();initmethod(\"m" + cm_client.Model.ID + "\",\"" + cm_client.Model.FullName + "\",\"" + cm_client.Model.TeleNum + "\",\"" + cm_client.Model.Address + "\")", true);
            }
        }
        else
        {
            MessageBox.ShowAndClose(this, "请选择门店!");
        }
    }
示例#3
0
        private void FillClientInfo(CM_Client m, int TDP)
        {
            if (m == null)
            {
                return;
            }

            CM_ClientBLL ClientBLL = new CM_ClientBLL(m.ID);

            if (ClientBLL.Model == null)
            {
                return;
            }

            #region 绑定基本资料
            ID           = m.ID;
            Code         = m.Code;
            FullName     = m.FullName == "" ? m.ShortName : m.FullName;
            ShortName    = m.ShortName;
            OfficialCity = m.OfficialCity;
            Address      = m.Address;
            ClientType   = m.ClientType;
            LinkManName  = m.LinkManName;
            TeleNum      = m.TeleNum;
            Mobile       = m.Mobile == "" ? m.TeleNum : m.Mobile;

            OfficialCityName = TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OfficialCity", m.OfficialCity).Replace("->", " ");
            #endregion

            #region 绑定供货信息
            CM_ClientSupplierInfo SupplierInfo = ClientBLL.GetSupplierInfo(TDP);
            if (SupplierInfo != null)
            {
                CodeBySupplier = SupplierInfo.Code;
                Supplier       = SupplierInfo.Supplier;
                StandardPrice  = SupplierInfo.StandardPrice;
                TDPChannel     = SupplierInfo.TDPChannel;
                TDPSalesArea   = SupplierInfo.TDPSalesArea;
                VisitRoute     = SupplierInfo.VisitRoute;
                VisitSequence  = SupplierInfo.VisitSequence;
                VisitTemplate  = SupplierInfo.VisitTemplate;

                #region 获取供货商名称
                CM_Client s = new CM_ClientBLL(Supplier).Model;
                if (s != null)
                {
                    SupplierName = s.ShortName == "" ? s.ShortName : s.FullName;
                }
                #endregion

                #region 获取价表名称
                if (StandardPrice != 0)
                {
                    PDT_StandardPrice price = new PDT_StandardPriceBLL(StandardPrice).Model;
                    if (price != null)
                    {
                        StandardPriceName = price.Name;
                    }
                }
                #endregion

                #region 获取渠道名称
                if (TDPChannel > 0)
                {
                    CM_RTChannel_TDP channel = new CM_RTChannel_TDPBLL(TDPChannel).Model;
                    if (channel != null)
                    {
                        TDPChannelName = channel.Name;
                    }
                }
                #endregion

                #region 获取区域名称
                if (TDPSalesArea > 0)
                {
                    CM_RTSalesArea_TDP area = new CM_RTSalesArea_TDPBLL(TDPSalesArea).Model;
                    if (area != null)
                    {
                        TDPSalesAreaName = area.Name;
                    }
                }
                #endregion

                #region 获取路线及拜访模板名称
                if (VisitRoute != 0)
                {
                    VST_Route r = new VST_RouteBLL(VisitRoute).Model;
                    if (r != null)
                    {
                        VisitRouteName = r.Name;
                    }
                }

                if (VisitTemplate != 0)
                {
                    VST_VisitTemplate t = new VST_VisitTemplateBLL(VisitTemplate).Model;
                    if (t != null)
                    {
                        VisitTemplateName = t.Name;
                    }
                }
                #endregion

                #region 获取销售员名称
                if (Salesman != 0)
                {
                    Org_Staff staff = new Org_StaffBLL(Salesman).Model;
                    if (staff != null)
                    {
                        SalesmanName = staff.RealName;
                    }
                }
                #endregion
            }
            #endregion

            #region 绑定厂商管理信息
            int manufacturer = 0;           //归属厂商
            if (m.ClientType == 3)
            {
                //门店的归属厂商为当前TDP所归属的厂商
                CM_Client supplier = new CM_ClientBLL(TDP).Model;
                if (supplier != null)
                {
                    manufacturer = supplier.OwnerClient;
                }
            }
            else if (m.ClientType == 2)
            {
                //TDP经销商的归属厂商
                manufacturer = m.OwnerClient;
            }

            CM_ClientManufactInfo ManufactInfo = ClientBLL.GetManufactInfo(manufacturer);
            if (ManufactInfo != null)
            {
                CodeByManufaturer = ManufactInfo.Code;
            }
            #endregion

            #region 绑定客户定位信息
            CM_ClientGeoInfo geo = CM_ClientGeoInfoBLL.GetGeoInfoByClient(m.ID);
            if (geo != null)
            {
                Latitude  = (float)geo.Latitude;
                Longitude = (float)geo.Longitude;
            }
            #endregion

            #region 绑定客户供货产品目录
            ClientProductLists = new List <ProductList>();
            foreach (CM_ClientProductList item in CM_ClientProductListBLL.GetModelList
                         ("Client=" + m.ID.ToString() + (TDP == 0 ? "" : " AND Supplier=" + TDP.ToString())))
            {
                ClientProductLists.Add(new ProductList(item));
            }
            #endregion

            #region 查询预收款余额
            AC_CurrentAccount ac = AC_CurrentAccountBLL.GetByTradeClient(TDP, m.ID);
            if (ac != null)
            {
                ARBalance = ac.PreReceivedAmount - ac.AR;
            }
            #endregion

            #region 获取附件明细
            IList <ATMT_Attachment> atts = ATMT_AttachmentBLL.GetAttachmentList(30, m.ID, DateTime.Today.AddMonths(-3), new DateTime(2100, 1, 1));
            Atts = new List <Attachment>(atts.Count);
            foreach (ATMT_Attachment item in atts.OrderByDescending(p => p.UploadTime))
            {
                Atts.Add(new Attachment(item));
            }
            #endregion
        }