Пример #1
0
        public static MaterialTracking.Model.BlockSentNotReturnedCollection GetBlocksSentNotReturned()
        {
            MaterialTracking.Model.BlockSentNotReturnedCollection result = new MaterialTracking.Model.BlockSentNotReturnedCollection();
            MySqlCommand cmd = new MySqlCommand();

            cmd.CommandText = "pBlocksSentNotReturned";
            cmd.CommandType = CommandType.StoredProcedure;

            using (MySqlConnection cn = new MySqlConnection(YellowstonePathology.Properties.Settings.Default.CurrentConnectionString))
            {
                cn.Open();
                cmd.Connection = cn;
                using (MySqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        MaterialTracking.Model.BlockSentNotReturned blockSentNotReturned = new MaterialTracking.Model.BlockSentNotReturned();
                        YellowstonePathology.Business.Persistence.SqlDataReaderPropertyWriter propertyWriter = new Persistence.SqlDataReaderPropertyWriter(blockSentNotReturned, dr);
                        propertyWriter.WriteProperties();
                        result.Add(blockSentNotReturned);
                    }
                }
            }
            return(result);
        }
Пример #2
0
        public void CreateReport(DateTime reportDate)
        {
            MaterialTracking.Model.BlockSentNotReturnedCollection blockSentNotReturnedCollection = Gateway.SlideAccessionGateway.GetBlocksSentNotReturned();

            this.m_ReportTemplate = @"\\CFileServer\documents\Reports\Templates\BlocksSentNotReturnedReport.xml";

            this.m_ReportXml = new XmlDocument();
            this.m_ReportXml.Load(this.m_ReportTemplate);

            this.m_NameSpaceManager = new XmlNamespaceManager(this.m_ReportXml.NameTable);
            this.m_NameSpaceManager.AddNamespace("w", "http://schemas.microsoft.com/office/word/2003/wordml");
            this.m_NameSpaceManager.AddNamespace("wx", "http://schemas.microsoft.com/office/word/2003/auxHint");
            this.m_ReportSaveFileName = @"\\CFileServer\documents\Reports\MissingBlocks\BlocksSentNotReturned.FILEDATE.v1.xml";

            this.ReportBaseXml = new XmlDocument();
            this.ReportBaseXml.Load(ReportBaseFileName);

            this.NameSpaceManagerBase = new XmlNamespaceManager(ReportBaseXml.NameTable);
            this.NameSpaceManagerBase.AddNamespace("w", "http://schemas.microsoft.com/office/word/2003/wordml");
            this.NameSpaceManagerBase.AddNamespace("wx", "http://schemas.microsoft.com/office/word/2003/auxHint");

            string reportTitle = "Blocks Sent Not Returned - " + reportDate.ToLongDateString();

            this.m_ReportXml.SelectSingleNode("//w:r[w:t='report_header']/w:t", this.NameSpaceManagerBase).InnerText = reportTitle;

            XmlNode nodeTable    = this.FindXmlTableInDetail("facility_id");
            XmlNode nodeTemplate = this.FindXmlTableRowInDetail("facility_id", nodeTable);

            foreach (MaterialTracking.Model.BlockSentNotReturned blockSentNotReturned in blockSentNotReturnedCollection)
            {
                string facilityName = blockSentNotReturned.FacilityId;
                Facility.Model.Facility facility = Business.Facility.Model.FacilityCollection.Instance.GetByFacilityId(blockSentNotReturned.FacilityId);
                if (facility != null)
                {
                    facilityName = string.IsNullOrEmpty(facility.FacilityName) ? blockSentNotReturned.FacilityId : facility.FacilityName;
                }

                XmlNode nodeNew = nodeTemplate.Clone();
                this.ReplaceTextInRowNode(nodeNew, "facility_id", facilityName);
                this.ReplaceTextInRowNode(nodeNew, "aliquot_id", blockSentNotReturned.AliquotId);
                this.ReplaceTextInRowNode(nodeNew, "log_date", blockSentNotReturned.LogDate.ToString("MM/dd/yyyy"));
                nodeTable.AppendChild(nodeNew);
            }

            nodeTable.RemoveChild(nodeTemplate);
            SetReportBody(nodeTable);
            SaveReport(reportDate.ToString());
        }