شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Default

Public general use code classes and xml files that we've compiled and used over the years:

Koran Reference Network Class Library support functions: Business model

   1:  using System;
   2:  using System.Collections;
   3:  using System.Collections.Generic;
   4:  using System.Linq;
   5:  using System.Web;
   6:  using System.Web.SessionState;
   7:  using System.Data;
   8:  using System.Text;
   9:  using System.Xml;
  10:  using System.Xml.Linq;
  11:  using System.Text.RegularExpressions;
  12:  using System.Globalization;
  13:   
  14:  namespace Ia.Islamic.Cl.Model.Business
  15:  {
  16:      ////////////////////////////////////////////////////////////////////////////
  17:   
  18:      /// <summary publish="true">
  19:      /// Koran Reference Network Class Library support functions: Business model
  20:      /// </summary>
  21:      /// <value>
  22:      /// https://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx
  23:      /// </value>
  24:      /// <remarks> 
  25:      /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  26:      ///
  27:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  28:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  29:      ///
  30:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  31:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  32:      /// 
  33:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  34:      /// 
  35:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  36:      /// </remarks> 
  37:      public class Default
  38:      {
  39:          ////////////////////////////////////////////////////////////////////////////
  40:   
  41:          /// <summary>
  42:          ///
  43:          /// </summary>
  44:          public Default()
  45:          {
  46:          }
  47:   
  48:          /*
  49:          ////////////////////////////////////////////////////////////////////////////
  50:          ////////////////////////////////////////////////////////////////////////////
  51:  
  52:          /// <summary>
  53:          ///
  54:          /// </summary>
  55:          public DataTable Search(string line, Ia.Cl.Model.Language language, out int op, out string result)
  56:          {
  57:              string s, id, word, verse_li;
  58:              string[] sp;
  59:              DataTable dt;
  60:              StringBuilder sb;
  61:              Hashtable ht, word_ht, variant_ht, verse_ht, variant_verse_ht, word_verse_ht;
  62:              MatchCollection mc;
  63:  
  64:              dt = null;
  65:  
  66:              if (line != "")
  67:              {
  68:                  // below: replace all consecutive space characters with a single ' '
  69:                  line = Regex.Replace(line, @"\s+", " ");
  70:  
  71:                  // below: spaces at the start and end of string
  72:                  line = Regex.Replace(line, @"^\s+", "");
  73:                  line = Regex.Replace(line, @"\s+$", "");
  74:  
  75:                  // below: remove any possible consecutive * wildcards.
  76:                  //line = Regex.Replace(line, @"\*{2,}", @"\*");
  77:  
  78:                  word_ht = new Hashtable(10);
  79:                  variant_ht = new Hashtable(word_ht.Count);
  80:                  variant_verse_ht = new Hashtable(word_ht.Count);
  81:                  word_verse_ht = new Hashtable(word_ht.Count);
  82:  
  83:                  s = "[" + Ia.Cl.Model.Language.Word(language.Symbol) + "]+|[" + Ia.Cl.Model.Language.Ideograph(language.Symbol) + "]{1}";
  84:                  s = s.Replace("|[]{1}", "");
  85:  
  86:                  mc = Regex.Matches(line, @"(" + s + ")", RegexOptions.Compiled);
  87:                  foreach (Match m in mc)
  88:                  {
  89:                      word = m.Groups[1].Captures[0].Value;
  90:  
  91:                      // below: words regular
  92:                      word_ht[word] = null;
  93:                      variant_ht[word] = word;
  94:  
  95:                      // below: unaccented:
  96:                      variant_ht[this.Unaccent(word)] = word;
  97:  
  98:                      // below: basic form: lower case, no accents
  99:                      variant_ht[this.Basic(word)] = word;
 100:                  }
 101:  
 102:                  word_ht.Remove(" ");
 103:                  word_ht.Remove("");
 104:  
 105:                  variant_ht.Remove(" ");
 106:                  variant_ht.Remove("");
 107:  
 108:                  // below: collect info from hashtable to sql
 109:  
 110:                  if (word_ht.Count > 0)
 111:                  {
 112:                      dt = data.ReturnAllWordVerseForLanguageAndVariants(language, variant_ht);
 113:  
 114:                      try
 115:                      {
 116:                          if (dt != null)
 117:                          {
 118:                              if (dt.Rows.Count > 0)
 119:                              {
 120:                                  verse_li = "";
 121:  
 122:                                  foreach (DataRow ra in dt.Rows)
 123:                                  {
 124:                                      id = ra["id"].ToString();
 125:                                      word = ra["word"].ToString();
 126:  
 127:                                      verse_li = ra["ia_verse_lid"].ToString();
 128:                                      verse_li = Regex.Replace(verse_li, @"\s+$", "");
 129:  
 130:                                      if (verse_li.Length > 0)
 131:                                      {
 132:                                          sp = verse_li.Split(' ');
 133:  
 134:                                          if (sp.Length > 0)
 135:                                          {
 136:                                              // below: the Hashtable below is to make sure we do not copy similar positions into variant_verse_ht
 137:  
 138:                                              ht = new Hashtable(sp.Length);
 139:  
 140:                                              foreach (string t in sp)
 141:                                              {
 142:                                                  if (t.Length > 0 && !ht.ContainsKey(t))
 143:                                                  {
 144:                                                      if (variant_verse_ht[word] == null) variant_verse_ht[word] = t;
 145:                                                      else variant_verse_ht[word] = variant_verse_ht[word] + " " + t;
 146:  
 147:                                                      ht[t] = 1;
 148:                                                  }
 149:                                              }
 150:                                          }
 151:                                      }
 152:                                  }
 153:  
 154:                                  variant_verse_ht.Remove(" ");
 155:                                  variant_verse_ht.Remove("");
 156:  
 157:                                  // below: I will loop through original words, loop through their variants, collect all positions of
 158:                                  // variants, and the positions of words
 159:                                  foreach (string u in word_ht.Keys)
 160:                                  {
 161:                                      foreach (string v in variant_ht.Keys)
 162:                                      {
 163:                                          word = variant_ht[v].ToString();
 164:  
 165:                                          // below: check if variant belongs to word
 166:                                          if (u == word)
 167:                                          {
 168:                                              // below: add positions of variant to word
 169:                                              if (variant_verse_ht[v] != null)
 170:                                              {
 171:                                                  if (word_verse_ht[u] == null) word_verse_ht[u] = variant_verse_ht[v].ToString();
 172:                                                  else if (word_verse_ht[u].ToString().IndexOf(variant_verse_ht[v].ToString()) >= 0) { }
 173:                                                  else word_verse_ht[u] = word_verse_ht[u] + " " + variant_verse_ht[v].ToString();
 174:                                              }
 175:                                          }
 176:                                      }
 177:                                  }
 178:  
 179:                                  // below: remove duplicate positions from word_verse
 180:                                  foreach (string u in word_ht.Keys)
 181:                                  {
 182:                                      sp = word_verse_ht[u].ToString().Split(' ');
 183:  
 184:                                      ht = new Hashtable(sp.Length);
 185:  
 186:                                      // below: collect unique positions
 187:                                      foreach (string t in sp) if (t.Length > 0) ht[t] = 1;
 188:  
 189:                                      sb = new StringBuilder(ht.Count * 8);
 190:  
 191:                                      // below: build string and assign it again
 192:                                      foreach (string v in ht.Keys) sb.Append(v + " ");
 193:  
 194:                                      if (sb.Length > 0)
 195:                                      {
 196:                                          s = sb.ToString();
 197:                                          s = s.Remove(s.Length - 1, 1);
 198:                                      }
 199:  
 200:                                      word_verse_ht[u] = s;
 201:                                  }
 202:  
 203:                                  if (word_verse_ht.Count > 0)
 204:                                  {
 205:                                      // below: collect all locations from all words in one hashtable. Increment the value for every time the location is entered
 206:                                      // then delete all entries that do not have a value equal to the number of words
 207:  
 208:                                      verse_ht = new Hashtable(1000);
 209:  
 210:                                      foreach (string t in word_verse_ht.Keys)
 211:                                      {
 212:                                          verse_li = word_verse_ht[t].ToString();
 213:  
 214:                                          if (verse_li.Length > 0)
 215:                                          {
 216:                                              sp = verse_li.Split(' ');
 217:  
 218:                                              if (sp.Length > 0)
 219:                                              {
 220:                                                  foreach (string u in sp)
 221:                                                  {
 222:                                                      // below: this will increment the value of key every time it appears
 223:                                                      if (verse_ht[u] == null) verse_ht[u] = 1;
 224:                                                      else verse_ht[u] = (int)verse_ht[u] + 1;
 225:                                                  }
 226:                                              }
 227:                                          }
 228:                                      }
 229:  
 230:                                      verse_ht.Remove(" ");
 231:                                      verse_ht.Remove("");
 232:  
 233:                                      ht = new Hashtable(verse_ht.Count);
 234:  
 235:                                      // below: now I will remove all verse_ht values that are less than the number of words
 236:                                      foreach (string t in verse_ht.Keys)
 237:                                      {
 238:                                          if ((int)verse_ht[t] == word_ht.Count) ht[t] = 1;
 239:  
 240:                                          if (ht.Count >= 1000) break; // TEMP break at max of results
 241:                                      }
 242:  
 243:                                      ht.Remove(" ");
 244:                                      ht.Remove("");
 245:  
 246:                                      if (ht.Count > 0)
 247:                                      {
 248:                                          dt = data.ReturnAllVersesForLanguageAndId(language, ht);
 249:  
 250:                                          try
 251:                                          {
 252:                                              if (dt != null)
 253:                                              {
 254:                                                  if (dt.Rows.Count > 0)
 255:                                                  {
 256:                                                      // below: result text
 257:                                                      op = 1;
 258:  
 259:                                                      if (word_ht.Count == 1)
 260:                                                      {
 261:                                                          result = Text("search_for_word");
 262:                                                          //result = (from u in xd.Descendants("search_for_word") select u.Value).Single();
 263:                                                      }
 264:                                                      else if (word_ht.Count > 1)
 265:                                                      {
 266:                                                          result = Text("search_for_words");
 267:                                                      }
 268:  
 269:                                                      result = @": """ + line + @""" " + Text("number_of_appear_words") + " " + ht.Count;
 270:                                                  }
 271:                                                  else
 272:                                                  {
 273:                                                      op = -1;
 274:                                                      result = "Verse query returned no results";
 275:                                                  }
 276:                                              }
 277:                                              else
 278:                                              {
 279:                                                  op = -1;
 280:                                                  result = "SQL verse query returned null DataTable";
 281:                                              }
 282:                                          }
 283:                                          catch (Exception ex)
 284:                                          {
 285:                                              op = -1;
 286:                                              result = "Exception: " + ex.Message;
 287:                                          }
 288:                                      }
 289:                                      else
 290:                                      {
 291:                                          op = -1;
 292:                                          result = Text("the_words");
 293:                                          result = @" """ + line + @""" ";
 294:                                          result = Text("not_all_together");
 295:                                      }
 296:                                  }
 297:                                  else
 298:                                  {
 299:                                      op = -1;
 300:                                      result = "Word verse Hashtable length zero";
 301:                                  }
 302:                              }
 303:                              else
 304:                              {
 305:                                  op = -1;
 306:  
 307:                                  if (word_ht.Count == 1)
 308:                                  {
 309:                                      result = Text("the_word");
 310:                                  }
 311:                                  else if (word_ht.Count > 1)
 312:                                  {
 313:                                      result = Text("the_words");
 314:                                  }
 315:  
 316:                                  result = @" """ + line + @""" ";
 317:  
 318:                                  if (word_ht.Count == 1)
 319:                                  {
 320:                                      result = Text("was_not_found");
 321:                                  }
 322:                                  else if (word_ht.Count > 1)
 323:                                  {
 324:                                      result = Text("were_not_found");
 325:                                  }
 326:                              }
 327:                          }
 328:                          else
 329:                          {
 330:                              op = -1;
 331:                              result = "SQL query returned null DataTable";
 332:                          }
 333:                      }
 334:                      catch (Exception ex)
 335:                      {
 336:                          op = -1;
 337:                          result = "Exception: " + ex.Message;
 338:                      }
 339:                  }
 340:                  else
 341:                  {
 342:                      op = -1;
 343:                      result = "Could not parse words";
 344:                  }
 345:              }
 346:              else
 347:              {
 348:                  op = -1;
 349:                  result = Text("empty_field");
 350:              }
 351:  
 352:              return dt;
 353:          }
 354:           */
 355:   
 356:          /*
 357:          ////////////////////////////////////////////////////////////////////////////
 358:          ////////////////////////////////////////////////////////////////////////////
 359:  
 360:          /// <summary>
 361:          /// Return text according to language
 362:          /// </summary>
 363:          public string Text(string text)
 364:          {
 365:              /*
 366:          language = "de";
 367:          translation_xd = Ia.Cl.Model.Xml.ReturnXmlNode(@"app_data\translation.xml");
 368:          xd = translation_xd.SelectSingleNode("language/lang[@symbol='" + language + "']/search/result"); 
 369:               * /
 370:  
 371:              return "";
 372:          }
 373:           */
 374:   
 375:          ////////////////////////////////////////////////////////////////////////////
 376:          ////////////////////////////////////////////////////////////////////////////
 377:   
 378:   
 379:   
 380:   
 381:   
 382:          ////////////////////////////////////////////////////////////////////////////
 383:          ////////////////////////////////////////////////////////////////////////////
 384:   
 385:          /// <summary>
 386:          ///
 387:          /// </summary>
 388:          public static List<Ia.Islamic.Cl.Model.Ui.VerseUi> Search(string line, string language_, out int op, out string result)
 389:          {
 390:              const int maximumLengthOfVerseList = 100;
 391:              string regularExpression, word, basicWord;
 392:              Hashtable wordHashtable, variantHashtable, variantVerseHashtable, wordVerseHashtable;
 393:              MatchCollection mc;
 394:              Translation translation;
 395:              List<Ia.Islamic.Cl.Model.Ui.VerseUi> verseList;
 396:              Ia.Cl.Model.Language language;
 397:   
 398:              language = new Ia.Cl.Model.Language(language_);
 399:   
 400:              translation = new Translation(language.Id);
 401:   
 402:              verseList = null;
 403:   
 404:              /*
 405:  - Fix search function using special language function by adding modified versions of words:
 406:      Beginning of word remove ال, و , 
 407:      Middle of word remove ا
 408:      Change لل to ل
 409:      ءا to آ and ا
 410:      Articles هم كم... etc.
 411:      remove redundant verces in search result
 412:  - Highlight search words and HTTP linked verses
 413:               */
 414:   
 415:              if (line != "")
 416:              {
 417:                  // below: replace all consecutive space characters with a single ' '
 418:                  line = Regex.Replace(line, @"\s+", " ");
 419:   
 420:                  // below: spaces at the start and end of string
 421:                  line = line.Trim();
 422:   
 423:                  // below: remove any possible consecutive * wildcards.
 424:                  //line = Regex.Replace(line, @"\*{2,}", @"\*");
 425:   
 426:                  wordHashtable = new Hashtable(10);
 427:                  variantHashtable = new Hashtable(wordHashtable.Count);
 428:                  variantVerseHashtable = new Hashtable(wordHashtable.Count);
 429:                  wordVerseHashtable = new Hashtable(wordHashtable.Count);
 430:   
 431:                  if (language.Id == "ja" || language.Id == "ko")
 432:                  {
 433:                      regularExpression = Ia.Cl.Model.Language.BasicWordsRegularExpression(language.Symbol) + "|[" + Ia.Cl.Model.Language.Ideograph(language.Symbol) + "]{1}";
 434:                      regularExpression = regularExpression.Replace("|[]{1}", "");
 435:                  }
 436:                  else
 437:                  {
 438:                      regularExpression = Ia.Cl.Model.Language.BasicWordsRegularExpression(language.Symbol);
 439:                  }
 440:   
 441:                  mc = Regex.Matches(Ia.Cl.Model.Language.BasicForm(line), @"(" + regularExpression + ")", RegexOptions.Compiled);
 442:   
 443:                  foreach (Match m in mc)
 444:                  {
 445:                      word = m.Groups[1].Captures[0].Value;
 446:   
 447:                      basicWord = Ia.Cl.Model.Language.BasicForm(word);
 448:   
 449:                      // below: words regular
 450:                      wordHashtable[word] = null;
 451:                      variantHashtable[word] = word;
 452:   
 453:                      // below: unaccented:
 454:                      //variant_ht[Ia.Cl.Model.Language.RemoveAccent(word)] = word;
 455:   
 456:                      // below: basic form: lower case, no accents
 457:                      variantHashtable[word] = basicWord;
 458:   
 459:                      if (language.Id == "ar")
 460:                      {
 461:                          ArrayList al;
 462:                          al = Ia.Cl.Model.Language.ProduceSimilarArabicWords(word);
 463:   
 464:                          foreach (string u in al) variantHashtable[u] = basicWord;
 465:                      }
 466:                  }
 467:   
 468:                  wordHashtable.Remove(" ");
 469:                  wordHashtable.Remove("");
 470:   
 471:                  variantHashtable.Remove(" ");
 472:                  variantHashtable.Remove("");
 473:   
 474:                  // below: collect info from hashtable to sql
 475:   
 476:                  if (wordHashtable.Count > 0)
 477:                  {
 478:                      verseList = Ia.Islamic.Cl.Model.Data.Default.VerseList(language, variantHashtable, maximumLengthOfVerseList, out op, out result);
 479:   
 480:                      if (verseList != null)
 481:                      {
 482:                          if (verseList.Count() > 0)
 483:                          {
 484:                              //    verse_li = "";
 485:   
 486:                              //    foreach (Verse ra in verseList)
 487:                              //    {
 488:                              //        id = ra.Id.ToString();
 489:                              //        word = ""; // ra["word"].ToString();
 490:   
 491:                              //        verse_li = ""; // ra["ia_verse_lid"].ToString();
 492:                              //        verse_li = Regex.Replace(verse_li, @"\s+$", "");
 493:   
 494:                              //        if (verse_li.Length > 0)
 495:                              //        {
 496:                              //            sp = verse_li.Split(' ');
 497:   
 498:                              //            if (sp.Length > 0)
 499:                              //            {
 500:                              //                // below: the Hashtable below is to make sure we do not copy similar positions into variant_verse_ht
 501:   
 502:                              //                ht = new Hashtable(sp.Length);
 503:   
 504:                              //                foreach (string t in sp)
 505:                              //                {
 506:                              //                    if (t.Length > 0 && !ht.ContainsKey(t))
 507:                              //                    {
 508:                              //                        if (variant_verse_ht[word] == null) variant_verse_ht[word] = t;
 509:                              //                        else variant_verse_ht[word] = variant_verse_ht[word] + " " + t;
 510:   
 511:                              //                        ht[t] = 1;
 512:                              //                    }
 513:                              //                }
 514:                              //            }
 515:                              //        }
 516:                              //    }
 517:   
 518:                              //    variant_verse_ht.Remove(" ");
 519:                              //    variant_verse_ht.Remove("");
 520:   
 521:                              //    // below: I will loop through original words, loop through their variants, collect all positions of
 522:                              //    // variants, and the positions of words
 523:                              //    foreach (string u in word_ht.Keys)
 524:                              //    {
 525:                              //        foreach (string v in variant_ht.Keys)
 526:                              //        {
 527:                              //            word = variant_ht[v].ToString();
 528:   
 529:                              //            // below: check if variant belongs to word
 530:                              //            if (u == word)
 531:                              //            {
 532:                              //                // below: add positions of variant to word
 533:                              //                if (variant_verse_ht[v] != null)
 534:                              //                {
 535:                              //                    if (word_verse_ht[u] == null) word_verse_ht[u] = variant_verse_ht[v].ToString();
 536:                              //                    else if (word_verse_ht[u].ToString().IndexOf(variant_verse_ht[v].ToString()) >= 0) { }
 537:                              //                    else word_verse_ht[u] = word_verse_ht[u] + " " + variant_verse_ht[v].ToString();
 538:                              //                }
 539:                              //            }
 540:                              //        }
 541:                              //    }
 542:   
 543:                              //    // below: remove duplicate positions from word_verse
 544:                              //    foreach (string u in word_ht.Keys)
 545:                              //    {
 546:                              //        sp = word_verse_ht[u].ToString().Split(' ');
 547:   
 548:                              //        ht = new Hashtable(sp.Length);
 549:   
 550:                              //        // below: collect unique positions
 551:                              //        foreach (string t in sp) if (t.Length > 0) ht[t] = 1;
 552:   
 553:                              //        sb = new StringBuilder(ht.Count * 8);
 554:   
 555:                              //        // below: build string and assign it again
 556:                              //        foreach (string v in ht.Keys) sb.Append(v + " ");
 557:   
 558:                              //        if (sb.Length > 0)
 559:                              //        {
 560:                              //            s = sb.ToString();
 561:                              //            s = s.Remove(s.Length - 1, 1);
 562:                              //        }
 563:   
 564:                              //        word_verse_ht[u] = s;
 565:                              //    }
 566:   
 567:                              //    if (word_verse_ht.Count > 0)
 568:                              //    {
 569:                              //        // below: collect all locations from all words in one hashtable. Increment the value for every time the location is entered
 570:                              //        // then delete all entries that do not have a value equal to the number of words
 571:   
 572:                              //        verse_ht = new Hashtable(1000);
 573:   
 574:                              //        foreach (string t in word_verse_ht.Keys)
 575:                              //        {
 576:                              //            verse_li = word_verse_ht[t].ToString();
 577:   
 578:                              //            if (verse_li.Length > 0)
 579:                              //            {
 580:                              //                sp = verse_li.Split(' ');
 581:   
 582:                              //                if (sp.Length > 0)
 583:                              //                {
 584:                              //                    foreach (string u in sp)
 585:                              //                    {
 586:                              //                        // below: this will increment the value of key every time it appears
 587:                              //                        if (verse_ht[u] == null) verse_ht[u] = 1;
 588:                              //                        else verse_ht[u] = (int)verse_ht[u] + 1;
 589:                              //                    }
 590:                              //                }
 591:                              //            }
 592:                              //        }
 593:   
 594:                              //        verse_ht.Remove(" ");
 595:                              //        verse_ht.Remove("");
 596:   
 597:                              //        ht = new Hashtable(verse_ht.Count);
 598:   
 599:                              //        // below: now I will remove all verse_ht values that are less than the number of words
 600:                              //        foreach (string t in verse_ht.Keys)
 601:                              //        {
 602:                              //            if ((int)verse_ht[t] == word_ht.Count) ht[t] = 1;
 603:   
 604:                              //            if (ht.Count >= 1000) break; // TEMP break at max of results
 605:                              //        }
 606:   
 607:                              //        ht.Remove(" ");
 608:                              //        ht.Remove("");
 609:   
 610:                              //        if (ht.Count > 0)
 611:                              //        {
 612:   
 613:                              if (wordHashtable.Count == 1)
 614:                              {
 615:                                  result = translation.ResultSearchForWord + @": """ + line + @""". " + translation.ResultNumberOfAppearWords + " " + verseList.Count();
 616:                              }
 617:                              else if (wordHashtable.Count > 1)
 618:                              {
 619:                                  result = translation.ResultSearchForWords + @": """ + line + @""". " + translation.ResultNumberOfAppearWords + " " + verseList.Count();
 620:                              }
 621:   
 622:                              //        }
 623:                              //        else
 624:                              //        {
 625:                              //            op = -1;
 626:                              //            result = "";//data.TranslationForKey("the_words") + @" """ + line + @""" " + data.TranslationForKey("not_all_together");
 627:                              //        }
 628:                              //    }
 629:                              //    else
 630:                              //    {
 631:                              //        op = -1;
 632:                              //        result = "Word verse Hashtable length zero";
 633:                              //    }
 634:   
 635:                              op = 1;
 636:                          }
 637:                          else
 638:                          {
 639:                              op = -1;
 640:   
 641:                              if (wordHashtable.Count == 1)
 642:                              {
 643:                                  result = translation.ResultTheWord + @" """ + line + @""" " + translation.ResultWasNotFound;
 644:                              }
 645:                              else if (wordHashtable.Count > 1)
 646:                              {
 647:                                  result = translation.ResultTheWords + @" """ + line + @""" " + translation.ResultWereNotFound;
 648:                              }
 649:                          }
 650:                      }
 651:                      else
 652:                      {
 653:                      }
 654:                  }
 655:                  else
 656:                  {
 657:                      op = -1;
 658:                      result = "Could not parse words";
 659:                  }
 660:              }
 661:              else
 662:              {
 663:                  op = -1;
 664:                  result = translation.ResultEmptyField;
 665:              }
 666:   
 667:              return verseList;
 668:          }
 669:   
 670:          ////////////////////////////////////////////////////////////////////////////
 671:   
 672:          /// <summary>
 673:          ///
 674:          /// </summary>
 675:          public static Ia.Islamic.Cl.Model.Ui.VerseUi Verse(Ia.Cl.Model.Language language, int chapterNumber, int verseNumber, out int op, out string result)
 676:          {
 677:              return Ia.Islamic.Cl.Model.Data.Default.Verse(language, chapterNumber, verseNumber, out op, out result);
 678:          }
 679:   
 680:          ////////////////////////////////////////////////////////////////////////////
 681:   
 682:          /// <summary>
 683:          ///
 684:          /// </summary>
 685:          public static Ia.Islamic.Cl.Model.Ui.VerseTopicUi VerseSpan(Ia.Cl.Model.Language language, int chapterNumber, int verseNumber, int numberOfVerses, out int op, out string result)
 686:          {
 687:              return Ia.Islamic.Cl.Model.Ui.VerseTopicUi.VerseTopic(language, chapterNumber, verseNumber, numberOfVerses, out op, out result);
 688:          }
 689:   
 690:          ////////////////////////////////////////////////////////////////////////////
 691:   
 692:          /// <summary>
 693:          ///
 694:          /// <remarks>HttpApplication has both Request and Session variables</remarks>
 695:          /// </summary>
 696:          public static void GlobalSession_Start(HttpContext context)
 697:          {
 698:              string countryCode, languageCode;
 699:   
 700:              //System.Data.DataSet ds;
 701:              //System.Data.DataRow dr;
 702:   
 703:              countryCode = "";
 704:              languageCode = "";
 705:   
 706:              /*
 707:              try
 708:              {
 709:                  // below: find the Geoip information of this IP
 710:  
 711:                  Ia.Cs.Sr.GeoipClient sr = new Ia.Cs.Sr.GeoipClient();
 712:  
 713:                  ds = sr.Ip_Country(this.Context.Request.UserHostAddress);
 714:  
 715:                  if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count == 1)
 716:                  {
 717:                      dr = ds.Tables[0].Rows[0];
 718:  
 719:      #if DEBUG
 720:                      languageCode = "fa";
 721:      #else
 722:                      languageCode = Ia.Cs.Language.ReturnLanguageCodeUsedInCountryFromCountyCode(dr["country_code"].ToString());
 723:      #endif
 724:                  }
 725:                  else
 726:                  {
 727:                  }
 728:              }
 729:              catch (Exception)
 730:              {
 731:              }
 732:               */
 733:   
 734:              context.Session["countryCode"] = countryCode;
 735:              context.Session["languageCode"] = languageCode;
 736:          }
 737:   
 738:          ////////////////////////////////////////////////////////////////////////////
 739:          ////////////////////////////////////////////////////////////////////////////
 740:      }
 741:  }