protected void AppendDetailViewRelationships(string sDETAIL_NAME, PlaceHolder plc) { DataTable dtFields = SplendidCache.DetailViewRelationships(sDETAIL_NAME); foreach (DataRow row in dtFields.Rows) { string sMODULE_NAME = Sql.ToString(row["MODULE_NAME"]); string sCONTROL_NAME = Sql.ToString(row["CONTROL_NAME"]); // 04/27/2006 Paul. Only add the control if the user has access. if (Security.GetUserAccess(sMODULE_NAME, "list") >= 0) { try { Control ctl = LoadControl(sCONTROL_NAME + ".ascx"); plc.Controls.Add(ctl); } catch (Exception ex) { Label lblError = new Label(); // 06/09/2006 Paul. Catch the error and display a message instead of crashing. lblError.ID = "lblDetailViewRelationshipsError"; lblError.Text = Utils.ExpandException(ex); lblError.ForeColor = System.Drawing.Color.Red; lblError.EnableViewState = false; plc.Controls.Add(lblError); } } } }
private void Page_Load(object sender, System.EventArgs e) { // 09/09/2007 Paul. We are having trouble dynamically adding user controls to the WebPartZone. // Instead, control visibility manually here. This approach as the added benefit of hiding the // control even if the WebPartManager has moved it to an alternate zone. if (this.Visible && this.Visible && !Sql.IsEmptyString(sDetailView)) { // 01/17/2008 Paul. We need to use the sDetailView property and not the hard-coded view name. DataView vwFields = new DataView(SplendidCache.DetailViewRelationships(sDetailView)); vwFields.RowFilter = "CONTROL_NAME = '~/Calendar/MyCalendar'"; this.Visible = vwFields.Count > 0; } if (!this.Visible) { return; } ctlCalendar.NextPrevFormat = NextPrevFormat.CustomText; ctlCalendar.PrevMonthText = "<div class=\"monthFooterPrev\"><img src=\"" + Session["themeURL"] + "images/calendar_previous.gif\" width=\"6\" height=\"9\" alt=\"" + L10n.Term("Calendar.LBL_PREVIOUS_MONTH") + "\" align=\"absmiddle\" border=\"0\"> " + L10n.Term("Calendar.LBL_PREVIOUS_MONTH").Replace(" ", " ") + "</div>"; ctlCalendar.NextMonthText = "<div class=\"monthFooterNext\">" + L10n.Term("Calendar.LBL_NEXT_MONTH").Replace(" ", " ") + " <img src=\"" + Session["themeURL"] + "images/calendar_next.gif\" width=\"6\" height=\"9\" alt=\"" + L10n.Term("Calendar.LBL_NEXT_MONTH") + "\" align=\"absmiddle\" border=\"0\"></div>"; if (Information.IsDate(Request["Date"])) { ctlCalendar.VisibleDate = Sql.ToDateTime(Request["Date"]); ctlCalendar.SelectedDate = Sql.ToDateTime(Request["Date"]); } }
private void Page_Load(object sender, System.EventArgs e) { // 09/09/2006 Paul. Visibility is already controlled by the ASPX page, // but since this control is used on the home page, we need to apply the module specific rules. // 11/05/2007 Paul. Don't show panel if it was manually hidden. this.Visible = this.Visible && (SplendidCRM.Security.GetUserAccess(m_sMODULE, "list") >= 0); // 09/09/2007 Paul. We are having trouble dynamically adding user controls to the WebPartZone. // Instead, control visibility manually here. This approach as the added benefit of hiding the // control even if the WebPartManager has moved it to an alternate zone. if (this.Visible && !Sql.IsEmptyString(sDetailView)) { // 01/17/2008 Paul. We need to use the sDetailView property and not the hard-coded view name. DataView vwFields = new DataView(SplendidCache.DetailViewRelationships(sDetailView)); vwFields.RowFilter = "CONTROL_NAME = '~/Activities/MyActivities'"; this.Visible = vwFields.Count > 0; } if (!this.Visible) { return; } if (!IsPostBack) { lstTHROUGH.DataSource = SplendidCache.List("appointment_filter_dom"); lstTHROUGH.DataBind(); } Bind(); }
protected void AppendDetailViewRelationships(string sDETAIL_NAME, PlaceHolder plc) { DataTable dtFields = SplendidCache.DetailViewRelationships(sDETAIL_NAME); foreach (DataRow row in dtFields.Rows) { string sMODULE_NAME = Sql.ToString(row["MODULE_NAME"]); string sCONTROL_NAME = Sql.ToString(row["CONTROL_NAME"]); // 04/27/2006 Paul. Only add the control if the user has access. if (Security.GetUserAccess(sMODULE_NAME, "list") >= 0) { Control ctl = LoadControl(sCONTROL_NAME + ".ascx"); plc.Controls.Add(ctl); } } }
protected void AppendDetailViewRelationships(string sDETAIL_NAME, PlaceHolder plc) { // 11/17/2007 Paul. Convert all view requests to a mobile request if appropriate. sDETAIL_NAME = sDETAIL_NAME + (this.IsMobile ? ".Mobile" : ""); DataTable dtFields = SplendidCache.DetailViewRelationships(sDETAIL_NAME); foreach (DataRow row in dtFields.Rows) { string sMODULE_NAME = Sql.ToString(row["MODULE_NAME"]); string sCONTROL_NAME = Sql.ToString(row["CONTROL_NAME"]); // 04/27/2006 Paul. Only add the control if the user has access. if (Security.GetUserAccess(sMODULE_NAME, "list") >= 0) { Control ctl = LoadControl(sCONTROL_NAME + ".ascx"); plc.Controls.Add(ctl); } } }
private void Page_Load(object sender, System.EventArgs e) { // 11/05/2007 Paul. Don't show panel if it was manually hidden. this.Visible = this.Visible && (SplendidCRM.Security.GetUserAccess(m_sMODULE, "list") >= 0); // 09/09/2007 Paul. We are having trouble dynamically adding user controls to the WebPartZone. // Instead, control visibility manually here. This approach as the added benefit of hiding the // control even if the WebPartManager has moved it to an alternate zone. if (this.Visible && this.Visible && !Sql.IsEmptyString(sDetailView)) { // 01/17/2008 Paul. We need to use the sDetailView property and not the hard-coded view name. DataView vwFields = new DataView(SplendidCache.DetailViewRelationships(sDetailView)); vwFields.RowFilter = "CONTROL_NAME = '~/Opportunities/MyPipeline'"; this.Visible = vwFields.Count > 0; } if (!this.Visible) { return; } valDATE_START.ErrorMessage = L10n.Term(".ERR_INVALID_DATE"); valDATE_END.ErrorMessage = L10n.Term(".ERR_INVALID_DATE"); if (!IsPostBack) { lstSALES_STAGE.DataSource = SplendidCache.List("sales_stage_dom"); lstSALES_STAGE.DataBind(); // 09/14/2005 Paul. Default to today, and all sales stages. foreach (ListItem item in lstSALES_STAGE.Items) { item.Selected = true; } // 07/09/2006 Paul. The date is passed in TimeZone time, so convert from server time. ctlDATE_START.Value = T10n.FromServerTime(DateTime.Today); ctlDATE_END.Value = T10n.FromServerTime(new DateTime(2100, 1, 1)); // 09/15/2005 Paul. Maintain the pipeline query string separately so that we can respond to specific submit requests // and ignore all other control events on the page. ViewState["MyPipelineQueryString"] = PipelineQueryString(); } }
private void Page_Load(object sender, System.EventArgs e) { // 09/09/2006 Paul. Visibility is already controlled by the ASPX page, // but since this control is used on the home page, we need to apply the module specific rules. // 11/05/2007 Paul. Don't show panel if it was manually hidden. this.Visible = this.Visible && (SplendidCRM.Security.GetUserAccess(m_sMODULE, "list") >= 0); // 09/09/2007 Paul. We are having trouble dynamically adding user controls to the WebPartZone. // Instead, control visibility manually here. This approach as the added benefit of hiding the // control even if the WebPartManager has moved it to an alternate zone. if (this.Visible && this.Visible && !Sql.IsEmptyString(sDetailView)) { // 01/17/2008 Paul. We need to use the sDetailView property and not the hard-coded view name. DataView vwFields = new DataView(SplendidCache.DetailViewRelationships(sDetailView)); vwFields.RowFilter = "CONTROL_NAME = '~/Contacts/MyContacts'"; this.Visible = vwFields.Count > 0; } if (!this.Visible) { return; } DbProviderFactory dbf = DbProviderFactories.GetFactory(); using (IDbConnection con = dbf.CreateConnection()) { string sSQL; sSQL = "select * " + ControlChars.CrLf + " from vwCONTACTS_MyList" + ControlChars.CrLf; using (IDbCommand cmd = con.CreateCommand()) { cmd.CommandText = sSQL; // 11/24/2006 Paul. Use new Security.Filter() function to apply Team and ACL security rules. Security.Filter(cmd, m_sMODULE, "list"); Sql.AppendParameter(cmd, Security.USER_ID, "ASSIGNED_USER_ID", false); if (bDebug) { RegisterClientScriptBlock("vwCONTACTS_List", Sql.ClientScriptBlock(cmd)); } try { using (DbDataAdapter da = dbf.CreateDataAdapter()) { ((IDbDataAdapter)da).SelectCommand = cmd; using (DataTable dt = new DataTable()) { da.Fill(dt); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.SortColumn = "DATE_ENTERED"; grdMain.SortOrder = "desc"; grdMain.ApplySort(); } // 09/15/2005 Paul. We must always bind, otherwise a Dashboard refresh will display the grid with empty rows. grdMain.DataBind(); } } } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); lblError.Text = ex.Message; } } } if (!IsPostBack) { // 06/09/2006 Paul. Remove data binding in the user controls. Binding is required, but only do so in the ASPX pages. //Page.DataBind(); } }