Example #1
0
        /// <summary>
        /// 构建Document树
        /// </summary>
        /// <param name="reload">是否重新从数据库中读取Document树</param>
        private void BuildDocumentTree(bool reload)
        {
            this.treeDocument.Nodes.Clear();

            if (reload)
            {
                this.LoadDocumentTreeToApplication();
            }

            ITreeObjectNode node = LoadDocumentTreeToApplication();

            this.treeDocument.Nodes.Add(BuildTreeNode(node));

            LanguageWord lword = this.languageComponent1.GetLanguage("documentRoot");

            if (lword != null)
            {
                this.treeDocument.Nodes[0].Text = lword.ControlText;
            }

            //this.treeModule.ExpandAll();
            this.treeDocument.CollapseAll();
            if (this.treeDocument.SelectedNode != null)
            {
                Infragistics.WebUI.UltraWebNavigator.Node nodeParent = this.treeDocument.SelectedNode.Parent;
                while (nodeParent != null)
                {
                    nodeParent.Expand(false);
                    nodeParent = nodeParent.Parent;
                }
            }

            this.BuildParentDocumentCodeList();
        }
Example #2
0
        /// <summary>
        /// 构建Menu树
        /// </summary>
        private void BuildMenuTree()
        {
            this.treeMenu.Nodes.Clear();

            ITreeObjectNode node = this.LoadMenuTree();

            this.treeMenu.Nodes.Add(BuildTreeNode(node));

            LanguageWord lword = this.languageComponent1.GetLanguage("menuRoot");

            if (lword != null)
            {
                this.treeMenu.Nodes[0].Text = lword.ControlText;
            }

            //this.treeMenu.ExpandAll();
            this.treeMenu.CollapseAll();
            if (this.treeMenu.SelectedNode != null)
            {
                Infragistics.WebUI.UltraWebNavigator.Node nodeParent = this.treeMenu.SelectedNode.Parent;
                while (nodeParent != null)
                {
                    nodeParent.Expand(false);
                    nodeParent = nodeParent.Parent;
                }
            }
            this.BuildParenMenuCodeList();
        }
Example #3
0
        public void Upload(IEnumerable <string> paths, string language, string method)
        {
            foreach (var path in paths)
            {
                var termsFromFile = DocumentService.FromPDF(path);
                IDictionary <string, double> termsProbability = null;

                if (method == FrequencyWordLanguageRecognizer.MethodName)
                {
                    termsProbability = FrequencyWordRecognizer.GetWords(termsFromFile);
                }
                else if (method == ShortWordLanguageRecognizer.MethodName)
                {
                    termsProbability = ShortWordRecognizer.GetWords(termsFromFile);
                }

                foreach (var(word, probability) in termsProbability)
                {
                    var newWord = new LanguageWord
                    {
                        Language    = language,
                        Method      = method,
                        Probability = probability,
                        Word        = word
                    };

                    if (!LanguageWord.Words.Contains(newWord, new LanguageWord.Comparer()))
                    {
                        LanguageWord.Words.Add(newWord);
                    }
                }
            }

            ButtonRecognize.IsEnabled = true;
        }
Example #4
0
 public void TestRandomInValidWords()
 {
     foreach (var word in random_invalid_words)
     {
         LanguageWord lWord = new LanguageWord(word);
         Assert.IsFalse(lWord.isValidWord());
     }
 }
Example #5
0
 public void TestInValids()
 {
     foreach (string word in invalid_words)
     {
         LanguageWord lWord = new LanguageWord(word);
         Assert.IsFalse(lWord.isValidWord());
     }
 }
Example #6
0
 public void TestValids()
 {
     foreach (string word in valid_words)
     {
         LanguageWord lWord = new LanguageWord(word);
         Console.WriteLine("Checking word:" + word);
         Assert.IsTrue(lWord.isValidWord());
     }
 }
Example #7
0
        public static string DisplayBoolean(bool value, ControlLibrary.Web.Language.LanguageComponent languageControl)
        {
            LanguageWord trueText  = languageControl.GetLanguage("trueText");
            LanguageWord falseText = languageControl.GetLanguage("falseText");

            if (trueText == null || falseText == null)
            {
                return(value ? "Y" : "N");
            }

            return(value ? trueText.ControlText : falseText.ControlText);
        }
