示例#1
0
        /// <summary>
        /// Edits an existing abbreviation in the list of
        /// abbreviations and then saves and reloads the list
        /// </summary>
        /// <param name="abbr">abbreviation to be edited</param>
        private void editAbbreviation(Abbreviation abbr)
        {
            Windows.SetVisible(_form, false);

            var operation = new AbbrOperation {
                InputAbbreviation = abbr, Add = false
            };

            editOrAddAbbreviation(operation);
            if (!operation.Cancel)
            {
                if (operation.Delete)
                {
                    Context.AppAbbreviations.Remove(abbr.Mnemonic);
                }
                else
                {
                    if (!Context.AppAbbreviations.Exists(operation.OutputAbbreviation.Mnemonic))
                    {
                        Context.AppAbbreviations.Add(operation.OutputAbbreviation);
                    }
                    else
                    {
                        Context.AppAbbreviations.Update(operation.OutputAbbreviation);
                    }
                }

                Context.AppAbbreviations.Save();
                Context.AppAbbreviations.Load();
            }

            _form.LoadAbbreviations();
            Windows.SetVisible(_form, true);
        }
        void GridShortNamesCellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 2)
            {
                string       abbreviationText;
                Abbreviation abbreviation = gridShortNames.Rows[e.RowIndex].Cells["ColumnShortName"].Value as Abbreviation;
                if (EditValueDialog.ShowDialog(
                        this,
                        Strings.Abbreviation,
                        Strings.EnterAbbreviation,
                        abbreviation == null ? string.Empty : abbreviation.Name,
                        out abbreviationText))
                {
                    if (abbreviation == null)
                    {
                        abbreviation = new Abbreviation();
                    }

                    abbreviation.Name     = abbreviationText;
                    abbreviation.Language = (Language)gridShortNames.Rows[e.RowIndex].Tag;
                    gridShortNames.Rows[e.RowIndex].Cells["ColumnShortName"].Value = abbreviation;
                    gridShortNames.Refresh();
                }
            }
        }
示例#3
0
    public static void Main()
    {
        Abbreviation obj = new Abbreviation();

        obj.Readdata();
        obj.Abbre();
    }
示例#4
0
 private void ParseAbreviations()
 {
     _readerSource.Seek((int)_offset, SeekOrigin.Begin);
     while (true)
     {
         var code = _readerSource.BaseStream.ReadULEB128();
         if (code == 0)
         {
             break;
         }
         var abv = new Abbreviation
         {
             Tag          = (ETag)_readerSource.BaseStream.ReadULEB128(),
             ChildrenFlag = (EChildren)_readerSource.ReadByte(),
             Attributes   = new List <AbbrevAttribute>()
         };
         while (true)
         {
             var abat = new AbbrevAttribute
             {
                 Name = (EAttributes)_readerSource.BaseStream.ReadULEB128(),
                 Form = (EForm)_readerSource.BaseStream.ReadULEB128()
             };
             abv.Attributes.Add(abat);
             if (abat.Name == EAttributes.DW_AT_null && abat.Form == EForm.DW_FORM_null)
             {
                 break;
             }
         }
         _abbreviations[code] = abv;
     }
 }
示例#5
0
        public override Specification <Country> GetSpecification()
        {
            var spec = new Specification <Country>();

            if (!Ids.IsEmpty())
            {
                int[] ids = ArrayHelpers.StringToIntArray(Ids);
                if (ids != null && ids.Length > 0)
                {
                    spec.And(c => ids.Contains(c.Id));
                }
            }
            if (!Name.IsEmpty())
            {
                spec.And(c => c.Name.StartsWith(Name));
            }
            if (!Abbreviation.IsEmpty())
            {
                spec.And(c => c.Abbreviation.StartsWith(Abbreviation));
            }
            if (!ShowAll)
            {
                spec.And(c => c.Enabled == true);
            }
            return(spec);
        }
