Exemplo n.º 1
0
        private void GetGroupInfo()
        {
            //所属分组
            Entities.EmployeeAgent model = BLL.EmployeeAgent.Instance.GetEmployeeAgentByUserID(int.Parse(UserID));
            if (model != null)
            {
                AtGroupID = model.BGID.ToString();
                AreaID    = model.RegionID.ToString();
            }

            //管辖分组
            Entities.QueryUserGroupDataRigth query = new Entities.QueryUserGroupDataRigth();
            query.UserID = int.Parse(UserID);
            int       totalCount = 0;
            DataTable dt         = BLL.UserGroupDataRigth.Instance.GetUserGroupDataRigth(query, "", 1, 1000, out totalCount);
            int       i          = 0;

            foreach (DataRow dr in dt.Rows)
            {
                ManagerGroupIDs += dr["BGID"].ToString() + ",";
            }
            if (ManagerGroupIDs != "")
            {
                ManagerGroupIDs = ManagerGroupIDs.Substring(0, ManagerGroupIDs.Length - 1);
            }
        }
Exemplo n.º 2
0
        private void GetGroupDataRight(out string msg)
        {
            msg = string.Empty;
            Entities.QueryUserGroupDataRigth query = new Entities.QueryUserGroupDataRigth();
            query.UserID = UserID;
            int       totalCount = 0;
            DataTable dt         = BLL.UserGroupDataRigth.Instance.GetUserGroupDataRigth(query, "", 1, 1000, out totalCount);
            int       i          = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (i == 0)
                {
                    msg += "[";
                }
                if (i == dt.Rows.Count - 1)
                {
                    msg += "{BGID:'" + dr["BGID"].ToString() + "',RightType:'" + dr["RightType"].ToString() + "'}]";
                }
                else
                {
                    msg += "{BGID:'" + dr["BGID"].ToString() + "',RightType:'" + dr["RightType"].ToString() + "'},";
                }
                i++;
            }
        }
