예제 #1
0
        public static void Store <TProperty>(this DocumentRecord documentRecord, string name,
                                             TProperty value, bool versioned = false)
        {
            var partName = documentRecord.GetType().Name;

            Store(documentRecord, partName, name, value, versioned);
        }
        //------------------------------------------------------//
        //---------------Material Records Section---------------//
        //------------------------------------------------------//

        //
        // GET: /Pipeline/CreateDoc

        public ActionResult CreateDoc(Pipeline pipeline)
        {
            //int currentPipeline = Convert.ToInt32(Session["CurrentPipeline"].ToString());

            int entry = 0;

            try { entry = (int)db.DocumentRecords.Where(p => p.PipelineID == pipeline.PipelineID).OrderByDescending(p => p.DocumentRecordID).Max(d => d.DocumentRecordID); }
            catch { }

            if (entry == 0)
            {
                Session["CurrentRecordIdentifier"] = "1";
            }
            else
            {
                entry++;
                try
                {
                    Session["CurrentRecordIdentifier"] = entry;
                }
                catch
                {
                    Session["CurrentRecordIdentifier"] = "1";
                }
            }

            ViewBag.DocumentTypeID = new SelectList(db.DocumentTypes, "DocumentTypeID", "DocumentTypeItem");
            DocumentRecord documentrecord = new DocumentRecord()
            {
                PipelineID = pipeline.PipelineID
            };

            ViewBag.PipelineItem = pipeline.PipelineItem;
            return(View(documentrecord));
        }
