Пример #1
0
    // Use this for initialization
    void Start()
    {
        Character = Listicle[Random.Range(0, 25)].ToUpper();

        TextObject      = GetComponent <TextMesh>();
        TextObject.text = Character;

        TheWord = GameObject.Find("TheWord").GetComponent <TheWord>();
    }
Пример #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Count;
         hashCode = (hashCode * 397) ^ Id;
         hashCode = (hashCode * 397) ^ (File != null ? File.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TheWord != null ? TheWord.GetHashCode() : 0);
         return(hashCode);
     }
 }
Пример #3
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.text.ToLower() == "join")
			{
				this.link = this.mainClass.from_join;
			}
			else
				throw new NoOneClass("Состояние: From_1, слово = " + word.text);
			return true;

		}
Пример #4
0
        public ActionResult FuPage()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }

            TheWord word = new TheWord();

            word = word.Generate();
            return(View(word));
        }
Пример #5
0
        public WordCount(String theWord)
        {
            TheWord     = theWord.ToLower();
            Length      = TheWord.Length;
            LetterCount = new Dictionary <char, int>();
            var charList = TheWord.GroupBy(x => x).OrderByDescending(x => x.Count());

            foreach (var letter in charList)
            {
                LetterCount.Add(letter.Key, letter.Count());
            }
        }
Пример #6
0
 private void GetWord_Click(object sender, EventArgs e)
 {
     CurrentWord = EnglishCouch.GetAWordForTraining(user);
     if (CurrentWord != null)
     {
         EnglishWord.Text = CurrentWord.English;
         RussianWord.Text = CurrentWord.Russian;
     }
     else
     {
         MessageBox.Show("Все слова выучены");
         Application.Exit();
     }
 }
Пример #7
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.text.ToLower() == "select" && word.type == TypeWord.TERM)
			{				
				this.link = this.mainClass.select_stmt;
				this.mainClass.data = new SQLStruct();
				//;
				//this.mainClass.idata++;
			}
			else
				throw new NoOneClass("Select, слово: " + word.text);
			return true;
		}
Пример #8
0
        public void WordCanNotBeGivenMoreThenThreeTimes()
        {
            User user = EnglishCouch.AddNewUser("Mark", FilePath);
            var  word = new TheWord("мама", "mom");

            var valueT1 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT2 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT3 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT4 = EnglishCouch.CheckTrueTheAnswer(word, user);

            Assert.IsFalse(valueT4);
        }
Пример #9
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			mainClass.data.group.once.isAll = true;
			if (word.text.ToLower() == "contain" && word.type == TypeWord.TERM)
			{				
				this.link = this.mainClass.group_contain;
			}
			else if (word.text.ToLower() == "flat" && word.type == TypeWord.TERM)
			{
				this.link = this.mainClass.group_flat;
			}
			else
				throw new NoOneClass("Состояние: Group, слово = " + word.text);
			return true;
		}
Пример #10
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.text.ToLower() == "use" && word.type == TypeWord.TERM)
			{				
				this.link = this.mainClass.select_all_use;
				mainClass.data.select.selectType = SELECTTYPE.ALL;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "from")
			{
				this.link = this.mainClass.fromClass;
			}
			else
				throw new NoOneClass("Select, слово: " + word.text);
			return true;
		}
Пример #11
0
		public override bool NextState(TheWord word)
		{
			//////Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM)
			{
				this.link = null;
				this.mainClass.data.As.Add(word.text);
			}				
			else if (this.mainClass.AsReturn !=null)
			{
				this.mainClass.AddWordBegin(word.text, word.type);
				this.link = this.mainClass.AsReturn;
				this.mainClass.AsReturn = null;
			}else
				throw new NoOneClass("Состояние: As, слово = " + word.text);
			return false;
		}
Пример #12
0
        public void Mathod_GetAWordForTraining_ShouldNotGivLearnedWord()
        {
            User user = EnglishCouch.AddNewUser("Stefun", FilePath);

            var word   = new TheWord("мама", "mom");
            var valueT = EnglishCouch.CheckTrueTheAnswer(word, user);

            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);

            word   = new TheWord("папа", "dad");
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);
            valueT = EnglishCouch.CheckTrueTheAnswer(word, user);

            word = EnglishCouch.GetAWordForTraining(user);
            Assert.IsNull(word);
        }
Пример #13
0
		public override bool NextState(TheWord word)
		{
			//int u=0;
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (mainClass.data.from.Count > 1)
				mainClass.data.select.SetTable(null);
			else
                mainClass.data.select.SetTable(word.text);

			if (word.type == TypeWord.TERM)
			{
				this.link = this.mainClass.from_1;
				this.mainClass.data.from.Add(word.text);
			}
			else
				throw new NoOneClass("Состояние: From, слово = " + word.text);
			return true;
		}