Exemplo n.º 3
0
        //add by qizq 2012-9-25 无主订单任务列表
        /// <summary>
        /// 按照查询条件查询
        /// </summary>
        /// <param name="query">查询条件</param>
        /// <param name="order">排序</param>
        /// <param name="currentPage">页号,-1不分页</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="totalCount">总行数</param>
        /// <returns>集合</returns>
        public DataTable GetOrderTaskList(QueryOrderTask query, string order, int currentPage, int pageSize, out int totalCount, int userid)
        {
            string where = string.Empty;

            #region 条件

            if (query.TaskID != Constant.INT_INVALID_VALUE)
            {
                where += " AND a.TaskID=" + StringHelper.SqlFilter(query.TaskID.ToString());
            }
            if (query.Source != Constant.INT_INVALID_VALUE)
            {
                where += " AND a.Source=" + StringHelper.SqlFilter(query.Source.ToString());
            }
            if (query.TaskStatus != Constant.INT_INVALID_VALUE)
            {
                where += " AND a.TaskStatus=" + StringHelper.SqlFilter(query.TaskStatus.ToString());
            }
            if (query.RelationID != Constant.INT_INVALID_VALUE)
            {
                where += " AND a.RelationID=" + StringHelper.SqlFilter(query.RelationID.ToString());
            }
            if (query.BGID != Constant.INT_INVALID_VALUE)
            {
                where += " AND a.BGID=" + StringHelper.SqlFilter(query.BGID.ToString());
            }
            if (query.AssignUserID != Constant.INT_INVALID_VALUE)
            {
                where += " AND a.AssignUserID=" + StringHelper.SqlFilter(query.AssignUserID.ToString());
            }
            if (query.UserName != Constant.STRING_INVALID_VALUE)
            {
                where += " AND a.UserName like '%" + StringHelper.SqlFilter(query.UserName) + "%'";
            }
            if (query.Status != Constant.INT_INVALID_VALUE)
            {
                where += " AND a.Status=" + StringHelper.SqlFilter(query.Status.ToString());
            }
            if (query.YpOrderID != Constant.INT_INVALID_VALUE)
            {
                where += " and ((a.source=2 and b.yporderid=" + query.YpOrderID + ") or (a.source=1 and c.yporderid=" + query.YpOrderID + ") or (a.source=3 and c.yporderid=" + query.YpOrderID + "))";
            }

            if (!string.IsNullOrEmpty(query.Area))
            {
                where += " and ((a.source=2 and b.AreaID='" + query.Area + "') or (a.source=1 and c.AreaID='" + query.Area + "') or (a.source=3 and c.AreaID='" + query.Area + "'))";
            }

            if (query.ProvinceID != Constant.INT_INVALID_VALUE)
            {
                where += " and ((a.source=2 and b.ProvinceID='" + query.ProvinceID + "') or (a.source=1 and c.ProvinceID='" + query.ProvinceID + "') or (a.source=3 and c.ProvinceID='" + query.ProvinceID + "'))";
            }
            if (query.CityID != Constant.INT_INVALID_VALUE)
            {
                where += " and ((a.source=2 and b.CityID='" + query.CityID + "') or (a.source=1 and c.CityID='" + query.CityID + "') or (a.source=3 and c.CityID='" + query.CityID + "'))";
            }
            //由于OrderCreateTime 是smallDatetime类型的所以如果查某天数据列如 2月1号的要写成 >='2013-2-1 00:00:000' and <'2013-2-2 00:00:000'
            if (query.CreateTimeBegin != Constant.DATE_INVALID_VALUE && query.CreateTimeEnd != Constant.DATE_INVALID_VALUE)
            {
                DateTime endtime = Convert.ToDateTime(query.CreateTimeEnd);
                if (endtime.Hour == 23 && endtime.Minute == 59)
                {
                    endtime = endtime.AddHours(-23);
                    endtime = endtime.AddMinutes(-59);
                    endtime = endtime.AddSeconds(-endtime.Second);
                    endtime = endtime.AddDays(1);
                }

                where += " and ((a.source=2 and (b.OrderCreateTime>='" + query.CreateTimeBegin + "' and b.OrderCreateTime<'" + endtime + "')) or (a.source=1 and (c.OrderCreateTime>='" + query.CreateTimeBegin + "' and c.OrderCreateTime<'" + endtime + "')) or (a.source=3 and (c.OrderCreateTime>='" + query.CreateTimeBegin + "' and c.OrderCreateTime<'" + endtime + "')))";
            }
            if (query.SubmitTimeBegin != Constant.DATE_INVALID_VALUE && query.SubmitTimeEnd != Constant.DATE_INVALID_VALUE)
            {
                where += " and (a.submittime>='" + Convert.ToDateTime(query.SubmitTimeBegin).ToShortDateString() + " 0:00:000' and a.submittime<='" + Convert.ToDateTime(query.SubmitTimeEnd).ToShortDateString() + " 23:59:59')";
            }


            if (query.TypeStr != Constant.STRING_INVALID_VALUE)
            {
                if (query.TypeStr.IndexOf(',') > 0)
                {
                    where += " and (";
                    for (int i = 0; i < Util.SqlFilterByInCondition(query.TypeStr).Split(',').Length; i++)
                    {
                        where += " a.Source='" + Util.SqlFilterByInCondition(query.TypeStr).Split(',')[i] + "' or";
                    }
                    where  = where.Substring(0, where.Length - 3);
                    where += ")";
                }
                else
                {
                    where += " and a.source='" + query.TypeStr + "'";
                }
            }
            //add by qizq 2013-7-18加任务类型,0是无主订单,不等于0是免费订单
            if (query.TaskType != Constant.STRING_INVALID_VALUE)
            {
                if (query.TaskType.IndexOf(',') > 0)
                {
                }
                else
                {
                    if (query.TaskType == "0")
                    {
                        where += " and a.DealerID=0";
                    }
                    else
                    {
                        where += " and a.DealerID!=0";
                    }
                }
            }
            //

            if (query.IsSelectdMsmemberstr != Constant.STRING_INVALID_VALUE)
            {
                if (query.IsSelectdMsmemberstr.IndexOf(',') > 0)
                {
                    where += " and ( a.isselectDMSMember='" + Util.SqlFilterByInCondition(query.IsSelectdMsmemberstr).Split(',')[0] + "' or (a.isselectDMSMember='" + query.IsSelectdMsmemberstr.Split(',')[1] + "'";

                    if (query.NoDealerReasonID != Constant.INT_INVALID_VALUE)
                    {
                        where += " and a.NoDealerReasonID=" + query.NoDealerReasonID + "";
                    }
                    where += "))";
                }
                else
                {
                    where += " and a.isselectDMSMember='" + Util.SqlFilterByInCondition(query.IsSelectdMsmemberstr) + "'";
                    if (query.NoDealerReasonID != Constant.INT_INVALID_VALUE)
                    {
                        where += " and a.NoDealerReasonID=" + query.NoDealerReasonID + "";
                    }
                }
            }
            if (query.StatuStr != Constant.STRING_INVALID_VALUE)
            {
                if (query.StatuStr.IndexOf(',') > 0)
                {
                    where += " and (";
                    for (int i = 0; i < Util.SqlFilterByInCondition(query.StatuStr).Split(',').Length; i++)
                    {
                        where += " a.TaskStatus='" + Util.SqlFilterByInCondition(query.StatuStr).Split(',')[i] + "' or";
                    }
                    where  = where.Substring(0, where.Length - 3);
                    where += ")";
                }
                else
                {
                    where += " and a.TaskStatus='" + StringHelper.SqlFilter(query.StatuStr) + "'";
                }
            }


            //判断当前人是否有全部数据权限
            int RightType = (int)Dal.UserDataRigth.Instance.GetUserDataRigth(userid).RightType;
            //如果没有
            if (RightType != 2)
            {
                //取当前人所对应的数据权限组
                Entities.QueryUserGroupDataRigth QueryUserGroupDataRigth = new Entities.QueryUserGroupDataRigth();
                QueryUserGroupDataRigth.UserID = userid;
                int       totcount             = 0;
                DataTable dtUserGroupDataRigth = Dal.UserGroupDataRigth.Instance.GetUserGroupDataRigth(QueryUserGroupDataRigth, "", 1, 100000, out totcount);
                string    Rolename             = string.Empty;
                if (dtUserGroupDataRigth != null && dtUserGroupDataRigth.Rows.Count > 0)
                {
                    where += "  and (";
                    for (int i = 0; i < dtUserGroupDataRigth.Rows.Count; i++)
                    {
                        //本人
                        if (dtUserGroupDataRigth.Rows[i]["RightType"].ToString() == "1")
                        {
                            where += "(a.BGID='" + dtUserGroupDataRigth.Rows[i]["BGID"].ToString() + "' and a.assignuserid='" + userid + "') or";
                        }
                        //本组
                        else
                        {
                            where += "(a.BGID='" + dtUserGroupDataRigth.Rows[i]["BGID"].ToString() + "') or";
                        }
                    }
                    where  = where.Substring(0, where.Length - 3);
                    where += ")";
                }
            }



            #endregion

            DataSet ds;

            SqlParameter[] parameters =
            {
                new SqlParameter("@where",         SqlDbType.NVarChar, 40000),
                new SqlParameter("@order",         SqlDbType.NVarChar,   200),
                new SqlParameter("@pagesize",      SqlDbType.Int,          4),
                new SqlParameter("@indexpage",     SqlDbType.Int,          4),
                new SqlParameter("@totalRecorder", SqlDbType.Int, 4)
            };

            parameters[0].Value     = where;
            parameters[1].Value     = order;
            parameters[2].Value     = pageSize;
            parameters[3].Value     = currentPage;
            parameters[4].Direction = ParameterDirection.Output;

            ds         = SqlHelper.ExecuteDataset(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_ORDERTASK_MANAGE, parameters);
            totalCount = (int)(parameters[4].Value);
            return(ds.Tables[0]);
        }
Exemplo n.º 4
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) + "}";
                }
            }
        }
Exemplo n.º 5
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();
        }