Пример #1
0
        public IEnumerable <EndPoint> Parse(StreamReader stream, TrackingItem item)
        {
            string str    = stream.ReadToEnd().Replace("\t", "").Replace("\n", "").Replace("\r", "").Replace("    ", "");
            string record = "<td class=\"([a-zA-Z0-9_ ]*)\">((([a-zA-Z0-9_ 가-힣\\*,\\.:\\-]|\\(|\\)|[<br />])+)|(<a href=\"javascript:checkDetail\\('[A-Z0-9]+'\\);\" title=\"영업소 정보 팝업\">[a-zA-Z0-9_ 가-힣\\*,\\.:-]+</a>))</td>";
            Regex  regex  = new Regex(string.Format("<tr>({0})+</tr>", record));
            Regex  regex2 = new Regex(record);
            bool   skip   = false;

            foreach (Match v in regex.Matches(str))
            {
                if (skip == false)
                {
                    skip = true; continue;
                }
                EndPoint ep    = new EndPoint();
                int      index = 0;
                foreach (Match vv in regex2.Matches(v.Value))
                {
                    switch (index++)
                    {
                    case 0: ep.State = GetState(vv.Groups [2].Value); ep.OriginalState = vv.Groups [2].Value; break;

                    case 1: ep.ArrivalTime = DateTime.Parse(vv.Groups [2].Value); break;

                    case 3:
                        string t = vv.Groups [2].Value;
                        ep.Terminal = t.Substring(t.IndexOf('>') + 1, t.IndexOf('<', t.IndexOf('>')) - t.IndexOf('>') - 1);
                        break;
                    }
                }
                yield return(ep);
            }
        }
Пример #2
0
        private void InsertTrackingItem(TrackingItem item, object key)
        {
            StringBuilder builder = new StringBuilder(100);

            builder.Append(string.Format("INSERT INTO SubmittalTrackingItem ({0},{1},{2},{3},{4},{5},{6},{7}) ",
                                         SubmittalFactory.FieldNames.SubmittalId,
                                         SubmittalFactory.FieldNames.TotalItemsReceived,
                                         SubmittalFactory.FieldNames.TotalItemsSent,
                                         SubmittalFactory.FieldNames.DeferredApproval,
                                         SubmittalFactory.FieldNames.SubstitutionNumber,
                                         SubmittalFactory.FieldNames.SpecificationSectionId,
                                         SubmittalFactory.FieldNames.Description,
                                         SubmittalFactory.FieldNames.Status));
            builder.Append(string.Format("VALUES ({0},{1},{2},{3},{4},{5},{6},{7});",
                                         DataHelper.GetSqlValue(key),
                                         DataHelper.GetSqlValue(item.TotalItemsReceived),
                                         DataHelper.GetSqlValue(item.TotalItemsSent),
                                         DataHelper.GetSqlValue(item.DeferredApproval),
                                         DataHelper.GetSqlValue(item.SubstitutionNumber),
                                         DataHelper.GetSqlValue(item.SpecSection.Key),
                                         DataHelper.GetSqlValue(item.Description),
                                         DataHelper.GetSqlValue(item.Status)));

            this.Database.ExecuteNonQuery(
                this.Database.GetSqlStringCommand(builder.ToString()));
        }
Пример #3
0
        private void DeleteTrackingItemCommandHandler(object sender,
                                                      DelegateCommandEventArgs e)
        {
            TrackingItem item = e.Parameter as TrackingItem;

            if (item != null)
            {
                this.trackingItems.Remove(item);
            }
        }
Пример #4
0
        public IEnumerable <EndPoint> Parse(StreamReader stream, TrackingItem item)
        {
            string str    = stream.ReadToEnd().Replace("\t", "").Replace("\n", "").Replace("\r", "").Replace("  ", "");
            string record = "<td width=\"100\">([가-힣]+)</td><td align=\"left\">(([a-zA-Z0-9가-힣. ]|\\(|\\)|\\-)+)</td>";
            Regex  regex  = new Regex(record);

            foreach (Match v in regex.Matches(str))
            {
                EndPoint ep = new EndPoint();
                ep.ArrivalTime   = DateTime.MinValue;
                ep.Terminal      = v.Groups [1].Value;
                ep.OriginalState = v.Groups [2].Value;
                ep.State         = GetState(v.Groups [2].Value);
                yield return(ep);
            }
        }