Пример #14
0
		public override bool NextState(TheWord word)
		{
			//int y;
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM && word.text.IndexOf("'") != -1)
			{
				//Значит это значение, а не имя колонки
				this.mainClass.CurentExpr.Type1 = ColumnType.VALUE;
				this.mainClass.CurentExpr.ColName1 = word.text.Trim('\'','\"');
			}
			else if (word.type == TypeWord.TERM)
			{
				this.link = this.mainClass.where_table1;
				this.mainClass.CurentExpr.ColName1 = word.text;
			}
			else
				throw new NoOneClass("Состояние: Where, слово = " + word.text);
			return true;
		}
Пример #15
0
        public void ShowAllLearnedWords()
        {
            User user = EnglishCouch.AddNewUser("Stefun", FilePath);
            var  word = new TheWord("мама", "mom");

            var valueT1 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT2 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var valueT3 = EnglishCouch.CheckTrueTheAnswer(word, user);

            var     List = new List <TheWord>(EnglishCouch.ShowShowLearnedWords(user));
            TheWord Word = new TheWord("мама", "mom");

            word.NumberOfCorrectAnswers = 3;
            Assert.AreEqual(List[0].English, word.English);
            Assert.AreEqual(List[0].Russian, word.Russian);
            Assert.AreEqual(List[0].NumberOfCorrectAnswers, word.NumberOfCorrectAnswers);
        }
Пример #16
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.text.ToLower() == "by" && word.type == TypeWord.TERM)
			{				
				this.link = this.mainClass.group_by;
				mainClass.data.group.AddGroup();
				this.mainClass.isGroup = true;
			}else if(word.text.ToLower() == "all" && word.type == TypeWord.TERM)
			{
                this.link = this.mainClass.group_by_all;
				mainClass.data.group.AddGroup();
				this.mainClass.isGroup = true;
				mainClass.data.group.once.isAll = true;
			}
			else
				throw new NoOneClass("Состояние: Group, слово = " + word.text);
			return true;
		}
Пример #17
0
		public override bool NextState(TheWord word)
		{
			if (word.text.ToLower() == "select")
			{
				//Тогда вложенный запрос.
				Link l = new Link(this.mainClass.Tr, this.mainClass.ArrayWords);
				l.AddWordBegin("select", TypeWord.TERM);
				l.Run();

				SQLStruct st = (SQLStruct) this.mainClass.data;
				if (l.data != null)
					st.select.Add(l.data);
				else
					throw new NoOneClass("Ошибка во вложенном запросе.");
				this.link = this.mainClass.select_stmt_1;
			}/*else if (word.text.ToLower() == "once")
			{
				mainClass.data.select.selectType = SELECTTYPE.ONCE;
                this.link = this.mainClass.select_stmt_0;
			}else if (word.text.ToLower() == "all")
			{
				mainClass.data.select.selectType = SELECTTYPE.ALL;
                this.link = this.mainClass.select_all;
			}*/else if (word.text.ToLower() == "use")
			{
                this.link = this.mainClass.select_all_use;                
			}
			/*else if (word.type == TypeWord.TERM && word.text.ToLower() == "*")
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}*/
			else if (word.type == TypeWord.TERM)
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}
			else
				throw new NoOneClass("Состояние: Select_stmt, слово = " + word.text);
			return true;
		}
Пример #18
0
  }//public string FilenameStylesheet

  /// <summary>ButtonSubmit_Click().</summary>
  public void ButtonSubmit_Click
  (
   Object sender, 
   EventArgs e
  )
  {

   int                            theWordId                     =  -1;

   String                         exceptionMessage              =  null;

   DataSet                        dataSetTheWord                =  null;

   TheWordSerializationArgument   theWordSerializationArgument  =  null;

   if ( TheWordId != null && TheWordId != String.Empty )
   {
    theWordId = System.Convert.ToInt32( TheWordId );
   }

   theWordSerializationArgument  =  new TheWordSerializationArgument
   (
    theWordId,
    TheWordDated,
    FilenameXmlDocument,
    FilenameXmlDocumentGenerate,
    FilenameStylesheet
   );

   TheWord.UtilitySerialization
   (
    ref FilenameConfigurationXml,
    ref DatabaseConnectionString,
    ref theWordSerializationArgument,
    ref dataSetTheWord,
    ref exceptionMessage
   );

   Feedback = exceptionMessage;

  }//public void ButtonSubmit_Click()
