public static void LoadButtonCoontrolTypeFromDatabaseToPublicClass() { CsConst.WholeTextsList = new List <FormDisplayTextList>(); try { string strsql = string.Format("select * from dbLanguaText order by TextIndex"); OleDbDataReader dr = DataModule.SearchAResultSQLDB(strsql, CsConst.mstrDefaultPath); if (dr != null) { while (dr.Read()) { FormDisplayTextList TmpButtonMode = new FormDisplayTextList(); TmpButtonMode.iIndexInWholeList = dr.GetInt32(0); TmpButtonMode.sMaxLimit = dr.GetInt32(1); if (dr.GetString(CsConst.iLanguageId + 2) != null) { TmpButtonMode.sDisplayName = dr.GetString(CsConst.iLanguageId + 2); } CsConst.WholeTextsList.Add(TmpButtonMode); } dr.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static int GetIfExistedTextAlready(String sName, int iMaxLimit) { int iResult = -1; try { Boolean bIsExisted = false; // 如果不存在 直接添加 if (CsConst.WholeTextsList == null || CsConst.WholeTextsList.Count == 0) { CsConst.WholeTextsList = new List <FormDisplayTextList>(); iResult = 0; } else { foreach (FormDisplayTextList tmp in CsConst.WholeTextsList) { if (tmp.sDisplayName.ToLower() == sName.ToLower()) { return(tmp.iIndexInWholeList); } } } if (bIsExisted == false) { if (iResult == -1) { iResult = CsConst.WholeTextsList.Count + 2; } //增加新的 FormDisplayTextList tmp = new FormDisplayTextList(); tmp.iIndexInWholeList = iResult; tmp.sDisplayName = sName; tmp.sMaxLimit = iMaxLimit; CsConst.WholeTextsList.Add(tmp); } return(iResult); } catch { return(iResult); } return(iResult); }