示例#6
0
 /// <summary>
 /// Deletes an abbreviation from the list and reloads
 /// the list
 /// </summary>
 /// <param name="abbr">abbreviation to delete</param>
 private void deleteAbbreviation(Abbreviation abbr)
 {
     Context.AppAbbreviations.Remove(abbr.Mnemonic);
     Context.AppAbbreviations.Save();
     Context.AppAbbreviations.Load();
     _form.LoadAbbreviations();
 }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogItem other &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) &&
                   ((Abbreviation == null && other.Abbreviation == null) || (Abbreviation?.Equals(other.Abbreviation) == true)) &&
                   ((LabelColor == null && other.LabelColor == null) || (LabelColor?.Equals(other.LabelColor) == true)) &&
                   ((AvailableOnline == null && other.AvailableOnline == null) || (AvailableOnline?.Equals(other.AvailableOnline) == true)) &&
                   ((AvailableForPickup == null && other.AvailableForPickup == null) || (AvailableForPickup?.Equals(other.AvailableForPickup) == true)) &&
                   ((AvailableElectronically == null && other.AvailableElectronically == null) || (AvailableElectronically?.Equals(other.AvailableElectronically) == true)) &&
                   ((CategoryId == null && other.CategoryId == null) || (CategoryId?.Equals(other.CategoryId) == true)) &&
                   ((TaxIds == null && other.TaxIds == null) || (TaxIds?.Equals(other.TaxIds) == true)) &&
                   ((ModifierListInfo == null && other.ModifierListInfo == null) || (ModifierListInfo?.Equals(other.ModifierListInfo) == true)) &&
                   ((Variations == null && other.Variations == null) || (Variations?.Equals(other.Variations) == true)) &&
                   ((ProductType == null && other.ProductType == null) || (ProductType?.Equals(other.ProductType) == true)) &&
                   ((SkipModifierScreen == null && other.SkipModifierScreen == null) || (SkipModifierScreen?.Equals(other.SkipModifierScreen) == true)) &&
                   ((ItemOptions == null && other.ItemOptions == null) || (ItemOptions?.Equals(other.ItemOptions) == true)));
        }
示例#8
0
 /// <summary>
 /// User wants to edit or delete an abbr
 /// </summary>
 private void handleEditAbbreviation(Abbreviation abbr)
 {
     if (EvtEditAbbreviation != null)
     {
         Invoke(new MethodInvoker(() => EvtEditAbbreviation(abbr)));
     }
 }
        public static string convertSerializedJSON(Abbreviation abr)
        {
            AbbreviationJSON abrJSON = new AbbreviationJSON(abr);
            var json = new JavaScriptSerializer().Serialize(abrJSON);

            return(json);
        }
        public override bool Collect(AbstractDataCollector <TEntity> collector)
        {
            if (collector == null)
            {
                return(false);
            }

            ActiveCollector = collector;

            ID = ((IDiagnosisCategory_Viewer)ActiveCollector.ActiveViewer).ID;

            if (ActiveDBItem == null)
            {
                return(false);
            }

            if (Name_P != null)
            {
                ((DiagnosisCategory_cu)ActiveDBItem).Name_P = Name_P.ToString();
            }

            if (Name_S != null)
            {
                ((DiagnosisCategory_cu)ActiveDBItem).Name_S = Name_S.ToString();
            }

            if (Abbreviation != null)
            {
                ((DiagnosisCategory_cu)ActiveDBItem).Abbreviation = Abbreviation.ToString();
            }

            if (IsDoctorRelated != null && Convert.ToBoolean(IsDoctorRelated))
            {
                if (DoctorID == null)
                {
                    MessageToView = "You should choose the Doctor";
                    return(false);
                }

                ((DiagnosisCategory_cu)ActiveDBItem).IsDoctorRelated = true;
            }

            if (UserID != null)
            {
                ((DiagnosisCategory_cu)ActiveDBItem).InsertedBy = Convert.ToInt32(UserID);
            }

            ((DiagnosisCategory_cu)ActiveDBItem).IsOnDuty = true;
            switch (((IDiagnosisCategory_Viewer)ActiveCollector.ActiveViewer).CommonTransactionType)
            {
            case DB_CommonTransactionType.DeleteExisting:
                ((DiagnosisCategory_cu)ActiveDBItem).IsOnDuty = false;
                break;
            }

            RelatedViewers = ((IDiagnosisCategory_Viewer)ActiveCollector.ActiveViewer).RelatedViewers;

            return(true);
        }
示例#11
0
        public ActionResult DeleteConfirmed(int id)
        {
            Abbreviation abbreviation = db.Abbreviations.Find(id);

            db.Abbreviations.Remove(abbreviation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#12
0
        public ZStringAddress GetAbbreviationZStringAddress(Abbreviation a)
        {
            var baseAddress         = WordAddress.FromAbbreviationTableBase(GetAbbreviationsTableBase());
            var abbreviationAddress = baseAddress.IncrementBy(a.Value);
            var wordAddress         = new WordZStringAddress(ReadWord(abbreviationAddress));

            return(wordAddress.DecodeWordAddress());
        }
示例#13
0
        public static void PassDirection(Pass pass)
        {
            if (!Options.DisplayPass)
            {
                return;
            }

            ToGrey();
            Console.WriteLine("Pass direction: " + Abbreviation.Get(pass));
        }
示例#14
0
 /// <summary>
 /// Returns hash code
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + Abbreviation.GetHashCode();
         hash = hash * 23 + Name.GetHashCode();
         return(hash);
     }
 }
