Exemple #1
0
 /// <summary>
 /// 导出单位信息到EXCEL
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnExport_Click(object sender, EventArgs e)
 {
     if (gvList.Rows.Count <= 0)
     {
         MessageBoxShow("导出没有数据!"); return;
     }
     try
     {
         Hashtable ht1 = new Hashtable();
         ht1.Add("Dictlabid", dropDictlab.SelectedValue);
         ht1.Add("IsActive", dropStatus.SelectedValue);
         ht1.Add("strKey", TextUtility.ReplaceText(txtStrKey.Text.Trim()) == "" ? null : TextUtility.ReplaceText(txtStrKey.Text.Trim()));
         DataTable dt = null;
         if (raoType.SelectedValue == "0")
         {
             dt = dictCustomerService.GetDictcustomerExportList(ht1);
         }
         else
         {
             dt = dictCustomerService.GetDictcustomerdiscountedExportList(ht1);
         }
         if (dt == null || dt.Rows.Count <= 0)
         {
             MessageBoxShow("导出没有数据!");
             return;
         }
         SortedList sortlist = new SortedList(new MySort());
         sortlist.Add("audittext", "审核状态");
         sortlist.Add("DICTCUSTOMERID", "单位ID");
         sortlist.Add("CUSTOMERNAME", "单位名称");
         sortlist.Add("CUSTOMERCODE", "客户代码");
         sortlist.Add("labname", "分点实验室");
         sortlist.Add("ADDRESS", "单位地址");
         sortlist.Add("CONTACTMAN", "联系人");
         sortlist.Add("CONTACTPHONE", "联系人电话");
         sortlist.Add("saleman", "销售人员");
         sortlist.Add("checkbillnam", "财务人员");
         sortlist.Add("TELEPHONE", "联系电话");
         sortlist.Add("FAX", "传真");
         sortlist.Add("EMAIL", "邮箱");
         sortlist.Add("POSTCODE", "邮编");
         sortlist.Add("CUSTOMERNAME2", "单位别名");
         sortlist.Add("REMARK", "备注");
         String sheetname = DateTime.Now.ToString("yyyy-MM-dd");
         String filename  = DateTime.Now.ToString("yyyyMMdd_hhmmss");
         ExcelOperation <DataTable> .ExportDataTableToExcel(dt, filename, sheetname, sortlist);
     }
     catch (Exception ex)
     {
         MessageBoxShow("导出数据出错。错误信息:" + ex.Message);
     }
 }
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExport_Click(object sender, EventArgs e)
        {
            Hashtable ht = GetParm();
            DataTable dt = ordersService.DataForFinanceAuditExport(ht);

            if (dt.Rows.Count > 0)
            {
                String sheetname = DateTime.Now.ToString("yyyy-MM-dd");
                String filename  = DateTime.Now.ToString("yyyyMMdd_hhmmss");
                ExcelOperation <DataTable> .ExportDataTableToExcel(dt, filename, sheetname);
            }
            else
            {
                MessageBoxShow("没有需要导出的数据!", MessageBoxIcon.Information);
            }
        }
Exemple #3
0
        //导出当前页数据
        protected void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                Hashtable ht       = new Hashtable();
                PageUtil  pageUtil = new PageUtil(GridInfos.PageIndex, GridInfos.PageSize);
                ht["Dictcustomerid"] = DropCustomer.SelectedValue;
                ht["Realname"]       = tbxName.Text = TextUtility.ReplaceText(tbxName.Text);
                ht["Idnumber"]       = tbxIDNumber.Text = TextUtility.ReplaceText(tbxIDNumber.Text);
                ht["dictsalemanid"]  = Userinfo.userId;//销售人员id
                ht["pageStart"]      = pageUtil.GetPageStartNum();
                ht["pageEnd"]        = pageUtil.GetPageEndNum();

                DataTable source = memberservice.GetCustomerInfosExportList(ht);
                if (source.Rows.Count == 0)
                {
                    MessageBoxShow("导出没有数据!");
                    return;
                }

                string     sheetname = DateTime.Now.ToString("yyyy-MM-dd");
                string     filename  = DateTime.Now.ToString("yyyyMMdd_hhmmss");
                SortedList sortlist  = new SortedList(new MySort());
                sortlist.Add("Realname", "姓名");
                sortlist.Add("Sex", "性别");
                sortlist.Add("Birthday", "出生日期");
                sortlist.Add("Mobile", "手机");
                sortlist.Add("Idnumber", "身份证");
                sortlist.Add("Addres", "住址");
                ExcelOperation <Dictmember> .ExportDataTableToExcel(source, filename, sheetname, sortlist);
            }
            catch (Exception)
            {
                MessageBoxShow("导出数据出错,请联系管理员!");
            }
        }
