private DataTable GetData()
        {
            string areaTypeWhereStr = string.Empty;

            Entities.QueryCRMDMSMember query = new Entities.QueryCRMDMSMember();

            if (!string.IsNullOrEmpty(RequestDMSMemberCode))
            {
                query.DMSMemberCode = RequestDMSMemberCode;
            }
            if (!string.IsNullOrEmpty(RequestDMSMemberName))
            {
                query.DMSMemberName = RequestDMSMemberName;
            }
            if (!string.IsNullOrEmpty(RequestProvinceID))
            {
                query.ProvinceID = RequestProvinceID;
            }
            if (!string.IsNullOrEmpty(RequestCityID))
            {
                query.CityID = RequestCityID;
            }
            if (!string.IsNullOrEmpty(RequestCountyID))
            {
                query.CountyID = RequestCountyID;
            }
            if (!string.IsNullOrEmpty(RequestAreaTypeIDs))
            {
                query.AreaTypeIDs = RequestAreaTypeIDs;
            }
            if (RequestAddMemberFlag.Equals("1"))
            {
                query.IsCCCreate = true;
            }
            else if (RequestAddMemberFlag.Equals("0"))
            {
                query.IsCCCreate = false;
            }

            if (RequestUserMappingFlag.Equals("1"))
            {
                query.IsCCUserMapping = true;
            }
            else if (RequestUserMappingFlag.Equals("0"))
            {
                query.IsCCUserMapping = false;
            }

            if (RequestReturnVisitFlag.Equals("1"))
            {
                query.IsCCReturnVisit = true;
            }
            else if (RequestReturnVisitFlag.Equals("0"))
            {
                query.IsCCReturnVisit = false;
            }
            if (!string.IsNullOrEmpty(SelectDeptID))
            {
                query.SelectDeptID = SelectDeptID;
            }
            if (!string.IsNullOrEmpty(StrDeptS))
            {
                if (StrDeptS.Trim() != "1,0" && StrDeptS.Trim() != "1,0")
                {
                    query.StrDeptS = StrDeptS;
                }
            }
            if (!string.IsNullOrEmpty(RequestMemberCreateTimeStart))
            {
                query.MemberCreateTimeStart = RequestMemberCreateTimeStart;
            }
            if (!string.IsNullOrEmpty(RequestMemberCreateTimeEnd))
            {
                query.MemberCreateTimeEnd = RequestMemberCreateTimeEnd;
            }
            if (!string.IsNullOrEmpty(RequestReturnVisitTimeStart))
            {
                query.ReturnVisitTimeStart = RequestReturnVisitTimeStart;
            }
            if (!string.IsNullOrEmpty(RequestReturnVisitTimeEnd))
            {
                query.ReturnVisitTimeEnd = RequestReturnVisitTimeEnd;
            }
            if (!string.IsNullOrEmpty(RequestBrandIDs))
            {
                query.BrandIDs = BLL.Util.GetStringBySplitArray(RequestBrandIDs);
            }

            if (CooperatedStatusIDs != string.Empty)
            {
                query.CooperatedStatusIDs = CooperatedStatusIDs;
            }
            if (!string.IsNullOrEmpty(RequestBeginMemberCooperatedTime))
            {
                query.BeginMemberCooperatedTime = RequestBeginMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestEndMemberCooperatedTime))
            {
                query.EndMemberCooperatedTime = RequestEndMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestBeginNoMemberCooperatedTime))
            {
                query.BeginNoMemberCooperatedTime = RequestBeginNoMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestEndNoMemberCooperatedTime))
            {
                query.EndNoMemberCooperatedTime = RequestEndNoMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestMemberCooperateStatus))
            {
                query.MemberCooperateStatus = RequestMemberCooperateStatus;
            }
            if (!string.IsNullOrEmpty(RequestMemberTypeIDs))
            {
                query.MemberType = BLL.Util.GetStringBySplitArray(RequestMemberTypeIDs);
            }
            if (RequestContactOfficeTypeCode > 0)
            {
                query.CustContactOfficeTypeCode = RequestContactOfficeTypeCode;
            }
            if (!string.IsNullOrEmpty(RequestIsReturnMagazine))
            {
                if (RequestIsReturnMagazine == "0")
                {
                    query.IsMagazineReturn = 0;
                }
                else if (RequestIsReturnMagazine == "1")
                {
                    query.IsMagazineReturn = 1;
                    if (!string.IsNullOrEmpty(RequestExecCycle))
                    {
                        query.ExecCycle = RequestExecCycle;
                    }
                }
            }
            if (!string.IsNullOrEmpty(RequestMemberSyncStatus) && RequestMemberSyncStatus != "-1")
            {
                query.MemberSyncStatus = RequestMemberSyncStatus;
            }
            query.Status = 0;
            DataTable dt = BLL.CRMDMSMember.Instance.GetCRMDMSMemberInfo(query, "DMSMember.CustID Desc", 1, 1000000, out CountOfRecords);

            return(dt);
        }