示例#15
0
        /// <summary>
        /// Intitializes the class
        /// </summary>
        /// <param name="startupArg">startup param</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _dialogCommon = new DialogCommon(this);

            Add                = false;
            Delete             = false;
            OutputAbbreviation = new Abbreviation(String.Empty, String.Empty, Abbreviation.AbbreviationMode.Speak);
            Cancel             = false;

            return(_dialogCommon.Initialize(startupArg));
        }
示例#16
0
        /// <summary>
        /// Matchs the abbr expansion with the filter and tells
        /// whether there is a match or not.
        /// </summary>
        /// <param name="abbr">abbr</param>
        /// <param name="filter">search filter</param>
        /// <returns>true on match</returns>
        private bool includeAbbr(Abbreviation abbr, String filter)
        {
            bool add = true;

            if (!String.IsNullOrEmpty(filter) && !abbr.Expansion.StartsWith(filter, StringComparison.InvariantCultureIgnoreCase))
            {
                add = false;
            }

            return(add);
        }
示例#17
0
 /// <summary>
 ///     Hash code.
 /// </summary>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Name?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Abbreviation?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Ascent?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (LetterOffsets?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
示例#18
0
 public ActionResult Edit([Bind(Include = "AbbreviationID,AbbrevName,StudyAreaID")] Abbreviation abbreviation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(abbreviation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StudyAreaID = new SelectList(db.StudyAreas, "StudyAreaID", "StudyAreaName", abbreviation.StudyAreaID);
     return(View(abbreviation));
 }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            CompassDirection other = obj as CompassDirection;

            return(Abbreviation.Equals(other.Abbreviation));
        }
示例#20
0
        public ActionResult Create([Bind(Include = "AbbreviationID,AbbrevName,StudyAreaID")] Abbreviation abbreviation)
        {
            if (ModelState.IsValid)
            {
                db.Abbreviations.Add(abbreviation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.StudyAreaID = new SelectList(db.StudyAreas, "StudyAreaID", "StudyAreaName", abbreviation.StudyAreaID);
            return(View(abbreviation));
        }
示例#21
0
        public bool Equals(Enumeration other)
        {
            if (other == null)
            {
                return(false);
            }

            var typeMatches  = GetType().Equals(other.GetType());
            var valueMatches = Abbreviation.Equals(other.Abbreviation);

            return(typeMatches && valueMatches);
        }
示例#22
0
 public override bool Equals(object other)
 {
     if (other is string unit)
     {
         return(Name.Equals(unit, StringComparison.OrdinalIgnoreCase) ||
                ToPlural(Name).Equals(unit, StringComparison.OrdinalIgnoreCase) ||
                Abbreviation.Equals(unit, StringComparison.OrdinalIgnoreCase));
     }
     else
     {
         return(this == other);
     }
 }
示例#23
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            if (!string.IsNullOrWhiteSpace(Abbreviation))
            {
                code.AppendLine($@"['Abbreviation'] = '{Abbreviation.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Abbreviation'] = nil,");
            }
        }
示例#24
0
        // GET: Abbreviations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Abbreviation abbreviation = db.Abbreviations.Find(id);

            if (abbreviation == null)
            {
                return(HttpNotFound());
            }
            return(View(abbreviation));
        }
示例#25
0
        /// <summary>
        /// Handles actuation of a widget
        /// </summary>
        /// <param name="widget">widget actuated</param>
        /// <param name="handled">true if handled</param>
        private void handleWidgetSelection(Widget widget, ref bool handled)
        {
            // the user actuated an abbreviation in the list
            if (widget.UserData is Abbreviation)
            {
                Abbreviation a = (Abbreviation)widget.UserData;
                TTSManager.Instance.ActiveEngine.Speak(a.Expansion);
                handled = true;
            }
            else
            {
                handled = true;
                switch (widget.Value)
                {
                case "@Quit":
                    if (EvtDone != null)
                    {
                        EvtDone.BeginInvoke(false, null, null);
                    }
                    break;

                case "@AbbrListSort":
                    switchSortOrder();
                    break;

                case "@AbbrListNextPage":
                    gotoNextPage();
                    break;

                case "@AbbrListPrevPage":
                    gotoPreviousPage();
                    break;

                case "@AbbrListClearFilter":
                    ClearFilter();
                    break;

                case "@AbbrListSearch":
                    if (EvtShowScanner != null)
                    {
                        EvtShowScanner.BeginInvoke(null, null, null, null);
                    }
                    break;

                default:
                    handled = false;
                    break;
                }
            }
        }
