Thursday, January 08, 2009 ..:: Forums ::.. Register  Login
 Forums Minimize
SearchForum Home
     
  Mainstream Forums  General Discussion  Campaign and Ac...
 Re: Campaign and Accounts
 
support
2240 posts
1st
Joined
1/3/2006

Re: Campaign and Accounts
Posted: 04 Sep 07 2:43 PM

Instead of AccountList, just use Accounts.  In SplendidCRM, we have a Prospects table and we have Prospect Lists table.  So, all references to ProspectLists would be renamed to Accounts, all references to PROSPECT_LISTS would be renamed to ACCOUNTS, and all PROSPECT_LIST_ID should be renamed to ACCOUNT_ID.

It sounds like you are almost done.  Just recompile, get rid of all errors and you should be done.

We still recommend that you compile using Web Application Projects, but if you insist on using Web Site Projects, then place the new files in ~/App_Code/Campaigns.  You should not need to change anything in the ~/App_Code/ProspectLists folder.

 

 

july
43 posts
Joined
3/30/2007

Re: Campaign and Accounts
Posted: 04 Sep 07 5:13 PM
Thanks for reply... but after creating  AccountList.ascx file... how can I use it?? Where I must to insert this page?

If I want to add Accounts in campaigns I must to see this page in my CRM....where insert it??

Thanks
support
2240 posts
1st
Joined
1/3/2006

Re: Campaign and Accounts
Posted: 04 Sep 07 8:27 PM

By adding the record to the DETAILVIEWS_RELATIONSHIPS table, SplendidCRM will automatically load the AccountList.ascx

 

july
43 posts
Joined
3/30/2007

Re: Campaign and Accounts
Posted: 06 Sep 07 7:25 AM

Thanks for help me!

I've renamed AccountList file and class to Accounts.... as you tell me!
in the table DETAILVIEWS_RELATIONSHIPS
ba04dea2-fcf0-4e66-9e0c-1d1dc03fe233 False NULL 06/08/2007 0.00.00 NULL 06/08/2007 0.00.00 Campaigns.DetailView Accounts Accounts 4

I've created Accounts.ascx and Accounts.ascx.cs files

Accounts.ascx


