예제 #1
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public CRM_VisitPlanResult GetInfo(CRM_VisitPlanParam param)
        {
            this.CheckSession();
            CRM_VisitPlanResult rst = new CRM_VisitPlanResult();

            #region 判断
            if (param.CustVstPlnID == null && param.CustVstPlnGuID == null)
            {
                throw new WarnException("请指定拜访计划主单ID或者GUID!");
            }
            #endregion
            #region 保存实体
            WhereClip where = GetWhereClip(param);

            rst = this.Select <CRM_VisitPlanResult>(where);
            if (rst.CompanyGuID != null)
            {
                CRM_CompanyBLL companyBLL = new CRM_CompanyBLL();
                companyBLL.SessionInfo = this.SessionInfo;
                CRM_CompanyResult companyRst = companyBLL.GetCustInfo(new CRM_CompanyParam {
                    CompanyGuID = rst.CompanyGuID
                });
                if (companyRst != null)
                {
                    rst.CrmCompany = companyRst;
                }
                CRM_VisitPlanLineBLL visitPlanLineBLL = new CRM_VisitPlanLineBLL();
                visitPlanLineBLL.SessionInfo = this.SessionInfo;
                DateTime?lastVistTime = visitPlanLineBLL.GetLastVisitTime(new CRM_VisitPlanLineParam()
                {
                    CustVstPlnGuID = rst.CustVstPlnGuID
                });
                if (lastVistTime != null)
                {
                    rst.LastVisitTime = lastVistTime.ToStringHasNull();
                }
                rst.TotalVisitCount = visitPlanLineBLL.GetTotalVisitCount(new CRM_VisitPlanLineParam()
                {
                    CustVstPlnGuID = rst.CustVstPlnGuID
                });
            }
            //Sys_EmpDataRightBLL.SetRecIsEdit<CRM_VisitPlanResult>(rst, "BeLongEmpID", "", "OrgID", this.SessionInfo);
            #endregion
            return(rst);
        }
예제 #2
0
        /// <summary>
        /// 查询记录,并返回分页列表
        /// </summary>
        /// <param name="param">查询条件实体</param>
        /// <returns></returns>
        public PageList <CRM_VisitPlanResult> GetPageList(CRM_VisitPlanParam param)
        {
            this.CheckSession();
            PageList <CRM_VisitPlanResult> rst = new PageList <CRM_VisitPlanResult>();

            WhereClip where = GetWhereClip(param);
            List <Field> lstField = new List <Field>()
            {
                CRM_VisitPlan._.All
            };

            rst = this.SelectList <CRM_VisitPlanResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), lstField, where, CRM_VisitPlan._.CreatedTime.Desc);
            Guid?[] arrCompanyID = rst.ResultList.Select(a => a.CompanyGuID).ToArray().Distinct().ToArray();
            List <CRM_CompanyResult> lstCompany = new List <CRM_CompanyResult>();
            CRM_CompanyBLL           companyBll = new CRM_CompanyBLL();

            companyBll.SessionInfo = this.SessionInfo;
            if (arrCompanyID.Length > 0)
            {
                lstCompany = companyBll.GetComapnyListByFilter(new List <Field>()
                {
                    CRM_Company._.CompanyName, CRM_Company._.CompanyGuID
                }, CRM_Company._.CompanyGuID.In(arrCompanyID));
            }
            CRM_CompanyResult findCompany;

            foreach (CRM_VisitPlanResult info in rst.ResultList)
            {
                findCompany = lstCompany.Find(a => a.CompanyGuID == info.CompanyGuID);
                if (findCompany != null)
                {
                    info.CompanyName = findCompany.CompanyName;
                }
            }
            // rst.ResultList = Sys_EmpDataRightBLL.SetRecIsEdit<CRM_VisitPlanResult>(rst.ResultList, "BeLongEmpID", "", "OrgID", this.SessionInfo);
            return(rst);
        }