Example #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) + "}";
                }
            }
        }
Example #2
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();
        }