コード例 #1
0
        private void SAP_AddObjsTo1251(System.Collections.Specialized.NameValueCollection P, HttpResponse httpResponse)
        {
            System.Data.Odbc.OdbcConnection conn = HELPERS.NewOdbcConn_FORCE();

            int IDauthobj = int.Parse(P["IDauthobj"]);
            int IDsaprole = int.Parse(P["IDsaprole"]);

            System.Data.Odbc.OdbcConnection conn2 = HELPERS.NewOdbcConn_FORCE();
            IAuthRow1251 engine1251 = new IAuthRow1251(conn2);

            OdbcDataReader dr = InquireFieldListForAuthObj(IDauthobj, conn);

            while (dr.Read())
            {
                int idSAPauthField = dr.GetInt32(2);

                // Does this obj+field combination already exist?
                returnListAuthRow1251ByTcodeAssignmentSet[] listAuthRows =
                    engine1251.ListAuthRow1251ByTcodeAssignmentSet
                        (null, " \"SAPauthObj\" = ?  AND \"SAPauthField\" = ?", new string[] { IDauthobj.ToString(), idSAPauthField.ToString() }, "",
                        /*TcodeAssignmentSet is the WorkspaceID: */ session.idWorkspace_SAP);

                if (listAuthRows.GetLength(0) < 1)
                {
                    // OK, we're ready to add a row
                    engine1251.NewAuthRow1251
                        (IDauthobj, idSAPauthField, session.idWorkspace_SAP, IDsaprole, 2);
                }
                else
                {
                    // A row for this combo already exists, but we will make sure it is not
                    // with its deletion bit set to delete.
                    engine1251.SetAuthRow1251
                        (listAuthRows[0].ID, listAuthRows[0].RangeLow, listAuthRows[0].RangeHigh,
                        listAuthRows[0].SAPauthObjID, listAuthRows[0].SAPauthFieldID, listAuthRows[0].TcodeAssignmentSetID,
                        listAuthRows[0].SAProleID,
                        listAuthRows[0].EditStatus & (8 + 2 + 1) /* to turn OFF the deletion bit if it happens to be on */);
                }
            }
        }