コード例 #1
0
        private void btexportExcell_Click(object sender, EventArgs e)
        {
            //FrmNhapLyDo nhapLyDo=new FrmNhapLyDo();
            //nhapLyDo.ShowDialog();
            //if(nhapLyDo._isdongy)
            //{
            SaveFileDialog save = new SaveFileDialog();

            save.Filter = "*.xls|*.xls|*.pdf|*.pdf";
            if (save.ShowDialog() == DialogResult.OK)
            {
                ExcelHelper.exportDataToExcel("Đơn Đặt Hàng", (DataTable)GrDSSKU.DataSource, save.FileName, txthotenKH.Text, txtDienThoai.Text, txtDiaChi.Text);
                //CXoa.Visible = false;
                //GrDSSKU.ExportToXls(save.FileName);

                if (txtghichu.Text != string.Empty)
                {
                    CTLImportExcel excel = new CTLImportExcel();
                    excel.WireGhiChuExcel(save.FileName, txtghichu.Text, gridView1.DataRowCount + 7);
                }
                //excel.WireInfomationCIM(save.FileName, gridView1.DataRowCount + 5, "Họ Tên KH: " + txthotenKH.Text, "Số Điện Thoại: " + txtDienThoai.Text, "Địa Chỉ: " + txtDiaChi.Text);


                //File.Copy(save.FileName, Path.Combine(Path.Combine(Path.Combine(Application.StartupPath, "ExpCust"), DateTime.Now.ToString("MMyyyy")), DateTime.Now.ToString("ddMMyyhhmmss")));
                ////GrDSSKU.ExportToXls(save.);
                ////GrDSSKU.ExportToXls(save.FileName);
                //CXoa.Visible = true;
                //CTLSearchBug ctlSearchBug = new CTLSearchBug();
                //ctlSearchBug.InsertTraceLog(Config._MaNV, DateTime.Now, GetIP(), "FrmXuatBangGia", 1, "FrontEnd Utility", "Export Export Excel");
                InfoMessage.HienThi("Xuất file " + save.FileName + " Thành công!!", "Xuất file Excel", "Thông báo",
                                    HinhAnhThongBao.THANHCONG, NutThongBao.DONGY);
            }
            //}
        }
コード例 #2
0
        private void btexportExcell_Click(object sender, EventArgs e)
        {
            FrmNhapLyDo nhapLyDo = new FrmNhapLyDo();

            nhapLyDo.ShowDialog();
            if (nhapLyDo._isdongy)
            {
                SaveFileDialog save = new SaveFileDialog();
                save.Filter = "*.xls|*.xls|*.pdf|*.pdf";
                if (save.ShowDialog() == DialogResult.OK)
                {
                    CXoa.Visible = false;
                    GrDSSKU.ExportToXls(save.FileName);
                    if (txtghichu.Text != string.Empty)
                    {
                        CTLImportExcel excel = new CTLImportExcel();
                        excel.WireGhiChuExcel(save.FileName, txtghichu.Text, gridView1.DataRowCount + 5);
                    }



                    File.Copy(save.FileName, Path.Combine(Path.Combine(Path.Combine(Application.StartupPath, "ExpCust"), DateTime.Now.ToString("MMyyyy")), DateTime.Now.ToString("ddMMyyhhmmss")));
                    //GrDSSKU.ExportToXls(save.);
                    //GrDSSKU.ExportToXls(save.FileName);
                    CXoa.Visible = true;
                    CTLSearchBug ctlSearchBug = new CTLSearchBug();
                    ctlSearchBug.InsertTraceLog(Config._MaNV, DateTime.Now, GetIP(), "FrmXuatBangGia", 1, "FrontEnd Utility", "Export Export Excel");
                    InfoMessage.HienThi("Xuất file " + save.FileName + " Thành công!!", "Xuất file Excel", "Thông báo",
                                        HinhAnhThongBao.THANHCONG, NutThongBao.DONGY);
                }
            }
        }