Beispiel #1
0
        private void ReportWorkThread_DoWork(object sender, DoWorkEventArgs e)
        {
            Utilities.LogInfoIN();
            m_reports = (Dictionary <int, object>)e.Argument;

            if (m_reports.Count > 0)
            {
                float fltNumRpts = m_reports.Count;

                ReportObjects = new clsReport[m_reports.Count];

                for (int c = 0; c < m_reports.Count; c++)
                {
                    if (m_worker.CancellationPending)
                    {
                        e.Cancel = true;
                        return;
                    }

                    ReportObjects[c]  = (clsReport)m_reports[c];
                    m_retrieveMessage = "Retrieving:" + ReportObjects[c].ReportInfo.DisplayName;
                    m_worker.ReportProgress((int)((c / fltNumRpts) * 100.0));
                    BuildReportDocument(ReportObjects[c]);
                }
            }
        }
Beispiel #2
0
 public static void fnOneTimeSetup()
 {
     clsReport.strReportImagePath = ConfigurationManager.AppSettings.Get("ReportImagePath");
     clsReport.strReportName      = ConfigurationManager.AppSettings.Get("ReportName");
     clsReport.strReportPath      = ConfigurationManager.AppSettings.Get("ReportPath");
     if (objReport == null)
     {
         objReport = new clsReport();
     }
 }
Beispiel #3
0
 public DataSet GetOSLossesClaimPaymentPrintData(clsReport objReport)
 {
     dataAccess = new DataAccess();
     Object[] parameters = new Object[] {
         objReport.ReinsurerName
         , objReport.Reinsurercode
         , objReport.MainClass
         , objReport.SubClass
         , objReport.Currency
         , objReport.PeriodFrom
         , objReport.PeriodTo
     };
     return(dataAccess.LoadDataSet(parameters, "P_IRM_Report_OSLossesClaimPayment", "Rep_OSLossesClaimPayment"));
 }
Beispiel #4
0
 public DataSet GetBrokerageReportPrintData(clsReport objReport)
 {
     dataAccess = new DataAccess();
     Object[] parameters = new Object[] { objReport.CoverNote
                                          , objReport.InvoiceNo
                                          , objReport.ReinsurerName
                                          , objReport.Reinsurercode
                                          , objReport.InsurerCode
                                          , objReport.InsurerName
                                          , objReport.MonthDate
                                          , objReport.User
                                          , objReport.MainClass
                                          , objReport.Currency };
     return(dataAccess.LoadDataSet(parameters, "P_IRM_Report_Brokerage", "Rep_BrokeragePrint"));
 }
Beispiel #5
0
        /// <summary>
        /// 插入一条报表记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public DataTable Insert(clsReport model, out string errMsg)
        {
            DataTable dt = null;

            errMsg = string.Empty;
            try
            {
                sql.Length = 0;
                sql.Append("Insert Into tReport (CheckUnitName,Trademark,Specifications,ProductionDate,QualityGrade,CheckedCompanyName,CheckedCompanyPhone,ProductionUnitsName,ProductionUnitsPhone,TaskSource,Standard,SamplingData,SampleNum,SamplingCode,SampleArrivalData,Notes,IsDeleted,CreateData) ");
                sql.Append("VALUES(");
                sql.AppendFormat("'{0}',", model.CheckUnitName);
                sql.AppendFormat("'{0}',", model.Trademark);
                sql.AppendFormat("'{0}',", model.Specifications);
                sql.AppendFormat("'{0}',", model.ProductionDate);
                sql.AppendFormat("'{0}',", model.QualityGrade);
                sql.AppendFormat("'{0}',", model.CheckedCompanyName);
                sql.AppendFormat("'{0}',", model.CheckedCompanyPhone);
                sql.AppendFormat("'{0}',", model.ProductionUnitsName);
                sql.AppendFormat("'{0}',", model.ProductionUnitsPhone);
                sql.AppendFormat("'{0}',", model.TaskSource);
                sql.AppendFormat("'{0}',", model.Standard);
                sql.AppendFormat("'{0}',", model.SamplingData);
                sql.AppendFormat("'{0}',", model.SampleNum);
                sql.AppendFormat("'{0}',", model.SamplingCode);
                sql.AppendFormat("'{0}',", model.SampleArrivalData);
                sql.AppendFormat("'{0}',", model.Notes);
                sql.AppendFormat("'{0}',", model.IsDeleted);
                sql.AppendFormat("'{0}'", model.CreateData);
                sql.Append(")");
                DataBase.ExecuteCommand(sql.ToString(), out errMsg);
                sql.Length = 0;

                sql.Append("Select Top 1 * From tReport Order By ID Desc");
                string[] cmd = new string[1] {
                    sql.ToString()
                };
                string[] names = new string[1] {
                    "Result"
                };
                dt         = DataBase.GetDataSet(cmd, names, out errMsg).Tables["Result"];
                sql.Length = 0;
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }
            return(dt);
        }
