/// <summary> /// Builds the connection string /// </summary> /// <returns></returns> public static string ConnectToK2() { GetDetails(); SCConnectionStringBuilder connectionstring = new SCConnectionStringBuilder(); connectionstring.Host = _Server; connectionstring.Port = _Port; connectionstring.IsPrimaryLogin = true; connectionstring.Integrated = true; return(connectionstring.ToString()); }
private static string EnvionmentServerConnection(string environmentServer) { SCConnectionStringBuilder cb = new SCConnectionStringBuilder(); cb.Host = environmentServer; cb.Port = 5555; cb.Integrated = true; cb.IsPrimaryLogin = true; cb.Authenticate = true; cb.EncryptedPassword = false; string envionmentServerConnection = cb.ToString(); return(envionmentServerConnection); }
/// <summary> /// Get Connection String Connect to K2. /// </summary> /// <returns>The connection string.</returns> private string GetConnectionString() { var hostServerConnectionString = new SCConnectionStringBuilder { Host = ConfigurationManager.AppSettings[ConstantValueService.K2_URL], Port = Convert.ToUInt32(ConfigurationManager.AppSettings[ConstantValueService.K2_MANAGEMENT_PORT]), IsPrimaryLogin = true, Integrated = false, UserID = ConfigurationManager.AppSettings[ConstantValueService.K2_ADMINUSERNAME], Password = ConfigurationManager.AppSettings[ConstantValueService.K2_ADMINPASSWORD], SecurityLabelName = ConfigurationManager.AppSettings[ConstantValueService.K2_SECURITYLABEL] }; return(hostServerConnectionString.ToString()); }
public SmartObjectClientServer NewSmartObjectClientServer() { SCConnectionStringBuilder hostServerConnectionString = new SCConnectionStringBuilder(); hostServerConnectionString.Host = this.AppConfig.K2Server; hostServerConnectionString.Port = 5555; hostServerConnectionString.IsPrimaryLogin = true; hostServerConnectionString.Integrated = true; SmartObjectClientServer result = new SmartObjectClientServer(); result.CreateConnection(); //open the connection to the K2 server result.Connection.Open(hostServerConnectionString.ToString()); //return the SOClientServer object return(result); }
public K2ConnectionStringBuilder(string userID) { ConnSetup = new ConnectionSetup(); SCConnectionStringBuilder connectionString = new SCConnectionStringBuilder(); connectionString.Authenticate = true; connectionString.Integrated = false; connectionString.IsPrimaryLogin = true; connectionString.EncryptedPassword = false; connectionString.Host = K2Environments.Host; connectionString.Port = K2Environments.Port; connectionString.SecurityLabelName = K2Environments.SecurityLabelName; connectionString.UserID = userID; connectionString.Password = "******"; ConnSetup.ConnectionString = connectionString.ToString(); }
public K2ConnectionStringBuilder(string userID) { ConnSetup = new ConnectionSetup(); SCConnectionStringBuilder connectionString = new SCConnectionStringBuilder(); connectionString.Authenticate = true; connectionString.Integrated = false; connectionString.IsPrimaryLogin = true; connectionString.EncryptedPassword = false; connectionString.Host = K2Environments.Host; connectionString.Port = K2Environments.Port; connectionString.SecurityLabelName = K2Environments.SecurityLabelName; connectionString.UserID = userID; connectionString.Password = "******"; ConnSetup.ConnectionString = connectionString.ToString(); }
public K2ConnectionStringBuilder(ServerType type) { switch (type) { case ServerType.UserRoleManager: SCConnectionStringBuilder builder = new SCConnectionStringBuilder() { Host = K2Environments.Host, Port = 5555, Integrated = true, IsPrimaryLogin = true, }; this.ConnectionString = builder.ToString(); break; } }
public K2ConnectionStringBuilder(ServerType type) { switch (type) { case ServerType.UserRoleManager: SCConnectionStringBuilder builder = new SCConnectionStringBuilder() { Host = K2Environments.Host, Port = 5555, Integrated = true, IsPrimaryLogin = true, }; this.ConnectionString = builder.ToString(); break; } }
static void Main(string[] args) { SmartObjectClientServer server = new SmartObjectClientServer(); try { SCConnectionStringBuilder cb = new SCConnectionStringBuilder(); cb.Host = "DLX"; cb.Port = 5555; cb.Integrated = true; cb.IsPrimaryLogin = true; //Connect to server server.CreateConnection(); server.Connection.Open(cb.ToString()); //-------------------------- //Get the Employee //Get SmartObject Definition SmartObject employee = server.GetSmartObject("Employee"); //Set properties employee.Properties["ID"].Value = "2"; //Get the record employee.MethodToExecute = "FindEmployee"; server.ExecuteScalar(employee); System.Diagnostics.Trace.WriteLine( employee.Properties["FirstName"].Value); System.Diagnostics.Trace.WriteLine( employee.Properties["LastName"].Value); System.Diagnostics.Trace.WriteLine( employee.Properties["Email"].Value); } catch (Exception ex) { throw new Exception("Error Creating Request >> " + ex.Message); } }
static void Main(string[] args) { SmartObjectClientServer server = new SmartObjectClientServer(); try { SCConnectionStringBuilder cb = new SCConnectionStringBuilder(); cb.Host = "DLX"; cb.Port = 5555; cb.Integrated = true; cb.IsPrimaryLogin = true; //Connect to server server.CreateConnection(); server.Connection.Open(cb.ToString()); //-------------------------- //Get the Employee //Get SmartObject Definition SmartObject employee = server.GetSmartObject("Employee"); //Set properties employee.Properties["ID"].Value = "2"; //Get the record employee.MethodToExecute = "FindEmployee"; server.ExecuteScalar(employee); System.Diagnostics.Trace.WriteLine( employee.Properties["FirstName"].Value); System.Diagnostics.Trace.WriteLine( employee.Properties["LastName"].Value); System.Diagnostics.Trace.WriteLine( employee.Properties["Email"].Value); } catch (Exception ex) { throw new Exception("Error Creating Request >> " + ex.Message); } }
static void Main(string[] args) { //Get Form View Relation DataTable dtFormView = new DataTable(); dtFormView.Columns.Add("FormGUID", typeof(Guid)); dtFormView.Columns.Add("ViewGUID", typeof(Guid)); SCConnectionStringBuilder sb = new SCConnectionStringBuilder(); sb.Authenticate = true; sb.IsPrimaryLogin = true; sb.Integrated = true; sb.Host = "localhost"; sb.Port = 5555; SmartObjectClientServer socs = new SmartObjectClientServer(); socs.CreateConnection(); socs.Connection.Open(sb.ToString()); FormsManager fm = new FormsManager(sb.ToString()); FormExplorer fe = fm.GetForms(); foreach (FormInfo fi in fe.Forms) { Guid formGUID = fi.Guid; //Console.WriteLine("Form: " + fi.DisplayName); ViewExplorer ve = fm.GetViewsForForm(fi.Guid); foreach (ViewInfo vi in ve.Views) { DataRow dr = dtFormView.NewRow(); dr["FormGUID"] = formGUID; dr["ViewGUID"] = vi.Guid; dtFormView.Rows.Add(dr); } } //Get Form Process Relation DataTable dtFormProcess = new DataTable(); dtFormProcess.Columns.Add("ProcessName", typeof(string)); dtFormProcess.Columns.Add("FormGUID", typeof(Guid)); fe = fm.GetForms(); foreach (FormInfo fi in fe.Forms) { Guid formGUID = fi.Guid; IEnumerable<string> processes = fm.GetProcessesForForm(fi.Guid); foreach (var process in processes) { DataRow dr = dtFormProcess.NewRow(); dr["FormGUID"] = formGUID; dr["ProcessName"] = process; dtFormProcess.Rows.Add(dr); } } //Get View SMO Relation DataTable dtViewSMO = new DataTable(); dtViewSMO.Columns.Add("ViewGUID", typeof(Guid)); dtViewSMO.Columns.Add("SmartObjectGUID", typeof(Guid)); fe = fm.GetForms(); foreach (FormInfo fi in fe.Forms) { ViewExplorer ve = fm.GetViewsForForm(fi.Guid); foreach (ViewInfo vi in ve.Views) { Guid viewGUID = vi.Guid; foreach (Guid soGuid in fm.GetObjectsForView(vi.Guid)) { DataRow dr = dtViewSMO.NewRow(); dr["ViewGUID"] = viewGUID; dr["SmartObjectGUID"] = soGuid; dtViewSMO.Rows.Add(dr); } } } fm.Connection.Close(); socs.Connection.Close(); //Delete data from table string stmt = "Delete From FormViewDependency"; ExecuteNoneQuery(stmt, CommandType.Text); //Insert Form View Relation to table for(int i = 0; i < dtFormView.Rows.Count; i++) { DataRow dr = dtFormView.Rows[i]; stmt = @"INSERT INTO [dbo].[FormViewDependency] ([FormGUID] ,[ViewGUID]) VALUES ('" + dr["FormGUID"].ToString() + @"' ,'" + dr["ViewGUID"].ToString() + "')"; ExecuteNoneQuery(stmt, CommandType.Text); } //Delete data from table stmt = "Delete From FormProcessDependency"; ExecuteNoneQuery(stmt, CommandType.Text); //Insert Form Process Relation to table for (int i = 0; i < dtFormProcess.Rows.Count; i++) { DataRow dr = dtFormProcess.Rows[i]; stmt = @"INSERT INTO [dbo].[FormProcessDependency] ([FormGUID] ,[ProcessName]) VALUES ('" + dr["FormGUID"].ToString() + @"' ,'" + dr["ProcessName"].ToString() + "')"; ExecuteNoneQuery(stmt, CommandType.Text); } //Delete data from table stmt = "Delete From ViewSMODependency"; ExecuteNoneQuery(stmt, CommandType.Text); //Insert View SMO Relation to table for (int i = 0; i < dtViewSMO.Rows.Count; i++) { DataRow dr = dtViewSMO.Rows[i]; stmt = @"INSERT INTO [dbo].[ViewSMODependency] ([ViewGUID] ,[SmartObjectGUID]) VALUES ('" + dr["ViewGUID"].ToString() + @"' ,'" + dr["SmartObjectGUID"].ToString() + "')"; ExecuteNoneQuery(stmt, CommandType.Text); } //SmartObjectClientServer socs = new SmartObjectClientServer(); //socs.CreateConnection(); //socs.Connection.Open(sb.ToString()); //FormsManager fm = new FormsManager(sb.ToString()); //FormExplorer fe = fm.GetForms(); //foreach (FormInfo fi in fe.Forms) //{ // Console.WriteLine("Form: " + fi.DisplayName); // ViewExplorer ve = fm.GetViewsForForm(fi.Guid); // IEnumerable<string> x = fm.GetProcessesForForm(fi.Guid); // foreach (var y in x) // { // Console.WriteLine("Process: " + y); // } // foreach (ViewInfo vi in ve.Views) // { // Console.WriteLine("View: " + vi.DisplayName); // foreach(Guid soGuid in fm.GetObjectsForView(vi.Guid)) // { // try // { // SmartObject so = socs.GetSmartObject(soGuid); // Console.WriteLine("SmartObject: " + so.Name); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // Console.WriteLine(); // } //} //fm.Connection.Close(); //socs.Connection.Close(); //Console.ReadLine(); }