示例#1
0
        private async Task <string> GetPostSolo()
        {
            if (_currWord == null) // The bot start the game by saying しりとり
            {
                _currWord = "しりとり";

                _dictionnary.Remove(_dictionnary.Find(x => x.Split('$')[0] == _currWord));
                _alreadySaid.Add("しりとり");
                return("しりとり (shiritori)");
            }
            string[] validWords = GetValidWords();
            if (validWords.Length == 0) // Not supposed to happen
            {
                LooseException le = new LooseException(GetStringFromSentence(Sentences.ShiritoriNoWord));
                await Program.p.LogError(new LogMessage(LogSeverity.Error, le.Source, le.Message, le));

                throw le;
            }
            string word = validWords[Program.p.rand.Next(0, validWords.Length)];

            string[] splitWord = word.Split('$');
            _dictionnary.Remove(word);
            _alreadySaid.Add(splitWord[0]);
            _currWord = Linguist.ToHiragana(splitWord[0]);
            return(splitWord[0] + " (" + Linguist.ToRomaji(splitWord[0]) + ") - " + GetStringFromSentence(Sentences.Meaning) + ": " + splitWord[1]);
        }
示例#2
0
    private static void Main(string[] args)
    {
        Linguist  linguist;
        Corrector corrector;

        try
        {
            linguist  = Linguist.Parse(Console.ReadLine());
            corrector = Corrector.Parse(Console.ReadLine());
        }

        catch (ArgumentException argumentException)
        {
            Console.WriteLine(argumentException.Message);
            return;
        }

        string text = Console.ReadLine();


        int totalSalary = 0;

        string editedText = linguist.EditHeader(text);

        totalSalary += linguist.CountSalary(text, editedText);

        text         = editedText;
        editedText   = corrector.EditHeader(text);
        totalSalary += corrector.CountSalary(text, editedText);

        Console.WriteLine(editedText);
        Console.WriteLine(totalSalary);
    }
示例#3
0
 public LinguistDumper(string filename, Linguist linguist) : base(linguist)
 {
     this.depthFirst = true;
     this.eqStates   = new Cache();
     this.eqSigs     = new HashMap();
     this.filename   = filename;
 }
        public override void run()
        {
            Linguist   linguist   = this.getLinguist();
            LinkedList linkedList = new LinkedList();
            HashSet    hashSet    = new HashSet();
            int        num        = 0;

            linkedList.add(linguist.getSearchGraph().getInitialState());
            while (!linkedList.isEmpty())
            {
                SearchState searchState = (SearchState)linkedList.remove(0);
                if (!hashSet.contains(searchState))
                {
                    num++;
                    this.incrementStateTypeCount(searchState);
                    hashSet.add(searchState);
                    SearchStateArc[] successors = searchState.getSuccessors();
                    for (int i = successors.Length - 1; i >= 0; i--)
                    {
                        SearchState state = successors[i].getState();
                        linkedList.add(state);
                    }
                }
            }
            [email protected]("# ----------- linguist stats ------------ ");
            [email protected](new StringBuilder().append("# Total states: ").append(num).toString());
            this.dumpStateTypeCounts();
        }
示例#5
0
 public GDLDumper(string filename, Linguist linguist, bool verticalLayout, bool skipHMMs, bool dumpArcLabels) : base(filename, linguist)
 {
     this.verticalLayout = verticalLayout;
     this.skipHMMs       = skipHMMs;
     this.dumpArcLabels  = dumpArcLabels;
     this.setDepthFirst(false);
     this.logMath = LogMath.getLogMath();
 }
 public SimpleBreadthFirstSearchManager(Linguist linguist, Pruner pruner, AcousticScorer scorer, ActiveListFactory activeListFactory, bool showTokenCount, double relativeWordBeamWidth, int growSkipInterval, bool wantEntryPruning)
 {
     this.name                     = Object.instancehelper_getClass(this).getName();
     this.logger                   = Logger.getLogger(this.name);
     this.logMath                  = LogMath.getLogMath();
     this.linguist                 = linguist;
     this.pruner                   = pruner;
     this.scorer                   = scorer;
     this.activeListFactory        = activeListFactory;
     this._showTokenCount          = showTokenCount;
     this.growSkipInterval         = growSkipInterval;
     this.wantEntryPruning         = wantEntryPruning;
     this.logRelativeWordBeamWidth = this.logMath.linearToLog(relativeWordBeamWidth);
     this.keepAllTokens            = true;
 }
