Enabling Notification Feature

<< Click to Display Table of Contents >>

Navigation:  Developers' Guide >

Enabling Notification Feature

Navigation: Developers' Guide >

hm_btn_navigate_prevhm_btn_navigate_tophm_btn_navigate_next

Enabling Notification Feature

 

This section covers information about creating notification using iVend Retail Add-on and enabling it from iVend Management Console.

The Notification feature allows you to send notifications  through Email, SMS, and Application.

To enable the feature for Email, and SMS:

1.In iVend Management Console, go to Administration > System Initialization > Communication Settings.

2.It opens the Communication Settings screen as shown below.

CommunicationSettings

3.Under the SMTP Details section, enter the respective information in the Server Host, User Name, User Password, and Server Port  fields then select the Enable SSL checkbox.

4.Once you enter the above SMTP details, click the Test Email button to verify if it is working correctly.

5.Then to enable SMS feature,

a.Enter the correct details in Enable SMS Notification field

b.Then select a gateway from the SMS Gateway list

c.Enter the assembly name in the Assembly Name field.

d.Then enter the class name in the Class Name field.

6.Once the above information is fed, click SMS Configuration button to verify the functionality.

7.Then click the Ok button to save the changes and close the screen.

 

Note: First a record to enable custom notification through add-on should be inserted in SchSchedule table.As mentioned above that the Notification feature can be customized through iVend Retail Add-on; refer the code sample for the same.

 

INSERT INTO SchSchedule

(ScheduleKey, Id, Description, Type, StartDate, StartTime, Recurrence, IntervalType, Interval, EndType, RepeatTimes, EndDate, EndTime, Configuration, IsEnabled, CreatedBy, Created, ModifiedBy, Modified, IsDeleted, SourceKey, SMSShortCode, RunOnRequest, MailTo, MailCC,Subject, Body, MailFrom, IsSystem)

SELECT 3 ScheduleKey, 'CustomNotification' Id, 'CustomNotification' Description, 6 Type, getdate() StartDate, getdate() StartTime, 8 Recurrence, 1 IntervalType, 5 Interval, 0 EndType, 0 RepeatTimes, null EndDate, null EndTime,

'' Configuration, 1 IsEnabled, 1 CreatedBy, getdate() Created, 1 ModifiedBy, getdate() Modified, 0 IsDeleted, 0 SourceKey, '' SMSShortCode, 0 RunOnRequest, '' MailTo, '' MailCC, '' Subject, '' Body, '' MailFrom, 1 IsSystem

 

 

class PlugIn : BasePlugin

{

     public override void Start()

    {

        base.Start();

        EmailNotification.SendEmail();

        SMSNotification.SendSMS();

        iVendApplicationNotification.SendNotification();

    }

}

 

public class EmailNotification

{

    public static void SendEmail()

    {

        OutgoingNotification outgoingNotification = null;

        outgoingNotification = OutgoingNotificationSubSystem.Instance.Create();

   

        outgoingNotification.IsEmailNotification = true;

        outgoingNotification.EmailSubject = "Email Notification from Add On";

        outgoingNotification.EmailBody = "Dear Customer\n\nThis is a test E-mail from the Notification Add On.\n                                               \nRegards.\nCXS Team";

        outgoingNotification.ToEmailIds = "abc@xyz.com";

        OutgoingNotificationSubSystem.Instance.Commit(outgoingNotification);

 

    }

}

 

   public class iVendApplicationNotification

{

    public static void SendNotification()

    {

        OutgoingNotification outgoingNotification = null;

        outgoingNotification = OutgoingNotificationSubSystem.Instance.Create();

 

        outgoingNotification.IsApplicationNotification = true;

        outgoingNotification.ApplicationNotificationText = "Test ApplicationNotification";

        outgoingNotification.UserKey = 1;

 

        OutgoingNotificationSubSystem.Instance.Commit(outgoingNotification);

 

    }

}

 

public class SMSNotification

{

    public static void SendSMS()

    {

        OutgoingNotification outgoingNotification = null;

        outgoingNotification = OutgoingNotificationSubSystem.Instance.Create();

 

        outgoingNotification.IsSMSNotification = true;

        outgoingNotification.MobileNumbers = "91999XXXXXXX";

        outgoingNotification.SMSText = "Dear Customer\n\nThis is a test SMS from the Notification Add On.\n                                                                   \nRegards.\nCXS Team";

 

        OutgoingNotificationSubSystem.Instance.Commit(outgoingNotification);

 

    }

}