Пример #1
0
        private void GetTagStatisticData(out string msg)
        {
            msg = "";

            int totcount;
            int userID = BLL.Util.GetLoginUserID();

            Entities.QueryCC_CustUserMapping query = new Entities.QueryCC_CustUserMapping();
            if (!string.IsNullOrEmpty(RequestCustName))
            {
                query.CustName = RequestCustName.Trim();
            }
            if (!string.IsNullOrEmpty(RequestBrand))
            {
                query.Brandids = RequestBrand.Trim();
            }
            if (!string.IsNullOrEmpty(RequestSearchTrueNameID))
            {
                query.UserName = RequestSearchTrueNameID.Trim();
            }
            //坐席查询条件:是否有坐席
            query.NoResponser = RequestNoResponser;
            if (!string.IsNullOrEmpty(RequestProvinceID) && int.Parse(RequestProvinceID) > 0)
            {
                query.ProvinceID = RequestProvinceID.Trim();
            }
            if (!string.IsNullOrEmpty(RequestCityID) && int.Parse(RequestCityID) > 0)
            {
                query.CityID = RequestCityID.Trim();
            }
            if (!string.IsNullOrEmpty(RequestCountyID) && int.Parse(RequestCountyID) > 0)
            {
                query.CountyID = RequestCountyID.Trim();
            }
            //add by qizq 2012-5-30 客户类型经和营范围
            if (!string.IsNullOrEmpty(ClientType))
            {
                query.TypeID = ClientType;
            }
            if (!string.IsNullOrEmpty(CarType))
            {
                query.CarType = CarType;
            }
            //add lxw 12.6.8 最近访问时间
            if (!string.IsNullOrEmpty(StartTime))
            {
                query.StartTime = DateTime.Parse(StartTime);
            }
            if (!string.IsNullOrEmpty(EndTime))
            {
                query.EndTime = DateTime.Parse(EndTime);
            }
            if (Contact != -2)
            {
                query.Contact = Contact;
            }
            if (!string.IsNullOrEmpty(RequestProjectName))
            {
                query.ProjectName = RequestProjectName.Trim();
            }
            if (!string.IsNullOrEmpty(radioTaoche))
            {
                query.radioTaoche = radioTaoche;
            }
            //取当前人所对应的数据权限组
            Entities.QueryUserGroupDataRigth QueryUserGroupDataRigth = new Entities.QueryUserGroupDataRigth();
            QueryUserGroupDataRigth.UserID = userID;
            DataTable dtUserGroupDataRigth = BLL.UserGroupDataRigth.Instance.GetUserGroupDataRigth(QueryUserGroupDataRigth, "", 1, 100000, out totcount);
            string    Rolename             = string.Empty;

            query.UserID = userID;//进列表肯定有查看本人负责的客户信息
            if (dtUserGroupDataRigth != null && dtUserGroupDataRigth.Rows.Count > 0)
            {
                for (int i = 0; i < dtUserGroupDataRigth.Rows.Count; i++)
                {
                    //4s电话营销,非4s电话营销
                    if (dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "6" || dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "7" || dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "19" || dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "27")
                    {
                        //本组
                        query.BGIDStr += dtUserGroupDataRigth.Rows[i]["bgid"].ToString() + ",";
                    }
                }
            }
            if (!string.IsNullOrEmpty(ReqeustCCProjectName))
            {
                query.ReqeustCCProjectName = ReqeustCCProjectName;
            }
            DataTable dtUserTags = BitAuto.YanFa.Crm2009.BLL.CustTag.Instance.GetCustTagByUserID(userID);
            string    TagIDs     = "";

            foreach (DataRow row in dtUserTags.Rows)
            {
                TagIDs += "," + row["TagID"];
            }
            if (TagIDs.Length > 0)
            {
                TagIDs = TagIDs.Substring(1);
            }
            else
            {
                TagIDs = "0";
            }
            query.TagID = TagIDs;
            DataTable dt = BLL.CC_UserCustDataRigth.Instance.GetCustUserMappingTagStatisticsByUserID(query, userID);


            DataColumn newcol = new DataColumn("ThisTagNum", typeof(string));

            dtUserTags.Columns.Add(newcol);
            //拼接起来
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    foreach (DataRow row2 in dtUserTags.Rows)
                    {
                        if (row["TagName"].ToString() == row2["TagName"].ToString())
                        {
                            row2["ThisTagNum"] = row["TheTagNum"];
                        }
                    }
                }
            }
            if (dtUserTags == null || dtUserTags.Rows.Count < 1)
            {
                msg = "{ }";
            }
            else
            {
                int i = 0;
                foreach (DataRow row in dtUserTags.Rows)
                {
                    if (row["ThisTagNum"] == null || string.IsNullOrEmpty(row["ThisTagNum"].ToString()))
                    {
                        msg += "'" + i + "':['" + row["TagID"].ToString() + "','0','" + row["TagName"].ToString() + "'],";
                        i++;
                    }
                    else
                    {
                        msg += "'" + i + "':['" + row["TagID"].ToString() + "','" + row["ThisTagNum"] + "','" + row["TagName"].ToString() + "'],";
                        i++;
                        // msg += "'" + row["TagName"].ToString() + "':['" + row["TagID"].ToString() + "','" + row["ThisTagNum"] + "'],";
                    }
                }
                if (msg.Length < 1)
                {
                    msg = "{ }";
                }
                else
                {
                    msg = "{ " + msg.Substring(0, msg.Length - 1) + "}";
                }
            }
        }