Example #2
0
        private void BindData()
        {
            string areaTypeWhereStr = string.Empty;

            Entities.QueryCRMDMSMember query = new Entities.QueryCRMDMSMember();

            if (!string.IsNullOrEmpty(RequestDMSMemberCode))
            {
                query.DMSMemberCode = RequestDMSMemberCode;
            }
            if (!string.IsNullOrEmpty(RequestDMSMemberName))
            {
                query.DMSMemberName = RequestDMSMemberName;
            }
            //if (!string.IsNullOrEmpty(RequestAreaType86_Value) ||
            //    RequestAreaValue86 != "-1" ||
            //    !string.IsNullOrEmpty(RequestAreaType246_Value))
            //{
            //    if (RequestAreaType86_Value.Equals("1"))
            //    {
            //        areaTypeWhereStr += " And " + (areaTypeWhereStr.Length > 0 || !RequestAreaType246_Value.Equals("2") ? "" : "(") +
            //                            "DMSMember.CityID IN (SELECT AreaID FROM AreaType WHERE Type=1 And Value=1) ";
            //    }
            //    if (RequestAreaValue86 != "-1")
            //    {
            //        areaTypeWhereStr += " And " + (areaTypeWhereStr.Length > 0 || !RequestAreaType246_Value.Equals("2") ? "" : "(") +
            //                            "DMSMember.CountyID IN (SELECT AreaID FROM AreaType WHERE Type=2 And Value=" + StringHelper.SqlFilter(RequestAreaValue86) + ") ";
            //    }
            //    if (RequestAreaType246_Value.Equals("2"))
            //    {
            //        string sqlWhere = " DMSMember.CityID IN (SELECT AreaID FROM AreaType WHERE Type=1 And Value=2)";
            //        if (areaTypeWhereStr.Length > 0)
            //        {
            //            areaTypeWhereStr += " OR " + sqlWhere + ")";
            //        }
            //        else
            //        {
            //            areaTypeWhereStr += " And " + sqlWhere;
            //        }
            //    }
            //    if (areaTypeWhereStr.Length > 0)
            //    {
            //        query.AreaTypeWhereStr = areaTypeWhereStr;
            //    }
            //}
            //else
            //{
            if (!string.IsNullOrEmpty(RequestProvinceID))
            {
                query.ProvinceID = RequestProvinceID;
            }
            if (!string.IsNullOrEmpty(RequestCityID))
            {
                query.CityID = RequestCityID;
            }
            if (!string.IsNullOrEmpty(RequestCountyID))
            {
                query.CountyID = RequestCountyID;
            }
            //}
            //if (!string.IsNullOrEmpty(RequestAreaTypeIDs))
            //{
            //    query.AreaTypeIDs = RequestAreaTypeIDs;
            //}
            if (!string.IsNullOrEmpty(SelectDeptID))
            {
                query.SelectDeptID = SelectDeptID;
            }
            if (!string.IsNullOrEmpty(StrDeptS))
            {
                if (StrDeptS.Trim() != "1,0" && StrDeptS.Trim() != "1,0")
                {
                    query.StrDeptS = StrDeptS;
                }
            }

            if (RequestAddMemberFlag.Equals("1"))
            {
                query.IsCCCreate = true;
            }
            else if (RequestAddMemberFlag.Equals("0"))
            {
                query.IsCCCreate = false;
            }

            if (RequestUserMappingFlag.Equals("1"))
            {
                query.IsCCUserMapping = true;
            }
            else if (RequestUserMappingFlag.Equals("0"))
            {
                query.IsCCUserMapping = false;
            }

            if (RequestReturnVisitFlag.Equals("1"))
            {
                query.IsCCReturnVisit = true;
            }
            else if (RequestReturnVisitFlag.Equals("0"))
            {
                query.IsCCReturnVisit = false;
            }

            //if (RequestMemberCooperateStatus >= 0)
            //{
            //    query.MemberCooperateStatus = RequestMemberCooperateStatus;
            //}
            if (!string.IsNullOrEmpty(RequestMemberCreateTimeStart))
            {
                query.MemberCreateTimeStart = RequestMemberCreateTimeStart;
            }
            if (!string.IsNullOrEmpty(RequestMemberCreateTimeEnd))
            {
                query.MemberCreateTimeEnd = RequestMemberCreateTimeEnd;
            }
            if (!string.IsNullOrEmpty(RequestReturnVisitTimeStart))
            {
                query.ReturnVisitTimeStart = RequestReturnVisitTimeStart;
            }
            if (!string.IsNullOrEmpty(RequestReturnVisitTimeEnd))
            {
                query.ReturnVisitTimeEnd = RequestReturnVisitTimeEnd;
            }

            //add by qizq 2012-8-2排期确认时间
            if (!string.IsNullOrEmpty(RequestConfirmDateStart))
            {
                query.ConfirmDateStart = RequestConfirmDateStart;
            }
            if (!string.IsNullOrEmpty(RequestConfirmDateEnd))
            {
                query.ConfirmDateEnd = RequestConfirmDateEnd;
            }



            if (!string.IsNullOrEmpty(RequestBrandIDs))
            {
                query.BrandIDs = BLL.Util.GetStringBySplitArray(RequestBrandIDs);
            }

            if (CooperatedStatusIDs != string.Empty)
            {
                query.CooperatedStatusIDs = CooperatedStatusIDs;
            }
            if (!string.IsNullOrEmpty(RequestBeginMemberCooperatedTime))
            {
                query.BeginMemberCooperatedTime = RequestBeginMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestEndMemberCooperatedTime))
            {
                query.EndMemberCooperatedTime = RequestEndMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestBeginNoMemberCooperatedTime))
            {
                query.BeginNoMemberCooperatedTime = RequestBeginNoMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestEndNoMemberCooperatedTime))
            {
                query.EndNoMemberCooperatedTime = RequestEndNoMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestMemberCooperateStatus))
            {
                query.MemberCooperateStatus = RequestMemberCooperateStatus;
            }
            if (!string.IsNullOrEmpty(RequestMemberTypeIDs))
            {
                query.MemberType = BLL.Util.GetStringBySplitArray(RequestMemberTypeIDs);
            }
            if (!string.IsNullOrEmpty(RequestIsReturnMagazine))
            {
                if (RequestIsReturnMagazine == "0")
                {
                    query.IsMagazineReturn = 0;
                }
                else if (RequestIsReturnMagazine == "1")
                {
                    query.IsMagazineReturn = 1;
                    if (!string.IsNullOrEmpty(RequestExecCycle))
                    {
                        query.ExecCycle = RequestExecCycle;
                    }
                }
            }
            if (RequestContactOfficeTypeCode > 0)
            {
                query.CustContactOfficeTypeCode = RequestContactOfficeTypeCode;
            }

            if (!string.IsNullOrEmpty(RequestStartMemberCooperatedBeginTime) ||
                !string.IsNullOrEmpty(RequestEndMemberCooperatedBeginTime))
            {
                query.CooperatedStatusIDs = "1";
                if (!string.IsNullOrEmpty(RequestStartMemberCooperatedBeginTime))
                {
                    query.StartMemberCooperatedBeginTime = RequestStartMemberCooperatedBeginTime.Trim();
                }
                if (!string.IsNullOrEmpty(RequestEndMemberCooperatedBeginTime))
                {
                    query.EndMemberCooperatedBeginTime = RequestEndMemberCooperatedBeginTime.Trim();
                }
            }
            if (!string.IsNullOrEmpty(RequestMemberSyncStatus) && RequestMemberSyncStatus != "-1")
            {
                query.MemberSyncStatus = RequestMemberSyncStatus;
            }

            query.Status = 0;

            DataTable dt = BLL.CRMDMSMember.Instance.GetCC_CRMDMSMemberInfo(query, "DMSMember.CustID Desc", PageCommon.Instance.PageIndex, PageSize, query.SelectDeptID, out CountOfRecords);

            if (dt != null && dt.Rows.Count > 0)
            {
                dt.Columns.Add("showCustName");

                dt.Columns.Add("titleCustName");

                for (int k = 0; k < dt.Rows.Count; k++)
                {
                    string[] depts = departName(dt.Rows[k]["CustID"].ToString());

                    dt.Rows[k]["showCustName"] = depts[1];

                    dt.Rows[k]["titleCustName"] = depts[0];
                }


                this.Repeater_DMSMember.DataSource = DealWithByTable(dt);
            }
            //绑定列表数据
            this.Repeater_DMSMember.DataBind();
            //分页控件(要明确页面容器ID,这里没有写是因为请求页面在Request参数中声明了)
            this.AjaxPager_DMSMember.InitPager(this.CountOfRecords, "divQueryResultContent", PageSize);
        }