When trying to save the plugin, I get this error message.
Error message:
the type of namespace name 'jiwaSales' does not exist in the namespace 'JiwaFinancialsJiwa' are you missing an assembly referance?
- Code: Select all
using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using JiwaFinancials.Jiwa;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Drawing;
using ServiceStack;
using ServiceStack.DataAnnotations;
using ServiceStack.Model;
using JiwaFinancials.Jiwa.JiwaServiceModel.Tables;
using ServiceStack.Auth;
using System.Linq;
using ServiceStack.OrmLite; // Db
using System.Configuration;
namespace JiwaFinancials.Jiwa.JiwaServiceModel
{
public class RESTAPIPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaRESTAPIPlugin
{
public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost AppHost, Funq.Container Container, JiwaApplication.Manager JiwaApplicationManager)
{
//System.Diagnostics.Debugger.Launch();
//System.Diagnostics.Debugger.Break();
AppHost.RegisterService<CustomServices>();
//using InvoiceID from QO_Main table as id in ToDo (TD_Main) table
AppHost.Routes.Add(typeof(InsertToDoRequest), "/Custom/InsertToDoRequest/{InvoiceID}/{MsgSubject}/{MsgBody}/{AssignTo}/", "GET", "Inserts a ToDo note associated with a quote to create an alert.", "");
}
}
#region "Requests"
[ApiResponse(200, "Records retrieved OK")]
[ApiResponse(401, "Not authenticated")]
[ApiResponse(404, "Handler for Request not found")]
public static class InsertToDoRequest
{
public static string InvoiceID { get; set; }
public static string MsgSubject { get; set; }
public static string MsgBody { get; set; }
public static string AssignTo { get; set; }
}
#endregion
#region "BusinessLogicPlugin"
public class BusinessLogicPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogicPlugin
{
public override object InitializeLifetimeService()
{
// returning null here will prevent the lease manager
// from deleting the Object.
return null;
}
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic JiwaBusinessLogic, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
if (JiwaBusinessLogic is JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuote)
{
JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuote quote = (JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuote)JiwaBusinessLogic;
quote.SaveEnd += Quote_SaveEnd;
}
}
private void Quote_SaveEnd(object sender, System.EventArgs e)
{
JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuote quote = (JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuote)sender;
if (quote.InsertFlag)
{
// insert flag indicates it was created.
JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo toDo = quote.Manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo>(null);
toDo.CreateNew();
toDo.AssignedTo.ReadRecordByUsername("Admin");
toDo.Subject = "New Quote Created";
toDo.Body = String.Format("Quote {0} was created.", quote.QuoteNo);
toDo.ReminderPredefinedSetting = JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo.ReminderPredefinedSettingType.WhenDue;
toDo.ReminderSpecificDateTime = DateTime.Now;
toDo.ReminderEnabled = true;
toDo.Save();
}
}
}
#endregion
#region "Services"
public class CustomServices : Service
{
[Authenticate]
public static void InsertToDoRequest()
{
Manager manager = new Manager();
JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo toDo = manager.BusinessLogicFactory.CreateBusinessLogic<JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo>(null);
toDo.CreateNew();
toDo.AssignedTo.ReadRecordByUsername(request.AssignTo);
toDo.Subject = request.MsgSubject;
toDo.Body = request.MsgBody;
toDo.ReminderPredefinedSetting = JiwaFinancials.Jiwa.JiwaApplication.JiwaToDos.ToDo.ReminderPredefinedSettingType.WhenDue;
toDo.ReminderSpecificDateTime = DateTime.Now;
toDo.ReminderEnabled = true;
toDo.Save();
}
}
#endregion
}