How to connect SSRS into ReportViewer 2010 at Runtime? - ssrs-2008

I have my codes as bellow and it shows me empty page after compiling:
ReportViewerControl = new ReportViewer();
ShowZoomControl="false"
ReportViewerControl.ServerReport.ReportServerUrl = new Uri(ReportServerUri);
ReportViewerControl.ServerReport.ReportPath = Model.Report.ReportPath;
ReportViewerControl.Visible = true;
ReportViewerControl.ShowReportBody = true;
ReportViewerControl.ShowParameterPrompts = false;
ReportViewerControl.ProcessingMode = ProcessingMode.Remote;
ReportViewerControl.ShowZoomControl = false;
ReportViewerControl.ShowBackButton = false;
ReportViewerControl.InteractivityPostBackMode = InteractivityPostBackMode.AlwaysAsynchronous;
ReportViewerControl.Height = 780;
ReportViewerControl.Width = 800;
IList<ReportParameter> FishSpeciesParameters = new List<ReportParameter>();
ReportParameter SPStatus = new ReportParameter();
SPStatus.Name = "SPStatus";
if (Model.Report.ID == 8)
SPStatus.Values.Add("T,E,C");
ReportParameter FishCode = new ReportParameter();
FishCode.Name = "FishCode";
FishCode.Values.Add("11");
FishSpeciesParameters.Add(SPStatus);
FishSpeciesParameters.Add(FishCode);
ReportViewerControl.ServerReport.SetParameters(FishSpeciesParameters);
ReportViewerControl.ServerReport.Refresh();
Any Ideas to view SSRS Report into ReportViewer on Fly?

maily you just need to set ServerReport.ReportServerUrl to something like this:
"http://localhost:8080/ReportServer"
and the ReportPath to
reportFolder + "/" + reportName;

Related

Apex Test Class failing on second asserEquals statement