Beispiel #6
0
 public DataSet GetOutstandingClaimReportPrintData(clsReport objReport)
 {
     dataAccess = new DataAccess();
     Object[] parameters = new Object[] { objReport.CoverNoteNo,
                                          objReport.ReinsurerName,
                                          objReport.Reinsurercode,
                                          objReport.CedantName,
                                          objReport.Cedantcode,
                                          objReport.ClientName,
                                          objReport.Clientcode,
                                          objReport.CedantPolicyNo,
                                          objReport.Currency,
                                          objReport.PeriodFrom,
                                          objReport.PeriodTo };
     return(dataAccess.LoadDataSet(parameters, "P_IRM_Report_OutstandingClaimList_Print", "Rep_OutClaimPrint"));
 }
Beispiel #7
0
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            string    error  = string.Empty;
            clsReport report = new clsReport();

            try
            {
                report.ID                   = _id;
                report.Title                = this.textBoxTitle.Text.Trim();
                report.Trademark            = this.textBoxTrademark.Text.Trim();
                report.CheckUnitName        = this.textBoxCheckUnitName.Text.Trim();
                report.Specifications       = this.textBoxSpecifications.Text.Trim();
                report.ProductionDate       = this.textBoxProductionDate.Text.Trim();
                report.QualityGrade         = this.textBoxQualityGrade.Text.Trim();
                report.TaskSource           = this.textBoxTaskSource.Text.Trim();
                report.CheckedCompanyName   = this.textBoxCheckedCompanyName.Text.Trim();
                report.CheckedCompanyPhone  = this.textBoxCheckedCompanyPhone.Text.Trim();
                report.ProductionUnitsName  = this.textBoxProductionUnitsName.Text.Trim();
                report.ProductionUnitsPhone = this.textBoxProductionUnitsPhone.Text.Trim();
                report.Standard             = this.textBoxStandard.Text.Trim();
                report.SamplingData         = this.textBoxSamplingData.Text.Trim();
                report.SampleNum            = this.textBoxSampleNum.Text.Trim();
                report.SamplingCode         = this.textBoxSamplingCode.Text.Trim();
                report.SampleArrivalData    = this.textBoxSampleArrivalData.Text.Trim();
                report.Notes                = this.textBoxNote.Text.Trim();
                report.IsDeleted            = "N";
                _resultTable.Update(report, out error);
            }
            catch (Exception ex)
            {
                MessageBox.Show("出现异常!\n" + ex.Message.ToString());
            }
            finally
            {
                if (error.Equals(string.Empty))
                {
                    if (MessageBox.Show("保存成功!是否返回【报表界面】?", "操作提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("保存失败!\n" + error);
                }
            }
        }
Beispiel #8
0
 public DataSet GetClaimInvoiceReportPrintData(clsReport objReport)
 {
     dataAccess = new DataAccess();
     Object[] parameters = new Object[] { objReport.ClaimNo,
                                          objReport.InvoiceNo,
                                          objReport.CoverNoteNo,
                                          objReport.ReinsurerName,
                                          objReport.Reinsurercode,
                                          objReport.CedantName,
                                          objReport.Cedantcode,
                                          objReport.ClientName,
                                          objReport.Clientcode,
                                          objReport.MainClass,
                                          objReport.SubClass,
                                          objReport.ClaimCreateMonth };
     return(dataAccess.LoadDataSet(parameters, "P_IRM_Report_ClaimInvoiceList_Print", "Rep_ClaimInvoicePrint"));
 }
        /// <summary>
        /// 删除原始报表
        /// </summary>
        private void Deletd()
        {
            string error = string.Empty;

            try
            {
                if (DataGridRecord.SelectedItems.Count <= 0)
                {
                    MessageBox.Show("请选择删除条目!");
                    return;
                }
                if (MessageBox.Show("确定要删除吗!?", "操作提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    try
                    {
                        clsReport report = (clsReport)DataGridRecord.SelectedItems[0];
                        if (report != null && report.ID > 0)
                        {
                            _resultTable.Deleted(report.ID, out error);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        if (!error.Equals(string.Empty))
                        {
                            MessageBox.Show("删除时出现异常!\n" + error);
                        }
                        else
                        {
                            MessageBox.Show("删除报表数据成功!");
                        }
                        SearchReport();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常(Deletd):\n" + ex.Message);
            }
        }
Beispiel #10
0
 /// <summary>
 /// 初始化界面的值
 /// </summary>
 /// <param name="report"></param>
 public void GetValues(clsReport report)
 {
     if (report != null)
     {
         try
         {
             _id = report.ID;
             if (report.Title != null && !report.Title.Equals(string.Empty))
             {
                 this.textBoxTitle.Text = report.Title;
             }
             this.textBoxCheckUnitName.Text        = report.CheckUnitName;
             this.textBoxTrademark.Text            = report.Trademark;
             this.textBoxSpecifications.Text       = report.Specifications;
             this.textBoxProductionDate.Text       = report.ProductionDate;
             this.textBoxQualityGrade.Text         = report.QualityGrade;
             this.textBoxTaskSource.Text           = report.TaskSource;
             this.textBoxCheckedCompanyName.Text   = report.CheckedCompanyName;
             this.textBoxCheckedCompanyPhone.Text  = report.CheckedCompanyPhone;
             this.textBoxProductionUnitsName.Text  = report.ProductionUnitsName;
             this.textBoxProductionUnitsPhone.Text = report.ProductionDate;
             this.textBoxStandard.Text             = report.Standard;
             this.textBoxSamplingData.Text         = report.SamplingData;
             this.textBoxSampleNum.Text            = report.SampleNum;
             this.textBoxSamplingCode.Text         = report.SamplingCode;
             this.textBoxSampleArrivalData.Text    = report.SampleArrivalData;
             this.textBoxNote.Text = report.Notes;
             if (report.reportList != null && report.reportList.Count > 0)
             {
                 DataGridRecord.DataContext = report.reportList;
             }
             else
             {
                 DataGridRecord.DataContext = null;
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("异常(GetValues):\n" + ex.Message);
         }
     }
 }
Beispiel #11
0
        /// <summary>
        /// 修改报表记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Update(clsReport model, out string errMsg)
        {
            int rtn = 0;

            errMsg = string.Empty;
            try
            {
                sql.Length = 0;
                sql.Append("Update tReport Set ");
                sql.AppendFormat("Title='{0}',", model.Title);
                sql.AppendFormat("CheckUnitName='{0}',", model.CheckUnitName);
                sql.AppendFormat("Trademark='{0}',", model.Trademark);
                sql.AppendFormat("Specifications='{0}',", model.Specifications);
                sql.AppendFormat("ProductionDate='{0}',", model.ProductionDate);
                sql.AppendFormat("QualityGrade='{0}',", model.QualityGrade);
                sql.AppendFormat("CheckedCompanyName='{0}',", model.CheckedCompanyName);
                sql.AppendFormat("CheckedCompanyPhone='{0}',", model.CheckedCompanyPhone);
                sql.AppendFormat("ProductionUnitsName='{0}',", model.ProductionUnitsName);
                sql.AppendFormat("ProductionUnitsPhone='{0}',", model.ProductionUnitsPhone);
                sql.AppendFormat("TaskSource='{0}',", model.TaskSource);
                sql.AppendFormat("Standard='{0}',", model.Standard);
                sql.AppendFormat("SamplingData='{0}',", model.SamplingData);
                sql.AppendFormat("SampleNum='{0}',", model.SampleNum);
                sql.AppendFormat("SamplingCode='{0}',", model.SamplingCode);
                sql.AppendFormat("SampleArrivalData='{0}',", model.SampleArrivalData);
                sql.AppendFormat("Notes='{0}',", model.Notes);
                sql.AppendFormat("IsDeleted='{0}' ", model.IsDeleted);
                sql.AppendFormat("Where ID={0}", model.ID);
                DataBase.ExecuteCommand(sql.ToString(), out errMsg);
                sql.Length = 0;
                rtn        = 1;
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }
            return(rtn);
        }
Beispiel #12
0
        private void BuildReportDocument(clsReport report)
        {
            Utilities.LogInfoIN();
            ReportDocument doc = LoadReport(report.ReportInfo.FileName);

            try
            {
                //***********************  Code from Report  ************************//
                // loop from Report
                foreach (CrystalDecisions.Shared.IConnectionInfo connInfo in doc.DataSourceConnections)
                {
                    Utilities.Log(report.ReportInfo.DisplayName + ": " +
                                  string.Format("setting database, server={0}, dbname={1}",
                                                Configuration.DBServer, Configuration.DBName),
                                  LoggerLevel.Information);
                    connInfo.SetConnection(Configuration.DBServer, Configuration.DBName, Configuration.DBUser, Configuration.DBPassword);
                }

                //set parameters
                //
                // FIX: DE7167
                // Parameter order different between db and rpt file. User unable to view in report center.
                // Vendor Code = 257 error thrown. Iterate over collection with proper order.
                // Original code: foreach (KeyValuePair<int, string> arg in report.ReportInfo.Parameters)
                Dictionary <int, string> rptParams = new Dictionary <int, string>();
                for (int i = 0; i < doc.ParameterFields.Count; i++)
                {
                    foreach (KeyValuePair <int, string> arg in report.ReportInfo.Parameters)
                    {
                        if (arg.Value == doc.ParameterFields[i].Name)
                        {
                            if (!rptParams.ContainsKey(arg.Key))
                            {
                                rptParams.Add(arg.Key, arg.Value);
                                break;
                            }
                        }

                        //knc 20150827
                        //I dont want to assign a new parameter into the Daily.ReportParameter Table so I have to go with this one.
                        //Hardcoded: assign value to rptParams. Use negative sign int starting with -10.
                        if (doc.ParameterFields[i].Name == "@spRaffleOrDrawingSetting")
                        {
                            rptParams.Add(-10, "@spRaffleOrDrawingSetting");
                            break;
                        }
                    }
                }
                // END: DE7167

                //foreach (KeyValuePair<int, string> arg in report.ReportInfo.Parameters)
                foreach (KeyValuePair <int, string> arg in rptParams)
                {
                    Utilities.Log(report.ReportInfo.DisplayName + ": parameters: ID=" + arg.Key + ",name=" + arg.Value, LoggerLevel.Information);

                    switch ((ReportParamIDs)arg.Key)
                    { //the first two are have to
                    case ReportParamIDs.ContentLocale:
                        if (Configuration.mForceEnglish)
                        {
                            doc.SetParameterValue(arg.Value, "en-US");
                        }
                        else
                        {
                            doc.SetParameterValue(arg.Value, Thread.CurrentThread.CurrentCulture.Name);
                        }
                        break;

                    case ReportParamIDs.OperatorID:
                        doc.SetParameterValue(arg.Value, Configuration.operatorID);
                        break;

                    case ReportParamIDs.StaffID:
                        doc.SetParameterValue(arg.Value, report.StaffID);
                        break;

                    case ReportParamIDs.StartDate:
                        doc.SetParameterValue(arg.Value, report.StartDate);     //.ToShortDateString());
                        break;

                    case ReportParamIDs.EndDate:
                        doc.SetParameterValue(arg.Value, report.EndDate);     //.ToShortDateString());
                        break;

                    case ReportParamIDs.PlayerID:
                        doc.SetParameterValue(arg.Value, report.PlayerID);
                        break;

                    case ReportParamIDs.Session:
                        doc.SetParameterValue(arg.Value, report.Session);
                        break;

                    case ReportParamIDs.GamingDate:
                        doc.SetParameterValue(arg.Value, report.GamingDate);
                        break;

                    case ReportParamIDs.Month:
                        switch (report.Quarter)
                        {
                        case 1: doc.SetParameterValue(arg.Value, 1); break;

                        case 2: doc.SetParameterValue(arg.Value, 4); break;

                        case 3: doc.SetParameterValue(arg.Value, 7); break;

                        case 4: doc.SetParameterValue(arg.Value, 10); break;
                        }
                        break;

                    case ReportParamIDs.Year:
                        doc.SetParameterValue(arg.Value, report.Year);
                        break;

                    //START RALLY DE6958 add machine id paramter
                    case ReportParamIDs.MachineID:
                        doc.SetParameterValue(arg.Value, report.MachineID);
                        break;
                    //END RALLY DE6958

                    // US1622
                    case ReportParamIDs.AccrualsName:
                        doc.SetParameterValue(arg.Value, report.AccrualsName);
                        break;

                    case ReportParamIDs.AccrualsStatus:
                        doc.SetParameterValue(arg.Value, report.AccrualsStatus);
                        break;

                    case ReportParamIDs.AccrualsType:
                        doc.SetParameterValue(arg.Value, report.AccrualsType);
                        break;
                    // END US1622

                    // US1814
                    // Allow user to print blank forms from the ReportCenter...
                    case ReportParamIDs.PlayerTaxID:
                        report.PlayerTaxID = -1;
                        doc.SetParameterValue(arg.Value, report.PlayerTaxID);
                        break;
                    // END US1814

                    case ReportParamIDs.PositionID:     // us1850
                        doc.SetParameterValue(arg.Value, report.PositionID);
                        break;

                    case ReportParamIDs.ProductItemID:     // us1754
                        doc.SetParameterValue(arg.Value, report.ProductItemID);
                        break;

                    case ReportParamIDs.CharityId:     // US2715
                        doc.SetParameterValue(arg.Value, report.CharityId);
                        break;

                    case ReportParamIDs.POSMenu:     // US2744
                        doc.SetParameterValue(arg.Value, report.POSMenuId);
                        break;

                    case ReportParamIDs.ProgramID:     // US2744
                        doc.SetParameterValue(arg.Value, report.ProgramId);
                        break;

                    case ReportParamIDs.ProductTypeID:
                        doc.SetParameterValue(arg.Value, report.ProductTypeId);
                        break;

                    case ReportParamIDs.InvLocationID:     // us1754
                        doc.SetParameterValue(arg.Value, report.LocationID);
                        break;

                    case ReportParamIDs.SerialNumber:     // us1747
                        doc.SetParameterValue(arg.Value, report.SerialNo);
                        break;

                    case ReportParamIDs.ProductGroupID:     // us1902
                        doc.SetParameterValue(arg.Value, report.ProductGroupID);
                        break;

                    case ReportParamIDs.SerialNbrDevice:     // us1839
                        doc.SetParameterValue(arg.Value, report.SerialNbrDevice);
                        break;

                    case ReportParamIDs.AuditLogType:
                        doc.SetParameterValue(arg.Value, report.AuditLogType);
                        break;

                    case ReportParamIDs.ByPackage:      //us1808
                        doc.SetParameterValue(arg.Value, report.ByPackage);
                        break;

                    case ReportParamIDs.RaffleOrDrawingSetting:
                        doc.SetParameterValue(arg.Value, Configuration.RaffleOrDrawing);
                        break;

                    case ReportParamIDs.CompID:      //knc_3
                        doc.SetParameterValue(arg.Value, report.CompID);
                        break;

                    case ReportParamIDs.IsActive:
                        doc.SetParameterValue(arg.Value, report.isActive);
                        break;

                    default:
                        Utilities.Log(report.ReportInfo.DisplayName + " parameters was not found " + arg.Key + " " + arg.Value, LoggerLevel.Severe);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(StrClassName + ": " + ex.Message);
            }
            report.CrystalRptDoc = doc;
        }
Beispiel #13
0
 public DataSet GetRenewalReportPrintData(clsReport objReport)
 {
     dataAccess = new DataAccess();
     Object[] parameters = new Object[] { objReport.PeriodFrom, objReport.PeriodTo };
     return(dataAccess.LoadDataSet(parameters, "P_IRM_Report_RenewalList_Print", "Rep_RenewalPrint"));
 }
Beispiel #14
0
 public void createNewReport()
 {
     objReport = new clsReport();
 }