Exemple #4
0
 protected void btnExcel_Click(object sender, EventArgs e)
 {
     try
     {
         if (Dp_BeginDate.Text == "" || Dp_EndDate.Text == "")
         {
             MessageBoxShow("起止时间不能为空!", MessageBoxIcon.Information);
             return;
         }
         Hashtable ht = new Hashtable();
         if (dropDictLab.SelectedValue == "-1")
         {
             ht.Add("labid", Userinfo.joinLabidstr);
         }
         else
         {
             ht.Add("labid", dropDictLab.SelectedValue);
         }
         if (DropCustomer.SelectedValue != "-1")
         {
             ht.Add("customername", DropCustomer.SelectedValue);
         }
         ht.Add("province", dropProvice.SelectedValue);
         ht.Add("DateStart", Dp_BeginDate.Text);
         ht.Add("Section", txtSection.Text.Trim());
         ht.Add("DateEnd", Convert.ToDateTime(Dp_EndDate.Text).AddDays(1).ToString("yyyy-MM-dd"));
         String sheetname = DateTime.Now.ToString("yyyy-MM-dd");
         String filename  = DateTime.Now.ToString("yyyyMMdd_hhmmss");
         if (ddlStatus.SelectedValue == "1")//护美类产品返回公司体检量统计
         {
             using (DataTable hpvinstrumentsList = new HpvtestingService().GetListHpvinstrumentsByWhereTime(ht))
             {
                 if (hpvinstrumentsList.Rows.Count > 0)
                 {
                     ExcelOperation <DataTable> .ExportDataTableToExcel(hpvinstrumentsList, filename, sheetname);
                 }
                 else
                 {
                     MessageBoxShow("没有需要导出的数据!", MessageBoxIcon.Information);
                 }
             }
         }
         else if (ddlStatus.SelectedValue == "0")//全部检测数据导出
         {
             using (DataTable TM15List = new HpvtestingService().GetListTM15ByWhereTime(ht))
             {
                 if (TM15List.Rows.Count > 0)
                 {
                     ExcelOperation <DataTable> .ExportDataTableToExcel(TM15List, filename, sheetname);
                 }
                 else
                 {
                     MessageBoxShow("没有需要导出的数据!", MessageBoxIcon.Information);
                 }
             }
         }
         else if (ddlStatus.SelectedValue == "2")//查询TM15检测数据
         {
             ht.Add("isTP", "1");
             using (DataTable TM15List = new HpvtestingService().GetListTM15ByWhereTime(ht))
             {
                 if (TM15List.Rows.Count > 0)
                 {
                     ExcelOperation <DataTable> .ExportDataTableToExcel(TM15List, filename, sheetname);
                 }
                 else
                 {
                     MessageBoxShow("没有需要导出的数据!", MessageBoxIcon.Information);
                 }
             }
         }
         else if (ddlStatus.SelectedValue == "3")//分点查询所有检测项目,并组合项目及价格求和
         {
             using (DataTable TestNameList = new HpvtestingService().GetListTestNameWhereTime(ht))
             {
                 if (TestNameList.Rows.Count > 0)
                 {
                     ExcelOperation <DataTable> .ExportDataTableToExcel(TestNameList, filename, sheetname);
                 }
                 else
                 {
                     MessageBoxShow("没有需要导出的数据!", MessageBoxIcon.Information);
                 }
             }
         }
         else if (ddlStatus.SelectedValue == "4")//HPV+TM检查统计导出
         {
             using (DataTable TM15HPVList = new HpvtestingService().SelectHPVTMAccondingInfos(ht))
             {
                 if (TM15HPVList.Rows.Count > 0)
                 {
                     ExcelOperation <DataTable> .ExportDataTableToExcel(TM15HPVList, filename, sheetname);
                 }
                 else
                 {
                     MessageBoxShow("没有需要导出的数据!", MessageBoxIcon.Information);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxShow(ex.Message, MessageBoxIcon.Error);
     }
 }