private void FillModel(int TemplateID)
        {
            VST_VisitTemplateBLL bll = new VST_VisitTemplateBLL(TemplateID);

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

            ID   = bll.Model.ID;
            Code = bll.Model.Code;
            Name = bll.Model.Name;
            IsMustRelateRoute   = bll.Model.IsMustRelateRoute.ToUpper() == "Y";
            CanTempVisit        = bll.Model.CanTempVisit.ToUpper() == "Y";
            IsMustSequenceCall  = bll.Model.IsMustSequenceCall.ToUpper() == "Y";
            CanRepetitionCall   = bll.Model.CanRepetitionCall.ToUpper() == "Y";
            IsMustRelateVehicel = bll.Model["IsMustRelateVehicel"].ToUpper() == "Y";

            Remark = bll.Model.Remark;

            Items = new List <VisitTemplateDetail>(bll.Items.Count);
            foreach (VST_VisitTemplateDetail item in bll.Items.OrderBy(p => p.SortID))
            {
                Items.Add(new VisitTemplateDetail(item));
            }
        }
示例#2
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
        }
        private void FillModel(int WorkListID)
        {
            VST_WorkListBLL bll = new VST_WorkListBLL(WorkListID);

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

            ID              = bll.Model.ID;
            RelateStaff     = bll.Model.RelateStaff;
            Route           = bll.Model.Route;
            Client          = bll.Model.Client;
            VisitTemplate   = bll.Model.Template;
            WorkingClassify = bll.Model.WorkingClassify;
            IsComplete      = bll.Model.IsComplete.ToUpper() == "Y";
            BeginTime       = bll.Model.BeginTime;
            EndTime         = bll.Model.EndTime;
            PlanID          = bll.Model.PlanID;
            Remark          = bll.Model.Remark;
            InsertTime      = bll.Model.InsertTime;

            //详细工作项目
            Items = new List <VisitWorkItem>(bll.Items.Count);
            foreach (VST_WorkItem item in bll.Items)
            {
                Items.Add(new VisitWorkItem(item));
            }

            #region ID转名称
            try
            {
                if (RelateStaff != 0)
                {
                    Org_Staff s = new Org_StaffBLL(RelateStaff).Model;
                    if (s != null)
                    {
                        RelateStaffName = s.RealName;
                    }
                }

                if (Route != 0)
                {
                    VST_Route r = new VST_RouteBLL(Route).Model;
                    if (r != null)
                    {
                        RouteName = r.Name;
                    }
                }

                if (Client != 0)
                {
                    CM_Client c = new CM_ClientBLL(Client).Model;
                    if (c != null)
                    {
                        ClientName = c.FullName;
                    }
                }

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

                if (WorkingClassify != 0)
                {
                    Dictionary_Data dic = DictionaryBLL.GetDicCollections("VST_WorkingClassify")[WorkingClassify.ToString()];
                    if (dic != null)
                    {
                        WorkingClassifyName = dic.Name;
                    }
                }
            }
            catch { }
            #endregion
        }
        private void FillModel(int WorkListID)
        {
            VST_WorkListBLL bll = new VST_WorkListBLL(WorkListID);
            if (bll.Model == null) return;

            ID = bll.Model.ID;
            RelateStaff = bll.Model.RelateStaff;
            Route = bll.Model.Route;
            Client = bll.Model.Client;
            VisitTemplate = bll.Model.Template;
            WorkingClassify = bll.Model.WorkingClassify;
            IsComplete = bll.Model.IsComplete.ToUpper() == "Y";
            BeginTime = bll.Model.BeginTime;
            EndTime = bll.Model.EndTime;
            PlanID = bll.Model.PlanID;
            Remark = bll.Model.Remark;
            InsertTime = bll.Model.InsertTime;

            //详细工作项目
            Items = new List<VisitWorkItem>(bll.Items.Count);
            foreach (VST_WorkItem item in bll.Items)
            {
                Items.Add(new VisitWorkItem(item));
            }

            #region ID转名称
            try
            {
                if (RelateStaff != 0)
                {
                    Org_Staff s = new Org_StaffBLL(RelateStaff).Model;
                    if (s != null) RelateStaffName = s.RealName;
                }

                if (Route != 0)
                {
                    VST_Route r = new VST_RouteBLL(Route).Model;
                    if (r != null) RouteName = r.Name;
                }

                if (Client != 0)
                {
                    CM_Client c = new CM_ClientBLL(Client).Model;
                    if (c != null) ClientName = c.FullName;
                }

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

                if (WorkingClassify != 0)
                {
                    Dictionary_Data dic = DictionaryBLL.GetDicCollections("VST_WorkingClassify")[WorkingClassify.ToString()];
                    if (dic != null) WorkingClassifyName = dic.Name;
                }
            }
            catch { }
            #endregion
        }
示例#5
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
        }
        private void FillModel(int TemplateID)
        {
            VST_VisitTemplateBLL bll = new VST_VisitTemplateBLL(TemplateID);
            if (bll.Model == null) return;

            ID = bll.Model.ID;
            Code = bll.Model.Code;
            Name = bll.Model.Name;
            IsMustRelateRoute = bll.Model.IsMustRelateRoute.ToUpper() == "Y";
            CanTempVisit = bll.Model.CanTempVisit.ToUpper() == "Y";
            IsMustSequenceCall = bll.Model.IsMustSequenceCall.ToUpper() == "Y";
            CanRepetitionCall = bll.Model.CanRepetitionCall.ToUpper() == "Y";
            IsMustRelateVehicel = bll.Model["IsMustRelateVehicel"].ToUpper() == "Y";

            Remark = bll.Model.Remark;

            Items = new List<VisitTemplateDetail>(bll.Items.Count);
            foreach (VST_VisitTemplateDetail item in bll.Items.OrderBy(p => p.SortID))
            {
                Items.Add(new VisitTemplateDetail(item));
            }
        }