/* Warning: this is still singleton-based */ /* This just takes whatever is the active EAS for the given subprocess, * but probably should receive the EAS ID as input. */ public static void WorkspaceCreate(OdbcConnection conn, int IDsubprocess, string commentary) { IEditingWorkspace Iws = new IEditingWorkspace(conn); // BUG: hardwired user ID! int IDnewWS = Iws.NewEditingWorkspace(commentary, DateTime.Now, IDsubprocess, 1); // Still singleton!! EmptyTable(conn, "t_r_BusRoleWorkspaceEntitlement"); EmptyTable(conn, "WorkspaceEntitlement"); IWorkspaceEntitlement Iwserows = new IWorkspaceEntitlement(conn); IEntAssignmentSet Ieas = new IEntAssignmentSet(conn); IEntitlement Ient = new IEntitlement(conn); /* See above comment: this hardwared active=true logic is not good */ returnListEntAssignmentSetBySubProcess[] _IDeas = Ieas.ListEntAssignmentSetBySubProcess(null, "\"BOOLisActive\" = 1", new string[] { }, "", IDsubprocess); int IDeas = _IDeas[0].ID; /* Find the list of EAssignments to bring over to the Workspace */ IEntAssignment Iea = new IEntAssignment(conn); returnListEntAssignmentByEntAssignmentSet[] _IDea = Iea.ListEntAssignmentByEntAssignmentSet(null, "", new string[] {}, "", IDeas); int numToConvert = _IDea.Length; Hashtable dictEntVectorClones = new Hashtable(); foreach (returnListEntAssignmentByEntAssignmentSet i in _IDea) { int IDentitlementVector = i.EntitlementID; int IDbusrole = i.BusRoleID; int IDcloneEntVector = -88; if (dictEntVectorClones.ContainsKey(IDentitlementVector)) { // The entitlement vector was already cloned in the workspace. IDcloneEntVector = (int)dictEntVectorClones[IDentitlementVector]; } else { // MUST CLONE THE VECTOR returnGetEntitlement theE = Ient.GetEntitlement(IDentitlementVector); IDcloneEntVector = Iwserows.NewWorkspaceEntitlement (theE.StandardActivity, theE.RoleType, theE.System, theE.Platform, theE.EntitlementName, theE.EntitlementValue, IDnewWS); dictEntVectorClones.Add(IDentitlementVector, IDcloneEntVector); } // We have the bus.role ID and we now have the ID of the // WorkspaceEntitlement object. // We now create the tie that binds them. RecordLinkFromBusRoleToWSEntitVector (conn, IDbusrole, IDcloneEntVector, IDnewWS); } }
private void Grid1_InsertCommand(object sender, ComponentArt.Web.UI.GridItemEventArgs e) { // NEVER INSERT USING SQLSERVER SHIT! // No way to get the primary key easily of the new row. // absolute shit // Use the RISE-genearated ODBC string connstr = @"Dsn=RISEauthframework"; System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection(connstr); conn.Open(); IWorkspaceEntitlement Iwserows = new IWorkspaceEntitlement(conn); // It would be nice to verify that the permutation vector is indeed unique to this sandbox!! // LATER! Hashtable fields = new Hashtable(); string SQLcolnames = "c_r_EditingWorkspace "; string SQLcolvalues = IDworkspace.ToString(); int numParams = 0; for (int i = 0; i < e.Item.ToArray().Length; i++) { GridColumn col = Grid1.Levels[0].Columns[i]; if (col.AllowEditing != InheritBool.False) { if (col.Visible && (col.DataField != "") && (col.DataField != null)) { SQLcolnames += " , "; SQLcolvalues += " , "; fields.Add(col.DataField, e.Item.ToArray()[i].ToString()); SQLcolnames += col.DataField; SQLcolvalues += "@" + col.DataField; numParams++; SqlDataSource1.InsertParameters.Add(col.DataField, e.Item.ToArray()[i].ToString()); } } } // Here we only add the REQUIRED columns, then we'll do an UPDATE to fill in the non-required int IDnewEntVector = Iwserows.NewWorkspaceEntitlement ( fields["c_u_StandardActivity"] as string, fields["c_u_RoleType"] as string, fields["c_u_System"] as string, fields["c_u_Platform"] as string, fields["c_u_EntitlementName"] as string, fields["c_u_EntitlementValue"] as string, IDworkspace); Iwserows.SetWorkspaceEntitlement(IDnewEntVector, fields["c_u_StandardActivity"] as string, fields["c_u_RoleType"] as string, fields["c_u_System"] as string, fields["c_u_Platform"] as string, fields["c_u_EntitlementName"] as string, fields["c_u_EntitlementValue"] as string, fields["c_u_AuthObjName"] as string, fields["c_u_AuthObjValue"] as string, fields["c_u_FieldSecName"] as string, fields["c_u_FieldSecValue"] as string, null, null, fields["c_u_Commentary"] as string, IDworkspace); conn.Close(); }