示例#7
0
        => input.Replace('ぢ', 'じ');     // We do that because both characters are pronounced the same way

        protected override async Task <string> GetLoose()
        {
            if (_currWord == null) // Multiplayer, if nobody say anything
            {
                return(Sentences.ShiritoriExplainBegin(GetGuild()));
            }
            string[] validWords = GetValidWords();
            if (validWords.Length == 0)
            {
                return(GetStringFromSentence(Sentences.ShiritoriNoMoreWord));
            }
            string word = validWords[Program.p.rand.Next(0, validWords.Length)];

            string[] splitWord = word.Split('$');
            return(Sentences.ShiritoriSuggestion(GetGuild(), splitWord[0], Linguist.ToRomaji(splitWord[0]), splitWord[1]));
        }
 public WordPruningBreadthFirstSearchManager(Linguist linguist, Pruner pruner, AcousticScorer scorer, ActiveListManager activeListManager, bool showTokenCount, double relativeWordBeamWidth, int growSkipInterval, bool checkStateOrder, bool buildWordLattice, int maxLatticeEdges, float acousticLookaheadFrames, bool keepAllTokens)
 {
     this.maxLatticeEdges         = 100;
     this.logger                  = Logger.getLogger(Object.instancehelper_getClass(this).getName());
     this.logMath                 = LogMath.getLogMath();
     this.linguist                = linguist;
     this.pruner                  = pruner;
     this.scorer                  = scorer;
     this.activeListManager       = activeListManager;
     this._showTokenCount         = showTokenCount;
     this.growSkipInterval        = growSkipInterval;
     this._checkStateOrder        = checkStateOrder;
     this.buildWordLattice        = buildWordLattice;
     this.maxLatticeEdges         = maxLatticeEdges;
     this.acousticLookaheadFrames = acousticLookaheadFrames;
     this.keepAllTokens           = keepAllTokens;
     this.relativeBeamWidth       = this.logMath.linearToLog(relativeWordBeamWidth);
 }