示例#26
0
        /// <summary>
        /// Checks if the word at the caret represents an abbreviation
        /// and if it requires expansion, does so
        /// </summary>
        /// <returns>true if abbr was expanded successfully</returns>
        private bool checkAndExpandAbbreviation()
        {
            bool retVal = false;

            Abbreviation abbr = TextController.CheckAndReplaceAbbreviation(ref retVal);

            if (!retVal && abbr != null && abbr.Mode == Abbreviation.AbbreviationMode.Speak)
            {
                retVal = true;
                textToSpeech(abbr.Expansion);
            }

            return(retVal);
        }
示例#27
0
 /// <summary>
 /// User wants to edit an abbreviation. Get confirmation to see
 /// if the user want to edit or delete
 /// </summary>
 /// <param name="abbr">Abbreviation to be edited</param>
 private void _form_EvtEditAbbreviation(Abbreviation abbr)
 {
     if (!_editDeleteMenuShown)
     {
         _abbreviationSelected     = abbr;
         _editDeleteConfirmScanner = Context.AppPanelManager.CreatePanel("AbbreviationEditDeleteConfirm", "Abbreviation");
         if (_editDeleteConfirmScanner != null)
         {
             _editDeleteMenuShown = true;
             IPanel panel = _editDeleteConfirmScanner as IPanel;
             Context.AppPanelManager.Show(Context.AppPanelManager.GetCurrentPanel(), panel);
         }
     }
 }
示例#28
0
        private void lbCurrency_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Abbreviation abb = e.RemovedItems.Count == 0 ? (Abbreviation)(int)e.AddedItems[0] : (Abbreviation)(int)e.RemovedItems[0];

            if (e.RemovedItems.Count != 0)
            {
                rates.Remove(abb);
            }

            if (e.AddedItems.Count != 0 && !rates.Any(item => item.Key == abb))
            {
                rates.Add(abb, RatesHelper.GetRatesForPeriod(abb, DateTime.Now.AddYears(-1), DateTime.Now));
            }
            RefreshChart();
        }
示例#29
0
        // GET: Abbreviations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Abbreviation abbreviation = db.Abbreviations.Find(id);

            if (abbreviation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StudyAreaID = new SelectList(db.StudyAreas, "StudyAreaID", "StudyAreaName", abbreviation.StudyAreaID);
            return(View(abbreviation));
        }
示例#30
0
 public DevAbbrevationWrapper(Abbreviation abbr)
 {
     SetAbbreviation = new Abbreviation
     {
         Description        = abbr.Description,
         Name               = abbr.Name,
         ParentLanguageCode = null,
         Parent             = null,
         ParentIdentifier   = null,
         ParentName         = null,
         ParentType         = abbr.ParentType,
         Position           = 0
     };
     IsChecked = false;
     Position  = 0;
 }
示例#31
0
        public static List<Rate> GetRatesForPeriod(Abbreviation abb, DateTime from, DateTime to)
        {
            List<Rate> result = new List<Rate>();

            Client.Execute(client =>
                {
                    var t = GetCurrenciesData().First(item => item.Abbreviation == abb.ToString()).ID;

                    var dt = client.ExRatesDyn(t, from, to).Tables[0];
                    foreach (DataRow row in dt.Rows)
                    {
                        result.Add(new Rate()
                        {
                            OfficialRate = double.Parse(row["Cur_OfficialRate"].ToString()),
                            Date = DateTime.Parse(row["Date"].ToString()),
                            Abbreviation = abb
                        });
                    }
                });

            return result;
        }
示例#32
0
 public LineOfBusiness(Abbreviation abbreviation)
 {
     _abbreviation = abbreviation.ToString();
     _name = EvaluateAbbreviation(abbreviation.ToString());
 }
 public void EnableCreateParameters(Abbreviation.Abbreviations abr)
 {
     if (autoClose == null) return;
     if (settings.CreateParameters)
     {
         autoClose.abbreviations = abr;
     }
 }
        private void _Write(Stream stream, Abbreviation abbrev)
        {
            using (var m = new MemoryStream())
            {
                Field.Create(FieldHeaders.Key, abbrev.Key).WriteToStream(m);
                Field.Create(FieldHeaders.Group, abbrev.Group).WriteToStream(m);
                Field.Create(FieldHeaders.Value, abbrev.Value).WriteToStream(m);

                Field.Create(FieldHeaders.Abbreviation, m).WriteToStream(stream);
            }
        }