-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
122958c
commit b72de55
Showing
7 changed files
with
346 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?xml version="1.0"?> | ||
<rpm:Process xmlns:rpm="urn:rpmsoftware.com:Process"> | ||
<name>Contact</name> | ||
<date>Mar 1,2018</date> | ||
<titleNumber>true</titleNumber> | ||
<number> | ||
<minumum>4</minumum> | ||
<formNumberReadOnly>True</formNumberReadOnly> | ||
</number> | ||
<repeating> | ||
<enabled>false</enabled> | ||
<addlink>Add repeating fields</addlink> | ||
</repeating> | ||
<agentautoaddagentparticipants>false</agentautoaddagentparticipants> | ||
<isSimple>false</isSimple> | ||
<ShowStartLink>true</ShowStartLink> | ||
<ShowStartLinkOnForm>true</ShowStartLinkOnForm> | ||
<OnStartShowAllFields>true</OnStartShowAllFields> | ||
<permissions> | ||
<addParticipantChangeOwner>Edit</addParticipantChangeOwner> | ||
<editTrashNotes>Edit</editTrashNotes> | ||
<addDeleteRepeatingFields>Start</addDeleteRepeatingFields> | ||
<permissionsForSubUsers>{"AgentUserEmailAccess":false,"CustomerUserEmailAccess":false,"AgentUserPermission":1,"AgentUserChangeStatus":false,"AgentUserAddAction":false,"CustomerUserPermission":1,"CustomerUserChangeStatus":false,"CustomerUserAddAction":false}</permissionsForSubUsers> | ||
</permissions> | ||
<NotificationFormInfo>[]</NotificationFormInfo> | ||
<Signature>{"IsEnabled":false,"Name":"Signatures","IsHandDrawn":false,"ShowCompany":false,"Instruction":""}</Signature> | ||
<fields> | ||
<field name="Contact Name (First & Last)"> | ||
<type>Text</type> | ||
<InternalFormat>{"PatternEnabled":false,"Pattern":"","Instruction":""}</InternalFormat> | ||
<order>1</order> | ||
<LayoutFormat>{"Width":"2","Order":1}</LayoutFormat> | ||
<repeating>false</repeating> | ||
<ID>40639</ID> | ||
</field> | ||
<field name="Primary Contact Number"> | ||
<type>Text</type> | ||
<InternalFormat>{"PatternEnabled":false,"Pattern":"","Instruction":""}</InternalFormat> | ||
<order>3</order> | ||
<LayoutFormat>{"Width":"1","Order":-1}</LayoutFormat> | ||
<repeating>false</repeating> | ||
<ID>40640</ID> | ||
</field> | ||
<field name="Email"> | ||
<type>Text</type> | ||
<InternalFormat>{"PatternEnabled":false,"Pattern":"","Instruction":""}</InternalFormat> | ||
<order>4</order> | ||
<LayoutFormat>{"Width":"1","Order":-1}</LayoutFormat> | ||
<repeating>false</repeating> | ||
<ID>40641</ID> | ||
</field> | ||
<field name="Company"> | ||
<type>Text</type> | ||
<InternalFormat>{"PatternEnabled":false,"Pattern":"","Instruction":""}</InternalFormat> | ||
<order>5</order> | ||
<LayoutFormat>{"Width":"1","Order":-1}</LayoutFormat> | ||
<repeating>false</repeating> | ||
<ID>40642</ID> | ||
</field> | ||
<field name="Website"> | ||
<type>Text</type> | ||
<InternalFormat>{"PatternEnabled":false,"Pattern":"","Instruction":""}</InternalFormat> | ||
<order>6</order> | ||
<LayoutFormat>{"Width":"1","Order":-1}</LayoutFormat> | ||
<repeating>false</repeating> | ||
<ID>40643</ID> | ||
</field> | ||
<field name="Web Lead Comment"> | ||
<type>Text</type> | ||
<InternalFormat>{"PatternEnabled":false,"Pattern":"","Instruction":""}</InternalFormat> | ||
<order>7</order> | ||
<LayoutFormat>{"Width":"2","Order":-1}</LayoutFormat> | ||
<repeating>false</repeating> | ||
<ID>40644</ID> | ||
</field> | ||
</fields> | ||
<statusLevels> | ||
<statusLevel> | ||
<name>New</name> | ||
<autoarchive>false</autoarchive> | ||
<userselectable>true</userselectable> | ||
<includeInSum>true</includeInSum> | ||
<allowAttachmentAddEdit>true</allowAttachmentAddEdit> | ||
<allowEditForm>true</allowEditForm> | ||
<signature>{"ShowLink":false}</signature> | ||
</statusLevel> | ||
</statusLevels> | ||
<statusTriggers /> | ||
<defaultColumns> | ||
<staff> | ||
<column>Number</column> | ||
<column>Owner</column> | ||
<column>Action due for me</column> | ||
<column>Started</column> | ||
<column>Started by</column> | ||
<column>Modified</column> | ||
<column>Modified by</column> | ||
<column>Files</column> | ||
</staff> | ||
<agent> | ||
<column>Number</column> | ||
<column>Owner</column> | ||
<column>Action due for me</column> | ||
<column>Started</column> | ||
<column>Started by</column> | ||
<column>Modified</column> | ||
<column>Modified by</column> | ||
</agent> | ||
<customer> | ||
<column>Number</column> | ||
<column>Owner</column> | ||
<column>Action due for me</column> | ||
<column>Started</column> | ||
<column>Started by</column> | ||
<column>Modified</column> | ||
<column>Modified by</column> | ||
</customer> | ||
<action> | ||
<column>Form title</column> | ||
<column>Done</column> | ||
<column>Due</column> | ||
<column>Assignee</column> | ||
<column>Description</column> | ||
<column>Result</column> | ||
</action> | ||
</defaultColumns> | ||
<customWebBoxes /> | ||
<holders /> | ||
<nofitificationSettings> | ||
<setting isOn="true" userType="AgentRep" watching="all" suppressOnCopy="false" suppressOnFlow="false" /> | ||
<setting isOn="true" userType="Staff" watching="all" suppressOnCopy="false" suppressOnFlow="false" /> | ||
<setting isOn="true" userType="CustomerContact" watching="all" suppressOnCopy="false" suppressOnFlow="false" /> | ||
</nofitificationSettings> | ||
</rpm:Process> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using System.Threading.Tasks; | ||
using Web2Rpm.Models; | ||
using Newtonsoft.Json; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System; | ||
|
||
namespace Web2Rpm.Controllers | ||
{ | ||
public class HomeController : Controller | ||
{ | ||
// CONFIGURATION | ||
private const string API_KEY = "fffff-fffff-fffff-fffff-fffff"; | ||
private const string API_URL = "http://api.cubedms.com/rpm/api2.svc/ProcFormAdd"; | ||
private const int API_PROCESSID = -1; | ||
|
||
// GET: /<controller>/ | ||
public IActionResult Index() | ||
{ | ||
return View(); | ||
} | ||
|
||
[HttpPost] | ||
[ValidateAntiForgeryToken] | ||
public async Task<ActionResult> Index(Lead leadForm) | ||
{ | ||
if (!ModelState.IsValid) | ||
{ | ||
return View(leadForm); | ||
} | ||
|
||
// Make the RPM form object | ||
RpmProcess rpmLead = new RpmProcess(); | ||
rpmLead.ProcessID = API_PROCESSID; | ||
|
||
// Add the fields | ||
rpmLead.Form.Fields.Add(new RpmField() { Field = "Contact Name (First & Last)", Value = leadForm.Name }); | ||
rpmLead.Form.Fields.Add(new RpmField() { Field = "Primary Contact Number", Value = leadForm.Phone }); | ||
rpmLead.Form.Fields.Add(new RpmField() { Field = "Email", Value = leadForm.Email }); | ||
rpmLead.Form.Fields.Add(new RpmField() { Field = "Company", Value = leadForm.Company }); | ||
rpmLead.Form.Fields.Add(new RpmField() { Field = "Website", Value = leadForm.Website }); | ||
rpmLead.Form.Fields.Add(new RpmField() { Field = "Web Lead Comment", Value = leadForm.Comment }); | ||
|
||
// Turn into JSON | ||
string body = JsonConvert.SerializeObject(rpmLead); | ||
|
||
// Send | ||
HttpClient client = new HttpClient(); | ||
try | ||
{ | ||
var content = new StringContent(body, Encoding.UTF8, "application/json"); | ||
content.Headers.Add("RpmApiKey", API_KEY); | ||
var response = await client.PostAsync(API_URL, content); | ||
} | ||
catch (HttpRequestException hre) | ||
{ | ||
return RedirectToAction("Error"); | ||
} | ||
catch (Exception ex) | ||
{ | ||
return RedirectToAction("Error"); | ||
} | ||
|
||
// Change the page | ||
return RedirectToAction("Sent"); | ||
} | ||
|
||
public ActionResult Sent() | ||
{ | ||
return View(); | ||
} | ||
|
||
public ActionResult Error() | ||
{ | ||
return View(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Web2Rpm.Models | ||
{ | ||
public class Lead | ||
{ | ||
[Required] | ||
public string Company { get; set; } | ||
|
||
[Required] | ||
public string Name { get; set; } | ||
|
||
[Required, EmailAddress] | ||
public string Email { get; set; } | ||
|
||
public string Phone { get; set; } | ||
|
||
public string Website { get; set; } | ||
|
||
[Display(Name = "Questions / Comments")] | ||
public string Comment { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Web2Rpm.Models | ||
{ | ||
public class RpmProcess | ||
{ | ||
public int ProcessID; | ||
public RpmForm Form = new RpmForm(); | ||
} | ||
public class RpmField | ||
{ | ||
public string Field { get; set; } | ||
public string Value { get; set; } | ||
} | ||
public class RpmForm | ||
{ | ||
public List<RpmField> Fields = new List<RpmField>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@{ | ||
ViewData["Title"] = "Error"; | ||
} | ||
<h2>Error</h2> |
Oops, something went wrong.