Пример #5
0
        internal static TrackingItem BuildTrackingItem(IDataReader reader)
        {
            TrackingItem item = new TrackingItem(SubmittalFactory.BuildSpecSection(reader));

            item.TotalItemsReceived = DataHelper.GetInteger(
                reader[FieldNames.TotalItemsReceived]);
            item.TotalItemsSent = DataHelper.GetInteger(
                reader[FieldNames.TotalItemsSent]);
            item.DeferredApproval = DataHelper.GetInteger(
                reader[FieldNames.DeferredApproval]);
            item.SubstitutionNumber = DataHelper.GetInteger(
                reader[FieldNames.SubstitutionNumber]);
            item.Description = reader[FieldNames.Description].ToString();
            item.Status      = DataHelper.GetEnumValue <ActionStatus>(
                reader[FieldNames.Status].ToString());
            return(item);
        }
Пример #6
0
    private void sendPODRequest()
    {
        //Send a POD request to Argix, send confirmation to user, and display confirmation
        TrackingItem item = null;

        if (ViewState["PODRequestItem"] is TrackingItem)
        {
            item = (TrackingItem)ViewState["PODRequestItem"];
        }
        if (item != null)
        {
            EmailGateway svcs = new EmailGateway();
            svcs.SendPODRequest(Membership.GetUser(), item);
            svcs.SendPODRequestConfirm(Membership.GetUser(), item);
            Master.ShowMessageBox("Thank you. Your POD request has been submitted. You will receive an email confirming your request.");
        }
    }
Пример #7
0
        public IEnumerable <EndPoint> Parse(StreamReader stream, TrackingItem item)
        {
            string str    = GetRealPage(item).Result.ReadToEnd().Replace("\t", "").Replace("\n", "").Replace("\r", "").Replace("  ", "");
            string record = "<td>([0-9.]+)</td>" + "<td>([0-9:]+)</td>" +
                            "<td><a href=\"#\" onclick=\"return goPostDetail\\(([0-9]+), '([가-힣]+)', event\\)\" onkeypress=\"return goPostDetail\\(([0-9]+), '([가-힣]+)', event\\)\">([a-zA-Z가-힣0-9 ]+)</a></td>" +
                            "<td>([a-zA-Z가-힣0-9 ]+)</td>";
            Regex regex = new Regex(record);

            foreach (Match v in regex.Matches(str))
            {
                EndPoint ep = new EndPoint();
                ep.ArrivalTime   = DateTime.Parse(string.Format("{0} {1}", v.Groups [1].Value, v.Groups [2].Value));
                ep.Terminal      = v.Groups [7].Value;
                ep.OriginalState = v.Groups [4].Value;
                ep.State         = GetState(v.Groups [4].Value);
                yield return(ep);
            }
        }
Пример #8
0
        private async Task <StreamReader> GetRealPage(TrackingItem item)
        {
            HttpWebRequest req = HttpWebRequest.CreateHttp("http://trace.epost.go.kr/xtts/servlet/kpl.tts.common.svl.SttSVL");

            req.Method      = "POST";
            req.ContentType = "application/x-www-form-urlencoded";
            Stream stream = await req.GetRequestStreamAsync();

            byte [] data = Encoding.UTF8.GetBytes(string.Format("target_command=kpl.tts.tt.epost.cmd.RetrieveOrderConvEpostPoCMD&sid1={0}&JspURI=/xtts/tt/epost/trace/Trace_list.jsp",
                                                                item.ItemNumber));
            stream.Write(data, 0, data.Length);
            stream.Dispose();
            req.Headers [HttpRequestHeader.ContentEncoding] = "utf-8";
            WebResponse response = await req.GetResponseAsync();

            stream = response.GetResponseStream();
            return(new StreamReader(stream));
        }