Пример #2
0
        private string GetList()
        {
            QueryCrmCustInfo queryCustInfo = new QueryCrmCustInfo();

            #region 条件

            if (CustID != string.Empty)
            {
                queryCustInfo.CustID = CustID;
            }
            if (CustName != string.Empty)
            {
                queryCustInfo.CustName = CustName;
            }
            if (CustAbbr != string.Empty)
            {
                queryCustInfo.AbbrName = CustAbbr;
            }
            if (BrandIDs != string.Empty)
            {
                queryCustInfo.BrandID = BrandIDs;
            }
            if (CarType != string.Empty)
            {
                queryCustInfo.CarType = CarType;
            }
            if (ProvinceID > 0)
            {
                queryCustInfo.ProvinceID = ProvinceID.ToString();
            }
            if (CityID > 0)
            {
                queryCustInfo.CityID = CityID.ToString();
            }
            if (CountyID > 0)
            {
                queryCustInfo.CountyID = CountyID.ToString();
            }
            //if (IsHavMember)
            //{
            //    queryCustInfo.IsHaveMember = true;
            //}
            //if (IsNoHavMember)
            //{
            //    queryCustInfo.IsHaveNoMember = true;
            //}

            if (!string.IsNullOrEmpty(CustType))
            {
                queryCustInfo.TypeID = CustType;
            }
            if (!string.IsNullOrEmpty(Address))
            {
                queryCustInfo.Address = Address;
            }
            if (!string.IsNullOrEmpty(TradeMarketID))
            {
                queryCustInfo.TradeMarketID = TradeMarketID;
            }

            if (CustStatus != string.Empty && CustStatus != "0,1")
            {
                queryCustInfo.StatusIDs = CustStatus;
            }
            if (CooperateStatusIDs != string.Empty)
            {
                queryCustInfo.CooperateStatusIDs = CooperateStatusIDs;
            }
            if (CooperatedStatusIDs != string.Empty)
            {
                queryCustInfo.CooperatedStatusIDs = CooperatedStatusIDs;
            }
            if (CustLockStatus != string.Empty && CustLockStatus != "0,1")
            {
                queryCustInfo.Lock = int.Parse(CustLockStatus);
            }
            if (DataSource != string.Empty && DataSource != "1,0")
            {
                queryCustInfo.TaskType = int.Parse(DataSource);
            }
            if (!string.IsNullOrEmpty(RequestBeginMemberCooperatedTime))
            {
                queryCustInfo.BeginMemberCooperatedTime = RequestBeginMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestEndMemberCooperatedTime))
            {
                queryCustInfo.EndMemberCooperatedTime = RequestEndMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestBeginNoMemberCooperatedTime))
            {
                queryCustInfo.BeginNoMemberCooperatedTime = RequestBeginNoMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestEndNoMemberCooperatedTime))
            {
                queryCustInfo.EndNoMemberCooperatedTime = RequestEndNoMemberCooperatedTime;
            }
            if (!string.IsNullOrEmpty(RequestMemberCooperateStatus))
            {
                queryCustInfo.MemberCooperateStatus = RequestMemberCooperateStatus;
            }
            if (!string.IsNullOrEmpty(RequestCreateCustStartDate))
            {
                queryCustInfo.CreateTimeStart = RequestCreateCustStartDate;
            }
            if (!string.IsNullOrEmpty(RequestCreateCustEndDate))
            {
                queryCustInfo.CreateTimeEnd = RequestCreateCustEndDate;
            }
            if (!string.IsNullOrEmpty(RequestAreaTypeIDs))
            {
                queryCustInfo.AreaTypeIDs = RequestAreaTypeIDs;
            }

            if (!string.IsNullOrEmpty(RequestProjectName))
            {
                queryCustInfo.ProjectName = RequestProjectName.Trim();
            }
            if (!string.IsNullOrEmpty(RequestStartMemberCooperatedBeginTime) ||
                !string.IsNullOrEmpty(RequestEndMemberCooperatedBeginTime))
            {
                queryCustInfo.CooperatedStatusIDs = "1";
                if (!string.IsNullOrEmpty(RequestStartMemberCooperatedBeginTime))
                {
                    queryCustInfo.StartMemberCooperatedBeginTime = RequestStartMemberCooperatedBeginTime.Trim();
                }
                if (!string.IsNullOrEmpty(RequestEndMemberCooperatedBeginTime))
                {
                    queryCustInfo.EndMemberCooperatedBeginTime = RequestEndMemberCooperatedBeginTime.Trim();
                }
            }
            #endregion

            DataTable dt = BLL.CrmCustInfo.Instance.GetCC_CrmCustIDsByAlone(queryCustInfo);

            List <string> colList = new List <string>();
            colList.Add("CustID");
            string jsonStr = Converter.DataTable2Json(dt, colList);
            return(jsonStr);
        }
