)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Skip Navigation LinksHome » Code Library » Business

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

Default business support class.

    1: using System.Data;
    2: using System.Text;
    3:  
    4: namespace Ia.Learning.Kafiya.Model
    5: {
    6:     ////////////////////////////////////////////////////////////////////////////
    7:  
    8:     /// <summary publish="true">
    9:     /// Default business support class.
   10:     /// </summary>
   11:     /// <value>
   12:     /// https://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx
   13:     /// </value>
   14:     /// <remarks> 
   15:     /// Copyright © 2008-2023 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   16:     ///
   17:     /// 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
   18:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   19:     ///
   20:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   21:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   22:     /// 
   23:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   24:     /// 
   25:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   26:     /// </remarks> 
   27:     public class Business
   28:     {
   29:         ////////////////////////////////////////////////////////////////////////////
   30:  
   31:         /// <summary>
   32:         ///
   33:         /// </summary>
   34:         public Business()
   35:         {
   36:         }
   37:  
   38:         ////////////////////////////////////////////////////////////////////////////
   39:  
   40:         /// <summary>
   41:         ///
   42:         /// </summary>
   43:         public static void Search(string prefix, string middle, string postfix, string maxNumberOfLetters, out StringBuilder resultWords, out int resultState, out string result)
   44:         {
   45:             int maxNumberOfLettersInt;
   46:  
   47:             resultState = 0;
   48:             result = "";
   49:  
   50:             resultWords = new StringBuilder();
   51:  
   52:             try
   53:             {
   54:                 if (prefix.Length == 0 && middle.Length == 0 && postfix.Length == 0 && maxNumberOfLetters.Length == 0)
   55:                 {
   56:                     result = "خطأ: لم تدخل أي قيم. ";
   57:                     resultState = -1;
   58:                 }
   59:                 else
   60:                 {
   61:                     if (maxNumberOfLetters.Length > 0 && !Ia.Cl.Model.Default.IsInt(maxNumberOfLetters))
   62:                     {
   63:                         result = "خطأ: عدد حروف الكلمات غير منطقي. ";
   64:                         resultState = -1;
   65:                     }
   66:                     else
   67:                     {
   68:                         var allArabicWordsList = Ia.Cl.Model.Language.AllArabicWordsList;
   69:  
   70:                         resultWords = new StringBuilder(allArabicWordsList.Count);
   71:  
   72:                         if (maxNumberOfLetters.Length == 0) maxNumberOfLettersInt = 100;
   73:                         else maxNumberOfLettersInt = int.Parse(maxNumberOfLetters);
   74:  
   75:                         var r = from string word in allArabicWordsList
   76:                                 where word.StartsWith(prefix) && word.Contains(middle) && word.EndsWith(postfix) && word.Length <= maxNumberOfLettersInt
   77:                                 orderby word
   78:                                 select word;
   79:  
   80:                         if (r.Count() > 0)
   81:                         {
   82:                             foreach (string u in r) resultWords.Append(u + " ");
   83:  
   84:                             resultWords = resultWords.Remove(resultWords.Length - 2, 2);
   85:  
   86:                             result = @"توجد " + r.Count() + @" كلمة تتوافر بها شروط البحث. ";
   87:                             resultState = 1;
   88:                         }
   89:                         else
   90:                         {
   91:                             result = @"لا توجد كلمات عربية تلبي شروط البحث. ";
   92:                             resultState = 0;
   93:                         }
   94:                     }
   95:                 }
   96:             }
   97:             catch (Exception ex)
   98:             {
   99:                 result = "خطأ استثنائي: " + ex.Message;
  100:                 resultState = -1;
  101:             }
  102:         }
  103:  
  104:         ////////////////////////////////////////////////////////////////////////////
  105:         ////////////////////////////////////////////////////////////////////////////
  106:     }
  107: }