Пример #19
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (mainClass.data.from.Count > 1)
                mainClass.data.select.SetTable(null);

			if (word.text.ToLower() == "as")
			{
				this.link = this.mainClass.asClass;
			}
			else if (word.text.ToLower() == "group")
				this.link = this.mainClass.group;
			else if (word.text.ToLower() == "where")
				this.link = this.mainClass.whereClass;
			else if (word.type == TypeWord.NonTERM && word.text.ToLower() == ",")
				this.link = this.mainClass.fromClass;
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "join")
			{
				this.link = this.mainClass.from_join;
			}
			else if (this.mainClass.FromReturn != null)
			{
				this.mainClass.AddWordBegin(word.text, word.type);
				this.link = this.mainClass.FromReturn;
				this.mainClass.FromReturn = null;
			}
			else //Если задан Алиас:
				if (mainClass.data.from.Count > 0)
				{
					string TName = mainClass.data.from[mainClass.data.from.Count-1];
					this.mainClass.data.alias.AddTable(TName, word.text);
					this.mainClass.data.from.ReNameTable(word.text);
					this.link = this.mainClass.from_1;
				}
			else
				throw new Exception("Ошибка!" + this.ToString() + " " + word.text);
			return true;
		}
Пример #20
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.NonTERM && (word.text.ToLower()== "=" || word.text.ToLower()== "<" || word.text.ToLower()== ">" || word.text.ToLower()== "!=" || word.text.ToLower()== "<=" || word.text.ToLower()== ">" ))
			{
				this.link = this.mainClass.where_comp;
				switch (word.text)
				{
					case "=":
						this.mainClass.CurentExpr.oper = TypeOper.RAVNO;
						break;
					case "!=":
						this.mainClass.CurentExpr.oper = TypeOper.NERAVNO;
						break;
					case ">":
						this.mainClass.CurentExpr.oper = TypeOper.BOLSHE;
						break;
					case "<":
						this.mainClass.CurentExpr.oper = TypeOper.MENSHE;
						break;
					case "<=":
						this.mainClass.CurentExpr.oper = TypeOper.BOLSHERAVNO;
						break;
					case ">=":
						this.mainClass.CurentExpr.oper = TypeOper.MENSHERAVNO;
						break;
					default:
						break;
				}
			}
			else if (word.type == TypeWord.NonTERM && word.text.ToLower()== ".")
				this.link = this.mainClass.where_point1;
			else
				throw new NoOneClass("Состояние: Where_Table1, слово = " + word.text);
			return true;
		}
Пример #21
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.text.ToLower() == "use" && word.type == TypeWord.TERM)
			{				
				this.link = this.mainClass.select_all_use;
				//this.mainClass.data = new SQLStruct();
				//;
				//this.mainClass.idata++;
			}else if (word.type == TypeWord.TERM)
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}
			else
				throw new NoOneClass(this.ToString() + ", слово: " + word.text);
			return true;
		}
Пример #22
0
		public override bool NextState(TheWord word)
		{
			mainClass.data.from.AddWhere(mainClass.data.where);
			mainClass.CurentExpr = new Expr();
			mainClass.CurentOper = new Oper();
			mainClass.data.where = new WhereClass(mainClass.data);

			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM && word.text.ToLower() == "on")
			{
				//this.link = this.mainClass.from_where;
				this.link = this.mainClass.whereClass;
				this.mainClass.WhereReturn = mainClass.from_where;
				mainClass.iCountJoin--;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "join")
			{
				this.link = this.mainClass.from_join;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "as")
			{
				this.link = this.mainClass.asClass;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "where")
			{
				this.link = this.mainClass.whereClass;
			}
			else if (word.text.ToLower() == "group")
				this.link = this.mainClass.group;
			else
				throw new NoOneClass("Состояние: From-Table_2, слово = " + word.text);
			
			return true;
		}
Пример #23
0
		public override bool NextState(TheWord word)
		{
			//int u=0;
			//Console.WriteLine(this.ToString() + ": " + word.text);

			if (word.text.ToLower()== "," && word.type == TypeWord.NonTERM)
			{
				this.link = this.mainClass.select_stmt_0;
			}			
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "as")
			{
				this.link = this.mainClass.select_stmt_as;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "keyed")
			{
				this.link = this.mainClass.select_key_1;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "paint")
			{
				this.link = this.mainClass.select_paint_1;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "from")
			{
				this.link = this.mainClass.fromClass;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "once")
			{
				this.link = this.mainClass.select_once;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "all")
			{
				this.link = this.mainClass.select_all_1;
			}
			else if (this.mainClass.SelectReturn != null)
			{
				//Добавляем обратно слово(вначало)
				this.mainClass.AddWordBegin(word.text, word.type);
				this.link = this.mainClass.SelectReturn;
				this.mainClass.SelectReturn = null;
			}
			else
				throw new NoOneClass("Ошибка перед словом : " + word.text);
			return true;
		}
Пример #24
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.text.ToLower() == "use" && word.type == TypeWord.TERM)
			{				
				this.link = this.mainClass.select_paint_use;
			}
			else
				throw new NoOneClass("Состояние: Select, слово = " + word.text);
			return true;
		}
Пример #25
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM)
			{
				mainClass.data.select.paint.Other = word.text;
				this.link = this.mainClass.select_paint_other_tag;
			}
			else
				throw new NoOneClass("Состояние: Select, слово = " + word.text);
			return true;
		}
