)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Feature (Ia.TentPlay.Cl.Models.Business.Trek)

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

Feature class for TentPlay Trek business model

    1: using System.Data;
    2: using System;
    3: using System.Linq;
    4: using System.Collections.Generic;
    5: using System.IO;
    6:  
    7: namespace Ia.TentPlay.Cl.Models.Business.Trek
    8: {
    9:     ////////////////////////////////////////////////////////////////////////////
   10:  
   11:     /// <summary publish="true">
   12:     /// Feature class for TentPlay Trek business model
   13:     /// </summary>
   14:     /// 
   15:     /// <remarks> 
   16:     /// Copyright © 2012-2016 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   17:     ///
   18:     /// 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
   19:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   20:     ///
   21:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   22:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   23:     /// 
   24:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   25:     /// 
   26:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   27:     /// </remarks> 
   28:     public partial class Feature
   29:     {
   30:         /// <summary/>
   31:         public Feature() { }
   32:  
   33:         ///<summary/>
   34:         public int Ufi { get; set; }
   35:  
   36:         ///<summary/>
   37:         public int Rk { get; set; }
   38:  
   39:         ///<summary/>
   40:         public decimal LatDd { get; set; }
   41:  
   42:         ///<summary/>
   43:         public decimal LongDd { get; set; }
   44:  
   45:         ///<summary/>
   46:         public string DMS_LAT { get; set; }
   47:  
   48:         ///<summary/>
   49:         public string DMS_LONG { get; set; }
   50:  
   51:         ///<summary/>
   52:         public string MGRS { get; set; }
   53:  
   54:         ///<summary/>
   55:         public string JOG { get; set; }
   56:  
   57:         ///<summary/>
   58:         public string Fc { get; set; }
   59:  
   60:         ///<summary/>
   61:         public string DesigCd { get; set; }
   62:  
   63:         ///<summary/>
   64:         public int PC { get; set; }
   65:  
   66:         ///<summary/>
   67:         public string CcFt { get; set; }
   68:  
   69:         ///<summary/>
   70:         public string Adm1 { get; set; }
   71:  
   72:         ///<summary/>
   73:         public string NOTE { get; set; }
   74:  
   75:         ///<summary/>
   76:         public string MODIFY_DATE { get; set; }
   77:  
   78:         ///<summary/>
   79:         public string DISPLAY { get; set; }
   80:  
   81:         ///<summary/>
   82:         public string F_EFCTV_DT { get; set; }
   83:  
   84:         ///<summary/>
   85:         public string F_TERM_DT { get; set; }
   86:  
   87:         /// <summary/>
   88:         public virtual ICollection<FeatureName> FeatureNames { get; set; }
   89:  
   90:         ///<summary/>
   91:         public string UsFeatureName { get; set; }
   92:  
   93:         ///<summary/>
   94:         public string UsFeatureNoDiacriticLowerCaseName { get; set; }
   95:  
   96:         ///<summary/>
   97:         public string UsFeatureNativeName { get; set; }
   98:  
   99:         /// <summary/>
  100:         public FeatureName ProperNameFeature
  101:         {
  102:             get
  103:             {
  104:                 FeatureName featureName;
  105:  
  106:                 featureName = (from fn in this.FeatureNames where fn.Ufi == this.Ufi && (fn.Nt == "N" || fn.Nt == "C") select fn).FirstOrDefault();
  107:  
  108:                 return featureName;
  109:             }
  110:         }
  111:  
  112:         /// <summary/>
  113:         public FeatureName ProperNativeNameFeature
  114:         {
  115:             get
  116:             {
  117:                 FeatureName featureName;
  118:  
  119:                 featureName = (from fn in this.FeatureNames where fn.Ufi == this.Ufi && (fn.Nt == "NS") select fn).FirstOrDefault();
  120:  
  121:                 // below: remove all non-latin characters, subject references then remove double spaces
  122:                 //s = Ia.Cl.Models.Language.RemoveNonLatinCharacters(FULL_NAME_ND_RO);
  123:                 //s = Ia.Cl.Models.Language.RemoveLatinTransliterationsOfSubjectReferencesOfNativeWordTransliterationAccordingToLanguagee(iso6393, s);
  124:  
  125:                 /*
  126: if (!result.HasError)
  127: {
  128:     // below: first loop: collect fix, defined translations
  129:     foreach (DataRow r in dataTable.Rows)
  130:     {
  131:         id = r["id"].ToString();
  132:         UFI = int.Parse(r["ufi"].ToString());
  133: 
  134:         iso6393 = r["language"].ToString();
  135:         iso3 = r["country"].ToString();
  136: 
  137:         if (ufiToNsHashtable.ContainsKey(UFI))
  138:         {
  139:             // we have a native translation and we will assign it to native_name
  140:             u = ufiToNsHashtable[UFI].ToString();
  141:             u = u.Trim();
  142: 
  143:             s = Ia.Cl.Models.Language.ConvertSingleLatinDigitsToNativeWordEquivalentAccordingToLanguage(iso6393, u);
  144: 
  145:             s = Ia.Cl.Models.Language.RemoveNonNativeAndNonNativeExtendedLettersAndDigitsAccordingToLanguage(iso6393, s);
  146:             s = s.Trim();
  147: 
  148:             // below: store this as a good translation
  149:             //ParseTransliterationsAndArabicAndStoreThemIntoHashtable(ufiToName[UFI].ToString().Trim(), s.Trim(), ref latinTransliterationToArabic);
  150: 
  151:             //r["transliterated_name"] = u;
  152:             r["native_name"] = s;
  153:         }
  154:         else
  155:         {
  156:             result.AddWarning("ufiToNs does not contain UFI: " + UFI + ". ");
  157:         }
  158:     }
  159: 
  160:     dataTable.AcceptChanges();
  161: 
  162:     // below: second loop: user built hashtable of fixed and defined translations here
  163:     foreach (DataRow r in dataTable.Rows)
  164:     {
  165:         id = r["id"].ToString();
  166:         UFI = int.Parse(r["ufi"].ToString());
  167: 
  168:         iso6393 = r["language"].ToString();
  169:         iso3 = r["country"].ToString();
  170: 
  171:         if (ufiToNsHashtable.ContainsKey(UFI))
  172:         {
  173:             // nothing, just skipping
  174:         }
  175:         else if (ufiToNameHashtable.ContainsKey(UFI))
  176:         {
  177:             // below: we will check if a proper translation had been used before. If there was no native translation given,
  178:             // we will attempt to produce a native equivelate of the latin transliteration
  179: 
  180:             v = "";
  181:             s = ufiToNameHashtable[UFI].ToString();
  182: 
  183:             /*
  184:             if (latinTransliterationToArabic.ContainsKey(s))
  185:             {
  186:                 t = latinTransliterationToArabic[s].ToString();
  187:             }
  188:             else
  189:             {
  190:              * /
  191:             // below: we will parse the tranliteration and attempt to construct a translation
  192: 
  193:             string[] sp;
  194: 
  195:             anApproximateConversion = false;
  196:             anExactMultiwordConversion = false;
  197: 
  198:             // below: exact explicit conversion for multiple words
  199:             t = ProduceExactNativeTextOfMultipleLatinTransliterationsOfNativeWordsAccordingToCountry(iso3, s);
  200: 
  201:             if (t != s) anExactMultiwordConversion = true;
  202: 
  203:             if (anExactMultiwordConversion)
  204:             {
  205:                 // below: store this as a good translation. DISABLED: not a good idea because of reverse in sentence word order. 
  206:                 // ParseTransliterationsAndArabicAndStoreThemIntoHashtable(s.Trim(), t.Trim(), ref latinTransliterationToArabic);
  207:             }
  208:             else
  209:             {
  210:                 sp = s.Split(' ');
  211:                 t = v = "";
  212: 
  213:                 for (int j = 0; j < sp.Length; j++)
  214:                 {
  215:                     s = sp[j].ToString();
  216: 
  217:                     // below: exact explicit conversion
  218:                     u = Ia.Cl.Models.Language.ProduceExactNativeTextOfSingleLatinTransliterationsOfNativeWordsAccordingToLanguage(iso6393, s);
  219: 
  220:                     // below: approximate conversion
  221:                     w = Ia.Cl.Models.Language.ProduceApproximateNativeTextOfLatinTransliterationsOfNativeWordsAccrodingToLanguage(iso6393, u);
  222: 
  223:                     if (w != u && !anApproximateConversion) anApproximateConversion = true;
  224: 
  225:                     w = w.Trim();
  226: 
  227:                     w = Ia.Cl.Models.Language.ConvertSingleLatinDigitsToNativeWordEquivalentAccordingToLanguage(iso6393, w);
  228: 
  229:                     w = Ia.Cl.Models.Language.RemoveNonNativeAndNonNativeExtendedLettersAndDigitsAccordingToLanguage(iso6393, w);
  230: 
  231:                     v += " " + s;
  232:                     t += " " + w;
  233: 
  234:                     // below: store this as a good translation
  235:                     //ParseTransliterationsAndArabicAndStoreThemIntoHashtable(s.Trim(), w.Trim(), ref latinTransliterationToArabic);
  236:                     //}
  237:                 }
  238: 
  239:                 // below: if there was an approximate conversion, we will construct
  240:                 if (anApproximateConversion) v = "--------- [" + v.Trim() + "] ---------";
  241:             }
  242:             //}
  243: 
  244:             v = v.Trim();
  245:             t = t.Trim();
  246: 
  247:             r["transliterated_name"] = v;
  248:             r["native_name"] = "";// Ia.Cl.Models.Language.RemoveWrongSpaceBetweenNativeDefinitArticleAndItsWord(iso6393, t);
  249:         }
  250:     }
  251:     */
  252:  
  253:  
  254:                 return featureName;
  255:             }
  256:         }
  257:  
  258:         ////////////////////////////////////////////////////////////////////////////
  259:         ////////////////////////////////////////////////////////////////////////////
  260:     }
  261:  
  262:     ////////////////////////////////////////////////////////////////////////////
  263:     ////////////////////////////////////////////////////////////////////////////
  264: }