<%@ Control CodeBehind="Accounts.ascx.cs" Language="c#" AutoEventWireup="false" Inherits="SplendidCRM.Campaigns.Accounts" %>
<script type="text/javascript">
function ChangeProspectList(sPARENT_ID, sPARENT_NAME)
{
 document.getElementById('<%= txtPROSPECT_LIST_ID.ClientID %>').value = sPARENT_ID  ;
 document.forms[0].submit();
}
function ProspectListPopup()
{
 return window.open('../ProspectLists/Popup.aspx?ClearDisabled=1','ProspectListPopup','width=600,height=400,resizable=1,scrollbars=1');
}
</script>
<div id="divCampaignsProspectLists">
 <input ID="txtPROSPECT_LIST_ID" type="hidden" Runat="server" />
 <br>
 <%@ Register TagPrefix="SplendidCRM" Tagname="ListHeader" Src="~/_controls/ListHeader.ascx" %>
 <SplendidCRM:ListHeader Title="ProspectLists.LBL_MODULE_NAME" Runat="Server" />
 
 <table width="100%" border="0" cellpadding="0" cellspacing="0" Visible="<%# !PrintView %>" runat="server">
  <tr>
   <td style="padding-bottom: 2px;">
    <asp:Button Visible='<%# SplendidCRM.Security.GetUserAccess("ProspectLists", "edit") >= 0 %>' CommandName="ProspectLists.Create" OnCommand="Page_Command" CssClass="button" Text='<%# "  " + L10n.Term(".LBL_NEW_BUTTON_LABEL"   ) + "  " %>' title='<%# L10n.Term(".LBL_NEW_BUTTON_TITLE"   ) %>' AccessKey='<%# L10n.AccessKey(".LBL_NEW_BUTTON_KEY"   ) %>' Runat="server" />
    <input type="button" class="button" onclick="return ProspectListPopup();" title="<%# L10n.Term(".LBL_SELECT_BUTTON_TITLE") %>" accessKey="<%# L10n.Term(".LBL_SELECT_BUTTON_KEY") %>" value="<%# L10n.Term(".LBL_SELECT_BUTTON_LABEL") %>" />
    <asp:Label ID="lblError" ForeColor="Red" EnableViewState="false" Runat="server" />
   </td>
  </tr>
 </table>

 <SplendidCRM:SplendidGrid id="grdMain" Width="100%" CssClass="listView"
  CellPadding="3" CellSpacing="0" border="0"
  AllowPaging="false" PageSize="20" AllowSorting="false"
  AutoGenerateColumns="false"
  EnableViewState="true" runat="server">
  <ItemStyle            CssClass="oddListRowS1"  />
  <AlternatingItemStyle CssClass="evenListRowS1" />
  <HeaderStyle          CssClass="listViewThS1"  />
  <PagerStyle HorizontalAlign="Right" Mode="NextPrev" PageButtonCount="6" Position="Top" CssClass="listViewPaginationTdS1" PrevPageText=".LNK_LIST_PREVIOUS" NextPageText=".LNK_LIST_NEXT" />
  <Columns>
   <asp:TemplateColumn HeaderText="" ItemStyle-Width="1%" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="false">
    <ItemTemplate>
     <asp:ImageButton Visible='<%# SplendidCRM.Security.GetUserAccess("ProspectLists", "edit", Sql.ToGuid(DataBinder.Eval(Container.DataItem, "ASSIGNED_USER_ID"))) >= 0 %>' CommandName="ProspectLists.Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PROSPECT_LIST_ID") %>' OnCommand="Page_Command" CssClass="listViewTdToolsS1" AlternateText='<%# L10n.Term(".LNK_EDIT") %>' ImageUrl='<%# Session["themeURL"] + "images/edit_inline.gif" %>' BorderWidth="0" Width="12" Height="12" ImageAlign="AbsMiddle" Runat="server" />
     <asp:LinkButton  Visible='<%# SplendidCRM.Security.GetUserAccess("ProspectLists", "edit", Sql.ToGuid(DataBinder.Eval(Container.DataItem, "ASSIGNED_USER_ID"))) >= 0 %>' CommandName="ProspectLists.Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PROSPECT_LIST_ID") %>' OnCommand="Page_Command" CssClass="listViewTdToolsS1" Text='<%# L10n.Term(".LNK_EDIT") %>' Runat="server" />
     &nbsp;
     <span onclick="return confirm('<%= L10n.TermJavaScript("ProspectLists.PROSPECT_REMOVE_PROSPECT_LISTS_CONFIRM") %>')">
      <asp:ImageButton Visible='<%# SplendidCRM.Security.GetUserAccess("Campaigns", "edit", Sql.ToGuid(DataBinder.Eval(Container.DataItem, "CAMPAIGN_ASSIGNED_USER_ID"))) >= 0 %>' CommandName="ProspectLists.Remove" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PROSPECT_LIST_ID") %>' OnCommand="Page_Command" CssClass="listViewTdToolsS1" AlternateText='<%# L10n.Term(".LNK_REMOVE") %>' ImageUrl='<%# Session["themeURL"] + "images/delete_inline.gif" %>' BorderWidth="0" Width="12" Height="12" ImageAlign="AbsMiddle" Runat="server" />
      <asp:LinkButton  Visible='<%# SplendidCRM.Security.GetUserAccess("Campaigns", "edit", Sql.ToGuid(DataBinder.Eval(Container.DataItem, "CAMPAIGN_ASSIGNED_USER_ID"))) >= 0 %>' CommandName="ProspectLists.Remove" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PROSPECT_LIST_ID") %>' OnCommand="Page_Command" CssClass="listViewTdToolsS1" Text='<%# L10n.Term(".LNK_REMOVE") %>' Runat="server" />
     </span>
    </ItemTemplate>
   </asp:TemplateColumn>
  </Columns>
 </SplendidCRM:SplendidGrid>
</div>

 

 


Accounts.ascx.cs


