Substream
Substream
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using eBAFlowScrAdp;
using eBAFormData;
using eBAPI;
using eBAPI.Connection;
using eBAPI.Workflow;
using eBAIntegrationAPI;
using System.Data;
using System.Data.SqlClient;
using eBADB;
using eBALibrary;
namespace ChangeManagement
{
public partial class FlowCode
{
public void FlowScript1_Execute()
{
eBAConnection eBACon = CreateServerConnection();
eBACon.Open();
Try
{ int i =0;
eBAIntegrationQuery query = new eBAIntegrationQuery("EBA","CMGetResponsibleView");
query. Parameters.Add("USER",Variable1.Value);
DataTable = DT Query. Execute(eBACon);
foreach(DataRow item in dt. Rows)
{
if(!string. IsNullOrEmpty(item["users"]. ToString()))
{
WorkflowProcess flow = eBACon.WorkflowManager.CreateProcess("ChaMngDeptAppr");
Ada. Parameters.Add("PartitionPrincipal",item["users"]. ToString());
Ada. Parameters.Add("MainAkisID",id.ToString());
Ada. Parameters.Add("FormView",item["VIEWS"]. ToString());
Ada. Parameters.Add("DocumentId",Document1.ProfileId.ToString());
if(item["VIEWS"]. ToString()=="View_Purchasing")
{
PurchasingOffer.SetFromUser(item["users"]. ToString());
}
if(item["VIEWS"]. ToString()=="View_Sales")
{
SalesCheck.SetFromUser(item["users"]. ToString());
SalesPos.Value = item["users"]. ToString();
}
if(item["VIEWS"]. ToString()=="View_Quality")
{
PQE. Value = item["users"]. ToString();
}
Ada. Parameters.Update();
Ada. Start();
User user = Organization.GetUser(item["users"]. ToString());
triggeredID.Value=flow. ProcessId.ToString();
int orderId = GetOrderID(id);
AddChildFlow(Convert.ToInt32(triggeredID.Value),orderId,"Partition Approval for which it is responsible");
i++;
}
}
PartitionNumber.Value = i.ToString();
}
finally
{
eBACon.Close();
}
}
int GetOrderID(int AkisID)
{
eBADBProvider SqlCon = CreateDatabaseProvider();
SqlCon.Open();
Try
{
string Sql = "Select Max(ORDERNO) AS ORDERNO From FLOWREQUESTS Where ProcessId="+AkisID;
SqlDataAdapter = (SqlDataAdapter)SqlCon.CreateDataAdapter(Sql);
DataTable dt = new DataTable();
also. Fill(dt);
if(dt. Rows.Count>
0)
{
return int. Parse(dt. Rows[0]["ORDERNO"]. ToString());
}
else
{
throw new Exception("Query Contains No Rows :\n"+Sql);
}
}
catch (Exception e)
{
throw new Exception(e.Message);
}
finally
{
SqlCon.Close();
}
}
public void AltFlowAdd(int triggeredId,int orderNo,string Description)
{
String = SQL. Format(@"INSERT INTO FLOWSUBFLOWS (PROCESSID,SUBPROCESSID,ORDERNO,DESCRIPTION,RELATIONDATE,RELATIONTYPE) VALUES('"+id.ToString()+"','"+triggeredId+"','"+orderNo+"','"+description+"',getdate(),'1')");
eBADB.eBADBProvider db = CreateDatabaseProvider();
SqlConnection = SqlCon (SqlConnection)db. Connection;
SqlCon.Open();
Try
{
SqlCommand com = new SqlCommand(sql,SqlCon);
.com. ExecuteNonQuery();
.com. Dispose();
}
finally
{
SqlCon.Close();
}
}
}
}