Пример #26
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.NonTERM && word.text.ToLower()== ",")
			{				
				this.link = this.mainClass.select_key_2;
			}
			else if (word.type == TypeWord.NonTERM && word.text.ToLower()== ".")
			{
                this.link = this.mainClass.select_key_point;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "from")
			{				
				this.link = this.mainClass.fromClass;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower()== "once")
			{
				this.link = this.mainClass.select_once;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "all")
			{
				this.link = this.mainClass.select_all_1;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "paint")
			{
				this.link = this.mainClass.select_paint_1;                
			}
			else
				throw new NoOneClass(this.ToString() + ", слово: " + word.text);
			return true;
		}
Пример #27
0
  }//public static void PageBuild()

  /// <summary>PageBuildTextBox().</summary>
  public void PageBuildTextBox()
  {

   int          dataTableCount                = -1;
   int          dataTableTotal                = -1;
   int          theWordIdColumnIndex          = 0;

   DateTime     dated                         = DateTime.Now;

   System.Web.UI.WebControls.Label            label  =  null;
   
   String       columnNameForeignKey          = null;
   String       exceptionMessage              = null;
   String[]     sourceName                    = null;
   String[]     sourceSQL                     = null;
   String       tableName                     = null;

   System.Web.UI.WebControls.TextBox          textBox  =  null;
   
   XmlNodeList  sourceXML                     = null;

   TheWord.SourceSQLQuery
   (
        filenameConfigurationXml,
    ref exceptionMessage,
    ref sourceXML,
    ref sourceSQL,
    ref sourceName
   );

   if ( exceptionMessage != null )
   {
    Feedback = exceptionMessage;
    return;
   }//if ( exceptionMessage != null ) 
   
   if ( !Page.IsPostBack )
   {

    theWord.DataSetInitialize
    (
         databaseConnectionString,
     ref exceptionMessage,
         nodeRoot,
         sourceSQL,
         sourceName
    );

    if ( exceptionMessage != null )
    {
     Feedback = exceptionMessage;
     return;
    }//if ( exceptionMessage != null ) 
          	
   }//if ( Page.IsPostBack )

    UtilityXml.XmlDocumentNodeInnerText
    (
         filenameConfigurationXml,
     ref exceptionMessage,         
         TheWord.XPathColumnForeign,
     ref columnNameForeignKey
    );

   dataTableTotal           = theWord.DataSetTheWord.Tables.Count;

   linkButtonAdd            = new System.Web.UI.WebControls.LinkButton[ dataTableTotal ];

   for( dataTableCount = 0; dataTableCount < theWord.DataSetTheWord.Tables.Count; ++dataTableCount )
   {
   	theWord.DataSetTheWord.Tables[dataTableCount].TableName = sourceName[dataTableCount];
   }

   dataTableCount = -1;

   foreach( DataTable dataTable in theWord.DataSetTheWord.Tables )
   {
    ++dataTableCount;
    tableName                                                 = dataTable.TableName;

    PlaceHolderGridView.Controls.Add
    ( 
     new LiteralControl
     (
      "<b>" + tableName + "</b>"
     ) 
    );

    foreach(DataRow dataRow in dataTable.Rows)
    {
     foreach(DataColumn dataColumn in dataTable.Columns)
     {
      label         =  new System.Web.UI.WebControls.Label(); 
      label.Id      =  "Label" + dataColumn.ColumnName;
      label.Text    =  dataColumn.ColumnName + ": ";
      PlaceHolderGridView.Controls.Add( label );
                     
      textBox       =  new System.Web.UI.WebControls.TextBox();
      textBox.ID    =  "TextBox" + dataColumn.ColumnName;
      textBox.Text  =  dataRow[dataColumn].ToString();
      PlaceHolderGridView.Controls.Add( textBox );
       
      label         =  new System.Web.UI.WebControls.Label(); 
      label.Text    =  "<br />";
      PlaceHolderGridView.Controls.Add( label );
     }//foreach(DataColumn dataColumn in dataTable.Columns)
    }//foreach(DataRow dataRow in dataTable.Rows)
    
    if ( dataTableCount == 0 )
    {
     PlaceHolderGridView.Controls.Add
     ( 
      new LiteralControl( "<br />" )
     );
    }
    else
    {
     linkButtonAdd[dataTableCount]                              = new System.Web.UI.WebControls.LinkButton();
     linkButtonAdd[dataTableCount].ID                           = dataTableCount + "|" + tableName + "|" + "Add";
     linkButtonAdd[dataTableCount].Text                         = "  Add <br />";

     // Register the event-handling method for the Click event. 
     linkButtonAdd[dataTableCount].Click                       += new EventHandler(this.LinkButtonAdd_Click);

     PlaceHolderGridView.Controls.Add( linkButtonAdd[dataTableCount]  );
    } 

   }//foreach( DataTable dataTable in theWord.DataSetTheWord.Tables )

  }//public static void PageBuildTextBox()