namespace SplendidCRM.Campaigns
{
 /// <summary>
 ///  Summary description for ProspectLists.
 /// </summary>
    public class Accounts : SplendidControl
 {
  protected Guid            gID                ;
  protected DataView        vwMain             ;
  protected SplendidGrid    grdMain            ;
  protected Label           lblError           ;
  protected HtmlInputHidden txtPROSPECT_LIST_ID;

protected void Page_Command(object sender, CommandEventArgs e)
  {
   try
   {
    switch ( e.CommandName )
    {
     case "ProspectLists.Create":
      Response.Redirect("~/ProspectLists/edit.aspx?PARENT_ID=" + gID.ToString());
      break;
     case "ProspectLists.Edit":
     {
      Guid gPROSPECT_LIST_ID = Sql.ToGuid(e.CommandArgument);
      Response.Redirect("~/ProspectLists/edit.aspx?ID=" + gPROSPECT_LIST_ID.ToString());
      break;
     }
     case "ProspectLists.Remove":
     {
      Guid gPROSPECT_LIST_ID = Sql.ToGuid(e.CommandArgument);
      SqlProcs.spPROSPECT_LIST_CAMPAIGNS_Delete(gPROSPECT_LIST_ID, gID);
      Response.Redirect("view.aspx?ID=" + gID.ToString());
      break;
     }
     default:
      throw(new Exception("Unknown command: " + e.CommandName));
    }
   }
   catch(Exception ex)
   {
    SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
    lblError.Text = ex.Message;
   }
  }

  private void Page_Load(object sender, System.EventArgs e)
  {
   gID = Sql.ToGuid(Request["ID"]);
   Guid gPROSPECT_LIST_ID = Sql.ToGuid(txtPROSPECT_LIST_ID.Value);
   if ( !Sql.IsEmptyGuid(gPROSPECT_LIST_ID) )
   {
    try
    {
     SqlProcs.spPROSPECT_LIST_CAMPAIGNS_Update(gPROSPECT_LIST_ID, gID);
     Response.Redirect("view.aspx?ID=" + gID.ToString());
    }
    catch(Exception ex)
    {
     SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
     lblError.Text = ex.Message;
    }
   }

   DbProviderFactory dbf = DbProviderFactories.GetFactory();
   using ( IDbConnection con = dbf.CreateConnection() )
   {
    string sSQL;
    sSQL = "select *                         " + ControlChars.CrLf
         + "  from vwCAMPAIGNS_PROSPECT_LISTS" + ControlChars.CrLf
         + " where CAMPAIGN_ID = @CAMPAIGN_ID" + ControlChars.CrLf
         + " order by DATE_ENTERED asc       " + ControlChars.CrLf;
    using ( IDbCommand cmd = con.CreateCommand() )
    {
     cmd.CommandText = sSQL;
     Sql.AddParameter(cmd, "@CAMPAIGN_ID", gID);

     if ( bDebug )
      RegisterClientScriptBlock("vwCAMPAIGNS_PROSPECT_LISTS", 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 ;
        // 09/05/2005 Paul. LinkButton controls will not fire an event unless the the grid is bound.
        //if ( !IsPostBack )
        {
         grdMain.ApplySort();
         grdMain.DataBind();
        }
       }
      }
     }
     catch(Exception ex)
     {
      SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
      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();
   }
  }

  #region Web Form Designer generated code
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: This call is required by the ASP.NET Web Form Designer.
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  ///  Required method for Designer support - do not modify
  ///  the contents of this method with the code editor.
  /// </summary>
  private void InitializeComponent()
  {
   this.Load += new System.EventHandler(this.Page_Load);
   // 11/26/2005 Paul.  Add fields early so that sort events will get called.
   grdMain.DynamicColumns("Campaigns.ProspectLists");
  }
  #endregion
 }
}


What to modify in this 2 files??


Now I will create the SP ... but are there other changes in other files??


Thanks!!

support
2240 posts
1st
Joined
1/3/2006

Re: Campaign and Accounts
Posted: 06 Sep 07 8:16 AM
All references to ProspectLists would be renamed to Accounts, all references to PROSPECT_LISTS would be renamed to ACCOUNTS, and all PROSPECT_LIST_ID should be renamed to ACCOUNT_ID.
  Mainstream Forums  General Discussion  Campaign and Ac...

Forum Home  Search       

Copyright (c) 2006-2008 SplendidCRM Software, Inc. All Rights Reserved.   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2009 by Perpetual Motion Interactive Systems Inc.