Example #1
0
        public EServ.Shared.Result ViewReport(Core.Core pCore, int TxnCode, string Type)
        {
            EServ.Shared.Result res = new EServ.Shared.Result();
            try
            {
                ISM.Report.Generator gen = new ISM.Report.Generator(_core);
                gen.ReportPath    = pCore.ReportPathIn;
                gen.ReportOutPath = pCore.ReportPathOut;
                gen.UserNo        = pCore.RemoteObject.User.UserNo;
                gen.Client        = pCore.RemoteObject.Connection;
                string error       = "";
                string outfilename = "";


                int success = gen.GetReport(TxnCode, Type, ref outfilename, ref error);

                if (success != 0)
                {
                    MessageBox.Show(string.Format("Result = {0} Error = {1}", success, error));
                    return(new EServ.Shared.Result(1, ""));
                }
                if (!File.Exists(outfilename))
                {
                    MessageBox.Show(string.Format("Ini file not found.", outfilename));
                    return(new EServ.Shared.Result(1, ""));
                }
                ISM.Template.Globals.ShellOpenFile(outfilename);
                return(res);
            }
            catch (Exception ex)
            {
                res.ResultNo   = 1;
                res.ResultDesc = ex.Message;
                return(res);
            }
        }
Example #2
0
        private void btnView1_Click(object sender, EventArgs e)
        {
            EServ.Shared.Result res = new EServ.Shared.Result();


            ISM.Report.Generator gen = new ISM.Report.Generator(_core);
            gen.ReportPath    = _core.ReportPathIn;
            gen.ReportOutPath = _core.ReportPathOut;
            gen.UserNo        = _core.RemoteObject.User.UserNo;
            gen.Client        = _core.RemoteObject.Connection;

            //string suc = gen.DynamicRead("ini", txtReportPriv.Text);
            //if (suc != "") { MessageBox.Show(suc); return; }
            //string succ = gen.DynamicRead("rpt", txtReportPriv.Text);
            //if (succ != "") { MessageBox.Show(succ); return; }

            gen.ReportFormTitle = "Тайлангийн параметер";

            string error       = "";
            string outfilename = "";
            int    success     = gen.GetReport(Convert.ToInt32(txtReportPriv.Text), cboOutType.Text, ref outfilename, ref error);



            if (success != 0)
            {
                if (success == 24)
                {
                    //    this.Close();
                }
                if (success == 30)
                {
                    MessageBox.Show("Report ini file not found.");
                }
                if (success == 10)
                {
                    MessageBox.Show("Ini file not found.");
                }
                if (success == 20)
                {
                    MessageBox.Show("Empty report file name.");
                    //MessageBox.Show("wergt");
                }
                if (success == 21)
                {
                    MessageBox.Show("Empty data source.");
                }
                if (success == 22)
                {
                    MessageBox.Show("Not found specified report file");
                }
                if (success == 23)
                {
                    MessageBox.Show("Export error.");
                }
                if (success == 29)
                {
                    MessageBox.Show("Other error.");
                }
                //    MessageBox.Show(string.Format("Result = {0} Error = {1}", success, error));
                //   return;
            }


            if (!File.Exists(outfilename))
            {
                // MessageBox.Show(string.Format("Output file does not exist.\r\n{0}", outfilename));


                return
                ;
            }



            ISM.Template.Globals.ShellOpenFile(outfilename);
        }