Пример #9
0
        public IEnumerable <EndPoint> Parse(StreamReader stream, TrackingItem item)
        {
            string str    = stream.ReadToEnd().Replace("\t", "").Replace("\n", "").Replace("\r", "").Replace("  ", "");
            string record = "<td class=\"left\">([0-9.]+)</td>" + "<td>(([0-9]|:|\\-)+)</td>" +
                            "<td>((<a href=\"#\" onClick=\"JavaScript:(([a-zA-Z0-9가-힣,' ]|\\(|\\)|\\-)+)\">([a-zA-Z0-9가-힣 ]+)</a>)|(고객))</td>" +
                            "<td class=\"left_a\"><p>(([a-zA-Z가-힣0-9. ,@#!+?]|\\-|\\(\\))+)</p></td>";
            Regex regex = new Regex(record);

            foreach (Match v in regex.Matches(str))
            {
                EndPoint ep = new EndPoint();
                ep.ArrivalTime = DateTime.Parse(
                    v.Groups [2].Value != "--:--" ?
                    string.Format("{0} {1}", v.Groups [1].Value, v.Groups [2].Value) :
                    v.Groups [1].Value
                    );
                ep.Terminal      = (v.Groups [4].Value == "고객") ? "고객" : v.Groups [8].Value;
                ep.OriginalState = v.Groups [10].Value;
                ep.State         = GetState(v.Groups [10].Value);
                yield return(ep);
            }
        }
Пример #10
0
        public IEnumerable <EndPoint> Parse(StreamReader stream, TrackingItem item)
        {
            string str    = stream.ReadToEnd().Replace("\t", "").Replace("\n", "").Replace("\r", "").Replace("  ", "");
            string record = "<td>([0-9.]+)</td>" + "<td>([0-9:]+)</td>" +
                            "<td>(([a-zA-Z가-힣0-9. ,]|-|/)+)</td>" +
                            "<td class=\"lst\">([a-zA-Z가-힣0-9. ,@#!+?]+)</td>";
            Regex regex = new Regex(record);

            foreach (Match v in regex.Matches(str))
            {
                if (v.Groups [5].Value == "운송장출력")
                {
                    continue;
                }
                EndPoint ep = new EndPoint();
                ep.ArrivalTime   = DateTime.Parse(string.Format("{0} {1}", v.Groups [1].Value, v.Groups [2].Value));
                ep.Terminal      = v.Groups [3].Value.Split('/') [0];
                ep.OriginalState = v.Groups [5].Value;
                ep.State         = GetState(v.Groups [5].Value);
                yield return(ep);
            }
        }
