private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { lstLANGUAGE.DataSource = SplendidCache.Languages(); lstLANGUAGE.DataBind(); lstLANGUAGE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); Utils.SetValue(lstLANGUAGE, L10N.NormalizeCulture(L10n.NAME)); lstMODULE_NAME.DataSource = SplendidCache.Modules(); lstMODULE_NAME.DataBind(); lstMODULE_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); lstLIST_NAME.DataSource = SplendidCache.TerminologyPickLists(); lstLIST_NAME.DataBind(); lstLIST_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); } if (!chkINCLUDE_LISTS.Checked) { lstLIST_NAME.SelectedIndex = 0; } lstLIST_NAME.Enabled = chkINCLUDE_LISTS.Checked; if (chkGLOBAL_TERMS.Checked) { lstMODULE_NAME.SelectedIndex = 0; } lstMODULE_NAME.Enabled = !chkGLOBAL_TERMS.Checked; }
private void Page_Load(object sender, System.EventArgs e) { // 06/09/2006 Paul. Remove data binding in the user controls. Binding is required, but only do so in the ASPX pages. //this.DataBind(); // Need to bind so that Text of the Button gets updated. reqNAME.ErrorMessage = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Terminology.LBL_LIST_NAME") + "<br>"; if (!IsPostBack) { // 01/12/2006 Paul. Language cannot be null. lstLANGUAGE.DataSource = SplendidCache.Languages(); lstLANGUAGE.DataBind(); DataTable dtModules = SplendidCache.Modules().Copy(); dtModules.Rows.InsertAt(dtModules.NewRow(), 0); lstMODULE_NAME.DataSource = dtModules; lstMODULE_NAME.DataBind(); // 01/12/2006 Paul. Insert is failing, but I don't know why. // It might be because the NewRecord control is loaded using LoadControl. // Very odd as the Search Control is not having a problem inserting a value. //lstMODULE_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); DataTable dtPickLists = SplendidCache.TerminologyPickLists().Copy(); dtPickLists.Rows.InsertAt(dtPickLists.NewRow(), 0); lstLIST_NAME.DataSource = dtPickLists; lstLIST_NAME.DataBind(); //lstLIST_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); try { // 01/12/2006 Paul. Set default value to current language. // 01/12/2006 Paul. This is not working. Use client-side script to select the default. lstLANGUAGE.SelectedValue = L10N.NormalizeCulture(L10n.NAME); } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message); } //this.DataBind(); } }
private void Page_Load(object sender, System.EventArgs e) { SetPageTitle(L10n.Term(".moduleList.Terminology")); // 06/04/2006 Paul. Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load. this.Visible = SplendidCRM.Security.IS_ADMIN; if (!this.Visible) { return; } try { gID = Sql.ToGuid(Request["ID"]); if (!IsPostBack) { lstLANGUAGE.DataSource = SplendidCache.Languages(); lstLANGUAGE.DataBind(); lstMODULE_NAME.DataSource = SplendidCache.Modules(); lstMODULE_NAME.DataBind(); lstMODULE_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); lstLIST_NAME.DataSource = SplendidCache.TerminologyPickLists(); lstLIST_NAME.DataBind(); lstLIST_NAME.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); Guid gDuplicateID = Sql.ToGuid(Request["DuplicateID"]); if (!Sql.IsEmptyGuid(gID) || !Sql.IsEmptyGuid(gDuplicateID)) { DbProviderFactory dbf = DbProviderFactories.GetFactory(); using (IDbConnection con = dbf.CreateConnection()) { string sSQL; sSQL = "select * " + ControlChars.CrLf + " from vwTERMINOLOGY_Edit" + ControlChars.CrLf + " where ID = @ID " + ControlChars.CrLf; using (IDbCommand cmd = con.CreateCommand()) { cmd.CommandText = sSQL; Sql.AddParameter(cmd, "@ID", gID); con.Open(); if (bDebug) { RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd)); } using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (rdr.Read()) { ctlModuleHeader.Title = Sql.ToString(rdr["NAME"]); SetPageTitle(L10n.Term(".moduleList.Terminology") + " - " + ctlModuleHeader.Title); ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title; // 01/20/2006 Paul. Don't allow the name to be changed. Require a new term. txtNAME.ReadOnly = true; txtNAME.Text = Sql.ToString(rdr["NAME"]); txtDISPLAY_NAME.Text = Sql.ToString(rdr["DISPLAY_NAME"]); if (Sql.ToInteger(rdr["LIST_ORDER"]) > 0) { txtLIST_ORDER.Text = Sql.ToString(rdr["LIST_ORDER"]); } try { lstLANGUAGE.SelectedValue = L10N.NormalizeCulture(Sql.ToString(rdr["LANG"])); } catch { } string sMODULE_NAME = Sql.ToString(rdr["MODULE_NAME"]); try { lstMODULE_NAME.SelectedValue = sMODULE_NAME; } catch { // 01/12/2006 Paul. If module does not exist in our table, then add it to prevent data loss. lstMODULE_NAME.Items.Add(sMODULE_NAME); lstMODULE_NAME.SelectedValue = sMODULE_NAME; } try { lstLIST_NAME.SelectedValue = Sql.ToString(rdr["LIST_NAME"]); } catch { } } } } } } } else { // 12/02/2005 Paul. When validation fails, the header title does not retain its value. Update manually. ctlModuleHeader.Title = Sql.ToString(ViewState["ctlModuleHeader.Title"]); SetPageTitle(L10n.Term(".moduleList.Administration") + " - " + ctlModuleHeader.Title); } } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); ctlEditButtons.ErrorText = ex.Message; } }
private void Page_Load(object sender, System.EventArgs e) { SetPageTitle(L10n.Term(".moduleList." + m_sMODULE)); this.Visible = SplendidCRM.Security.IS_ADMIN; if (!this.Visible) { return; } try { gID = Sql.ToGuid(Request["ID"]); if (!IsPostBack) { MODULE_NAME.DataSource = SplendidCache.Modules(); MODULE_NAME.DataBind(); SHORTCUT_MODULE.DataSource = SplendidCache.Modules(); SHORTCUT_MODULE.DataBind(); SHORTCUT_MODULE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); SHORTCUT_ACLTYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), "")); if (!Sql.IsEmptyGuid(gID)) { DbProviderFactory dbf = DbProviderFactories.GetFactory(); using (IDbConnection con = dbf.CreateConnection()) { string sSQL; sSQL = "select * " + ControlChars.CrLf + " from vwSHORTCUTS_Edit" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; using (IDbCommand cmd = con.CreateCommand()) { cmd.CommandText = sSQL; Sql.AppendParameter(cmd, gID, "ID", false); con.Open(); if (bDebug) { RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd)); } using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (rdr.Read()) { ctlModuleHeader.Title = Sql.ToString(rdr["DISPLAY_NAME"]); SetPageTitle(L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title); ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title; try { MODULE_NAME.SelectedValue = Sql.ToString(rdr["MODULE_NAME"]); } catch { } DISPLAY_NAME.Text = Sql.ToString(rdr["DISPLAY_NAME"]); RELATIVE_PATH.Text = Sql.ToString(rdr["RELATIVE_PATH"]); IMAGE_NAME.Text = Sql.ToString(rdr["IMAGE_NAME"]); SHORTCUT_ENABLED.Checked = Sql.ToBoolean(rdr["SHORTCUT_ENABLED"]); if (Sql.ToInteger(rdr["SHORTCUT_ORDER"]) > 0) { SHORTCUT_ORDER.Text = Sql.ToString(rdr["SHORTCUT_ORDER"]); } try { SHORTCUT_MODULE.SelectedValue = Sql.ToString(rdr["SHORTCUT_MODULE"]); } catch { } try { SHORTCUT_ACLTYPE.SelectedValue = Sql.ToString(rdr["SHORTCUT_ACLTYPE"]); } catch { } } } } } } } else { // 12/02/2005 Paul. When validation fails, the header title does not retain its value. Update manually. ctlModuleHeader.Title = Sql.ToString(ViewState["ctlModuleHeader.Title"]); SetPageTitle(L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title); } } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); ctlEditButtons.ErrorText = ex.Message; } }