Пример #28
0
		public override bool NextState(TheWord word)
		{
			if (word.type == TypeWord.TERM)
			{
				mainClass.data.select.UseTag = word.text;
				this.link = this.mainClass.select_all_word;
			}
			else
				throw new NoOneClass(this.ToString() + ", слово: " + word.text);
			return true;
		}
Пример #29
0
		public override bool NextState(TheWord word)
		{
			mainClass.data.select.selectType = SELECTTYPE.ONCE;
			if (word.type == TypeWord.TERM && word.text.ToLower() == "from")
			{
				this.link = this.mainClass.fromClass;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "once")
			{
				this.link = this.mainClass.select_once;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "all")
			{
				this.link = this.mainClass.select_all_1;
			}
			else
				throw new NoOneClass(this.ToString() + ", слово: " + word.text);
			return true;
		}
Пример #30
0
 public override bool Equals(object obj)
 {
     return(TheWord.Equals(((Word)obj).TheWord));
 }
Пример #31
0
  }//Page_Load
  
  /// <summary>PageBuild().</summary>
  public void PageBuild()
  {

   int          dataTableCount                = -1;
   int          dataTableTotal                = -1;
   int          theWordIdColumnIndex          = 0;

   DateTime     dated                         = DateTime.Now;

   System.Web.UI.WebControls.Label            label  =  null;
   
   String       columnNameForeignKey          = null;
   String       exceptionMessage              = null;
   String[]     sourceName                    = null;
   String[]     sourceSQL                     = null;
   String       tableName                     = null;

   System.Web.UI.WebControls.TextBox          textBox  =  null;
   
   XmlNodeList  sourceXML                     = null;

   TheWord.SourceSQLQuery
   (
        filenameConfigurationXml,
    ref exceptionMessage,
    ref sourceXML,
    ref sourceSQL,
    ref sourceName
   );

   if ( exceptionMessage != null )
   {
    Feedback = exceptionMessage;
    return;
   }//if ( exceptionMessage != null ) 
   
   if ( !Page.IsPostBack )
   {

    theWord.DataSetInitialize
    (
         databaseConnectionString,
     ref exceptionMessage,
         nodeRoot,
         sourceSQL,
         sourceName
    );

    if ( exceptionMessage != null )
    {
     Feedback = exceptionMessage;
     return;
    }//if ( exceptionMessage != null ) 
          	
   }//if ( Page.IsPostBack )

    UtilityXml.XmlDocumentNodeInnerText
    (
         filenameConfigurationXml,
     ref exceptionMessage,         
         TheWord.XPathColumnForeign,
     ref columnNameForeignKey
    );

   dataTableTotal           = theWord.DataSetTheWord.Tables.Count;

   GridViewTheWord          = new System.Web.UI.WebControls.GridView[ dataTableTotal ];
   linkButtonAdd            = new System.Web.UI.WebControls.LinkButton[ dataTableTotal ];

   for( dataTableCount = 0; dataTableCount < theWord.DataSetTheWord.Tables.Count; ++dataTableCount )
   {
   	theWord.DataSetTheWord.Tables[dataTableCount].TableName = sourceName[dataTableCount];
   }

   dataTableCount = -1;

   foreach( DataTable dataTable in theWord.DataSetTheWord.Tables )
   {
    ++dataTableCount;
    
    GridViewTheWord[dataTableCount]                           = new System.Web.UI.WebControls.GridView();
    
    tableName                                                 = dataTable.TableName;

    GridViewTheWord[dataTableCount].BorderWidth               = 1;
    GridViewTheWord[dataTableCount].CellPadding               = 1;
    GridViewTheWord[dataTableCount].DataSource                = dataTable;

    GridViewTheWord[dataTableCount].AllowPaging               = true;
    GridViewTheWord[dataTableCount].AllowSorting              = true;    

    GridViewTheWord[dataTableCount].AutoGenerateColumns       = false;
      
    GridViewTheWord[dataTableCount].AutoGenerateDeleteButton  = true;    
    GridViewTheWord[dataTableCount].AutoGenerateEditButton    = true;
    GridViewTheWord[dataTableCount].AutoGenerateSelectButton  = true;

    switch ( DataColumnFieldGridView )
    {
     case DataColumnField.Bound:

      foreach( DataColumn dataColumn in dataTable.Columns )
      {
       BoundField boundField      = null;
       boundField                 = new BoundField();
       boundField.DataField       = dataColumn.ColumnName;
       boundField.HeaderText      = dataColumn.ColumnName;
       boundField.SortExpression  = dataColumn.ColumnName;
       GridViewTheWord[dataTableCount].Columns.Add( boundField );
      }
      break;

     case DataColumnField.Template:
      foreach( DataColumn dataColumn in dataTable.Columns )
      {
       TemplateField                    templateField    = null;
       //System.Web.UI.WebControls.Label  label            = null;
       
       templateField                     = new TemplateField();
      
       templateField.HeaderText          = dataColumn.ColumnName;
       templateField.SortExpression      = dataColumn.ColumnName;
       
       //templateField.EditItemTemplate    = new DataGridTemplate(ListItemType.EditItem,  dataColumn.ColumnName);       
       //templateField.FooterTemplate    = new DataGridTemplate(ListItemType.Footer,    dataColumn.ColumnName);
       //templateField.HeaderTemplate    = new DataGridTemplate(ListItemType.Header,    dataColumn.ColumnName);
       templateField.ItemTemplate      = new DataGridTemplate(ListItemType.Item,      dataColumn.ColumnName);

       GridViewTheWord[dataTableCount].Columns.Add( templateField );
      }
      break;

     case DataColumnField.TextBox:
      PlaceHolderGridView.Controls.Add
      ( 
       new LiteralControl
       (
        "<b>" + tableName + "</b><br />"
       ) 
      );

      foreach( DataColumn dataColumn in dataTable.Columns )
      {
       label         =  new System.Web.UI.WebControls.Label(); 
       //label.Id      =  dataColumn.ColumnName;
       label.Text    =  dataColumn.ColumnName + ": ";
       PlaceHolderGridView.Controls.Add( label );
                     
       textBox       =  new System.Web.UI.WebControls.TextBox();
       //textBox.Name  =  dataColumn.ColumnName;
       textBox.Text  =  dataColumn.ColumnName;
       PlaceHolderGridView.Controls.Add( textBox );
       
       label         =  new System.Web.UI.WebControls.Label(); 
       label.Text    =  "<br />";
       PlaceHolderGridView.Controls.Add( label );

      }
      break;

    }  

    GridViewTheWord[dataTableCount].DataBind();
    GridViewTheWord[dataTableCount].ID                        = tableName;

    theWordIdColumnIndex = UtilityDatabase.DataTableColumnIndex
    (
     theWord.DataSetTheWord.Tables[tableName],
     columnNameForeignKey  
    );
    
    if ( DataColumnFieldGridView <= DataColumnField.Template )
    {
     if ( theWordIdColumnIndex >= 0 )
     {     
      //UtilityDatabase.DataSetTableColumnVisible( GridViewTheWord[dataTableCount], theWordIdColumnIndex, false );
      GridViewTheWord[dataTableCount].Columns[theWordIdColumnIndex].Visible = false;
     }//if ( theWordIdColumnIndex >= 0 ) 

     //GridViewTheWord[dataTableCount].UserDeletingRow += new GridViewRowCancelEventHandler( GridViewDeleteEventArgs );

     PlaceHolderGridView.Controls.Add
     ( 
      new LiteralControl
      (
       "<b>" + GridViewTheWord[dataTableCount].ID + "</b>"
      ) 
     );
    }
    
    if ( dataTableCount != 0 )
    {
     linkButtonAdd[dataTableCount]                              = new System.Web.UI.WebControls.LinkButton();
     linkButtonAdd[dataTableCount].ID                           = dataTableCount + "|" + tableName + "|" + "Add";
     linkButtonAdd[dataTableCount].Text                         = "Add <br />";

     // Register the event-handling method for the Click event. 
     linkButtonAdd[dataTableCount].Click                       += new EventHandler(this.LinkButtonAdd_Click);

     PlaceHolderGridView.Controls.Add( linkButtonAdd[dataTableCount]  );
    } 

    if ( DataColumnFieldGridView <= DataColumnField.Template )
    {
     PlaceHolderGridView.Controls.Add(GridViewTheWord[dataTableCount]);
     PlaceHolderGridView.Controls.Add(new LiteralControl("<br />"));
    }

   }//foreach( DataTable dataTable in theWord.DataSetTheWord.Tables )

  }//public static void PageBuild()
