using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SourceCode.SmartObjects.Client;
// C:\WINDOWS\assembly\GAC_32\SourceCode.Workflow.Client\4.0.0.0__16a2c5aaaa1b130d\SourceCode.Workflow.Client.dll
using SourceCode.Workflow.Client;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
#region Connect to SO Server for Employee Information
SmartObjectClientServer soClient = new SmartObjectClientServer();
soClient.Connection = soClient.CreateConnection();
if (soClient.Connection.IsConnected == false)
{
//Very Important, use connection string builder to create connection string.
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder connectionStr = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
connectionStr.Host = "dlx";
connectionStr.Integrated = true;
connectionStr.IsPrimaryLogin = true;
connectionStr.Port = 5555;
//Open connection
//Need method to handle closing of the connection when required - not implemented
try
{
soClient.Connection.Open(connectionStr.ConnectionString);
}
catch (Exception ex)
{
Response.Write("
Error: " + ex.Message);
}
}
#endregion
#region Load Employee Information
SmartObject soEmployee = soClient.GetSmartObject("NewEmployee");
soEmployee.MethodToExecute = "Load";
soEmployee.Properties["Username"].Value = System.Environment.UserName;
soClient.ExecuteScalar(soEmployee);
#endregion
#region Bind Employee Information with Form Data
Username.Text = soEmployee.Properties["Username"].Value.ToString();
ReqFullName.Text = soEmployee.Properties["name"].Value.ToString();
ReqTitle.Text = soEmployee.Properties["description"].Value.ToString();
Email.Text = soEmployee.Properties["mail"].Value.ToString();
Region.Text = soEmployee.Properties["Region"].Value.ToString();
#endregion
ApproximateCloseDate.Text = DateTime.Today.AddDays(14).ToShortDateString();
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
Connection k2Conn = new Connection();
try
{
k2Conn.Open("DLX");
ProcessInstance pi = k2Conn.CreateProcessInstance("Processes\\Pricing Approval");
#region Bind Data Fields from Form Data
pi.DataFields["Region"].Value = Region.Text;
pi.DataFields["TransactionType"].Value = TransactionType.SelectedValue;
pi.DataFields["NumPayees"].Value = Convert.ToInt32(NumPayees.Text);
pi.DataFields["CustomerName"].Value = CustomerName.SelectedValue;
pi.DataFields["PrimaryBusiness"].Value = PrimaryBusiness.Text;
pi.DataFields["AnnualRevenue"].Value = Convert.ToInt32(AnnualRevenue.Text);
pi.DataFields["PricingList"].Value = Convert.ToInt32(PricingList.Text);
pi.DataFields["PricingNet"].Value = Convert.ToInt32(PricingNet.Text);
pi.DataFields["PricingDiscount"].Value = Convert.ToInt32(PricingDiscount.Text);
pi.DataFields["Maintenance"].Value = Maintenance.SelectedValue;
pi.DataFields["FirstYearRate"].Value = Convert.ToInt32(FirstYearRate.Text);
pi.DataFields["RenewalRate"].Value = Convert.ToInt32(RenewalRate.Text);
pi.DataFields["Competition"].Value = Competition.Text;
pi.DataFields["ClientBudget"].Value = ClientBudget.Text;
pi.DataFields["ApproximateCloseDate"].Value = Convert.ToDateTime(ApproximateCloseDate.Text).ToShortDateString();
pi.DataFields["OutsideFinancingOffered"].Value = OutsideFinancingOffered.Text;
pi.DataFields["ServicesTraining"].Value = ServicesTraining.Text;
pi.DataFields["ServicesConsulting"].Value = ServicesConsulting.Text;
pi.DataFields["OriginatorComments"].Value = ReqComments.Text;
pi.DataFields["OriginatorUsername"].Value = Username.Text;
pi.DataFields["OriginatorEmail"].Value = Email.Text;
pi.DataFields["OriginatorTitle"].Value = ReqTitle.Text;
pi.DataFields["OriginatorFullName"].Value = ReqFullName.Text;
foreach (ListItem item in ModulesRequested.Items)
{
if (item.Selected == true)
{
pi.DataFields["ModulesRequested"].Value += item.Value + ", ";
}
}
pi.DataFields["ModulesRequested"].Value = pi.DataFields["ModulesRequested"].Value.ToString().Trim().TrimEnd(',');
#endregion
k2Conn.StartProcessInstance(pi);
}
catch (Exception exception)
{
Response.Write("
Error: " + exception.Message);
}
finally
{
k2Conn.Close();
}
}
}
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SourceCode.SmartObjects.Client;
// C:\WINDOWS\assembly\GAC_32\SourceCode.Workflow.Client\4.0.0.0__16a2c5aaaa1b130d\SourceCode.Workflow.Client.dll
using SourceCode.Workflow.Client;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
#region Connect to SO Server for Employee Information
SmartObjectClientServer soClient = new SmartObjectClientServer();
soClient.Connection = soClient.CreateConnection();
if (soClient.Connection.IsConnected == false)
{
//Very Important, use connection string builder to create connection string.
SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder connectionStr = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
connectionStr.Host = "dlx";
connectionStr.Integrated = true;
connectionStr.IsPrimaryLogin = true;
connectionStr.Port = 5555;
//Open connection
//Need method to handle closing of the connection when required - not implemented
try
{
soClient.Connection.Open(connectionStr.ConnectionString);
}
catch (Exception ex)
{
Response.Write("
Error: " + ex.Message);
}
}
#endregion
#region Load Employee Information
SmartObject soEmployee = soClient.GetSmartObject("NewEmployee");
soEmployee.MethodToExecute = "Load";
soEmployee.Properties["Username"].Value = System.Environment.UserName;
soClient.ExecuteScalar(soEmployee);
#endregion
#region Bind Employee Information with Form Data
Username.Text = soEmployee.Properties["Username"].Value.ToString();
ReqFullName.Text = soEmployee.Properties["name"].Value.ToString();
ReqTitle.Text = soEmployee.Properties["description"].Value.ToString();
Email.Text = soEmployee.Properties["mail"].Value.ToString();
Region.Text = soEmployee.Properties["Region"].Value.ToString();
#endregion
ApproximateCloseDate.Text = DateTime.Today.AddDays(14).ToShortDateString();
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
Connection k2Conn = new Connection();
try
{
k2Conn.Open("DLX");
ProcessInstance pi = k2Conn.CreateProcessInstance("Processes\\Pricing Approval");
#region Bind Data Fields from Form Data
pi.DataFields["Region"].Value = Region.Text;
pi.DataFields["TransactionType"].Value = TransactionType.SelectedValue;
pi.DataFields["NumPayees"].Value = Convert.ToInt32(NumPayees.Text);
pi.DataFields["CustomerName"].Value = CustomerName.SelectedValue;
pi.DataFields["PrimaryBusiness"].Value = PrimaryBusiness.Text;
pi.DataFields["AnnualRevenue"].Value = Convert.ToInt32(AnnualRevenue.Text);
pi.DataFields["PricingList"].Value = Convert.ToInt32(PricingList.Text);
pi.DataFields["PricingNet"].Value = Convert.ToInt32(PricingNet.Text);
pi.DataFields["PricingDiscount"].Value = Convert.ToInt32(PricingDiscount.Text);
pi.DataFields["Maintenance"].Value = Maintenance.SelectedValue;
pi.DataFields["FirstYearRate"].Value = Convert.ToInt32(FirstYearRate.Text);
pi.DataFields["RenewalRate"].Value = Convert.ToInt32(RenewalRate.Text);
pi.DataFields["Competition"].Value = Competition.Text;
pi.DataFields["ClientBudget"].Value = ClientBudget.Text;
pi.DataFields["ApproximateCloseDate"].Value = Convert.ToDateTime(ApproximateCloseDate.Text).ToShortDateString();
pi.DataFields["OutsideFinancingOffered"].Value = OutsideFinancingOffered.Text;
pi.DataFields["ServicesTraining"].Value = ServicesTraining.Text;
pi.DataFields["ServicesConsulting"].Value = ServicesConsulting.Text;
pi.DataFields["OriginatorComments"].Value = ReqComments.Text;
pi.DataFields["OriginatorUsername"].Value = Username.Text;
pi.DataFields["OriginatorEmail"].Value = Email.Text;
pi.DataFields["OriginatorTitle"].Value = ReqTitle.Text;
pi.DataFields["OriginatorFullName"].Value = ReqFullName.Text;
foreach (ListItem item in ModulesRequested.Items)
{
if (item.Selected == true)
{
pi.DataFields["ModulesRequested"].Value += item.Value + ", ";
}
}
pi.DataFields["ModulesRequested"].Value = pi.DataFields["ModulesRequested"].Value.ToString().Trim().TrimEnd(',');
#endregion
k2Conn.StartProcessInstance(pi);
}
catch (Exception exception)
{
Response.Write("
Error: " + exception.Message);
}
finally
{
k2Conn.Close();
}
}
}