Test Class failing on asserEqual:
I am trying to use this Test Class to test a isBefore && isInsert or IsUpdate Trigger but the test is failing on second assertEquals statement (end of the code, trying to compare return of SOQL Query:
I don't know why this is taking because I am doing a few simple inserts to test my Trigger.
Complete code:
#isTest
private class Test_Triggers{
static testMethod void Test_Triggers() {
Account acc = new Account();
acc.Name = 'sacasac';
insert acc;
Account contateste0 = new Account();
contateste0.Name = 'GRANITOS E MARMORES MACHADO LTDA EPP';
contateste0.Phone = '(27)3727-2929';
insert contateste0;
Contact contatoTeste = new Contact();
contatoTeste.FirstName = 'TITANIUM';
contatoTeste.LastName = 'TITANIUM';
contatoTeste.Phone = '3329-4053';
contatoTeste.MobilePhone = '27999970208';
contatoTeste.Email = 'gmmcontabil#gmail.com';
contatoTeste.AccountId = contateste0.Id;
insert contatoTeste;
Case novoCaso = new Case();
novoCaso.Subject = 'assunto';
novoCaso.Description = 'obs';
novoCaso.AccountId = contateste0.Id;
novoCaso.ContactId = contatoTeste.Id;
novoCaso.Origin = 'Portal';
insert novoCaso;
Opportunity novaOpp = new Opportunity();
novaOpp.AccountId = contateste0.Id;
novaOpp.Amount = 4200;
novaOpp.Name = '4200';
novaOpp.StageName = 'Pré_Oportunidade';
novaOpp.CloseDate = Date.today();
insert novaOpp;
Id idMeta = Schema.SObjectType.Meta__c.getRecordTypeInfosByName().get('CORE').getRecordTypeId();
Id idMeta2 = Schema.SObjectType.Meta__c.getRecordTypeInfosByName().get('NOVO').getRecordTypeId();
Meta__c meta01 = new Meta__c();
meta01.Data__c = Date.today();
meta01.Id_Usuario__c = UserInfo.getUserId();
meta01.Id_Conta__c = contateste0.Id;
meta01.RecordTypeId = idMeta;
meta01.Valor__c = 53161;
insert meta01;
System.assertEquals(53161, meta01.Valor__c);
Ordem_de_venda__c ordem = new Ordem_de_venda__c();
ordem.Oportunidade__c = novaOpp.Id;
ordem.Conta_Principal__c = acc.Id;
ordem.Pagador__c = acc.Id;
ordem.Data_de_vencimento__c = System.today().addDays(2);
ordem.Id_Meta__c = meta01.Id;
ordem.Tipo__c = 'Serviço';
insert ordem;
List<AggregateResult> aggregateOrdensVenda = [SELECT Id_Meta__c, sum(Valor_faturado__c) total, sum(VlrFor__c) forecast FROM Ordem_de_venda__c WHERE Id_Meta__c =:meta01.Id GROUP BY Id_Meta__c];
//This is failing because SOQL s returning nothing
system.assertEquals(1,aggregateOrdensVenda.size());
}
}```

Codeigniter Pagination highlights last link when current link is first

I got a strange problem, Codeigniter Pagination highlights last link when current link is first
$route['favorite/(:num)'] = 'user/favorite/$1';
$route['favorite/(:num)/page/(:num)'] = 'user/favorite/$1/$2';
$this->load->library('pagination');
$config['base_url'] = "/favorite/$user_fav_id/page";
$config['total_rows'] = $this->user_model->count_user_fav_all_movies($user_id, $user_fav_id);
$config['per_page'] = 3;
$config['use_page_numbers'] = true;
$config['first_link'] = 'в начало';
$config['last_link'] = 'в конец';
$config['next_link'] = '';
$config['prev_link'] = '';
$config['first_url'] = "/favorite/$user_fav_id";
$this->pagination->initialize($config);
You have to tell CI at what page you are currently at, by providing uri_segment :
$config['uri_segment'] = $this->uri->total_segments();
Or
$config['uri_segment'] = 4;

PSI update resource custom field with lookup table (Project Server)

Can someone show me a code to update a enterprise resource custom field with lookup table ? Already ran the internet looking for some sample code but did not succeed.
You can create and update a custom field with a lookup table using the below code . But we can not update or delete builtin custom fields
var projContext = new ProjectContext(projectServerUrl);
CustomFieldCollection CustomField = projContext.CustomFields;
EntityTypes Entitytype = projContext.EntityTypes;
LookupTableCollection lookupTables = projContext.LookupTables;
projContext.Load(CustomField);
projContext.Load(Entitytype);
projContext.Load(lookupTables);
projContext.ExecuteQuery();
CustomFieldCreationInformation NewfieldInfo = new CustomFieldCreationInformation();
NewfieldInfo.Id = new Guid();
NewfieldInfo.Name = "The Name";
NewfieldInfo.Description = "The Description";
NewfieldInfo.IsWorkflowControlled = true;
NewfieldInfo.IsRequired = true;
NewfieldInfo.IsEditableInVisibility = false;
NewfieldInfo.IsMultilineText = false;
LookupTable lookuptable = lookupTables.ToList().Find(x => x.Name == "LookupTableName");
projContext.Load(lookuptable);
projContext.ExecuteQuery();
NewfieldInfo.LookupTable = lookuptable;
NewfieldInfo.EntityType = Entitytype.ProjectEntity;
NewfieldInfo.FieldType = CustomFieldType.TEXT;
projContext.CustomFields.Add(NewfieldInfo);
projContext.CustomFields.Update();
projContext.ExecuteQuery();

Can't add TaxService to QBO with .NET SDK

How do I create a tax rate in QBO using API v3 and the TaxService resource? When I try to add it the same way as I would any other object, Visual Studio gives me this error: "The type 'Intuit.Ipp.Data.TaxService' cannot be used as type parameter 'T' in the generic type or method Intuit.Ipp.DataService.DataService.Add(T)'. There is no implicit reference conversion from 'Intuit.Ipp.Data.TaxService' to 'Intuit.Ipp.Data.IEntity'."
Here's the code:
Intuit.Ipp.Data.TaxService ts = new Intuit.Ipp.Data.TaxService();
// Populate fields here...
DataService ds = new DataService(ServiceContext);
Intuit.Ipp.Data.TaxService newTs = ds.Add<Intuit.Ipp.Data.TaxService>(ts);
Use GlobalTaxService endpoint and JSON format only. Try this code:
GlobalTaxService taxSvc = new GlobalTaxService(context);
Intuit.Ipp.Data.TaxService taxCodetobeAdded = new Data.TaxService();
taxCodetobeAdded.TaxCode = "taxC_" + Guid.NewGuid().ToString("N");
QueryService<TaxAgency> taxagency = new QueryService<TaxAgency>(context);
TaxAgency taxagencyResult = taxagency.ExecuteIdsQuery("select * from TaxAgency").FirstOrDefault<TaxAgency>();
List<TaxRateDetails> lstTaxRate = new List<TaxRateDetails>();
TaxRateDetails taxdetail1 = new TaxRateDetails();
taxdetail1.TaxRateName = "taxR1_" + Guid.NewGuid().ToString("N");
taxdetail1.RateValue = 3m;
taxdetail1.RateValueSpecified = true;
taxdetail1.TaxAgencyId = taxagencyResult.Id.ToString();
taxdetail1.TaxApplicableOn = TaxRateApplicableOnEnum.Sales;
taxdetail1.TaxApplicableOnSpecified = true;
lstTaxRate.Add(taxdetail1);
TaxRateDetails taxdetail2 = new TaxRateDetails();
taxdetail2.TaxRateName = "taxR2_" + Guid.NewGuid().ToString("N");
taxdetail2.RateValue = 2m;
taxdetail2.RateValueSpecified = true;
taxdetail2.TaxAgencyId = taxagencyResult.Id.ToString();
taxdetail2.TaxApplicableOn = TaxRateApplicableOnEnum.Sales;
taxdetail2.TaxApplicableOnSpecified = true;
lstTaxRate.Add(taxdetail2);
//TaxRateDetails taxdetail3 = new TaxRateDetails();
//taxdetail3.TaxRateName = "rate298";
//taxdetail3.TaxRateId = "2";
//lstTaxRate.Add(taxdetail3);
taxCodetobeAdded.TaxRateDetails = lstTaxRate.ToArray();
Intuit.Ipp.Data.TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded);

How to create an ArcMap Layer from a ArcGIS Map Service

I would like to add an ILayer created from an ArcGIS Server Map service to an IMap with ArcObjects, but don't see how to do it.
I am getting an IMapServer3 with the following code, where mapName = the map service:
serverContext = som.CreateServerContext(mapName, "MapServer");
IServerObject serverObject = serverContext.ServerObject;
IMapServer3 mapServer = (IMapServer3)serverObject;
It looks like I can get an ILayer from an IMapServerGroupLayer, but it looks like the IMapServerGroupLayer is looking for a different connection type than I am using.
If you have an example of getting an ILayer from a Map Service, your assistance is appreciated.
This is what worked...
private static void GetLayerFromMapServerLayer()
{
IAGSServerConnectionName servConnName = new AGSServerConnectionNameClass();
IPropertySet props = new PropertySetClass();
props.SetProperty("machine", "server");
servConnName.ConnectionProperties = props;
IAGSServerConnectionFactory pAGSServerConnectionFactory = new AGSServerConnectionFactoryClass();
IAGSServerConnection pAGSConnection = pAGSServerConnectionFactory.Open(props, 0);
IAGSEnumServerObjectName pEnumSOName = pAGSConnection.ServerObjectNames;
IAGSServerObjectName pSOName = pEnumSOName.Next();
while (pSOName != null)
{
if (pSOName.Name == "Base_Map")
break;
pSOName = pEnumSOName.Next();
}
IName pName = (IName)pSOName;
IMapServer mapServer = (IMapServer)pName.Open();
IMapServerLayer msLyr = new MapServerLayerClass();
msLyr.ServerConnect(pSOName, mapServer.DefaultMapName);
IMapServerGroupLayer group = (IMapServerGroupLayer)msLyr;
ILayer msLayer = (ILayer)msLyr;
//return msLayer;
MapDocument mapDoc = new MapDocumentClass();
mapDoc.Open(#"F:\~mkoneya~2011_82_13_58_30.mxd");
IMap myMap = mapDoc.get_Map(0);
myMap.AddLayer(msLayer);
mapDoc.Save();
}