Beispiel #1
0
        private void btSave_Click(object sender, EventArgs e)
        {
            if (dgvQDView.CurrentRow != null && dgvQDView.CurrentRow.RowIndex >= 0)
            {
                String         qd_id = dgvQDView.CurrentRow.Cells["QD_ID"].Value.ToString();
                String         dtb   = dgvQDView.CurrentRow.Cells["DTB"].Value.ToString();
                LIST_QDControl ctr   = new LIST_QDControl();

                qdinfo       = ctr.Get_LIST_QD(dtb, qd_id, ref sErr);
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Beispiel #2
0
        private static string ExexPDF(string[] args)
        {
            string dtb = args[1];

            string qdid  = "";
            int    index = 0;
            string value = "";

            if (args.Length >= 6)
            {
                qdid = args[5];
            }
            if (args.Length >= 7)
            {
                index = Convert.ToInt32(args[6]);
            }
            if (args.Length >= 8)
            {
                value = args[7];
            }

            BUS.LIST_QDControl qdCtr  = new LIST_QDControl();
            DTO.LIST_QDInfo    qdInfo = qdCtr.Get_LIST_QD(dtb, qdid, ref sErr);
            if (qdInfo.QD_ID != "")
            {
                _sqlText = qdInfo.SQL_TEXT;
                try
                {
                    //  ;General Timeout=100
                    LoadQD(qdInfo);
                    if (value != "")
                    {
                        _sqlBuilder.Filters[index].FilterFrom = _sqlBuilder.Filters[index].FilterTo = _sqlBuilder.Filters[index].ValueTo = _sqlBuilder.Filters[index].ValueFrom = value;
                    }
                    BUS.DBAControl dbaCtr = new DBAControl();
                    DTO.DBAInfo    dbaInf = dbaCtr.Get(dtb, ref sErr);
                    __templatePath = dbaInf.REPORT_TEMPLATE_DRIVER;
                    ReportGenerator report = new ReportGenerator(_sqlBuilder, qdInfo.QD_ID, _sqlText, _strConnectDes, __templatePath, __reportPath, __documentDirectory);
                    return(report.ExportPDFToPath(__reportPath));
                }
                catch (Exception ex)
                {
                    sErr = ex.Message;
                    BUS.CommonControl.AddLog("ErroLog", __documentDirectory + "\\Log", String.Format("[QDCommand]\t[{0}]:\t{1}, {2}, {3}", DateTime.Now, ex.Message, ex.Source, ex.StackTrace));
                    return("");
                }
            }
            return("");
        }
Beispiel #3
0
        private static string ExexReport(string[] args)
        {
            string dtb   = args[1];
            string qdid  = "";
            int    index = 0;
            string value = "";

            if (args.Length >= 6)
            {
                qdid = args[5];
            }
            if (args.Length >= 7)
            {
                index = args[6] == "ZZZ" ? 0 : Convert.ToInt32(args[6]);
            }
            if (args.Length >= 8)
            {
                value = args[7] == "ZZZ" ? "" : args[7];
            }
            string path = "";

            if (args.Length >= 9)
            {
                path = args[8] == "ZZZ" ? "" : args[8];
            }
            path = path.Replace("%20", " ");
            string filename = "";

            if (args.Length >= 10)
            {
                filename = args[9] == "ZZZ" ? "" : args[9];
            }
            filename = filename.Replace("%20", " ");

            BUS.LIST_QDControl qdCtr  = new LIST_QDControl();
            DTO.LIST_QDInfo    qdInfo = qdCtr.Get_LIST_QD(dtb, qdid, ref sErr);
            if (qdInfo.QD_ID != "")
            {
                _sqlText = qdInfo.SQL_TEXT;
                try
                {
                    LoadQD(qdInfo);
                    if (value != "")
                    {
                        _sqlBuilder.Filters[index].FilterFrom = _sqlBuilder.Filters[index].FilterTo = _sqlBuilder.Filters[index].ValueTo = _sqlBuilder.Filters[index].ValueFrom = value;
                    }
                    BUS.DBAControl dbaCtr = new DBAControl();
                    DTO.DBAInfo    dbaInf = dbaCtr.Get(dtb, ref sErr);
                    __templatePath = dbaInf.REPORT_TEMPLATE_DRIVER;

                    ReportGenerator report = new ReportGenerator(_sqlBuilder, qdInfo.QD_ID, _sqlText, _strConnectDes, __templatePath, __reportPath, __documentDirectory);

                    if (path == "" && filename == "")
                    {
                        return(report.ExportExcelToPath(__reportPath));
                    }
                    else if (path != "" && filename == "")
                    {
                        return(report.ExportExcelToPath(path));
                    }
                    else if (path == "" && filename != "")
                    {
                        return(report.ExportExcelToFile(__reportPath, filename));
                    }
                    else
                    {
                        return(report.ExportExcelToFile(path, filename));
                    }
                }
                catch (Exception ex)
                {
                    sErr = ex.Message;
                    BUS.CommonControl.AddLog("ErroLog", __documentDirectory + "\\Log", "[QDCommand]\t[" + DateTime.Now.ToString() + "]:\t" + ex.Message + ", " + ex.Source + ", " + ex.StackTrace);
                    return("");
                }
            }
            return("");
        }