예제 #1
0
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetListCRM(int Top, string strWhere, string filedOrder, string strEmp_id, string strFactoryId)
        {
            DataSet ds = dal.GetListCRM(Top, strWhere, filedOrder, strEmp_id, strFactoryId);

            BLL.CRM_Customer customer = new BLL.CRM_Customer();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                //全部客户(权限内)
                string strTemp = customer.GetCount("dataAllCus", " Factory_Id='" + strFactoryId + "'" + " and privatecustomer='私客'" + " and isDelete=0 " + DataAuth(strEmp_id.ToString(), strFactoryId)).ToString();//
                //本月未联系(权限内)
                string sqlMonth = " lastfollow<DATE_ADD(curdate(),interval -day(curdate())+1 day)" + DataAuth(strEmp_id.ToString(), strFactoryId)
                                  + " and Factory_Id='" + strFactoryId + "' and privatecustomer='私客' and isDelete=0";
                string strTemp1 = customer.GetCount("dataAllCus", sqlMonth).ToString();//

                //当天联系(权限内)
                string sqlDay = " date_format(lastfollow,'%Y-%m-%d')=curdate()" + DataAuth(strEmp_id.ToString(), strFactoryId) +
                                " and Factory_Id='" + strFactoryId + "' and privatecustomer='私客' and isDelete=0";
                string strTemp2 = customer.GetCount("dataAllCus", sqlDay).ToString();

                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    switch (item["Menu_name"].ToString())
                    {
                    case "全部客户(权限内)":
                        item["count1"] = strTemp;
                        break;

                    case "本月未联系(权限内)":
                        item["count1"] = strTemp1;
                        break;

                    case "当天联系(权限内)":
                        item["count1"] = strTemp2;
                        break;

                    default:
                        break;
                    }
                }
            }
            return(ds);
        }