Example #1
0
 private void Init()
 {
     //_persistBroker = PersistBrokerManager.PersistBroker(@"Provider=Microsoft.Jet.OLEDB.4.0;Password=;Data Source=" + this.FullPath + ";Persist Security Info=True", null);
     //add by klaus
     _persistBroker = PersistBrokerManager.PersistBroker(@"Provider=Microsoft.ACE.OLEDB.12.0;Password=;Data Source=" + this.FullPath + ";Persist Security Info=False", null);
     //end
     _domainDataProvider = DomainDataProviderManager.DomainDataProvider(_persistBroker, null);
     _languageHashtable  = new System.Collections.Hashtable();
     this.CacheLanguage();
 }
Example #2
0
 public static IDomainDataProvider  DomainDataProvider(IPersistBroker persistBroker, System.Globalization.CultureInfo cultureInfo)
 {
     if (cultureInfo == null)
     {
         cultureInfo = new System.Globalization.CultureInfo("en-US", false);
     }
     if (persistBroker == null)
     {
         return(new SQLDomainDataProvider(PersistBrokerManager.PersistBroker(cultureInfo), cultureInfo));
     }
     else
     {
         return(new SQLDomainDataProvider(persistBroker, cultureInfo));
     }
 }
Example #3
0
        public virtual string GetDisplayText(string fieldName)
        {
            string returnValue = string.Empty;

            FieldInfo info = this.GetType().GetField(fieldName);

            if (info != null)
            {
                returnValue = info.GetValue(this).ToString();

                if (info.IsDefined(typeof(FieldDisplayAttribute), true))
                {
                    object[] fieldDisplayList = info.GetCustomAttributes(typeof(FieldDisplayAttribute), true);
                    foreach (FieldDisplayAttribute fieldDisplay in fieldDisplayList)
                    {
                        string descString = string.Empty;

                        if (fieldDisplay.RemoteTable.Trim().Length <= 0 &&
                            fieldDisplay.RemoteField.Trim().Length > 0)
                        {
                            FieldInfo[] fieldInfoList = this.GetType().GetFields();
                            if (fieldInfoList != null)
                            {
                                foreach (FieldInfo fieldInfo in fieldInfoList)
                                {
                                    if (fieldInfo.IsDefined(typeof(FieldMapAttribute), true))
                                    {
                                        FieldMapAttribute fieldMap = (FieldMapAttribute)Attribute.GetCustomAttribute(fieldInfo, typeof(FieldMapAttribute));
                                        if (string.Compare(fieldMap.FieldName.Trim(), fieldDisplay.RemoteField.Trim(), true) == 0)
                                        {
                                            descString = fieldInfo.GetValue(this).ToString();
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            string sql = "SELECT {0} FROM {1} WHERE {2} = '{3}' ";
                            sql = string.Format(sql, fieldDisplay.RemoteField, fieldDisplay.RemoteTable, fieldDisplay.RemoteKey, info.GetValue(this).ToString());

                            IPersistBroker persistBroker = PersistBrokerManager.PersistBroker(true);
                            DataSet        result        = persistBroker.Query(sql);
                            if (result != null && result.Tables.Count > 0 && result.Tables[0].Rows.Count > 0)
                            {
                                descString = result.Tables[0].Rows[0][0].ToString();
                            }
                        }

                        if (descString.Trim().Length > 0)
                        {
                            if (fieldDisplay.ModifyType == FieldDisplayModifyType.Append)
                            {
                                returnValue += " - " + descString;
                            }
                            else if (fieldDisplay.ModifyType == FieldDisplayModifyType.Replace)
                            {
                                returnValue = descString;
                            }
                        }
                    }
                }
            }

            return(returnValue);
        }
Example #4
0
 //added by carey.cheng on 2010-05-20 for muti db support
 public static IDomainDataProvider DomainDataProvider(string ConnectDB)
 {
     return(new SQLDomainDataProvider(PersistBrokerManager.PersistBroker(ConnectDB), new System.Globalization.CultureInfo("en-US", false)));
 }
Example #5
0
 private void Init()
 {
     _persistBroker      = PersistBrokerManager.PersistBroker(@"Provider=Microsoft.Jet.OLEDB.4.0;Password=;Data Source=" + this.FullPath + ";Persist Security Info=True", null);
     _domainDataProvider = DomainDataProviderManager.DomainDataProvider(_persistBroker, null);
 }