示例#1
0
        public List <OpstiDomenskiObjekat> VratiListu(System.Data.OleDb.OleDbDataReader citac)
        {
            List <OpstiDomenskiObjekat> rentiranja = new List <OpstiDomenskiObjekat>();

            while (citac.Read())
            {
                Rentiranje rent = new Rentiranje();
                Klijent    k    = new Klijent();
                Automobil  a    = new Automobil();
                Zaposleni  zz   = new Zaposleni();
                Zaposleni  zr   = new Zaposleni();

                rent.rentiranjeID   = citac.GetString(0);
                a.AutomobilID       = citac.GetString(1);
                k.KlijentID         = citac.GetString(2);
                rent.datumZaduzenja = citac.GetDateTime(3);
                if (!citac.IsDBNull(4))
                {
                    rent.datumRazduzenja = citac.GetDateTime(4);
                }

                rent.ukupnaCena = Convert.ToDouble(citac["UkupnaCena"]);
                rent.razduzeno  = citac.GetBoolean(6);
                rent.stornirano = citac.GetBoolean(7);

                zz.ZaposleniID = citac.GetString(8);
                if (!citac.IsDBNull(9))
                {
                    zr.ZaposleniID = citac.GetString(9);
                }
                else
                {
                    zr.ZaposleniID = "/";
                }


                rent.klijent    = k;
                rent.automobil  = a;
                rent.zaduzioID  = zz;
                rent.razduzioID = zr;

                rentiranja.Add(rent);
            }
            return(rentiranja);
        }
示例#2
0
        /// <summary>
        /// Queries the normative database for a list of segments comprising the message structure.  The
        /// returned list may also contain strings that denote repetition and optionality.  Choice
        /// indicators (i.e. begin choice, next choice, end choice) for alternative segments are ignored,
        /// so that the class structure allows all choices.  The matter of enforcing that only a single
        /// choice is populated can't be handled by the class structure, and should be handled elsewhere.
        /// </summary>
        ///
        /// <param name="message">  The message. </param>
        /// <param name="version">  The version. </param>
        ///
        /// <returns>   An array of segment definition. </returns>

        private static SegmentDef[] getSegments(System.String message, System.String version)
        {
            /*String sql = "select HL7Segments.seg_code, repetitional, optional, description " +
             * "from (HL7MsgStructIDSegments inner join HL7Segments on HL7MsgStructIDSegments.seg_code = HL7Segments.seg_code " +
             * "and HL7MsgStructIDSegments.version_id = HL7Segments.version_id) " +
             * "where HL7Segments.version_id = 6 and message_structure = '" + message + "' order by seq_no";*/
            System.String sql = getSegmentListQuery(message, version);
            //System.out.println(sql.toString());
            SegmentDef[] segments = new SegmentDef[200]; //presumably there won't be more than 200
            using (System.Data.OleDb.OleDbConnection conn = NormativeDatabase.Instance.Connection)
            {
                System.Data.OleDb.OleDbCommand stmt = SupportClass.TransactionManager.manager.CreateStatement(conn);
                System.Data.OleDb.OleDbCommand temp_OleDbCommand;
                temp_OleDbCommand             = stmt;
                temp_OleDbCommand.CommandText = sql;
                System.Data.OleDb.OleDbDataReader rs = temp_OleDbCommand.ExecuteReader();
                int c = -1;
                while (rs.Read())
                {
                    System.String name      = SegmentGenerator.altSegName(System.Convert.ToString(rs[1 - 1]));
                    bool          repeating = rs.GetBoolean(2 - 1);
                    bool          optional  = rs.GetBoolean(3 - 1);
                    System.String desc      = System.Convert.ToString(rs[4 - 1]);
                    System.String groupName = System.Convert.ToString(rs[6 - 1]);

                    //ignore the "choice" directives ... the message class structure has to include all choices ...
                    //  if this is enforced (i.e. exception thrown if >1 choice populated) this will have to be done separately.
                    if (!(name.Equals("<") || name.Equals("|") || name.Equals(">")))
                    {
                        c++;
                        segments[c] = new SegmentDef(name, groupName, !optional, repeating, desc);
                    }
                }
                rs.Close();
                SegmentDef[] ret = new SegmentDef[c + 1];
                Array.Copy(segments, 0, ret, 0, c + 1);
                return(ret);
            }
        }