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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Feature

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