Ejemplo n.º 1
0
        private void buttonExcel_Click(object sender, EventArgs e)
        {
            SQLBackupandRestore SQLBR = new SQLBackupandRestore();
            TrialBalancePretty  TBP   = new TrialBalancePretty();

            String lsDealerNum = comboBoxDealer.Text.TrimEnd().TrimStart() + "%", lsState;

            lsState = (comboBoxState.SelectedValue != null) ? comboBoxState.SelectedValue.ToString().TrimStart().TrimEnd() + "%" : "%";

            IACDataSetTableAdapters.CUSTOMERTableAdapter                CUSTOMERTableAdapter                = new IACDataSetTableAdapters.CUSTOMERTableAdapter();
            IACDataSetTableAdapters.ClosedDealerSummaryTableAdapter     ClosedDealerSummaryTableAdapter     = new IACDataSetTableAdapters.ClosedDealerSummaryTableAdapter();
            IACDataSetTableAdapters.WS_DEALER_TRIAL_BALANCETableAdapter WS_DEALER_TRIAL_BALANCETableAdapter = new IACDataSetTableAdapters.WS_DEALER_TRIAL_BALANCETableAdapter();
            // Moses Newman 05/3/2014 Get rid of SQL Pass Through!
            CUSTOMERTableAdapter.FillByStateDealer(iACDataSet.CUSTOMER, lsState, lsDealerNum);
            ClosedDealerSummaryTableAdapter.Fill(iACDataSet.ClosedDealerSummary, DateTime.Now.Month, DateTime.Now.Year);
            WS_DEALER_TRIAL_BALANCETableAdapter.FillByStateDealer(iACDataSet.WS_DEALER_TRIAL_BALANCE, lsState, lsDealerNum);
            Int32 elapsed = 0;

            if (SQLBR.RunJob("TrialBalance", "Export Trial Balance To EXCEL", false))
            {
                TBP.IACType            = "C";
                TBP.CustDealerCount    = iACDataSet.CUSTOMER.Rows.Count;
                TBP.DealerCount        = iACDataSet.WS_DEALER_TRIAL_BALANCE.Rows.Count;
                TBP.DealerSummaryCount = iACDataSet.ClosedDealerSummary.Rows.Count;
                TBP.FullSourcePath     = @"\\Dc-iac\public\AccStuff\mfdata\comp1000\ClosedTrialBalance.xlsx";
                Thread.Sleep(5000);
                var fi1 = new FileInfo(TBP.FullSourcePath);

                while (TBP.IsFileLocked(fi1) && elapsed < 500000)
                {
                    Thread.Sleep(1000);
                    elapsed += 1000;
                }
                TBP.TBPRetty();
            }
        }
Ejemplo n.º 2
0
        private void ReadPCPAYFILE(IACDataSet PCPAY)
        {
            PaymentDataSet      IVR   = new PaymentDataSet();
            SQLBackupandRestore SQLBR = new SQLBackupandRestore();

            IACDataSetTableAdapters.IVRPAYTableAdapter         IVRPAYTableAdapter     = new IACDataSetTableAdapters.IVRPAYTableAdapter();
            IACDataSetTableAdapters.PAYMENTTableAdapter        PAYMENTTableAdapter    = new IACDataSetTableAdapters.PAYMENTTableAdapter();
            PaymentDataSetTableAdapters.IVRRejectsTableAdapter IVRRejectsTableAdapter = new PaymentDataSetTableAdapters.IVRRejectsTableAdapter();

            if (SQLBR.RunJob("IVRIMPORT", "Import from IVR", false))
            {
                Thread.Sleep(5000);
                try
                {
                    IVRPAYTableAdapter.Fill(PCPAY.IVRPAY);
                }
                catch
                {
                    IVRPAYTableAdapter.Fill(PCPAY.IVRPAY);
                }
            }
            // Moses Newman 09/25/2018 Create Rejects Report if any customers are Inactive.
            if (PCPAY.IVRPAY.Rows.Count != 0)
            {
                IVRRejectsTableAdapter.Create();
                IVRRejectsTableAdapter.FillByAll(IVR.IVRRejects);
                if (IVR.IVRRejects.Rows.Count > 0)
                {
                    MDIIAC2013 MDImain = (MDIIAC2013)MdiParent;
                    Hide();
                    MDImain.CreateFormInstance("ReportViewer", false);
                    ReportViewer rptViewer = (ReportViewer)MDImain.ActiveMdiChild;

                    IVRRejects myReportObject = new IVRRejects();
                    myReportObject.SetDataSource(IVR);
                    myReportObject.SetParameterValue("gsUserID", Program.gsUserID);
                    myReportObject.SetParameterValue("gsUserName", Program.gsUserName);
                    myReportObject.SetParameterValue("gsTitle", "IVR PAYMENT REJECTS REPORT");
                    rptViewer.crystalReportViewer.ReportSource = myReportObject;
                    rptViewer.crystalReportViewer.Refresh();
                    rptViewer.Show();
                }
            }

            if (SQLBR.RunJob("IVRToPayment", "Move IVR to PAYMENT", false))
            {
                Thread.Sleep(5000);
                try
                {
                    PAYMENTTableAdapter.FillByAll(PCPAY.PAYMENT);
                }
                catch
                {
                    PAYMENTTableAdapter.FillByAll(PCPAY.PAYMENT);
                }
            }
            PCPAY.IVRPAY.Clear();

            IVRPAYTableAdapter.Dispose();
            PAYMENTTableAdapter.Dispose();

            PCPAY.Dispose();
        }