Reply
Regular Visitor
Kiriano
Posts: 1
0

Web service help needed. Salesforce and asp.net

Hello guys, 

 

I am totaly new in Salesforce and in programming in general. 

I have to create a webservice between salesforce and asp.net. Asp.net has a <List> of license kies, a user who has expirational date for the key. 

I need to make a apex class which will grab info from asp.net, will compair data with existing Accounts in salesforce and then send a email template with notification that in 3 months the license will be expired.

 

 

Have no ideas how to make a List in asp.net and then bring rows to salesforce. Also confused with date formation in both asp.net and salesforce and just in general would like to understand the right logic to make it in Apex, as I learn it just for 2 month. 

 

Would be really great guys if you could help me with some ideas about coding. Thanks in advance. 

 

Here is my Apex class, first scetch. 

 

 

global class NotificationForLicences {

Webservice static void SendNotificationReminder(String ReceivableAccount, List<String>licence, Date ExpirationDate ){

Account acc = [Select Account_ID_Number__c, name, Account_Email__c from Account where Account_ID_Number__c =:ReceivableAccount];


NotificationLog__c nl = new NotificationLog__c();


nl.ReceivableAccount__c = ReceivableAccount;

nl.ExpirationDate__c = ExpirationDate;

nl.licence__c = Licence;

insert nl;


messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

mail.setTargetObjectId(nl.ReceivableAccount__c);
mail.setSenderDisplayName('Abbyy Salesforce Development');

EmailTemplate et = [Select id from EmailTemplate where name='WebService Confirmation mail'];
mail.setTemplateId(et.id);


Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}

 

 

here is C sharp code

 

 

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
using System.Text;
using Enterprise;
using NotificationReminder;
using System.Web.Services.Protocols;

public partial class LicenceNotification : System.Web.UI.Page
{
private SforceService enterpriseBinding = new SforceService();
private NotificationForLicencesService myBinding = new NotificationForLicencesService();

 


protected void Page_Load(object sender, EventArgs e)
{
LoginResult lr = enterpriseBinding.login("username", "password");

myBinding.SessionHeaderValue = new NotificationReminder.SessionHeader();
myBinding.SessionHeaderValue.sessionId = lr.sessionId;


myBinding.SendNotificationReminder("001P0XJEO3", "HXKMXXMMPKU", "2011-10-10");


}