Пример #3
0
        private void BindData()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            int totcount = 0;

            if (!int.TryParse(RequestPageSize, out PageSize))
            {
                PageSize = 20;
            }
            Entities.QueryCC_CustUserMapping query = new Entities.QueryCC_CustUserMapping();
            if (!string.IsNullOrEmpty(RequestCustName))
            {
                query.CustName = RequestCustName.Trim();
            }
            if (!string.IsNullOrEmpty(RequestBrand))
            {
                query.Brandids = RequestBrand.Trim();
            }
            if (!string.IsNullOrEmpty(RequestSearchTrueNameID))
            {
                query.UserName = RequestSearchTrueNameID.Trim();
            }
            //坐席查询条件:是否有坐席
            query.NoResponser = RequestNoResponser;
            if (!string.IsNullOrEmpty(RequestProvinceID) && int.Parse(RequestProvinceID) > 0)
            {
                query.ProvinceID = RequestProvinceID.Trim();
            }
            if (!string.IsNullOrEmpty(RequestCityID) && int.Parse(RequestCityID) > 0)
            {
                query.CityID = RequestCityID.Trim();
            }
            if (!string.IsNullOrEmpty(RequestCountyID) && int.Parse(RequestCountyID) > 0)
            {
                query.CountyID = RequestCountyID.Trim();
            }
            //add by qizq 2012-5-30 客户类型经和营范围
            if (!string.IsNullOrEmpty(ClientType))
            {
                query.TypeID = ClientType;
            }
            if (!string.IsNullOrEmpty(CarType))
            {
                query.CarType = CarType;
            }
            //add lxw 12.6.8 最近访问时间
            if (!string.IsNullOrEmpty(StartTime))
            {
                query.StartTime = DateTime.Parse(StartTime);
            }
            if (!string.IsNullOrEmpty(EndTime))
            {
                query.EndTime = DateTime.Parse(EndTime);
            }
            if (Contact != -2)
            {
                query.Contact = Contact;
            }
            if (!string.IsNullOrEmpty(RequestProjectName))
            {
                query.ProjectName = RequestProjectName.Trim();
            }
            if (!string.IsNullOrEmpty(radioTaoche))
            {
                query.radioTaoche = radioTaoche;
            }
            //取当前人所对应的数据权限组
            Entities.QueryUserGroupDataRigth QueryUserGroupDataRigth = new Entities.QueryUserGroupDataRigth();
            QueryUserGroupDataRigth.UserID = userID;
            DataTable dtUserGroupDataRigth = BLL.UserGroupDataRigth.Instance.GetUserGroupDataRigth(QueryUserGroupDataRigth, "", 1, 100000, out totcount);
            string    Rolename             = string.Empty;

            query.UserID = userID;//进列表肯定有查看本人负责的客户信息
            if (dtUserGroupDataRigth != null && dtUserGroupDataRigth.Rows.Count > 0)
            {
                for (int i = 0; i < dtUserGroupDataRigth.Rows.Count; i++)
                {
                    //4s电话营销,非4s电话营销
                    if (dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "6" || dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "7" || dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "19" || dtUserGroupDataRigth.Rows[i]["bgid"].ToString() == "27")
                    {
                        //本组
                        query.BGIDStr += dtUserGroupDataRigth.Rows[i]["bgid"].ToString() + ",";
                    }
                }
            }
            if (!string.IsNullOrEmpty(ReqeustCCProjectName))
            {
                query.ReqeustCCProjectName = ReqeustCCProjectName;
            }
            query.TagID = TagID;
            int       count;
            DataTable dt;
            string    order = "ISNULL(ISNULL(b1.NextVisitDate,b2.NextVisitDate),'9999-12-30'),ISNULL(a.LastUpdateTime,'9999-12-30')";

            dt = BLL.CC_UserCustDataRigth.Instance.GetCustUserMappingByUserID(query, order, PageCommon.Instance.PageIndex, PageSize, out count);
            string s1 = sw.Elapsed.ToString();

            RecordCount             = count;
            repeaterList.DataSource = dt;
            repeaterList.DataBind();
            litPagerDown.Text = PageCommon.Instance.LinkStringByPost(BLL.Util.GetUrl(), GroupLength, count, PageSize, PageCommon.Instance.PageIndex, 1);
            sw.Stop();
            string s2 = sw.Elapsed.ToString();
        }