Exemplo n.º 1
0
        private void RegisterNewTcode
            (System.Collections.Specialized.NameValueCollection P,
            HttpResponse httpResponse, string newname, string newdescr)
        {
            ITcodeDictionary engine = new ITcodeDictionary(HELPERS.NewOdbcConn());

            try
            {
                int IDbaby = engine.NewTcodeDictionary(newname);
                engine.SetTcodeDescription(IDbaby, newdescr);
            }
            catch (Exception eee)
            {
                throw new Exception("That TCode name is already registered.");
            }
        }
Exemplo n.º 2
0
        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);
            }
        }