예제 #3
0
        public void ParseMetaData()
        {
            var meta = new MetaData();

            reader = new BinaryReader(this.Stream, Encoding.ASCII);

            var variableRecords   = new List <VariableRecord>();
            var valueLabelRecords = new List <ValueLabelRecord>();
            var infoRecords       = new InfoRecords();

            RecordType nextRecordType = (RecordType)reader.ReadInt32();

            while (nextRecordType != RecordType.End)
            {
                switch (nextRecordType)
                {
                case RecordType.HeaderRecord:
                    meta.HeaderRecord = HeaderRecord.ParseNextRecord(reader);
                    break;

                case RecordType.VariableRecord:
                    variableRecords.Add(VariableRecord.ParseNextRecord(reader));
                    break;

                case RecordType.ValueLabelRecord:
                    valueLabelRecords.Add(ValueLabelRecord.ParseNextRecord(reader));
                    break;

                case RecordType.DocumentRecord:
                    meta.DocumentRecord = DocumentRecord.ParseNextRecord(reader);
                    break;

                case RecordType.InfoRecord:
                    infoRecords.AllRecords.Add(InfoRecord.ParseNextRecord(reader));
                    break;

                default:
                    throw new UnexpectedFileFormatException();
                }
                nextRecordType = (RecordType)reader.ReadInt32();
            }

            meta.VariableRecords   = new Collection <VariableRecord>(variableRecords);
            meta.ValueLabelRecords = new Collection <ValueLabelRecord>(valueLabelRecords);

            // Interpret known inforecords:
            infoRecords.ReadKnownRecords(meta.VariableCount);
            meta.InfoRecords = infoRecords;
            this.SysmisValue = meta.InfoRecords.MachineFloatingPointInfoRecord.SystemMissingValue;

            // Filler Record
            reader.ReadInt32();

            this.dataStartPosition = this.Stream.Position;

            this.MetaData = meta;
            SetDataRecordStream();
            this.MetaDataParsed = true;
        }
        public ActionResult DeleteConfirmed(int id)
        {
            DocumentRecord documentrecord = db.DocumentRecords.Find(id);

            db.DocumentRecords.Remove(documentrecord);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #5
0
 private ViewDocumentQueryResponse GetResponse(DocumentRecord documentRecord)
 {
     return(new ViewDocumentQueryResponse
     {
         Id = documentRecord.Id,
         Name = documentRecord.Name,
         Text = documentRecord.Text,
         WordCount = documentRecord.WordCount,
     });
 }
        //
        // GET: /DocumentRecord/

        //public ActionResult Index()
        //{
        //    var documentrecords = db.DocumentRecords.Include(d => d.PipelineID).Include(d => d.DocumentType).Include(d => d.RecordIdentifier);
        //    return View(documentrecords.ToList());
        //}

        //
        // GET: /DocumentRecord/Details/5

        public ActionResult Details(int id = 0)
        {
            DocumentRecord documentrecord = db.DocumentRecords.Find(id);

            if (documentrecord == null)
            {
                return(HttpNotFound());
            }
            return(View(documentrecord));
        }
        public ActionResult DeleteDocConfirmed(int id)
        {
            DocumentRecord documentrecord = db.DocumentRecords.Find(id);

            //Need to add in some validation code to look for feature attributes that have this document assigned to them.
            //Cannot delete the record if there are documents assigned to any features

            db.DocumentRecords.Remove(documentrecord);
            db.SaveChanges();
            return(RedirectToAction("Details", "Pipeline", new { id = documentrecord.PipelineID }));
        }
예제 #8
0
        public static void Store <TProperty>(this DocumentRecord documentRecord, string partName, string name, TProperty value, bool versioned = false)
        {
            var infoset     = (versioned ? documentRecord.VersionInfoset : documentRecord.Infoset);
            var partElement = infoset.Element.Element(partName);

            if (partElement == null)
            {
                partElement = new XElement(partName);
                infoset.Element.Add(partElement);
            }
            partElement.Attr(name, value);
        }
 public ActionResult Edit(DocumentRecord documentrecord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(documentrecord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ValveSectionID     = new SelectList(db.ValveSection, "ValveSectionID", "OrionStationSeries", documentrecord.PipelineID);
     ViewBag.DocumentTypeID     = new SelectList(db.DocumentTypes, "DocumentTypeID", "DocumentTypeItem", documentrecord.DocumentTypeID);
     ViewBag.RecordIdentifierID = new SelectList(db.RecordIdentifiers, "RecordIdentifierID", "RecordIdentifierItem", documentrecord.DocumentRecordID);
     return(View(documentrecord));
 }
        //
        // GET: /DocumentRecord/Edit/5

        public ActionResult Edit(int id = 0)
        {
            DocumentRecord documentrecord = db.DocumentRecords.Find(id);

            if (documentrecord == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ValveSectionID     = new SelectList(db.ValveSection, "ValveSectionID", "OrionStationSeries", documentrecord.PipelineID);
            ViewBag.DocumentTypeID     = new SelectList(db.DocumentTypes, "DocumentTypeID", "DocumentTypeItem", documentrecord.DocumentTypeID);
            ViewBag.RecordIdentifierID = new SelectList(db.RecordIdentifiers, "RecordIdentifierID", "RecordIdentifierItem", documentrecord.DocumentRecordID);
            return(View(documentrecord));
        }
        public ActionResult EditDoc(DocumentRecord documentrecord)
        {
            if (ModelState.IsValid)
            {
                //documentrecord.ModifiedBy_UserID = Convert.ToInt64(Session["UserID"].ToString());
                //documentrecord.ModifiedOn = DateTime.Now;

                documentrecord.DocumentTypeItem = db.DocumentTypes.Where(doctype => doctype.DocumentTypeID == documentrecord.DocumentTypeID).Select(doctype => doctype.DocumentTypeItem).FirstOrDefault();

                db.Entry(documentrecord).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Details", "Pipeline", new { id = documentrecord.PipelineID }));
            }
            return(View(documentrecord));
        }
        //
        // GET: /Pipeline/DeleteDoc

        public ActionResult DeleteDoc(int id = 0)
        {
            DocumentRecord documentrecord = db.DocumentRecords.Find(id);

            if (documentrecord == null)
            {
                return(HttpNotFound());
            }

            ViewBag.StationName = (from p in db.Pipelines
                                   join doc in db.DocumentRecords on p.PipelineID equals doc.PipelineID
                                   where doc.DocumentRecordID == documentrecord.DocumentRecordID
                                   select p.PipelineItem).FirstOrDefault();

            return(View(documentrecord));
        }
        public ActionResult CreateDoc(DocumentRecord documentrecord)
        {
            if (ModelState.IsValid)
            {
                //documentrecord.PipelineID = Convert.ToInt64(Session["CurrentPipeline"].ToString());
                documentrecord.DocumentRecordID = Convert.ToInt32(Session["CurrentRecordIdentifier"].ToString());

                documentrecord.DocumentTypeItem = db.DocumentTypes.Where(doctype => doctype.DocumentTypeID == documentrecord.DocumentTypeID).Select(doctype => doctype.DocumentTypeItem).FirstOrDefault();

                db.DocumentRecords.Add(documentrecord);
                db.SaveChanges();
                return(RedirectToAction("Details", "Pipeline", new { id = documentrecord.PipelineID }));
            }

            return(View());
        }
        //
        // GET: /Pipeline/EditDoc/

        public ActionResult EditDoc(int id = 0)
        {
            DocumentRecord documentrecord = db.DocumentRecords.Find(id);

            if (documentrecord == null)
            {
                return(HttpNotFound());
            }

            ViewBag.PipelineItem = db.Pipelines.Where(p => p.PipelineID == documentrecord.PipelineID).Select(p => p.PipelineItem).FirstOrDefault();

            ViewBag.DocumentTypeID = new SelectList(db.DocumentTypes, "DocumentTypeID", "DocumentTypeItem", documentrecord.DocumentTypeID);

            ViewBag.DocumentRecordID = id;

            return(View(documentrecord));
        }
예제 #15
0
        private void btnPoll_Click(object sender, EventArgs e)
        {
            DocumentRecord record = new DocumentRecord();

            btnPoll.Enabled   = false;
            btnDelete.Enabled = false;
            pollTimer.Enabled = true;

            VAT100_Poll pollMessage = new VAT100_Poll();

            pollMessage.Header.MessageDetails.Class         = "HMRC-VAT-DEC";
            pollMessage.Header.MessageDetails.CorrelationID = editCorrelationID.Text;

            string pollMsg;

            // Serialize the message to a string
            XmlSerializer xmlSerializer = new XmlSerializer(pollMessage.GetType());


            //SS:04/06/2018:2018-R1:ABSEXCH-20538:VAT 100 Submissions failing due to HMRC gateway changes
            using (Utf8StringWriter textWriter = new Utf8StringWriter())
            {
                xmlSerializer.Serialize(textWriter, pollMessage);
                pollMsg = textWriter.ToString();
            }

            // Submit the resulting XML to HMRC
            // Create a request
            var request = (HttpWebRequest)WebRequest.Create(comboTargetURL.Text /* + @"\poll" */);
            var data    = Encoding.ASCII.GetBytes(pollMsg);

            request.Method        = "POST";
            request.ContentType   = "application/x-www-form-urlencoded";
            request.ContentLength = data.Length;

            // Write the data to the request parameters
            using (var stream = request.GetRequestStream())
            {
                stream.Write(data, 0, data.Length);
            }

            // Send the request and get the response.
            WebResponse response = null;

            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (Exception ex)
            {
                textNarrative.AppendText("Error submitting Poll request\r\n" + ex.Message);
                return;
            }

            // Get the response in a stream.
            var responseData = new StreamReader(response.GetResponseStream()).ReadToEnd();

            // Convert the stream to a string
            string responseXML = responseData.ToString();

            HandleHMRCResponse(responseXML);
        }
예제 #16
0
 private Document GetDocument(DocumentRecord record)
 {
     return(new Document(record.Name, record.Text));
 }
예제 #17
0
 private void ProcessDocumentRecord(DocumentRecord packet)
 {
     _dataAccessService.UpdateSpDocumentChangeRecord(_accountId, packet.DocumentHash.ToHexString(), packet.BlockHeight);
 }
예제 #18
0
 public InfosetPart()
 {
     Document = new DocumentRecord();
 }