Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        const string QueryName = "campaignResponses";
        const string targetsQuery = "campaignTargetsQuery";

        INamedQueryCacheService service = ApplicationContext.Current.Services.Get<INamedQueryCacheService>(false);
        if (service != null)
        {
            if (!service.Contains(QueryName))
            {
                NamedQueryInfo queryinfo = new NamedQueryInfo();
                queryinfo.Hql =
                    "select c.id, c.CampaignName, c.StartDate, c.EndDate, c.ExpectedContactResponses, c.ExpectedLeadResponses from Campaign c where c.Status='Active' order by c.EndDate asc";
                queryinfo.Name = QueryName;
                queryinfo.ColumnAliases = new string[] { "id", "name", "startdate", "enddate", "expectedcontact", "expectedlead" };
                service.Add(queryinfo);
            }
            if (!service.Contains(targetsQuery))
            {
                NamedQueryInfo targetsQueryInfo = new NamedQueryInfo();
                targetsQueryInfo.Hql =
                    "select t.ResponseDate from TargetResponse t";
                targetsQueryInfo.Name = targetsQuery;
                targetsQueryInfo.ColumnAliases = new string[] { "ResponseDate" };
                service.Add(targetsQueryInfo);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        const string QueryName    = "campaignResponses";
        const string targetsQuery = "campaignTargetsQuery";

        INamedQueryCacheService service = ApplicationContext.Current.Services.Get <INamedQueryCacheService>(false);

        if (service != null)
        {
            if (!service.Contains(QueryName))
            {
                NamedQueryInfo queryinfo   = new NamedQueryInfo();
                string         activeEquiv = GetGlobalResourceObject("Campaign", "Campaign_Status_Active").ToString();
                string         whereClause = string.Empty;
                if (!string.IsNullOrEmpty(activeEquiv))
                {
                    whereClause = string.Format("where c.Status='{0}'", activeEquiv);
                }
                queryinfo.Hql =
                    string.Format("select c.id, c.CampaignName, c.StartDate, c.EndDate, c.ExpectedContactResponses, c.ExpectedLeadResponses from Campaign c {0} order by c.EndDate asc", whereClause);
                queryinfo.Name          = QueryName;
                queryinfo.ColumnAliases = new string[] { "id", "name", "startdate", "enddate", "expectedcontact", "expectedlead" };
                service.Add(queryinfo);
            }
            if (!service.Contains(targetsQuery))
            {
                NamedQueryInfo targetsQueryInfo = new NamedQueryInfo();
                targetsQueryInfo.Hql =
                    "select t.ResponseDate from TargetResponse t";
                targetsQueryInfo.Name          = targetsQuery;
                targetsQueryInfo.ColumnAliases = new string[] { "ResponseDate" };
                service.Add(targetsQueryInfo);
            }
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// creates a named query that is retrieved by the slxdata.ashx/slx/namedqueries handler
 /// this code was based on the sample by Newell found in the salesLogix wiki.  The wiki entry
 /// can be found at:
 /// http://slxdevwiki.testlogix.com/index.php?title=Projects/Gobi/Platform_Documentation/Named_Query_Example&highlight=named+queries
 /// </summary>
 private void CreateNamedQuery()
 {
     //Get a reference to the Named Query Cache Service
     INamedQueryCacheService service =
         ApplicationContext.Current.Services.Get<INamedQueryCacheService>(false);
     //Whenever you get try to get a service, it's a good idea to make sure you really got something back.
     if (service != null)
     {
         //It might already have this query, so there is no need to create it all over again...
         if (!service.Contains("LibraryQuery"))
         {
             //Here is the base HQL statement that is going to provide the data for the grid
             string hql =
                 "select doc.id, doc.FileName, doc.Description, doc.RevisionDate, doc.CreateDate, doc.Expires, doc.ExpireDate, doc.FileSize, doc.Directory.DirectoryName, doc.Directory.FullPath from LibraryDocs doc";
             //These aliases are referenced in the SLXLiveGrid markup
             string[] aliases = new string[] { "id", "FileName", "Description", "RevisionDate", "CreateDate", "Expires", "ExpireDate", "FileSize", "Directory.DirectoryName", "Directory.FullPath" };
             //The NamedQueryInfo object is what the Named Query Service wants.
             //the first parameter is the "name" or identifier for the query.  The REST URI to get data will contain this name.
             NamedQueryInfo query = new NamedQueryInfo("LibraryQuery", hql, aliases);
             //Add our NamedQueryInfo to the service.
             service.Add(query);
             //Now everything is all set up so the SLXLiveGrid can ask the NamedQuery service for the data.
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        const string QueryName = "campaignResponses";
        const string targetsQuery = "campaignTargetsQuery";

        INamedQueryCacheService service = ApplicationContext.Current.Services.Get<INamedQueryCacheService>(false);
        if (service != null)
        {
            if (!service.Contains(QueryName))
            {
                NamedQueryInfo queryinfo = new NamedQueryInfo();
                string activeEquiv = GetGlobalResourceObject("Campaign", "Campaign_Status_Active").ToString();
                string whereClause = string.Empty;
                if (!string.IsNullOrEmpty(activeEquiv))
                {
                    whereClause = string.Format("where c.Status='{0}'", activeEquiv);
                }
                queryinfo.Hql =
                    string.Format("select c.id, c.CampaignName, c.StartDate, c.EndDate, c.ExpectedContactResponses, c.ExpectedLeadResponses from Campaign c {0} order by c.EndDate asc", whereClause);
                queryinfo.Name = QueryName;
                queryinfo.ColumnAliases = new string[] { "id", "name", "startdate", "enddate", "expectedcontact", "expectedlead" };
                service.Add(queryinfo);
            }
            if (!service.Contains(targetsQuery))
            {
                NamedQueryInfo targetsQueryInfo = new NamedQueryInfo();
                targetsQueryInfo.Hql =
                    "select t.ResponseDate from TargetResponse t";
                targetsQueryInfo.Name = targetsQuery;
                targetsQueryInfo.ColumnAliases = new string[] { "ResponseDate" };
                service.Add(targetsQueryInfo);
            }
        }
    }
Ejemplo n.º 5
0
    private NamedQueryInfo GetAccountNamedQueryinfo()
    {
        NamedQueryInfo info = new NamedQueryInfo();

        info.Name = "AccountSearch";
        //info.Id = new Guid("1");
        string[] AliasCols = new string[] { "id", "name", "address_address1", "address_citystatezip", "mainphone", "email", "division", "type", "accountmanager_userinfo_firstname", "accountmanager_userinfo_lastname", "tollfree", "industry", "webaddress", "status", "subType" };
        string   hql       = "select  mainentity.id,  mainentity.AccountName,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.MainPhone,  mainentity.Email,  mainentity.Division,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.AccountManager.UserInfo.LastName, mainentity.TollFree, mainentity.Industry, mainentity.WebAddress, mainentity.Status, mainentity.SubType from Account mainentity left join  mainentity.Address  left join  mainentity.AccountManager";

        info.Hql           = hql;
        info.ColumnAliases = AliasCols;
        return(info);
    }
Ejemplo n.º 6
0
    private NamedQueryInfo GetLeadNamedQueryinfo()
    {
        NamedQueryInfo info = new NamedQueryInfo();

        info.Name = "LeadSearch";
        //info.Id = new Guid("1");
        string[] AliasCols = new string[] { "id", "name", "address_address1", "address_citystatezip", "homephone", "email", "company", "title", "type", "accountmanager_userinfo_firstname", "accountmanager_userinfo_lastname", "workphone", "mobilePhone", "webaddress" };
        string   hql       = "select  mainentity.id,  mainentity.LeadNameFirstLast,  mainentity.Address.Address1,  mainentity.Address.LeadCtyStZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Company,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.AccountManager.UserInfo.LastName, mainentity.WorkPhone, mainentity.Mobile, mainentity.WebAddress  from Lead  mainentity left join  mainentity.Address  left join  mainentity.AccountManager";

        info.Hql           = hql;
        info.ColumnAliases = AliasCols;
        return(info);
    }
Ejemplo n.º 7
0
    private NamedQueryInfo GetContactNamedQueryinfo()
    {
        NamedQueryInfo info = new NamedQueryInfo();

        info.Name = "ContactSearch";
        //info.Id = new Guid("1");
        string[] AliasCols = new string[] { "id", "name", "address_address1", "address_citystatezip", "homephone", "email", "account_id", "accountname", "title", "type", "accountmanager_userinfo_firstname", "workphone", "mobilePhone", "webaddress" };
        //string hql = "select  mainentity.id,  mainentity.Name,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Account.id,  mainentity.AccountName,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.WorkPhone from Contact  mainentity  left join  mainentity.Address  left join  mainentity.Account  left join  mainentity.AccountManager  group by  mainentity.id,  mainentity.Name,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Account.id,  mainentity.AccountName,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.WorkPhone ";
        string hql = "select  mainentity.id,  mainentity.Name,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Account.id,  mainentity.AccountName,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.WorkPhone, mainentity.Mobile, mainentity.WebAddress  from Contact  mainentity  left join  mainentity.Address  left join  mainentity.Account  left join  mainentity.AccountManager";

        info.Hql           = hql;
        info.ColumnAliases = AliasCols;
        return(info);
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        const string QueryName = "recentNotes";

        INamedQueryCacheService service = ApplicationContext.Current.Services.Get<INamedQueryCacheService>(false);
        if (service != null)
        {
            if (!service.Contains(QueryName))
            {
                SLXUserService slxUserService = ApplicationContext.Current.Services.Get<Sage.Platform.Security.IUserService>() as SLXUserService;
                NamedQueryInfo queryinfo = new NamedQueryInfo();  //
                queryinfo.Hql =
                    "select h.id, h.Description, h.Notes from History h where h.Type=262148 and h.UserId=? and h.CreateDate>? order by h.CreateDate desc";
                queryinfo.Name = QueryName;
                queryinfo.ColumnAliases = new string[] { "id", "description", "notes" };
                queryinfo.SetParameter(0, slxUserService.GetUser().Id);
                queryinfo.SetParameter(1, DateTime.Now.AddDays(-15));

                service.Add(queryinfo);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        const string QueryName = "recentNotes";

        INamedQueryCacheService service = ApplicationContext.Current.Services.Get <INamedQueryCacheService>(false);

        if (service != null)
        {
            if (!service.Contains(QueryName))
            {
                SLXUserService slxUserService = ApplicationContext.Current.Services.Get <Sage.Platform.Security.IUserService>() as SLXUserService;
                NamedQueryInfo queryinfo      = new NamedQueryInfo(); //
                queryinfo.Hql =
                    "select h.id, h.Description, h.Notes from History h where h.Type=262148 and h.UserId=? and h.CreateDate>? order by h.CreateDate desc";
                queryinfo.Name          = QueryName;
                queryinfo.ColumnAliases = new string[] { "id", "description", "notes" };
                queryinfo.SetParameter(0, slxUserService.GetUser().Id);
                queryinfo.SetParameter(1, DateTime.Now.AddDays(-15));

                service.Add(queryinfo);
            }
        }
    }
 private NamedQueryInfo GetLeadNamedQueryinfo()
 {
     NamedQueryInfo info = new NamedQueryInfo();
     info.Name = "LeadSearch";
     //info.Id = new Guid("1");
     string[] AliasCols = new string[] { "id", "name", "address_address1", "address_citystatezip", "homephone", "email", "company", "title", "type", "accountmanager_userinfo_firstname","accountmanager_userinfo_lastname", "workphone", "mobilePhone", "webaddress" };
     string hql = "select  mainentity.id,  mainentity.LeadNameFirstLast,  mainentity.Address.Address1,  mainentity.Address.LeadCtyStZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Company,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.AccountManager.UserInfo.LastName, mainentity.WorkPhone, mainentity.Mobile, mainentity.WebAddress  from Lead  mainentity left join  mainentity.Address  left join  mainentity.AccountManager";
     info.Hql = hql;
     info.ColumnAliases = AliasCols;
     return info;
 }
 private NamedQueryInfo GetContactNamedQueryinfo()
 {
     NamedQueryInfo info = new NamedQueryInfo();
     info.Name = "ContactSearch";
     //info.Id = new Guid("1");
     string[] AliasCols = new string[] {"id", "name", "address_address1","address_citystatezip","homephone","email", "account_id","accountname", "title", "type", "accountmanager_userinfo_firstname", "workphone", "mobilePhone", "webaddress" };
     //string hql = "select  mainentity.id,  mainentity.Name,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Account.id,  mainentity.AccountName,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.WorkPhone from Contact  mainentity  left join  mainentity.Address  left join  mainentity.Account  left join  mainentity.AccountManager  group by  mainentity.id,  mainentity.Name,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Account.id,  mainentity.AccountName,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.WorkPhone ";
     string hql = "select  mainentity.id,  mainentity.Name,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.HomePhone,  mainentity.Email,  mainentity.Account.id,  mainentity.AccountName,  mainentity.Title,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.WorkPhone, mainentity.Mobile, mainentity.WebAddress  from Contact  mainentity  left join  mainentity.Address  left join  mainentity.Account  left join  mainentity.AccountManager";
     info.Hql = hql;
     info.ColumnAliases = AliasCols;
     return info;
 }
 private NamedQueryInfo GetAccountNamedQueryinfo()
 {
     NamedQueryInfo info = new NamedQueryInfo();
     info.Name = "AccountSearch";
     //info.Id = new Guid("1");
     string[] AliasCols = new string[] { "id", "name", "address_address1", "address_citystatezip", "mainphone", "email", "division", "type", "accountmanager_userinfo_firstname", "accountmanager_userinfo_lastname", "tollfree", "industry", "webaddress", "status", "subType" };
     string hql = "select  mainentity.id,  mainentity.AccountName,  mainentity.Address.Address1,  mainentity.Address.CityStateZip,  mainentity.MainPhone,  mainentity.Email,  mainentity.Division,  mainentity.Type,  mainentity.AccountManager.UserInfo.FirstName, mainentity.AccountManager.UserInfo.LastName, mainentity.TollFree, mainentity.Industry, mainentity.WebAddress, mainentity.Status, mainentity.SubType from Account mainentity left join  mainentity.Address  left join  mainentity.AccountManager";
     info.Hql = hql;
     info.ColumnAliases = AliasCols;
     return info;
 }