Example #8
0
        public string GetString(string keyWord)
        {
            LanguageWord lw = GetLanguage(keyWord);

            if (lw == null)
            {
                return(string.Empty);
                //return keyWord;
            }

            return(lw.ControlText);
        }
        public void AddAllItem(ControlLibrary.Web.Language.LanguageComponent languageControl)
        {
            LanguageWord lword = languageControl.GetLanguage("listItemAll");

            if (lword != null)
            {
                this._drpList.Items.Insert(0, new ListItem(lword.ControlText, ""));
            }
            else
            {
                this._drpList.Items.Insert(0, new ListItem("", ""));
            }
        }
 public ActionResult Edit(LanguageWord languageWord)
 {
     try
     {
         _languageWordService.Update(new  LanguageWord
         {
             //TODO:Alanlar buraya yazılacak Id alanı en altta olacak unutmayın!!!
             //Örn:BrandName = brand.BrandName,
             //BrandId = brand.BrandId
             LanguageWordId = languageWord.LanguageWordId
         });
         SuccessNotification("Kayıt Güncellendi");
         return(RedirectToAction("LanguageWordIndex"));
     }
     catch
     {
         return(View());
     }
 }
Example #11
0
        private void Button1_Click(object sender, EventArgs e)
        {
            //Console.Write("Enter a word : ");
            //String iWord = Console.ReadLine();
            // can add input validations to remove special characters, etc etc
            string iWord;

            iWord = textBox1.Text;
            string       cword = iWord;
            LanguageWord lWord = new LanguageWord(iWord);

            if (lWord.isValidWord())
            {
                label1.Text = iWord + "  Is a valid Word";
            }
            else
            {
                label1.Text = iWord + "  Is a invalid Word";
            }
        }
Example #12
0
 public void Update(LanguageWord languageWord)
 {
     _languageWordDal.Update(languageWord);
 }
        public void AddNewTranslation(NeededWords word, string langID, string translationText)
        {
            LanguageWord lw = new LanguageWord(word, langID);

            _translations.Add(lw, translationText);
        }
        public string GetWordTranslation(NeededWords word, string langID)
        {
            LanguageWord lw = new LanguageWord(word, langID);

            return(_translations[lw]);
        }
        public ActionResult Delete(int id, LanguageWord languageWord)
        {
            var data = AutoMapperHelper.MapToSameViewModel <LanguageWord, LanguageWordViewModel>(_languageWordService.GetById(id));

            return(View(data.ToVM()));
        }
Example #16
0
 public LanguageWord Add(LanguageWord languageWord)
 {
     return(_languageWordDal.Add(languageWord));
 }