Пример #11
0
    private void showItem(TrackingItem item)
    {
        //Display summary
        if (item != null)
        {
            this.lblCartonNumber.Text   = item.CartonNumber;
            this.lblClientName.Text     = item.ClientName;
            this.lblStoreNumber.Text    = "Consignee " + item.StoreNumber.PadLeft(5, '0');
            this.lblStore.Text          = ": " + item.StoreName + ", " + item.StoreAddress1 + (item.StoreAddress2.Length > 0 ? ", " + item.StoreAddress2 + ", " : " ") + item.StoreCity + ", " + item.StoreState + " " + item.StoreZip;
            this.lblVendorName.Text     = item.VendorName.Trim();
            this.lblPickupDate.Text     = item.PickupDate.Trim();
            this.lblBOLNumber.Text      = item.BOLNumber.ToString();
            this.lblTLNumber.Text       = item.TLNumber.Trim();
            this.lblLabelNumber.Text    = item.LabelNumber.ToString();
            this.lblPONumber.Text       = item.PONumber.Trim();
            this.lblWeight.Text         = item.Weight.ToString();
            this.lblShipmentNumber.Text = item.ShipmentNumber.Trim();
            this.lblSchDelivery.Text    = item.ActualStoreDeliveryDate.Trim();

            //Display detail
            TrackingItems detail = new TrackingItems();
            TrackingItem  row    = null;
            if (item.SortFacilityArrivalDate.Trim().Length > 0)
            {
                row            = new TrackingItem();
                row.ItemNumber = item.ItemNumber;
                row.DateTime   = item.SortFacilityArrivalDate;
                row.Status     = item.SortFacilityArrivalStatus;
                row.Location   = item.SortFacilityLocation;
                detail.Add(row);
            }
            if (item.ActualDepartureDate.Trim().Length > 0)
            {
                row            = new TrackingItem();
                row.ItemNumber = item.ItemNumber;
                row.DateTime   = item.ActualDepartureDate;
                row.Status     = item.ActualDepartureStatus;
                row.Location   = item.ActualDepartureLocation;
                detail.Add(row);
            }
            if (item.ActualArrivalDate.Trim().Length > 0)
            {
                row            = new TrackingItem();
                row.ItemNumber = item.ItemNumber;
                row.DateTime   = item.ActualArrivalDate;
                row.Status     = item.ActualArrivalStatus;
                row.Location   = item.ActualArrivalLocation;
                detail.Add(row);
            }
            if (item.ActualStoreDeliveryDate.Trim().Length > 0)
            {
                row            = new TrackingItem();
                row.ItemNumber = item.ItemNumber;
                row.DateTime   = item.ActualStoreDeliveryDate;
                row.Status     = item.ActualStoreDeliveryStatus;
                row.Location   = item.ActualStoreDeliveryLocation;
                detail.Add(row);
            }
            if (item.PODScanDate.Trim().Length > 0)
            {
                row            = new TrackingItem();
                row.ItemNumber = item.ItemNumber;
                row.DateTime   = item.PODScanDate;
                row.Status     = item.PODScanStatus;
                row.Location   = item.PODScanLocation;
                detail.Add(row);
            }
            this.grdDetail.DataSource = detail;
            this.grdDetail.DataBind();
        }
        else
        {
            this.lblCartonNumber.Text = this.lblClientName.Text = this.lblStoreNumber.Text = "";
            this.lblStore.Text        = this.lblVendorName.Text = this.lblPickupDate.Text = "";
            this.lblBOLNumber.Text    = this.lblTLNumber.Text = this.lblLabelNumber.Text = this.lblPONumber.Text = "";
            this.lblWeight.Text       = this.lblShipmentNumber.Text = this.lblSchDelivery.Text = "";
            this.grdDetail.DataSource = null;
            this.grdDetail.DataBind();
        }
    }