示例#9
0
        internal void Save(XmlTextWriter writer)
        {
            writer.WriteStartElement("newskills");

            writer.WriteElementString("skillptsmax", SkillPointsMaximum.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("skillgrpsmax", SkillGroupPointsMaximum.ToString(CultureInfo.InvariantCulture));
            writer.WriteElementString("uneducated", Uneducated.ToString());
            writer.WriteElementString("uncouth", Uncouth.ToString());
            writer.WriteElementString("schoolofhardknocks", SchoolOfHardKnocks.ToString());
            writer.WriteElementString("collegeeducation", CollegeEducation.ToString());
            writer.WriteElementString("jackofalltrades", JackOfAllTrades.ToString());
            writer.WriteElementString("techschool", TechSchool.ToString());
            writer.WriteElementString("linguist", Linguist.ToString());

            writer.WriteStartElement("skills");
            foreach (Skill skill in Skills)
            {
                skill.WriteTo(writer);
            }
            writer.WriteEndElement();
            writer.WriteStartElement("knoskills");
            foreach (KnowledgeSkill knowledgeSkill in KnowledgeSkills)
            {
                knowledgeSkill.WriteTo(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("skilljackknowledgeskills");
            foreach (KnowledgeSkill objSkill in KnowsoftSkills)
            {
                objSkill.WriteTo(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("groups");
            foreach (SkillGroup skillGroup in SkillGroups)
            {
                skillGroup.WriteTo(writer);
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
        }
示例#10
0
        public WordPruningBreadthFirstLookaheadSearchManager(Linguist linguist, Linguist fastmatchLinguist, Loader loader, Pruner pruner, AcousticScorer scorer, ActiveListManager activeListManager, ActiveListFactory fastmatchActiveListFactory, bool showTokenCount, double relativeWordBeamWidth, int growSkipInterval, bool checkStateOrder, bool buildWordLattice, int lookaheadWindow, float lookaheadWeight, int maxLatticeEdges, float acousticLookaheadFrames, bool keepAllTokens) : base(linguist, pruner, scorer, activeListManager, showTokenCount, relativeWordBeamWidth, growSkipInterval, checkStateOrder, buildWordLattice, maxLatticeEdges, acousticLookaheadFrames, keepAllTokens)
        {
            this.loader                     = loader;
            this.fastmatchLinguist          = fastmatchLinguist;
            this.fastmatchActiveListFactory = fastmatchActiveListFactory;
            this.lookaheadWindow            = lookaheadWindow;
            this.lookaheadWeight            = lookaheadWeight;
            if (lookaheadWindow < 1 || lookaheadWindow > 10)
            {
                string text = new StringBuilder().append("Unsupported lookahead window size: ").append(lookaheadWindow).append(". Value in range [1..10] is expected").toString();

                throw new IllegalArgumentException(text);
            }
            this.ciScores  = new LinkedList();
            this.penalties = new HashMap();
            if (loader is Sphinx3Loader && ((Sphinx3Loader)loader).hasTiedMixtures())
            {
                ((Sphinx3Loader)loader).setGauScoresQueueLength(lookaheadWindow + 2);
            }
        }
示例#11
0
        string GetColNameSub(string colName)
        {
            if (!string.IsNullOrEmpty(colName))
            {
                switch (colName)
                {
                case "morning":
                    return(Linguist.Phrase("mornSub"));

                case "noon":
                    return(Linguist.Phrase("noonSub"));

                case "evening":
                    return(Linguist.Phrase("eveSub"));

                case "night":
                    return(Linguist.Phrase("nightSub"));
                }
            }
            return("");
        }
示例#12
0
        private void buildDataSubReport()
        {
            listCup4 = new List <SureMedRdlcReportOutsideCupInfo>();
            listCup3 = new List <SureMedRdlcReportOutsideCupInfo>();
            listCup2 = new List <SureMedRdlcReportOutsideCupInfo>();
            listCup1 = new List <SureMedRdlcReportOutsideCupInfo>();
            listPill = new List <SureMedRdlcReportOutsidePillInfo>();
            #region list cup
            var rowNum  = 0;
            var colNum1 = 0;
            var colNum2 = 0;
            var colNum3 = 0;
            var colNum4 = 0;

            var isMultiPatient           = tray.Patients.Count() > 1;
            var firstCupByIntakeDateTime = tray.Cups.OrderBy(o => o.IntakeDateTime).FirstOrDefault();
            for (int i = 1; i <= 28; i++)
            {
                var cupInfo = new SureMedRdlcReportOutsideCupInfo();
                var cup     = tray.Cups.FirstOrDefault(x => x.Number == i);
                if (cup != null)
                {
                    var listDoseDispense = new List <string> {
                        "a", "b", "c", "d"
                    };
                    var isDoesDispen = listDoseDispense.Contains(cup.TimeSlotCode);
                    if (cup.Number == firstCupByIntakeDateTime.Number)
                    {
                        cupInfo.FirstCup = true;
                    }

                    //defaultFormatDate = languageCode == "bg-BG" ? "dd.MM.yyyy" : "dd-MM-yy";
                    cupInfo.IntakeDateTimeStr = (isDoesDispen ? cup.TimeSlotDescription : cup.IntakeTimeDescription);
                    cupInfo.IntakeIcon        = isDoesDispen ? (cup.TimeSlotIcon != null ? Utils.imageToByteArray(cup.TimeSlotIcon) : new byte[0]) : (cup.IntakeTimeIcon != null ? Utils.imageToByteArray(cup.IntakeTimeIcon) : new byte[0]);
                    cupInfo.PatientName       = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : cup.Patient.FullName.ToUpper();
                    cupInfo.TimeSlotColor     = isDoesDispen ? cup.TimeSlotColor : cup.IntakeTimeColor;
                    cupInfo.PrintTime         = isDoesDispen ? cup.TimeSlotDescription : cup.IntakeTimeDescription;
                    cupInfo.IsMultiPatient    = isMultiPatient;
                    cupInfo.DayName           = cup.IntakeDateTime
                                                .ToString("dddd");
                    #region list pill info
                    var medicines = CalculateWholePillsInCup(cup, isDoesDispen);
                    listPill.AddRange(medicines);
                    #endregion
                }

                cupInfo.cupNumber = i;
                if (i % 4 == 0)
                {
                    cupInfo.row = rowNum + 1;
                    cupInfo.col = colNum4 + 1;
                    colNum4++;
                    listCup4.Add(cupInfo);
                }
                if (i % 4 == 3)
                {
                    cupInfo.row = rowNum + 2;
                    cupInfo.col = colNum3 + 1;
                    colNum3++;
                    listCup3.Add(cupInfo);
                }
                if (i % 4 == 2)
                {
                    cupInfo.row = rowNum + 3;
                    cupInfo.col = colNum2 + 1;
                    colNum2++;
                    listCup2.Add(cupInfo);
                }
                if (i % 4 == 1)
                {
                    cupInfo.row = rowNum + 4;
                    cupInfo.col = colNum1 + 1;
                    colNum1++;
                    listCup1.Add(cupInfo);
                }
            }
            foreach (var item in listCup1)
            {
                listCup4.FirstOrDefault(x => x.col == item.col).DayName1 = item.DayName;
            }

            foreach (var item in listCup2)
            {
                listCup4.FirstOrDefault(x => x.col == item.col).DayName2 = item.DayName;
            }

            foreach (var item in listCup3)
            {
                listCup4.FirstOrDefault(x => x.col == item.col).DayName3 = item.DayName;
            }

            foreach (var item in listCup4)
            {
                var listDayName = new List <string>();
                if (!string.IsNullOrEmpty(item.DayName))
                {
                    listDayName.Add(item.DayName);
                }
                if (!string.IsNullOrEmpty(item.DayName1))
                {
                    listDayName.Add(item.DayName1);
                }
                if (!string.IsNullOrEmpty(item.DayName2))
                {
                    listDayName.Add(item.DayName2);
                }
                if (!string.IsNullOrEmpty(item.DayName3))
                {
                    listDayName.Add(item.DayName3);
                }
                var count = listDayName.Distinct().Count();
                item.DayName = count > 1 ? "" : listDayName.Distinct().FirstOrDefault();
            }
            #endregion
        }
示例#13
0
 public LinguistTimer(Linguist linguist, bool details)
 {
     this.linguist = linguist;
     this.details  = details;
 }
示例#14
0
        void BindingDataToReport()
        {
            tray = _reportService.GetTrayNew();
            if (tray != null)
            {
                var cartonLabel = tray.Carton != null ? tray.Carton.Label : null;
                if (isPrint)
                {
                    labelId = Guid.NewGuid().ToString();
                }
                else
                {
                    labelId = cartonLabel != null ? cartonLabel.LabelId : Guid.Empty.ToString();
                }
                isMultiLocation = tray.Locations.Count > 1;
                var    models          = new List <SureMedRdlcReportOutsideInfo>();
                var    isMultiPatient  = tray.Patients.Count() > 1;
                var    patient         = tray.Patients.FirstOrDefault().Value;
                var    cupFirst        = tray.Cups.OrderBy(x => x.IntakeDateTime).FirstOrDefault();
                var    location        = tray.Locations.FirstOrDefault().Value;
                var    customerAdrress = location.Customer.Addresses.FirstOrDefault(o => ("Medication packing address").Equals(o.AddressType));
                Bitmap imagetemp       = null;
                if (patient.PhotoImage != null)
                {
                    imagetemp = (Bitmap)patient.PhotoImage.Clone();
                }
                var model = new SureMedRdlcReportOutsideInfo()
                {
                    PatientName  = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : patient.FullName.Length > 25 ? patient.FullName.Substring(0, 25): patient.FullName,
                    PatientPhoto = patient.PhotoImage != null && !isMultiPatient?Utils.imageToByteArray(imagetemp) : new byte[0],
                                       RoomBedInfo         = buildBedRoomInfo(patient, isMultiPatient),
                                       PatientId           = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : patient.PatientId,
                                       PatientIdWithPrefix = Linguist.Phrase("PatientIdWithColonTitle") + " " + patient.PatientId,
                                       StartDate           = cupFirst.IntakeDateTime.ToString(defaultFormatDate),
                                       PatientDob          = isMultiPatient
                        ? Linguist.Phrase("ErrorDataTitle")
                        : (patient.DateOfBirth != DateTime.MinValue ? Linguist.Phrase("DOBTitle") + patient.DateOfBirth.ToString(defaultFormatDate) : ""),
                                       Facility = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : cupFirst.Location.Institution.Name,
                                       DayOfWeekStartDatestr = isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : cupFirst.IntakeDateTime.ToString("dddd") + " " + cupFirst.IntakeDateTime.ToString("MM/dd/yyyy"),
                                       DayOfWeek             = cupFirst.IntakeDateTime.ToString("dddd"),
                                       PackXofX        = Linguist.Phrase("PackTitle") + " " + (tray.SequenceTrayNumberByPatient <= 0 ? 1 : tray.SequenceTrayNumberByPatient) + " " + Linguist.Phrase("OfTitle") + " " + (tray.TotalTrayInBatchByPatient <= 0 ? 1 : tray.TotalTrayInBatchByPatient),
                                       PatientBigPhoto = patient.PhotoImage != null && !isMultiPatient?Utils.imageToByteArray(imagetemp) : new byte[0],
                                                             PharmacyInfo    = location.Customer.Name,
                                                             PharmacyAddress = customerAdrress != null?buildCustomerAddress(customerAdrress) : "",
                                                                                   BarcodeImage = Utils.CreateQRCode(labelId),
                                                                                   CompanyLogo  = tray.Batch.Order.CompanyLogo != null?Utils.imageToByteArray(tray.Batch.Order.CompanyLogo) : new byte[0],
                                                                                                      PromoLogo = tray.Batch.Order.Template1 != null?Utils.imageToByteArray(Utils.rotateInternalFunction(tray.Batch.Order.Template1, RotateFlipType.Rotate270FlipNone)) : new byte[0],
                                                                                                                      DateCreated    = Linguist.Phrase("DatePackedWithColonTitle") + " " + tray.DateCreated.ToString(defaultFormatDate),
                                                                                                                      IsMultiPatient = isMultiPatient,
                                                                                                                      Phone          = location.Customer.Phone1,
                                                                                                                      ExpireDate     = Linguist.Phrase("ExpireDateWithColonTitle") + " " + Helper.CalculateExpireDate(tray, cupFirst, Settings.Default.MinimumExpirePeriod).ToString(defaultFormatDate),
                                                                                                                      Unit           = patient.Unit,
                                                                                                                      Location       = isMultiLocation ? Linguist.Phrase("ErrorDataTitle") : tray.Locations.FirstOrDefault().Value.LocationId,
                                                                                                                      PhoneLabel     = Linguist.Phrase("PhoneWithColonTitle"),
                                                                                                                      Dea            = Linguist.Phrase("Dea#WithColonTitle"),
                                                                                                                      DeaValue       = location.Customer.DeaNumber,
                                                                                                                      CautionValue   = Linguist.Phrase("Warning") + Environment.NewLine + Linguist.Phrase("Caution"),
                                                                                                                      PatientStreet  = patient.Addresses.FirstOrDefault() != null?patient.Addresses.FirstOrDefault().Street                                                        : "",
                                                                                                                      PatientZipCode = patient.Addresses.FirstOrDefault() != null?patient.Addresses.FirstOrDefault().ZipPostalCode + " " + patient.Addresses.FirstOrDefault().City : ""
                };

                models.Add(model);
                ReportDataSource reportDataSource1 =
                    new Microsoft.Reporting.WinForms.ReportDataSource();
                reportDataSource1.Name  = "SureMedPlusCardOutsideInfoDataset";
                reportDataSource1.Value = models;
                this.reportViewer.LocalReport.DataSources.Add(reportDataSource1);
                buildDataSubReport();
            }
        }
示例#15
0
 public LinguistStats(Linguist linguist) : base(linguist)
 {
     this.stateCountByType = new HashMap();
 }
示例#16
0
        private List <SureMedRdlcReportInsideInfo> buildPillInside()
        {
            var listPillGroup  = listPill.GroupBy(p => new { p.PillId }, (key, group) => new { pillId = key.PillId, pillInfo = group });
            var listPillInside = new List <SureMedRdlcReportInsideInfo>();

            listImagePill = new List <Image>();
            foreach (var item in listPillGroup.OrderBy(p => p.pillId))
            {
                if (item.pillId != null)
                {
                    var pillGroup = listPillGroup.FirstOrDefault(o => o.pillId == item.pillId);

                    var medicine   = Helper.GetMedicineData(tray, item.pillId);
                    var pillInside = new SureMedRdlcReportInsideInfo();
                    pillInside.NationalDrugCode = Linguist.Phrase("NDCPrefix") + item.pillId.ToUpper();
                    var col1Name = Helper.CalculateIntakeTime(tray, 1);
                    var col2Name = Helper.CalculateIntakeTime(tray, 2);
                    var col3Name = Helper.CalculateIntakeTime(tray, 3);
                    var col4Name = Helper.CalculateIntakeTime(tray, 0);
                    pillInside.Col1Name = col1Name.Length > 5 ? col1Name.Substring(0, 5) : col1Name;
                    pillInside.Col2Name = col2Name.Length > 5 ? col2Name.Substring(0, 5) : col2Name;
                    pillInside.Col3Name = col3Name.Length > 5 ? col3Name.Substring(0, 5) : col3Name;
                    pillInside.Col4Name = col4Name.Length > 5 ? col4Name.Substring(0, 5) : col4Name;
                    if (medicine.PillInfo != null)
                    {
                        pillInside.Manufacturer = (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Length > 30? (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Substring(0, 30): (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName);
                        pillInside.BrandName    = Linguist.Phrase("BrandWithColonTitle") + " " + medicine.PillInfo.BrandNameShort;
                        pillInside.DrugName     = medicine.PillInfo.ItemShortName;
                        pillInside.Description  = medicine.PillInfo.Description;
                        pillInside.RxNumber     = Linguist.Phrase("RxWithColonTitle") + " " + medicine.PrescriptionNumber;
                        pillInside.DrName       = Linguist.Phrase("DrNameWithColonTitle") + " " + medicine.PrescribingPhysician;
                        if (medicine.MedicationsInstruction.Contains("*"))
                        {
                            pillInside.Instructions = medicine.MedicationsInstruction.Substring(0, medicine.MedicationsInstruction.IndexOf("*") - 1);
                            pillInside.Notes        = medicine.MedicationsInstruction.Substring(medicine.MedicationsInstruction.IndexOf("*") + 1);
                        }
                        else
                        {
                            pillInside.Instructions = medicine.MedicationsInstruction;
                            pillInside.Notes        = null;
                        }
                        //pillInside.Model1 = medicine.PillInfo.Model1 != null ? Utils.imageToByteArray(medicine.PillInfo.Model1) : new byte[0];
                        //pillInside.Model2 = (medicine.PillInfo.Model2 != null) ? Utils.imageToByteArray(medicine.PillInfo.Model2) : new byte[0];
                        pillInside.DrugName = medicine.PillInfo.Description;
                        if (medicine.PillInfo.Model1 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model1);
                            pillInside.ImgModel1 = medicine.PillInfo.Model1;
                        }
                        if (medicine.PillInfo.Model2 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model2);
                            pillInside.ImgModel2 = medicine.PillInfo.Model2;
                        }
                        if (medicine.PillInfo.Model3 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model3);
                            pillInside.ImgModel3 = medicine.PillInfo.Model3;
                        }
                        if (medicine.PillInfo.Model4 != null)
                        {
                            listImagePill.Add(medicine.PillInfo.Model4);
                            pillInside.ImgModel4 = medicine.PillInfo.Model4;
                        }
                    }
                    if (pillGroup != null && pillGroup.pillInfo != null)
                    {
                        foreach (var pill in pillGroup.pillInfo)
                        {
                            if (pill != null)
                            {
                                switch ((pill.cupNumber + 3) % 4)
                                {
                                case 0:
                                    pillInside.NumMorn = pill.Amount;
                                    break;

                                case 1:
                                    pillInside.NumNoon = pill.Amount;
                                    break;

                                case 2:
                                    pillInside.NumEve = pill.Amount;
                                    break;

                                case 3:
                                    pillInside.NumNight = pill.Amount;
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }

                    listPillInside.Add(pillInside);
                }
            }
            var size = ProcessImageModelPill.SetNewImageSize(listImagePill);

            foreach (var item in listPillInside)
            {
                item.Model1 = ProcessImageModelPill.ResizePillModels(item.ImgModel1, size);
                item.Model2 = ProcessImageModelPill.ResizePillModels(item.ImgModel2, size);
            }
            return(listPillInside);
        }
示例#17
0
        private List <SureMedRdlcReportInsideInfo> buildPillInside()
        {
            var listPillGroup  = listPill.GroupBy(p => new { p.PillId }, (key, group) => new { pillId = key.PillId, pillInfo = group });
            var listPillInside = new List <SureMedRdlcReportInsideInfo>();

            listImagePill = new List <Image>();
            foreach (var item in listPillGroup.OrderBy(p => p.pillId))
            {
                if (item.pillId != null)
                {
                    var pillGroup = listPillGroup.FirstOrDefault(o => o.pillId == item.pillId);

                    var medicine   = Helper.GetMedicineData(tray, item.pillId);
                    var pillInside = new SureMedRdlcReportInsideInfo();
                    pillInside.NationalDrugCode = Linguist.Phrase("NDCPrefix") + item.pillId.ToUpper();
                    var listDispense = GetChargeAndExpireDate();
                    var dispenseInfo = listDispense.FirstOrDefault(x => x.PillId.Contains(item.pillId));
                    var LotTemp      = dispenseInfo != null ? dispenseInfo.ChargeNumberList : "";
                    var col1Name     = Helper.CalculateIntakeTime(tray, 1);
                    var col2Name     = Helper.CalculateIntakeTime(tray, 2);
                    var col3Name     = Helper.CalculateIntakeTime(tray, 3);
                    var col4Name     = Helper.CalculateIntakeTime(tray, 0);
                    pillInside.Col1Name = col1Name.Length > 5 ? col1Name.Substring(0, 5) : col1Name;
                    pillInside.Col2Name = col2Name.Length > 5 ? col2Name.Substring(0, 5) : col2Name;
                    pillInside.Col3Name = col3Name.Length > 5 ? col3Name.Substring(0, 5) : col3Name;
                    pillInside.Col4Name = col4Name.Length > 5 ? col4Name.Substring(0, 5) : col4Name;
                    if (medicine.PillInfo != null)
                    {
                        pillInside.Manufacturer  = (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Length > 30? (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName).Substring(0, 30): (Linguist.Phrase("MgfWithColonTitle") + " " + medicine.PillInfo.ManufactureName);
                        pillInside.BrandName     = Linguist.Phrase("BrandWithColonTitle") + " " + medicine.PillInfo.BrandNameShort;
                        pillInside.DrugName      = medicine.PillInfo.ItemShortName;
                        pillInside.Description   = medicine.PillInfo.Description;
                        pillInside.Shape         = medicine.PillInfo.Shape;
                        pillInside.Color         = medicine.PillInfo.Color;
                        pillInside.Imprint       = medicine.PillInfo.Imprint;
                        pillInside.LotNumber     = Linguist.Phrase("LotWithColonTitle") + "" + LotTemp;
                        pillInside.RxNumber      = Linguist.Phrase("RxWithColonTitle") + " " + medicine.PrescriptionNumber;
                        pillInside.RxOrigBarCode = Utils.imageToByteArray(GenCode128.Code128Rendering.MakeBarcodeImage(medicine.PrescriptionNumberOriginal, 2, true));
                        pillInside.DrName        = Linguist.Phrase("DrNameWithColonTitle") + " " + medicine.PrescribingPhysician;
                        pillInside.Instructions  = medicine.MedicationsInstruction;
                        pillInside.Model1        = medicine.PillInfo.Model1 != null?Utils.imageToByteArray(medicine.PillInfo.Model1) : new byte[0];

                        pillInside.Model2 = (medicine.PillInfo.Model2 != null) ? Utils.imageToByteArray(medicine.PillInfo.Model2) : new byte[0];
                        //if (medicine.PillInfo.Model1 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model1);
                        //pillInside.ImgModel1 = medicine.PillInfo.Model1;
                        //}
                        //if (medicine.PillInfo.Model2 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model2);
                        //pillInside.ImgModel2 = medicine.PillInfo.Model2;
                        //}
                        //if (medicine.PillInfo.Model3 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model3);
                        //pillInside.ImgModel3 = medicine.PillInfo.Model3;
                        //}
                        //if (medicine.PillInfo.Model4 != null)
                        //{
                        //listImagePill.Add(medicine.PillInfo.Model4);
                        //pillInside.ImgModel4 = medicine.PillInfo.Model4;
                        //}
                    }
                    if (pillGroup != null && pillGroup.pillInfo != null)
                    {
                        foreach (var pill in pillGroup.pillInfo)
                        {
                            if (pill != null)
                            {
                                switch ((pill.cupNumber + 3) % 4)
                                {
                                case 0:
                                    pillInside.NumMorn += pill.Amount;
                                    break;

                                case 1:
                                    pillInside.NumNoon += pill.Amount;
                                    break;

                                case 2:
                                    pillInside.NumEve += pill.Amount;
                                    break;

                                case 3:
                                    pillInside.NumNight += pill.Amount;
                                    break;

                                default:
                                    break;
                                }
                            }
                        }
                    }

                    listPillInside.Add(pillInside);
                }
            }
            //var size = ProcessImageModelPill.SetNewImageSize(listImagePill);

            //foreach (var item in listPillInside)
            //{
            //item.Model1 = ProcessImageModelPill.ResizePillModels(item.ImgModel1, size);
            //item.Model2 = ProcessImageModelPill.ResizePillModels(item.ImgModel2, size);
            //}
            return(listPillInside);
        }
示例#18
0
        protected override async Task <string> GetCheckCorrectAsync(string userAnswer)
        {
            string hiraganaAnswer = ReplaceLocalString(Linguist.ToHiragana(userAnswer));

            if (_currWord == null) // Multiplayer only
            {
                if (hiraganaAnswer != "しりとり")
                {
                    return(GetStringFromSentence(Sentences.ShiritoriExplainBegin));
                }
                _currWord = "しりとり";
                _alreadySaid.Add(_currWord);
                _dictionnary.Remove(_dictionnary.Find(x => x.Split('$')[0] == _currWord));
                return(null);
            }
            if (hiraganaAnswer.Any(c => c < 0x0041 || (c > 0x005A && c < 0x0061) || (c > 0x007A && c < 0x3041) || (c > 0x3096 && c < 0x30A1) || c > 0x30FA))
            {
                return(GetStringFromSentence(Sentences.OnlyHiraganaKatakanaRomaji));
            }
            dynamic json;

            json = JsonConvert.DeserializeObject(await _http.GetStringAsync("http://www.jisho.org/api/v1/search/words?keyword=" + Uri.EscapeDataString(userAnswer)));
            if (json.data.Count == 0)
            {
                return(GetStringFromSentence(Sentences.ShiritoriDoesntExist));
            }
            bool   isCorrect = false, isNoun = false;
            string reading;

            string[] meanings = new string[] { };
            foreach (dynamic s in json.data)
            {
                foreach (dynamic jp in s.japanese)
                {
                    reading = Linguist.ToHiragana((string)jp.reading);
                    if (reading == null)
                    {
                        continue;
                    }
                    reading = ReplaceLocalString(reading);
                    if (reading == hiraganaAnswer)
                    {
                        isCorrect = true;
                        foreach (dynamic meaning in s.senses)
                        {
                            foreach (dynamic partSpeech in meaning.parts_of_speech)
                            {
                                if (partSpeech == "Noun")
                                {
                                    isNoun   = true;
                                    meanings = ((JArray)meaning.english_definitions).Select(x => (string)x).ToArray();
                                    goto ContinueCheck;
                                }
                            }
                        }
                    }
                }
            }
ContinueCheck:
            if (!isCorrect)
            {
                return(GetStringFromSentence(Sentences.ShiritoriDoesntExist));
            }
            string lastCharac = GetLastCharacter(_currWord);

            if (!hiraganaAnswer.StartsWith(ReplaceLocalString(GetLastCharacter(_currWord))))
            {
                return(Sentences.ShiritoriMustBegin(GetGuild(), lastCharac, Linguist.ToRomaji(lastCharac)));
            }
            if (!isNoun)
            {
                return(GetStringFromSentence(Sentences.ShiritoriNotNoun));
            }
            if (GetLastCharacter(hiraganaAnswer) == hiraganaAnswer)
            {
                return(GetStringFromSentence(Sentences.ShiritoriTooSmall));
            }
            if (_alreadySaid.Contains(hiraganaAnswer))
            {
                await LooseAsync(GetStringFromSentence(Sentences.ShiritoriAlreadySaid));

                return("");
            }
            if (hiraganaAnswer.Last() == 'ん')
            {
                await LooseAsync(GetStringFromSentence(Sentences.ShiritoriEndWithN));

                return("");
            }
            var elem = _dictionnary.Find(x => x.Split('$')[0] == hiraganaAnswer);

            if (HaveMultiplayerLobby())
            {
                _endTurnMsg = hiraganaAnswer + " (" + Linguist.ToRomaji(hiraganaAnswer) + ") - " + GetStringFromSentence(Sentences.Meaning) + ": " + string.Join(", ", meanings.Select(x => "\"" + x + "\""));
            }
            _dictionnary.Remove(elem);
            _alreadySaid.Add(hiraganaAnswer);
            _currWord = hiraganaAnswer;
            return(null);
        }
示例#19
0
        private string buildBedRoomInfo(PatientData patient, bool isMultiPatient)
        {
            var result = string.IsNullOrEmpty(patient.Room) ? "" : (isMultiPatient ? Linguist.Phrase("ErrorDataTitle") : patient.Room);

            return(result);
        }
示例#20
0
 public LinguistProcessor(Linguist linguist)
 {
     this.linguist = linguist;
 }