Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int page = GetInt("page", 1);
                int rows = GetInt("rows", 100);
                int total = 0;
                int corpid = GetInt("corpid", 0);
                string customername = GetString("uname");
                string customerphone = GetString("phone");
                int connectuserid = GetInt("uid",0);
                int connectwayid = GetInt("connectway",0);
                int customerlevelid = GetInt("customerlevel",0);
                string starttime = GetString("starttime");
                string endtime = GetString("endtime");

                CustomerConnectRecordQuery query = new CustomerConnectRecordQuery();
                query.CorporationID = corpid;
                if (!string.IsNullOrEmpty(customername))
                    query.CustomerName = customername;
                if (!string.IsNullOrEmpty(customerphone))
                    query.CustomerPhone = customerphone;
                if(connectuserid > 0)
                    query.ConnectUserID = connectuserid;
                if (connectwayid > 0)
                    query.ConnectwayID = connectwayid;
                if (customerlevelid > 0)
                    query.CustomerLevelID = customerlevelid;
                if (!string.IsNullOrEmpty(starttime))
                    query.StartTime = DataConvert.SafeDate(starttime);
                if (!string.IsNullOrEmpty(endtime))
                    query.EndTime = DataConvert.SafeDate(endtime).AddDays(1);
                if (!Admin.Administrator && Admin.UserRole != UserRoleType.系统管理员)
                {
                    if (CurrentPowerGroup != null && !string.IsNullOrEmpty(CurrentPowerGroup.CanviewGroupIds))
                    {
                        query.CanviewGroupIds = CurrentPowerGroup.CanviewGroupIds;
                    }
                }

                List<CustomerConnectRecordInfo> list = CustomerConnectRecords.Instance.GetList(query, page, rows, ref total);

                int maxpage = total / rows + (total % rows == 0 ? 0 : 1);

                Response.Write("{\"count\":" + list.Count + ",\"total\":" + total + ",\"maxpage\":" + maxpage + ",\"rows\":" + Serializer.SerializeJson(list) + "}");
            }
        }
Example #2
0
        protected void ExportUseDetail()
        {
            List<AdminInfo> adminlist = Admins.Instance.GetUsers();
            List<CustomerInfo> customerlist = Customers.Instance.GetCustomerListByCorporation(DataConvert.SafeInt(ddlCorporation.SelectedValue),true);
            CustomerConnectRecordQuery query;
            List<CustomerConnectRecordInfo> connectrecordlist;
            adminlist = adminlist.FindAll(a => a.CorporationID == DataConvert.SafeInt(ddlCorporation.SelectedValue)).OrderBy(c=>c.PowerGroupID).ToList();
            InitializeWorkbook();
            HSSFSheet sheet1 = (HSSFSheet)hssfworkbook.CreateSheet("Sheet1");
            HSSFRow rowHeader = (HSSFRow)sheet1.CreateRow(0);
            rowHeader.CreateCell(0).SetCellValue("姓名");
            rowHeader.CreateCell(1).SetCellValue("线索数量");
            rowHeader.CreateCell(2).SetCellValue("跟踪次数");
            rowHeader.CreateCell(3).SetCellValue("登录次数");
            rowHeader.CreateCell(4).SetCellValue("最后登录时间");

            for (int i = 0; i < adminlist.Count; i++)
            {
                HSSFRow row = (HSSFRow)sheet1.CreateRow(i + 1);
                row.CreateCell(0).SetCellValue(adminlist[i].Realname);
                row.CreateCell(4).SetCellValue(adminlist[i].LastLoginTime.HasValue ? adminlist[i].LastLoginTime.Value.ToString("yyyy-M-d HH:mm:ss") : "");
                row.CreateCell(3).SetCellValue(adminlist[i].LoginTimes);
                row.CreateCell(1).SetCellValue(customerlist.FindAll(c => c.OwnerID == adminlist[i].ID).Count);
                int recordcount = 0;
                query = new CustomerConnectRecordQuery();
                query.ConnectUserID = adminlist[i].ID;
                connectrecordlist = CustomerConnectRecords.Instance.GetList(query, 1, 1, ref recordcount);
                row.CreateCell(2).SetCellValue(recordcount);
            }

            using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
            {
                hssfworkbook.Write(ms);
                Response.Clear();
                Response.Buffer = true;
                Response.ContentType = "application/vnd.ms-excel";
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                Response.AppendHeader("Content-Disposition", "attachment; filename=销售客户管理系统使用情况统计.xls");
                Response.BinaryWrite(ms.ToArray());
                Response.End();
                hssfworkbook = null;
            }
        }
Example #3
0
 public abstract List <CustomerConnectRecordInfo> GetCustomerConnectRecordList(CustomerConnectRecordQuery query, int pageindex, int pagesize, ref int recordcount);
        public override List<CustomerConnectRecordInfo> GetCustomerConnectRecordList(CustomerConnectRecordQuery query, int pageindex, int pagesize, ref int recordcount)
        {
            List<CustomerConnectRecordInfo> list = new List<CustomerConnectRecordInfo>();

            SqlParameter p;

            using (IDataReader reader = CommonPageSql.GetDataReaderByPager(_con, pageindex, pagesize, query, out p))
            {
                while (reader.Read())
                {
                    list.Add(PopulateCustomerConnectRecordInfo(reader));
                }
            }
            recordcount = int.Parse(p.Value.ToString());

            return list;
        }
 public List<CustomerConnectRecordInfo> GetList(CustomerConnectRecordQuery query,int pageindex,int pagesize,ref int recordcount)
 {
     return CommonDataProvider.Instance().GetCustomerConnectRecordList(query, pageindex, pagesize,ref recordcount);
 }
Example #6
0
 public abstract List<CustomerConnectRecordInfo> GetCustomerConnectRecordList(CustomerConnectRecordQuery query, int pageindex, int pagesize, ref int recordcount);
Example #7
0
 public List <CustomerConnectRecordInfo> GetList(CustomerConnectRecordQuery query, int pageindex, int pagesize, ref int recordcount)
 {
     return(CommonDataProvider.Instance().GetCustomerConnectRecordList(query, pageindex, pagesize, ref recordcount));
 }