private void _DEFUNCT_RecordChangeToRoleLink(int IDtass, int IDentit, GridItemEventArgs e) { ITcodeAssignment Itass = new ITcodeAssignment(HELPERS.NewOdbcConn()); // Get the ID of the current SAP role linked via this TcodeAssignment obj returnGetTcodeAssignment prev = Itass.GetTcodeAssignment(IDtass); int prevID = prev.SAProleID; // NEW? int newID = int.Parse(SafeString(e.Item["SAProlename"])); if (prevID != newID) { /* * IEventLog LOG = new IEventLog(HELPERS.NewOdbcConn()); * // 1. Log this change so we record the previous value. * string action = "OrigTASSro"; * int IDlog = LOG.NewEventLog * (DateTime.Now, * this.session.idUser, * this.Request.ServerVariables["REMOTE_ADDR"], * action); * LOG.SetEventLog * (IDlog, DateTime.Now, * this.session.idUser, * this.Request.ServerVariables["REMOTE_ADDR"], * action, IDtass, IDentit.ToString()); */ throw new Exception("NOT IMPLEMENTED"); // I BLIEVE THIS IS NOT UJSED ANYHMORE? // 2A. Make the actual change. /* * returnGetTcodeAssignment theTass = Itass.GetTcodeAssignment(IDtass); * Itass.SetTcodeAssignment * (IDtass, * theTass.TcodeAssignmentSetID, * newID, * theTass.TcodeEntitlementID, * theTass.EditStatus | 8); */ // DBrefresh(); } }
private void EditSAPentitlement (System.Collections.Specialized.NameValueCollection P, HttpResponse httpResponse) { ITcodeEntitlement engineTCEnt = new ITcodeEntitlement(HELPERS.NewOdbcConn()); bool RETURNnewOneWasCreated; int RETURNid; SAP_HELPERS.CreateTcodeEntitlementIfNotExists (engineTCEnt, P["c_u_TCode"], P["c_u_ActivityFolder"], P["c_u_Type"], P["c_u_AccessLevel"], P["c_u_Comment"], out RETURNnewOneWasCreated, out RETURNid); int IDentitlement = RETURNid; /* * if ( ! RETURNnewOneWasCreated) * { * if (P["IDentit"].Length > 1) { * if (IDentitlement != int.Parse(P["IDentit"])) { * throw new Exception("Database Internal Error: multiple identical TC entitlements: " + IDentitlement + " and " + int.Parse(P["IDentit"])); + } + } + } */ // It really doesn't matter if this is a new TC entitlement. // The workspace ID is in session paarm INTcurWS_SAP // The role is being sent in. ITcodeAssignment engine = new ITcodeAssignment(HELPERS.NewOdbcConn()); string strIDtass = P["IDtass"]; int intIDtass; int IDrole = int.Parse(P["IDrole"]); int IDuser = int.Parse(P["IDuser"]); int IDws = int.Parse(P["IDws"]); string tcode = (P["c_u_TCode"]); char subjunctiveTestTcodeAssignment = SAP_HELPERS.CreateTcodeAssignmentIfNotExists (IDws, engine, IDrole, RETURNnewOneWasCreated, IDentitlement, true, out intIDtass); if (strIDtass == "ADD") { // // The user is trying to create a NEW assignment. // // Fail non-violently if already exists in this workspace if (subjunctiveTestTcodeAssignment == 'E') { throw new Exception("That particular assignment is already in place."); } SAP_HELPERS.CreateTcodeAssignmentIfNotExists (IDws, engine, IDrole, RETURNnewOneWasCreated, IDentitlement, false, out intIDtass); } else { // // The user is trying to edit an EXISTING assignment. // if (subjunctiveTestTcodeAssignment == 'E') { throw new Exception("That particular assignment is already in place."); } intIDtass = int.Parse(strIDtass); SAP_HELPERS.RecordChangeInEntitlementAssignmentRow (intIDtass, IDws, IDentitlement, IDuser, IDrole, P["ipaddr"], P); } }
public static void ImportDataTableAsNewTcodeAssignmentSet( DataTable dt, int IDuser, int IDsubpr, System.Data.Odbc.OdbcConnection conn) { IUser Iuser = new IUser(conn); ISubProcess Isubpr = new ISubProcess(conn); ITcodeAssignmentSet Ieaset = new ITcodeAssignmentSet(conn); ITcodeAssignment Iea = new ITcodeAssignment(conn); ITcodeEntitlement Ientit = new ITcodeEntitlement(conn); ITcodeDictionary Idict = new ITcodeDictionary(conn); ISAProle Isr = new ISAProle(conn); int IDneweas = Ieaset.NewTcodeAssignmentSet (false, DateTime.Now, "Import from CSV", IDsubpr, IDuser); // These Get function are only useful for a read-only view of fields; // not for generating subordinate entities. returnGetTcodeAssignmentSet neweas = Ieaset.GetTcodeAssignmentSet(IDneweas); IEnumerator <System.Data.DataRow> x = (IEnumerator <System.Data.DataRow>)dt.Rows.GetEnumerator(); while (x.MoveNext()) { int IDsaprole; int IDtcode; if (x.Current[0].Equals(System.DBNull.Value)) { // Ignore any line with no value in the first field. // Often the end of the csv file has just lots of blank rows. continue; } // Make sure SAP role object exists; create if not. string saprole = (string)(x.Current["SAProle"]); RBSR_AUFW.DB.ISAProle.returnListSAProle[] xx = Isr.ListSAProle(null, "\"Name\" like ?", new string[] { saprole }, ""); if (xx.Length < 1) { // MUST ADD NEW ONE IDsaprole = Isr.NewSAProle(saprole, IDsubpr); } else { IDsaprole = xx[0].ID; } // Make sure Tcode exists in the Tcode dictionary string tcodeshortname = (string)(x.Current["TCODE Value"]); returnListTcodeDictionary[] xxx = Idict.ListTcodeDictionary (null, "\"TcodeID\" like ?", new string[] { tcodeshortname }, ""); if (xxx.Length < 1) { // MUST ADD NEW ONE IDtcode = Idict.NewTcodeDictionary(tcodeshortname, x.Current["TCODE Description"] as string); } else { IDtcode = xxx[0].ID; } int IDnewent = Ientit.NewTcodeEntitlement( x.Current["Standard Activity"] as string, x.Current["Type"] as string, x.Current["System"] as string, x.Current["Platform"] as string, IDtcode); Ientit.SetTcodeEntitlement(IDnewent, x.Current["Standard Activity"] as string, x.Current["Type"] as string, x.Current["System"] as string, x.Current["Platform"] as string, x.Current["AuthObj Name"] as string, x.Current["AuthObj Description"] as string, x.Current["Field-Level Security Value Description"] as string, x.Current["Field-Level Security Value"] as string, x.Current["Additional Comments"] as string, IDtcode); int IDnewentass = Iea.NewTcodeAssignment(IDneweas, IDsaprole, IDnewent); } }