Пример #32
0
  }//static void Main( String[] argv ) 

  ///<summary>Stub.</summary>
  public static void Stub()
  {
   TheWord.UtilitySerialization();   
  }
Пример #33
0
  ///<summary>The entry point for the application.</summary>
  ///<param name="argv">A list of command line arguments</param>
  public static void Main
  (
   String[] argv
  )
  {
   Boolean                       booleanParseCommandLineArguments  =  false;
   String                        exceptionMessage                  =  null;

   DataSet                       dataSetTheWord                    =  null;
   TheWordSerializationArgument  theWordSerializationArgument      =  null;
   
   theWordSerializationArgument = new TheWordSerializationArgument();
   
   booleanParseCommandLineArguments =  UtilityParseCommandLineArgument.ParseCommandLineArguments
   ( 
    argv, 
    theWordSerializationArgument
   );
   
   if ( booleanParseCommandLineArguments  == false )
   {
    // error encountered in arguments. Display usage message
    System.Console.Write
    (
     UtilityParseCommandLineArgument.CommandLineArgumentsUsage( typeof ( TheWordSerializationArgument ) )
    );
    return;
   }//if ( booleanParseCommandLineArguments  == false )

   if ( theWordSerializationArgument.files.Length > TheWordSerializationArgumentFilenameXmlDocument )
   {
    theWordSerializationArgument.filenameXmlDocument = theWordSerializationArgument.files[TheWordSerializationArgumentFilenameXmlDocument];
   }//if ( theWordSerializationArgument.files.Length > TheWordSerializationArgumentFilenameXmlDocument )

   if ( theWordSerializationArgument.files.Length > TheWordSerializationArgumentFilenameXmlDocumentGenerate )
   {
    theWordSerializationArgument.filenameXmlDocumentGenerate = theWordSerializationArgument.files[TheWordSerializationArgumentFilenameXmlDocumentGenerate];
   }//if ( theWordSerializationArgument.files.Length > TheWordSerializationArgumentFilenameXmlDocumentGenerate )

   if ( theWordSerializationArgument.files.Length > TheWordSerializationArgumentFilenameStylesheet )
   {
    theWordSerializationArgument.filenameStylesheet = theWordSerializationArgument.files[TheWordSerializationArgumentFilenameStylesheet];    
   }//if ( theWordSerializationArgument.files.Length > TheWordSerializationArgumentFilenameStylesheet )

   #if (DEBUG)
    System.Console.WriteLine
    (
     "Argument TheWordId: {0} | Dated: {1} | FilenameXmlDocument: {2} | FilenameXmlDocumentGenerate: {3} | FilenameStylesheet: {4} | Files: {5}", 
     theWordSerializationArgument.theWordId,
     theWordSerializationArgument.dated,
     theWordSerializationArgument.filenameXmlDocument,
     theWordSerializationArgument.filenameXmlDocumentGenerate,
     theWordSerializationArgument.filenameStylesheet,
     theWordSerializationArgument.files
    );
   #endif

   TheWord.UtilitySerialization
   (
    ref FilenameConfigurationXml,
    ref DatabaseConnectionString,
    ref theWordSerializationArgument,
    ref dataSetTheWord,
    ref exceptionMessage
   );
  
  }//static void Main( String[] argv ) 
