/// <summary> /// Area3 ComboBox Refresh /// </summary> protected void OnArea3Refresh(object sender, StoreRefreshDataEventArgs e) { try { var data = new List <object>(); data.Add(new { Id = WebUtility.DefaultItemID, Name = WebUtility.DefaultItemName }); if (LscsComboBox.SelectedIndex > 0) { var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value); if (ids.Length == 2) { var lscId = Int32.Parse(ids[0]); var groupId = Int32.Parse(ids[1]); var comboboxEntity = new BComboBox(); var area2Id = Area2ComboBox.SelectedIndex > 0 ? Int32.Parse(Area2ComboBox.SelectedItem.Value) : WebUtility.DefaultInt32; var dict = comboboxEntity.GetArea3(lscId, area2Id, groupId); if (dict != null && dict.Count > 0) { foreach (var key in dict) { data.Add(new { Id = key.Key, Name = key.Value }); } } } } Area3Store.DataSource = data; Area3Store.DataBind(); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); WebUtility.ShowMessage(EnmErrType.Error, err.Message); } }
/// <summary> /// Lsc ComboBox Refresh /// </summary> protected void OnLscsRefresh(object sender, StoreRefreshDataEventArgs e) { try { var data = new List <object>(); data.Add(new { Id = WebUtility.DefaultLscID, Name = WebUtility.DefaultItemName }); var lscIds = new Dictionary <int, int>(); var lscUsers = UserData.LscUsers; foreach (var lscUser in lscUsers) { lscIds.Add(lscUser.LscID, lscUser.Group.GroupID); } if (lscIds.Count > 0) { var comboBoxEntity = new BComboBox(); var dict = comboBoxEntity.GetLscs(lscIds); if (dict != null && dict.Count > 0) { foreach (var key in dict) { data.Add(new { Id = key.Key, Name = key.Value }); } } } LscsStore.DataSource = data; LscsStore.DataBind(); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); WebUtility.ShowMessage(EnmErrType.Error, err.Message); } }
/// <summary> /// Station Type ComboBox Refresh /// </summary> protected void OnStaTypeRefresh(object sender, StoreRefreshDataEventArgs e) { try { var data = new List <object>(); var comboboxEntity = new BComboBox(); var dict = comboboxEntity.GetStaTypes(); if (dict != null && dict.Count > 0) { foreach (var key in dict) { data.Add(new { Id = key.Key, Name = key.Value }); } } StaTypeStore.DataSource = data; StaTypeStore.DataBind(); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); WebUtility.ShowMessage(EnmErrType.Error, err.Message); } }
/// <summary> /// Set BComboBox Data /// </summary> /// <param name="bcbo">BComboBox</param> /// <param name="ds">DataSet</param> /// <param name="displaymember">Display Member</param> /// <param name="valuemember">Value Member</param> /// <param name="filter">Filtering by DataTable Select Function</param> /// <param name="sort">Sort by DataTable Select Function </param> /// <param name="selectvalue">Default Select Value</param> /// <param name="InsertCustomText">Add Custom Text (ex> ALL, SELECT)</param> /// <param name="isDefaultSelect">if default select value is not exist, it will select first Item</param> public void SetBComboBoxData(BComboBox bcbo, DataSet ds, string displaymember, string valuemember, string filter, string sort, string selectvalue, string InsertCustomText, bool isDefaultSelect) { DataSet dsSource = null; bcbo.DataSource = null; if (ds.Tables.Count > 0) { if (displaymember.Length > 0) { bcbo.DisplayMember = displaymember; } if (valuemember.Length > 0) { bcbo.ValueMember = valuemember; } if (filter.Length > 0) { dsSource = ds.Clone(); if (InsertCustomText.Length > 0) { DataRow drCTxt = dsSource.Tables[0].NewRow(); drCTxt[displaymember] = InsertCustomText; drCTxt[valuemember] = InsertCustomText; dsSource.Tables[0].Rows.Add(drCTxt); } DataRow[] drFilters = null; if (sort.Length > 0) { drFilters = ds.Tables[0].Select(filter, sort); } else { drFilters = ds.Tables[0].Select(filter, sort); } foreach (DataRow drFilter in drFilters) { dsSource.Tables[0].ImportRow(drFilter); } } else { if (InsertCustomText.Length > 0) { dsSource = ds.Copy(); DataRow drCTxt = dsSource.Tables[0].NewRow(); drCTxt[displaymember] = InsertCustomText; drCTxt[valuemember] = InsertCustomText; dsSource.Tables[0].Rows.InsertAt(drCTxt, 0); } else { dsSource = ds; } } bcbo.DataSource = dsSource.Tables[0]; if (dsSource.Tables[0].Rows.Count > 0) { if (selectvalue.Length > 0) { bcbo.SelectedValue = selectvalue; } else if (isDefaultSelect) { bcbo.SelectedValue = dsSource.Tables[0].Rows[0][valuemember].ToString(); } else { bcbo.SelectedIndex = -1; } } } }
/// <summary> /// Set BComboBox Data /// </summary> /// <param name="bcbo">BComboBox</param> /// <param name="ds">DataSet</param> /// <param name="displaymember">Display Member</param> /// <param name="valuemember">Value Member</param> /// <param name="filter">Filtering By DataTable Select Fuction</param> /// <param name="sort">Sort By DataTable Select Function</param> /// <param name="selectvalue">Default Select Value</param> /// <param name="isDefaultSelect">if default select value is not exist, it will select first Item</param> public void SetBComboBoxData(BComboBox bcbo, DataSet ds, string displaymember, string valuemember, string filter, string sort, string selectvalue, bool isDefaultSelect) { SetBComboBoxData(bcbo, ds, displaymember, valuemember, filter, sort, selectvalue, "", isDefaultSelect); }
/// <summary> /// Set BComboBox Data /// </summary> /// <param name="bcbo">BComboBox</param> /// <param name="ds">DataSet</param> /// <param name="displaymember">Display Member</param> /// <param name="valuemember">Value Member</param> /// <param name="selectvalue">Default Select Value</param> /// <param name="InsertCustomText">Add Custom Text (ex> ALL, SELECT)</param> /// <param name="isDefaultSelect">if default select value is not exist, it will select first Item</param> public void SetBComboBoxData(BComboBox bcbo, DataSet ds, string displaymember, string valuemember, string selectvalue, string InsertCustomText, bool isDefaultSelect) { SetBComboBoxData(bcbo, ds, displaymember, valuemember, "", "", selectvalue, InsertCustomText, isDefaultSelect); }