Пример #12
0
        public void OpenDocument()
        {
            //Step 1: Login to DokuFlex to get the ticket;
            var ticket = Session.GetTikect();

            //Step 2: get addional info
            var community = (UserGroup)null;
            var folder    = (FileFolder)null;
            var file      = (FileFolder)null;

            using (var form = new OpenFileForm(ticket, _fileExtensions))
            {
                if (form.ShowOpenFileDialog())
                {
                    community = form.Group;
                    folder    = form.Folder;
                    file      = form.File;
                }
                else
                {
                    return;
                }
            }

            TrackingListManager.Reload();

            var trackingItem = TrackingListManager.GetByFileId(file.id);

            if (trackingItem != null && File.Exists(trackingItem.Path))
            {
                if (trackingItem.ModifiedTime < file.modifiedTime)
                {
                    using (var form = new TransferProgressForm())
                    {
                        if (form.DownloadFile(ticket, trackingItem.FileId, trackingItem.Path))
                        {
                            TrackOff();
                            Globals.ThisAddIn.Application.Documents.Open(trackingItem.Path);
                            TrackOn();
                            trackingItem.ModifiedTime = file.modifiedTime;
                            TrackingListManager.Save();
                        }
                    }
                }
                else
                {
                    //Open the document.
                    TrackOff();
                    this.Application.Documents.Open(trackingItem.Path);
                    TrackOn();
                }
            }
            else
            {
                //Step 3: Create directory and file paths
                var currentDir  = String.Format("{0}\\{1}", DFEnvironment.GetSpecialFolder(DFEnvironment.SpecialFolder.Documents), community.name);
                var currentPath = string.Format("{0}\\{1}", currentDir, file.name);

                try
                {
                    if (!Directory.Exists(currentDir))
                    {
                        try
                        {
                            Directory.CreateDirectory(currentDir);
                        }
                        catch (Exception)
                        {
                            //Silent exception
                        }
                    }
                }
                catch (Exception e)
                {
                    LogFactory.CreateLog().LogError(e);
                    MessageBox.Show(e.Message, this.Application.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }

                //Step 4: download the file
                using (var form = new TransferProgressForm())
                {
                    if (form.DownloadFile(ticket, file.id, currentPath))
                    {
                        TrackOff();
                        Globals.ThisAddIn.Application.Documents.Open(currentPath);
                        TrackOn();

                        trackingItem = new TrackingItem()
                        {
                            Name          = file.name,
                            LastWriteTime = DateTime.Now.ToFileTimeUtc(),
                            Path          = currentPath,
                            Type          = "F",
                            GroupId       = community.id,
                            FolderId      = folder.id,
                            FileId        = file.id,
                            ModifiedTime  = file.modifiedTime
                        };

                        TrackingListManager.Add(trackingItem);
                        TrackingListManager.Save();
                    }
                }
            }
        }
Пример #13
0
        public void OpenRecentDocument(string ticket, IDocument document)
        {
            TrackingListManager.Reload();

            var trackingItem = TrackingListManager.GetByFileId(document.id);

            if (trackingItem != null)
            {
                if (trackingItem.ModifiedTime < document.modifiedTime)
                {
                    using (var form = new TransferProgressForm())
                    {
                        if (form.DownloadFile(ticket, trackingItem.FileId, trackingItem.Path))
                        {
                            TrackOff();
                            Globals.ThisAddIn.Application.Documents.Open(trackingItem.Path);
                            TrackOn();
                            trackingItem.ModifiedTime = document.modifiedTime;
                            TrackingListManager.Save();
                        }
                    }
                }
                else
                {
                    //Open the document.
                    TrackOff();
                    this.Application.Documents.Open(trackingItem.Path);
                    TrackOn();
                }
            }
            else
            {
                //Step 3: Create directory and file paths
                var currentDir  = String.Format("{0}\\{1}", DFEnvironment.GetSpecialFolder(DFEnvironment.SpecialFolder.Documents), "Huerfanos");
                var currentPath = string.Format("{0}\\{1}", currentDir, document.name);

                try
                {
                    if (!Directory.Exists(currentDir))
                    {
                        try
                        {
                            Directory.CreateDirectory(currentDir);
                        }
                        catch (Exception)
                        {
                            //Silent exception
                        }
                    }
                }
                catch (Exception e)
                {
                    LogFactory.CreateLog().LogError(e);
                    MessageBox.Show(e.Message, this.Application.Name, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }

                //Step 4: download the file
                using (var form = new TransferProgressForm())
                {
                    if (form.DownloadFile(ticket, document.id, currentPath))
                    {
                        TrackOff();
                        Globals.ThisAddIn.Application.Documents.Open(currentPath);
                        TrackOn();

                        trackingItem = new TrackingItem()
                        {
                            Name          = document.name,
                            LastWriteTime = DateTime.Now.ToFileTimeUtc(),
                            Path          = currentPath,
                            Type          = "F",
                            FileId        = document.id,
                            ModifiedTime  = document.modifiedTime
                        };

                        TrackingListManager.Add(trackingItem);
                        TrackingListManager.Save();
                    }
                }
            }
        }
Пример #14
0
        private string UploadFile(string ticket, string fullName)
        {
            //Step 1: Create a copy of the file and build the path to there.
            var uploadPath = string.Empty;
            var uploadDir  = DFEnvironment.GetSpecialFolder(DFEnvironment.SpecialFolder.UploadDirectory);
            var fileName   = string.Empty;

            try
            {
                if (!Directory.Exists(uploadDir))
                {
                    Directory.CreateDirectory(uploadDir);
                }

                var fileInfo = new FileInfo(fullName);

                uploadPath = string.Format("{0}\\{1}", uploadDir, fileInfo.Name);
                fileName   = fileInfo.Name;

                fileInfo.CopyTo(uploadPath, true);
            }
            catch (Exception ex)
            {
                LogFactory.CreateLog().LogError(ex);
                MessageBox.Show(ex.Message, this.Application.Name, MessageBoxButtons.YesNo,
                                MessageBoxIcon.Error);

                return(String.Empty);
            }

            //Step 3: Upload the file

            TrackingListManager.Reload();

            var trackingItem = TrackingListManager.GetByPath(fullName);

            if (trackingItem != null)
            {
                using (var form = new TransferProgressForm())
                {
                    if (form.UploadFile(ticket, trackingItem.GroupId, trackingItem.FolderId,
                                        trackingItem.FileId, uploadPath, true))
                    {
                        trackingItem.FileId       = form.FileId;
                        trackingItem.ModifiedTime = form.ModifiedTime;

                        TrackingListManager.Save();
                    }
                }
            }
            else
            {
                var community        = (UserGroup)null;
                var folder           = (FileFolder)null;
                var saveAsNewVersion = false;

                using (var saveFileView = new SaveFileForm(ticket))
                {
                    if (saveFileView.ShowSaveFileDialog())
                    {
                        community        = saveFileView.Group;
                        folder           = saveFileView.Folder;
                        saveAsNewVersion = saveFileView.SaveAsNewVersion;
                    }
                    else
                    {
                        return(String.Empty);
                    }
                }

                //Upload file to the server.
                using (var form = new TransferProgressForm())
                {
                    if (form.UploadFile(ticket, community.id,
                                        folder.id, string.Empty, uploadPath, saveAsNewVersion))
                    {
                        trackingItem = new TrackingItem()
                        {
                            Name          = Path.GetFileName(fullName),
                            LastWriteTime = DateTime.Now.ToFileTimeUtc(),
                            Path          = fullName,
                            Type          = "F",
                            GroupId       = community.id,
                            FolderId      = folder.id,
                            FileId        = form.FileId,
                            ModifiedTime  = form.ModifiedTime
                        };

                        TrackingListManager.Add(trackingItem);
                        TrackingListManager.Save();
                    }
                }
            }

            try
            {
                File.Delete(uploadPath);
            }
            catch (Exception e)
            {
                LogFactory.CreateLog().LogError(e);
            }

            return(trackingItem.FileId);
        }
        public override IEnumerable <string> Process()
        {
            this.Progress.SetMessage("Reading group sample map file ...");
            var groupSampleMap = new MapReader(0, 1).ReadFromFile(options.MapFile);

            Dictionary <string, SignificantItem> geneNameMap = new Dictionary <string, SignificantItem>();

            this.Progress.SetMessage("Reading cuffdiff significant files ...");
            var sigs = (from file in options.SignificantFiles
                        from line in File.ReadAllLines(file).Skip(1)
                        let parts = line.Split('\t')
                                    where parts.Length >= 3
                                    let gene = parts[1]
                                               let name = parts[2]
                                                          where !name.Equals("-")
                                                          let location = parts[3]
                                                                         select new SignificantItem()
            {
                Gene = gene, GeneName = name, GeneLocation = location
            }).ToList();

            foreach (var gene in sigs)
            {
                if (!geneNameMap.ContainsKey(gene.Gene))
                {
                    geneNameMap[gene.Gene] = gene;
                }
            }
            Func <string, bool> acceptGene = m => geneNameMap.ContainsKey(m);
            var countFile = options.OutputFilePrefix + ".count";
            var fpkmFile  = options.OutputFilePrefix + ".fpkm";

            var items = new List <TrackingItem>();

            foreach (var trackingFile in options.InputFiles)
            {
                this.Progress.SetMessage("Reading cuffdiff read_group_tracking file " + trackingFile + "...");
                using (StreamReader sr = new StreamReader(trackingFile))
                {
                    string line = sr.ReadLine();
                    while ((line = sr.ReadLine()) != null)
                    {
                        var parts = line.Split('\t');
                        if (parts.Length <= 7)
                        {
                            continue;
                        }
                        var gene = parts[0];
                        if (!acceptGene(gene))
                        {
                            continue;
                        }

                        var group_index = parts[1] + "_" + parts[2];
                        var sample      = groupSampleMap.ContainsKey(group_index) ? groupSampleMap[group_index] : group_index;
                        var count       = parts[3];
                        var fpkm        = parts[6];
                        var item        = new TrackingItem()
                        {
                            Gene = gene, Sample = sample, Count = count, FPKM = fpkm
                        };
                        items.Add(item);
                    }
                }
            }

            this.Progress.SetMessage("Preparing result ...");
            var samples = new HashSet <string>(from item in items
                                               select item.Sample).OrderBy(m => m).ToList();

            this.Progress.SetMessage(string.Format("There are {0} samples", samples.Count));

            var genes = new HashSet <string>(from item in items
                                             select item.Gene).OrderBy(m => m).ToList();

            this.Progress.SetMessage(string.Format("There are {0} genes", genes.Count));

            var map = ToDoubleDirectory(items);

            this.Progress.SetMessage("Removing empty genes ...");
            foreach (var gene in genes)
            {
                if (map[gene].All(m => m.Value.Count == "0"))
                {
                    map.Remove(gene);
                }
            }

            var finalGenes = map.Keys.OrderBy(m => m).ToList();

            this.Progress.SetMessage("Outputing result ...");
            OutputFile(samples, finalGenes, map, geneNameMap, m => Math.Round(double.Parse(m.Count)).ToString(), countFile);
            OutputFile(samples, finalGenes, map, geneNameMap, m => m.FPKM, fpkmFile);

            this.Progress.End();
            return(new[] { countFile, fpkmFile });
        }
Пример #16
0
    private void showItem(TrackingItem item)
    {
        //Display summary
        this.lblCartonNumber.Text = item.CartonNumber;
        this.lblClientName.Text   = item.ClientName;
        //this.lblStoreNumber.Text = "Store# " + item.StoreNumber.PadLeft(5,'0');
        this.lblStore.Text          = item.StoreName + ", " + item.StoreAddress1 + (item.StoreAddress2.Length > 0 ? ", " + item.StoreAddress2 + ", " : " ") + item.StoreCity + ", " + item.StoreState + " " + item.StoreZip;
        this.lblVendorName.Text     = item.VendorName.Trim();
        this.lblPickupDate.Text     = item.PickupDate.Trim();
        this.lblBOLNumber.Text      = item.BOLNumber.ToString();
        this.lblTLNumber.Text       = item.TLNumber.Trim();
        this.lblLabelNumber.Text    = item.LabelNumber.ToString();
        this.lblPONumber.Text       = item.PONumber.Trim();
        this.lblWeight.Text         = item.Weight.ToString();
        this.lblShipmentNumber.Text = item.ShipmentNumber.Trim();
        this.lblSchDelivery.Text    = item.ActualStoreDeliveryDate.Trim();

        //Display detail
        Argix.Enterprise.TrackingItems detail = new Argix.Enterprise.TrackingItems();
        Argix.Enterprise.TrackingItem  row    = null;
        if (item.SortFacilityArrivalDate.Trim().Length > 0)
        {
            row            = new Argix.Enterprise.TrackingItem();
            row.ItemNumber = item.ItemNumber;
            row.DateTime   = item.SortFacilityArrivalDate;
            row.Status     = item.SortFacilityArrivalStatus;
            row.Location   = item.SortFacilityLocation;
            detail.Add(row);
        }
        if (item.ActualDepartureDate.Trim().Length > 0)
        {
            row            = new Argix.Enterprise.TrackingItem();
            row.ItemNumber = item.ItemNumber;
            row.DateTime   = item.ActualDepartureDate;
            row.Status     = item.ActualDepartureStatus;
            row.Location   = item.ActualDepartureLocation;
            detail.Add(row);
        }
        if (item.ActualArrivalDate.Trim().Length > 0)
        {
            row            = new Argix.Enterprise.TrackingItem();
            row.ItemNumber = item.ItemNumber;
            row.DateTime   = item.ActualArrivalDate;
            row.Status     = item.ActualArrivalStatus;
            row.Location   = item.ActualArrivalLocation;
            detail.Add(row);
        }
        if (item.ActualStoreDeliveryDate.Trim().Length > 0)
        {
            row            = new Argix.Enterprise.TrackingItem();
            row.ItemNumber = item.ItemNumber;
            row.DateTime   = item.ActualStoreDeliveryDate;
            row.Status     = item.ActualStoreDeliveryStatus;
            row.Location   = item.ActualStoreDeliveryLocation;
            detail.Add(row);
        }
        if (item.PODScanDate.Trim().Length > 0)
        {
            row            = new Argix.Enterprise.TrackingItem();
            row.ItemNumber = item.ItemNumber;
            row.DateTime   = item.PODScanDate;
            row.Status     = item.PODScanStatus;
            row.Location   = item.PODScanLocation;
            detail.Add(row);
        }
        this.grdDetail.DataSource = detail;
        this.grdDetail.DataBind();

        //POD Request link available if carton delivered
        this.lnkPODReq.Enabled = (item.ScanType == 3 && item.PODScanStatus.ToLower().Contains("delivered") == true);
        this.lnkPODReq.ToolTip = (item.ScanType == 3 && item.PODScanStatus.ToLower().Contains("delivered") == true) ? "Display POD image (if image available)" : "POD only available after carton delivery";
    }
Пример #17
0
 public ItemDetailResponse(string store, TrackingItem item)
 {
     this.mStore = store; this.mItem = item;
 }
Пример #18
0
    public override IEnumerable<string> Process()
    {
      this.Progress.SetMessage("Reading group sample map file ...");
      var groupSampleMap = new MapReader(0, 1).ReadFromFile(options.MapFile);

      Dictionary<string, SignificantItem> geneNameMap = new Dictionary<string, SignificantItem>();

      this.Progress.SetMessage("Reading cuffdiff significant files ...");
      var sigs = (from file in options.SignificantFiles
                  from line in File.ReadAllLines(file).Skip(1)
                  let parts = line.Split('\t')
                  where parts.Length >= 3
                  let gene = parts[1]
                  let name = parts[2]
                  where !name.Equals("-")
                  let location = parts[3]
                  select new SignificantItem() { Gene = gene, GeneName = name, GeneLocation = location }).ToList();
      foreach (var gene in sigs)
      {
        if (!geneNameMap.ContainsKey(gene.Gene))
        {
          geneNameMap[gene.Gene] = gene;
        }
      }
      Func<string, bool> acceptGene = m => geneNameMap.ContainsKey(m);
      var countFile = options.OutputFilePrefix + ".count";
      var fpkmFile = options.OutputFilePrefix + ".fpkm";

      var items = new List<TrackingItem>();
      foreach (var trackingFile in options.InputFiles)
      {
        this.Progress.SetMessage("Reading cuffdiff read_group_tracking file " + trackingFile + "...");
        using (StreamReader sr = new StreamReader(trackingFile))
        {
          string line = sr.ReadLine();
          while ((line = sr.ReadLine()) != null)
          {
            var parts = line.Split('\t');
            if (parts.Length <= 7)
            {
              continue;
            }
            var gene = parts[0];
            if (!acceptGene(gene))
            {
              continue;
            }

            var group_index = parts[1] + "_" + parts[2];
            var sample = groupSampleMap.ContainsKey(group_index) ? groupSampleMap[group_index] : group_index;
            var count = parts[3];
            var fpkm = parts[6];
            var item = new TrackingItem() { Gene = gene, Sample = sample, Count = count, FPKM = fpkm };
            items.Add(item);
          }
        }
      }

      this.Progress.SetMessage("Preparing result ...");
      var samples = new HashSet<string>(from item in items
                                        select item.Sample).OrderBy(m => m).ToList();
      this.Progress.SetMessage(string.Format("There are {0} samples", samples.Count));

      var genes = new HashSet<string>(from item in items
                                      select item.Gene).OrderBy(m => m).ToList();
      this.Progress.SetMessage(string.Format("There are {0} genes", genes.Count));

      var map = ToDoubleDirectory(items);

      this.Progress.SetMessage("Removing empty genes ...");
      foreach (var gene in genes)
      {
        if (map[gene].All(m => m.Value.Count == "0"))
        {
          map.Remove(gene);
        }
      }

      var finalGenes = map.Keys.OrderBy(m => m).ToList();

      this.Progress.SetMessage("Outputing result ...");
      OutputFile(samples, finalGenes, map, geneNameMap, m => Math.Round(double.Parse(m.Count)).ToString(), countFile);
      OutputFile(samples, finalGenes, map, geneNameMap, m => m.FPKM, fpkmFile);

      this.Progress.End();
      return new[] { countFile, fpkmFile };
    }