Пример #34
0
		public override bool NextState(TheWord word)
		{
			mainClass.iCountJoin++;
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM)
			{
				this.link = this.mainClass.from_table_2;
				this.mainClass.data.from.Add(word.text);
			}
			else
				throw new NoOneClass("Состояние: From_1, слово = " + word.text);

			return true;
		}
  }//public static void Main( String[] argv )

  ///<summary>Stub.</summary>
  public static void Stub()
  {
   TheWord.TheWordSerialization();   
  }
Пример #36
0
  /// <summary>Page Load.</summary>
  public void Page_Load
  (
   object     sender, 
   EventArgs  e
  ) 
  {
  
   String    exceptionMessage = null;
  
   serverMapPath = this.MapPath("");
   if ( serverMapPath != null)
   {
    filenameConfigurationXml = serverMapPath + @"\" + filenameConfigurationXml;
   }//if ( serverMapPath != null)
   UtilityXml.XmlDocumentNodeInnerText
   (
         filenameConfigurationXml,
     ref exceptionMessage,         
         TheWord.XPathDatabaseConnectionString,
     ref databaseConnectionString
   );
   UtilityXml.XmlDocumentNodeInnerText
   (
         filenameConfigurationXml,
     ref exceptionMessage,         
         TheWord.XPathNodeRoot,
     ref nodeRoot
   );
   if ( exceptionMessage != null )
   {
    Feedback = exceptionMessage;
    return;
   }//if ( exceptionMessage != null ) 

   // Check to see if the cookies have already been saved for this session.
   if (Session["theWord"] == null)
   { 
    theWord = new TheWord();
   }
   else
   { 
    theWord = (TheWord) Session["theWord"];
   }

   switch ( DataColumnFieldGridView )
   {
   	case DataColumnField.Bound:
     PageBuild();
     break;

   	case DataColumnField.Template:
     PageBuild();
     break;

   	case DataColumnField.TextBox:
     PageBuildTextBox();
     break;
   }
   
   // Store the cookies received in the session state for future retrieval by this session.
   Session["theWord"] = theWord;

  }//Page_Load
Пример #37
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM && word.text.ToLower()=="by")
			{				
				this.link = this.mainClass.select_key_2;
			}
			else
				throw new NoOneClass(this.ToString() + ", слово: " + word.text);
			return true;
		}
Пример #38
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);

			if (word.type == TypeWord.TERM)
			{
				this.mainClass.CurentExpr.TblName2 = mainClass.CurentExpr.ColName2;
				mainClass.CurentExpr.ColName2 = word.text;
				this.link = this.mainClass.where_column2;
			}
			else
				throw new NoOneClass("Состояние: Where_Point2, слово = " + word.text);
			return true;
		}
Пример #39
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM)
			{
				this.mainClass.data.select.SetKeyTable(word.text);
				this.link = this.mainClass.select_key_value_2;
			}
			else
				throw new NoOneClass(this.ToString() + ", слово: " + word.text);
			return true;
		}
