private void PopulateGroupList() { IList <Plugin> pluginList = PluginManager.GetPluginList(PluginType.ACOGroup, "CONTACT", true, false); foreach (var group in pluginList) { if (!string.IsNullOrEmpty(group.DisplayName)) { group.Name = group.DisplayName; } } ddlContactGroup.DataSource = pluginList; ddlContactGroup.DataTextField = "Name"; ddlContactGroup.DataValueField = "PluginId"; ddlContactGroup.DataBind(); GroupContext ctx = GroupContext.GetGroupContext(); if (ctx != null && !string.IsNullOrEmpty(ctx.CurrentTable) && ctx.CurrentTable.ToUpperInvariant().Equals("CONTACT")) { try { ddlContactGroup.SelectedValue = ctx.CurrentGroupID; } catch (Exception e) { Log.WarnFormat("Unable to set Contact group dropdown list to group {0}. {1}", ctx.CurrentGroupID, e); } } }
/// <summary> /// Initialization of the page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack && Visible) { object o = null; DialogService.DialogParameters.TryGetValue("SelectedGroupID", out o); if (o != null) { string groupId = o.ToString(); Page.Session["SelectedGroupID"] = groupId; if (GroupContext.GetGroupContext().CurrentGroupID == groupId && cbxGroupName.Items.Count == 0) { string entity = GroupContext.GetGroupContext().CurrentEntity.ToUpper(); InitializeGroupList(entity); if (!rbAccts.Checked) { rbAccts.Checked = (entity.Equals("ACCOUNT")); } if (!rbCntcts.Checked) { rbCntcts.Checked = (entity.Equals("CONTACT")); } cbxGroupName.SelectedValue = (string)Page.Session["SelectedGroupID"]; cbxGroupName.Enabled = false; } //rbAccts_lbl.Visible = rbAccts.Visible = false; //rbCntcts_lbl.Visible = rbCntcts.Visible = false; } else { Page.Session["SelectedGroupID"] = null; InitializeRadioButtons(); if (cbxGroupName.Items.Count == 0) { InitializeGroupList("ACCOUNT"); } } Page.Session["MapVisible"] = false; InitializeDefaultSortMethod(); InitializeLocationItems(); InitializeDisplayRadius(); //cbxCenterLoc.Items.Add("63114"); //cbxCenterLoc.Text = "63114"; } DataBind(); }
/// <summary> /// /// </summary> /// <param name="grpType">"ACCOUNT" or "CONTACT"</param> private void InitializeGroupList(string grpType) { cbxGroupName.Items.Clear(); GroupContext.GetGroupContext().CurrentTable = grpType; EntityGroupInfo groupCache = GroupContext.GetGroupContext().GetGroupInfoForTable(grpType); foreach (var gi in groupCache.GroupsList) { cbxGroupName.Items.Add(new ListItem(gi.GroupName, gi.GroupID)); } }
protected void Page_Load(object sender, EventArgs e) { //ScriptManager.RegisterClientScriptBlock( // Page, // typeof(Page), // "filter-client-script", // String.Format( // @"<script pin=""pin"" type=""text/javascript"" src=""{0}""></script>", // Page.ClientScript.GetWebResourceUrl(typeof(Sage.SalesLogix.Client.GroupBuilder.BaseFilter), "Sage.SalesLogix.Client.GroupBuilder.jscript.Filter_ClientScript.js") // ), // false); /* * ScriptManager.GetCurrent(Page).Scripts.Add( * new ScriptReference("Sage.SalesLogix.Client.GroupBuilder.jscript.Filter_ClientScript.js", * "Sage.SalesLogix.Client.GroupBuilder")); */ StringBuilder script = new StringBuilder(); script.AppendFormat( "var {0};$(document).ready(function(){{if (!{0} && (Sage.FilterManager)){{ {0} = new Sage.FilterManager({{id: \"{0}\",clientId: \"{1}\", allText: \"({2})\"}});{0}.init();}}}});", ID, ClientID, GetLocalResourceObject("All").ToString()); script.AppendFormat("Sage.FilterStrings={{\"allText\": \"({0})\"}};", GetLocalResourceObject("All").ToString()); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), ID, script.ToString(), true); HyperLink clear = new HyperLink(); clear.NavigateUrl = string.Format("javascript:{0}.ClearFilters();", ID); clear.Text = GetLocalResourceObject("Clear_Filters").ToString(); clear.Attributes.Add("style", "display: block; margin-bottom: 0.5em"); this.Controls.Add(clear); GroupContext groupContext = GroupContext.GetGroupContext(); string entity = groupContext.CurrentEnity; entity = string.IsNullOrEmpty(entity) ? "Activity" : entity; IList <BaseFilter> filterList = FilterManager.GetFiltersForEntity(entity, this.Page.Server.MapPath(@"Filters\")); foreach (BaseFilter f in filterList) { this.Controls.Add(f); } edit.NavigateUrl = string.Format("javascript:{0}.EditFilters();", ID); edit.Text = GetLocalResourceObject("Edit_Filters").ToString(); }
protected void ddlReports_TextChanged(object sender, EventArgs e) { Plugin report = new Plugin(); string reportURL = ""; GroupContext groupContext = GroupContext.GetGroupContext(); GroupInfo groupInfo = new GroupInfo(); groupInfo.GroupID = groupContext.CurrentGroupID; switch (ddlReports.Text) { case "None": break; case "Sales Process Stage Analysis": report = Sage.SalesLogix.Plugins.Plugin.LoadByName("Sales Process Stage Analysis", "Opportunity", Sage.SalesLogix.Plugins.PluginType.CrystalReport); break; case "Sales Process Step Usage": report = Sage.SalesLogix.Plugins.Plugin.LoadByName("Sales Process Step Usage", "Opportunity", Sage.SalesLogix.Plugins.PluginType.CrystalReport); break; //case "Quota vs. Actual Sales": // report = Sage.SalesLogix.Plugins.Plugin.LoadByName("Quota Vs. Actual Sales", "Opportunity", Sage.SalesLogix.Plugins.PluginType.CrystalReport); // break; case "Forecast by Account Manager": report = Sage.SalesLogix.Plugins.Plugin.LoadByName("Forecast by Account Manager", "Opportunity", Sage.SalesLogix.Plugins.PluginType.CrystalReport); break; //case "Competetive Analysis": // report = Sage.SalesLogix.Plugins.Plugin.LoadByName("Competetive Analysis", "Opportunity", Sage.SalesLogix.Plugins.PluginType.CrystalReport); // break; } if (report.PluginId != null) { reportURL = "~/ReportManager.aspx?showthisreport=" + report.PluginId + "&showrptfamily=" + report.Family + "&filterbygroupid=" + groupInfo.GroupID; Response.Redirect(reportURL); } }
/// <summary> /// Saves the options. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void SaveOption(object sender, EventArgs e) { IUserOptionsService userOption = ApplicationContext.Current.Services.Get <IUserOptionsService>(); userOption.SetCommonOption(DefaultGroupOptionName(), "DefaultGroup", GetFamNameFromId(ddlGroup.SelectedValue), false); userOption.SetCommonOption(DefaultGroupOptionName(), "LookupLayoutGroup", GetFamNameFromId(ddlLookupLayoutGroup.SelectedValue), false); var egis = GroupContext.GetGroupContext().EntityGroupInfos; if (egis != null) { foreach (var egi in egis) { if (egi.EntityName.Equals(DefaultGroupOptionName(), StringComparison.OrdinalIgnoreCase)) { egi.ClearCache(true); break; } } } userOption.SetCommonOption("defaultLookupCondition", "DefaultLookupCondition", ddlDefaultSearchCondition.SelectedValue, false); }
/// <summary> /// Saves the options. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void SaveOption(object sender, EventArgs e) { IUserOptionsService userOption = ApplicationContext.Current.Services.Get <IUserOptionsService>(); userOption.SetCommonOption(DefaultGroupOptionName(), "DefaultGroup", GetFamNameFromId(ddlGroup.SelectedValue), false); userOption.SetCommonOption(DefaultGroupOptionName(), "LookupLayoutGroup", GetFamNameFromId(ddlLookupLayoutGroup.SelectedValue), false); var egis = GroupContext.GetGroupContext().EntityGroupInfos; if (egis != null) { foreach (var egi in egis) { if (egi.EntityName.Equals(DefaultGroupOptionName(), StringComparison.OrdinalIgnoreCase)) { egi.ClearCache(true); break; } } } userOption.SetCommonOption("autoFitColumns", "GroupGridView", cbAutoFitColumns.Checked.ToString(CultureInfo.InvariantCulture), false); }
protected void LoadGrid() { if (this.Visible) { GenerateScript(); EnableEstCloseControls(); GroupContext groupContext = GroupContext.GetGroupContext(); string fromSQL = null; string whereSQL = null; string selectSQL = null; string groupSQL = null; //string joinSQL = null; IList <DbParameter> parameters; if (groupContext.CurrentGroupID != "LOOKUPRESULTS") { GroupInfo groupInfo = new GroupInfo(); groupInfo.GroupID = groupContext.CurrentGroupID; fromSQL = groupInfo.FromSQL; whereSQL = groupInfo.WhereSQL; parameters = groupInfo.Parameters; } else { CachedGroup groupInfo = groupContext.CurrentGroupInfo.CurrentGroup; fromSQL = groupInfo.GroupInformation.FromSQL; whereSQL = groupInfo.GroupInformation.WhereSQL; parameters = groupInfo.GroupInformation.Parameters; } // the joing caused ambiguous columns in the select clause so aliases had to be specified. // I made an assumption that opportunity is a required table and that the format of the // query would remain the same. Shaky at best, I know. //string opportunityAlias = null; //int startIndex = fromSQL.ToLower().IndexOf("opportunity ") + "opportunity ".Length; //int stringLength = fromSQL.ToLower().IndexOf(" ", startIndex); //opportunityAlias = fromSQL.Substring(startIndex, stringLength - startIndex); //if (whereSQL != "") // whereSQL = " WHERE " + whereSQL; //selectSQL = "SELECT opportunityid, " + opportunityAlias + ".description, estimatedclose, closeprobability, addtoforecast, " + opportunityAlias + ".notes, salespotential, UserInfoCustom.LastName + ', ' + UserInfoCustom.FirstName as AccountManager"; //joinSQL = "LEFT OUTER JOIN USERINFO UserInfoCustom ON (" + opportunityAlias + ".AccountManagerId = UserInfoCustom.USERID)"; //groupSQL = selectSQL + " FROM " + fromSQL + " " + joinSQL + " " + whereSQL; if (whereSQL != "") { whereSQL = " WHERE " + whereSQL; } selectSQL = "SELECT opportunityid, description, estimatedclose, closeprobability, accountmanagerid, addtoforecast, notes, salespotential"; groupSQL = selectSQL + " FROM " + fromSQL + " " + whereSQL; var vConn = GroupInfo.GetOpenConnection(); var vAdapter = new OleDbDataAdapter(groupSQL, vConn as OleDbConnection); foreach (DbParameter p in parameters) { vAdapter.SelectCommand.Parameters.Add(p); } DataTable dt = new DataTable(); try { using (new SparseQueryScope()) { vAdapter.Fill(dt); } } catch { //throw new GroupInfoException(string.Format("Error Executing SQL", groupSQL), e); throw new Exception("Error Executing SQL"); } finally { vConn.Close(); } UpdateOppsGrid.DataSource = dt; UpdateOppsGrid.DataBind(); CalcOppValues(); } }
protected void Page_Load(object sender, EventArgs e) { try { GroupContext groupContext = GroupContext.GetGroupContext(); GroupInfo groupInfo = new GroupInfo(); groupInfo.GroupID = groupContext.CurrentGroupID; string fromSQL = groupInfo.FromSQL; string whereSQL = groupInfo.WhereSQL; if (whereSQL != "") { whereSQL = "WHERE " + whereSQL; } string selectSQL = "SELECT SALESPOTENTIAL, CLOSEPROBABILITY, ACTUALAMOUNT, DATEOPENED, CLOSED, ESTIMATEDCLOSE "; string groupSQL = selectSQL + "FROM " + fromSQL + " " + whereSQL; using (new SparseQueryScope()) using (IDbConnection vConn = GroupInfo.GetOpenConnection()) { OleDbDataAdapter vAdapter = new OleDbDataAdapter(groupSQL, vConn as OleDbConnection); foreach (DbParameter p in groupInfo.Parameters) { vAdapter.SelectCommand.Parameters.Add(p); } vAdapter.SelectCommand.Prepare(); DataTable dt = new DataTable(); vAdapter.Fill(dt); if (dt.Rows.Count != 0) { GetNumOfOpportunities(dt); GetPotentialValues(dt); GetAverageCloseProb(dt); GetActualAmountValues(dt); GetAverageDaysOpen(dt); GetRangeofDates(dt); } else { lblNumOfOppsVal.Text = "0"; curSalesPotentialTotalVal.Text = "0"; curSalesPotentialAverageVal.Text = "0"; curWeightedPotentialAverageVal.Text = "0"; curWeightedPotentialTotalVal.Text = "0"; lblAverageCloseProbabilityVal.Text = "0"; curActualAmountTotalVal.Text = "0"; curActualAmountAverageVal.Text = "0"; lblAverageNumOfDaysOpenVal.Text = "0"; lblRangeOfEstCloseVal.Text = GetLocalResourceObject("None_rsc").ToString(); } } } catch //Group didn't contain any records disable active controls { btnUpdateOpps.Enabled = false; ddlReports.Enabled = false; } }