Example #17
0
        private void WriteControl(Control ctrl, bool isSubControl)
        {
            string       text1        = isSubControl ? "SubControl" : "Control";
            LanguageWord languageWord = new LanguageWord();

            if (ctrl is Label)
            {
                languageWord.ControlID      = ctrl.ID;
                languageWord.ControlType    = "Label";
                languageWord.ControlClass   = ((Label)ctrl).Site.Name;
                languageWord.ControlCHSText = ((Label)ctrl).Text;
                LanguagePack.Current(this.LanguageProfileName).Insert(languageWord, this.Language);
            }

            if (ctrl is Literal)
            {
                languageWord.ControlID      = ctrl.ID;
                languageWord.ControlType    = "Literal";
                languageWord.ControlClass   = ((Literal)ctrl).Site.Name;
                languageWord.ControlCHSText = ((Literal)ctrl).Text;
                LanguagePack.Current(this.LanguageProfileName).Insert(languageWord, this.Language);
            }
            else if (ctrl is Button)
            {
                languageWord.ControlID      = ctrl.ID;
                languageWord.ControlType    = "Button";
                languageWord.ControlClass   = ((Button)ctrl).Site.Name;
                languageWord.ControlCHSText = ((Button)ctrl).Text;
                LanguagePack.Current(this.LanguageProfileName).Insert(languageWord, this.Language);
            }
            else if (ctrl is LinkButton)
            {
                languageWord.ControlID      = ctrl.ID;
                languageWord.ControlType    = "LinkButton";
                languageWord.ControlClass   = ((LinkButton)ctrl).Site.Name;
                languageWord.ControlCHSText = ((LinkButton)ctrl).Text;
                LanguagePack.Current(this.LanguageProfileName).Insert(languageWord, this.Language);
            }

            else if (ctrl is HyperLink)
            {
                languageWord.ControlID      = ctrl.ID;
                languageWord.ControlType    = "HyperLink";
                languageWord.ControlClass   = ((HyperLink)ctrl).Site.Name;
                languageWord.ControlCHSText = ((HyperLink)ctrl).Text;
                LanguagePack.Current(this.LanguageProfileName).Insert(languageWord, this.Language);
            }

            else if (ctrl is RadioButton)
            {
                languageWord.ControlID      = ctrl.ID;
                languageWord.ControlType    = "RadioButton";
                languageWord.ControlClass   = ((RadioButton)ctrl).Site.Name;
                languageWord.ControlCHSText = ((RadioButton)ctrl).Text;
                LanguagePack.Current(this.LanguageProfileName).Insert(languageWord, this.Language);
            }
            else if (ctrl is CheckBox)
            {
                languageWord.ControlID      = ctrl.ID;
                languageWord.ControlType    = "CheckBox";
                languageWord.ControlClass   = ((CheckBox)ctrl).Site.Name;
                languageWord.ControlCHSText = ((CheckBox)ctrl).Text;
                LanguagePack.Current(this.LanguageProfileName).Insert(languageWord, this.Language);
            }
//			else if ((ctrl is CheckBoxList) || (ctrl is DropDownList)  || (ctrl is ListBox))
//			{
//				foreach (ListItem item1 in ((ListControl) ctrl).Items)
//				{
//					languageWord.ControlID		=  ((ListControl) ctrl).ID+ "_" + item1.Value;
//					languageWord.ControlType = "ListItem";
//					languageWord.ControlClass = ((ListControl) ctrl).Site.Name;
//					languageWord.ControlCHSText  = item1.Text;
//				}
//
//				try
//				{
//					ControlLibrary.Domian.LanguagePack.Current.Insert(languageWord);
//				}
//				catch(Exception ex)
//				{
//					System.Windows.Forms.MessageBox.Show(ex.Message);
//				}
//			}
            else
            {
                if (!(ctrl is Panel))
                {
                    return;
                }
                foreach (Control control2 in ((Panel)ctrl).Controls)
                {
                    this.WriteControl(control2, false);
                }
            }
        }
 public void AddNewTranslation(NeededWords word, string langID, string translationText)
 {
     LanguageWord lw = new LanguageWord(word,langID);
     _translations.Add(lw, translationText);
 }
Example #19
0
        private void ReadControl(Control ctrl)
        {
            LanguageWord languageWord = LanguagePack.Current(this.LanguageProfileName).GetLanguageWord(ctrl.ID, this.Language);

            if (ctrl is Label)
            {
                if (languageWord != null)
                {
                    ((Label)ctrl).Text = languageWord.ControlText;
                }
            }

            if (ctrl is Literal)
            {
                if (languageWord != null)
                {
                    ((Literal)ctrl).Text = languageWord.ControlText;
                }
            }
            else if (ctrl is Button)
            {
                if (languageWord != null)
                {
                    ((Button)ctrl).Text = languageWord.ControlText;
                }
            }
            else if (ctrl is LinkButton)
            {
                if (languageWord != null)
                {
                    ((LinkButton)ctrl).Text = languageWord.ControlText;
                }
            }

            else if (ctrl is HyperLink)
            {
                if (languageWord != null)
                {
                    ((HyperLink)ctrl).Text = languageWord.ControlText;
                }
            }

            else if (ctrl is RadioButton)
            {
                if (languageWord != null)
                {
                    ((RadioButton)ctrl).Text = languageWord.ControlText;
                }
            }
            else if (ctrl is CheckBox)
            {
                if (languageWord != null)
                {
                    ((CheckBox)ctrl).Text = languageWord.ControlText;
                }
            }
//			else if ((ctrl is CheckBoxList) || (ctrl is DropDownList)  || (ctrl is ListBox))
//			{
//				foreach (ListItem item1 in ((ListControl) ctrl).Items)
//				{
//					ControlLibrary.Domian.LanguageWord languageWord2 = ControlLibrary.Domian.LanguagePack.Current.GetLanguageWord(((ListControl) ctrl).ID+ "_" + item1.Value, this.Language);
//					item1.Text =    languageWord2.ControlText;
//				}
//			}
            else
            {
                foreach (Control control2 in ctrl.Controls)
                {
                    this.ReadControl(control2);
                }
            }
        }
 public string GetWordTranslation(NeededWords word, string langID)
 {
     LanguageWord lw = new LanguageWord(word, langID);
     return _translations[lw];
 }
Example #21
0
 public void Delete(LanguageWord languageWord)
 {
     _languageWordDal.Delete(languageWord);
 }