Пример #40
0
		public override bool NextState(TheWord word)
		{
			//int u=0;
			////Console.WriteLine(this.ToString() + ": " + word.text);

			if (word.text.ToLower() == "select")
			{
				//Тогда вложенный запрос.
				Link l = new Link(this.mainClass.Tr, this.mainClass.ArrayWords);
				l.AddWordBegin("select", TypeWord.TERM);
				l.Run();

				SQLStruct st = (SQLStruct) this.mainClass.data;
				if (l.data != null)
					st.select.Add(l.data);
				else
					throw new NoOneClass("Ошибка во вложенном запросе.");
				this.link = this.mainClass.select_stmt_1;
			}
			/*else if (word.type == TypeWord.TERM && word.text.ToLower() == "*")
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}*/
			else if (word.type == TypeWord.TERM)
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}
			else
				throw new NoOneClass("Состояние: Select_stmt, слово = " + word.text);
			return true;
		}
Пример #41
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM)
			{	
				//Добавляем значение для раскрасски
				mainClass.data.select.paint.AddVal(word.text.Trim('\'','\"','`'));
				this.link = this.mainClass.select_paint_value;
			}
			else
				throw new NoOneClass("Состояние: Select, слово = " + word.text);
			return true;
		}
Пример #42
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);

			if (word.type == TypeWord.TERM && word.text.ToLower() == "as" && mainClass.WhereReturn == null)
			{
				this.link = this.mainClass.asClass;
				this.mainClass.data.where.Add(mainClass.CurentExpr);
			}
			else if (word.text.ToLower() == "group")
				this.link = this.mainClass.group;
			else if (word.type == TypeWord.TERM && (word.text.ToLower() == "or" || word.text.ToLower() == "and"))
			{
				//Expr ex = new Expr(this.TableName1, this.ColumnName1, this.TableName2, this.ColumnName2);
				if (word.text.ToLower() == "or")
					this.mainClass.data.where.AddOr(mainClass.CurentExpr);
				else if (word.text.ToLower() == "and")
					this.mainClass.data.where.AddAnd(mainClass.CurentExpr);

				//Создаем новые экземпляры
				this.mainClass.CurentExpr = new Expr();
				this.mainClass.CurentOper = new Oper();
				this.link = this.mainClass.whereClass;
			}
			else if (this.mainClass.WhereReturn != null)
			{
				this.mainClass.data.where.Add(mainClass.CurentExpr);
				this.mainClass.AddWordBegin(word.text, word.type);
				this.link = this.mainClass.WhereReturn;
				this.mainClass.WhereReturn = null;
			}
			else
				throw new NoOneClass("Состояние: Where_Column2, слово = " + word.text);
			return true;
		}
Пример #43
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM)
			{	
				//Добавляем имя тега для раскрасски
				mainClass.data.select.paint.AddTag(word.text);
				//mainClass.data.select.paint.Other = word.text;
				this.link = this.mainClass.select_paint_col_name;
			}
			else
				throw new NoOneClass("Состояние: Select, слово = " + word.text);
			return true;
		}
Пример #44
0
		public override bool NextState(TheWord word)
		{
			if (word.type == TypeWord.TERM)
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				string str = st.select[st.select.Count-1];
				st.select.Set(str, word.text, st.select.Count-1);

				this.link = this.mainClass.select_stmt_1;
			}
			else
				throw new NoOneClass("Ошибка перед словом : " + word.text);
			return true;
		}
Пример #45
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM && word.text.ToLower() == "from")
			{
				this.link = this.mainClass.fromClass;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "once")
			{
				this.link = this.mainClass.select_once;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "all")
			{
				this.link = this.mainClass.select_all_1;
			}
			else
				throw new NoOneClass("Состояние: Select, слово = " + word.text);
			return true;
		}
Пример #46
0
		public override bool NextState(TheWord word)
		{
			//Console.WriteLine(this.ToString() + ": " + word.text);
			if (word.type == TypeWord.TERM && word.text.ToLower() == "on")
			{
				//this.link = this.mainClass.from_where;
				this.link = this.mainClass.whereClass;
				this.mainClass.WhereReturn = mainClass.from_where;
				mainClass.iCountJoin--;
			}
			else if (word.type == TypeWord.TERM && word.text.ToLower() == "join")
			{
				this.link = this.mainClass.from_join;
			}
			else if (mainClass.data.from.Count > 0)
			{
				string TName = mainClass.data.from[mainClass.data.from.Count-1];
				this.mainClass.data.alias.AddTable(TName, word.text);
				this.mainClass.data.from.ReNameTable(word.text);
				//this.link = this.mainClass.from_1;
				this.link = this.mainClass.from_table_2;
			}
			else
				throw new NoOneClass("Состояние: From-Table_2, слово = " + word.text);
			
			return true;
		}