public static void LoadDictionarySelect(DropDownList ddlDict, string dictionaryName, string selectedText, string selectedValue, string projectCode) { try { EntityData dictionaryItemByNameProject = SystemManageDAO.GetDictionaryItemByNameProject(dictionaryName, projectCode); int count = dictionaryItemByNameProject.CurrentTable.Rows.Count; for (int i = 0; i < count; i++) { dictionaryItemByNameProject.SetCurrentRow(i); ListItem item = new ListItem(dictionaryItemByNameProject.GetString("Name"), dictionaryItemByNameProject.GetString("DictionaryItemCode")); ddlDict.Items.Add(item); } dictionaryItemByNameProject.Dispose(); if (selectedValue != null) { ddlDict.SelectedIndex = ddlDict.Items.IndexOf(ddlDict.Items.FindByValue(selectedValue)); } else { ddlDict.SelectedIndex = ddlDict.Items.IndexOf(ddlDict.Items.FindByText(selectedText)); } } catch (Exception exception) { throw exception; } }
public void BindSource() { try { if (this.Items.Count > 0) { this.SetValue(); } else { EntityData dictionaryItemByNameProject = SystemManageDAO.GetDictionaryItemByNameProject(this._DictionaryName, this._ProjectCode); int count = dictionaryItemByNameProject.CurrentTable.Rows.Count; this.DataSource = dictionaryItemByNameProject; this.DataTextField = "Name"; this.DataValueField = "DictionaryItemCode"; this.DataBind(); dictionaryItemByNameProject.Dispose(); } this.DefaultSelect(); } catch (Exception exception) { throw exception; } }
public void BindMoneyList() { try { if (this.DDl_MoneyTypeList.Items.Count <= 0) { if (this.Page.Cache["MoneyTypeList"] == null) { DataSet set; if (this._MoneyTypeSoure == null) { EntityData dictionaryItemByNameProject = SystemManageDAO.GetDictionaryItemByNameProject(this._DictionaryName, ""); set = dictionaryItemByNameProject; dictionaryItemByNameProject.Dispose(); } else { set = this._MoneyTypeSoure; } this.Page.Cache.Insert("MoneyTypeList", set, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(25)); } this.DDl_MoneyTypeList.DataSource = (DataSet)this.Page.Cache["MoneyTypeList"]; this.DDl_MoneyTypeList.DataTextField = "Name"; this.DDl_MoneyTypeList.DataValueField = "DictionaryItemCode"; this.DDl_MoneyTypeList.DataBind(); } } catch (Exception exception) { throw exception; } }
public static void LoadDictionarySelect(HtmlSelect sltDict, string dictionaryName, string selectedValue, string projectCode) { try { EntityData dictionaryItemByNameProject = SystemManageDAO.GetDictionaryItemByNameProject(dictionaryName, projectCode); int count = dictionaryItemByNameProject.CurrentTable.Rows.Count; for (int i = 0; i < count; i++) { dictionaryItemByNameProject.SetCurrentRow(i); sltDict.Items.Add(new ListItem(dictionaryItemByNameProject.GetString("Name"), dictionaryItemByNameProject.GetString("Name"))); } dictionaryItemByNameProject.Dispose(); sltDict.Value = selectedValue; } catch (Exception exception) { throw exception; } }