Exemple #1
0
        // Constructor for searched login
        public Login(uint gloid)
        {
            // Declarations
            uint gvoid = 0, modifiedby = 0;
            string username = null, password = null, note = null, status = null;
            bool active = false;
            DateTime datemodified = new DateTime(1901, 1, 1);

            // Command
            string query = string.Format("SELECT glo_username, glo_password, glo_note, glo_active, glo_status, gvo_id, date_modified, modified_by FROM gfrc_login" +
                                            " WHERE glo_id = {0}", gloid);

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        username = rdr.GetString(0);
                        password = rdr.GetString(1);
                        note = rdr.GetString(2);
                        active = rdr.GetBoolean(3);
                        status = rdr.GetString(4);
                        if (!UInt32.TryParse(rdr.GetValue(5).ToString(), out gvoid))
                            gvoid = 0;
                        if (!DateTime.TryParse(rdr.GetValue(6).ToString(), out datemodified))
                            datemodified = new DateTime(1901, 1, 1);
                        if (!UInt32.TryParse(rdr.GetValue(7).ToString(), out modifiedby))
                            modifiedby = 0;
                    }
                }
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            _gloID = gloid;
            _Username = username;
            _Password = password;
            _Note = note;
            _Active = active;
            _Status = status;
            _gvoID = gvoid;
            _DateModified = datemodified;
            _ModifiedBy = modifiedby;
        }
        /// <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>
        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
            //UPGRADE_NOTE: There are other database providers or managers under System.Data namespace which can be used optionally to better fit the application requirements. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1208'"
            using (System.Data.OleDb.OleDbConnection conn = NormativeDatabase.Instance.Connection)
            {
                //UPGRADE_TODO: Method 'java.sql.Connection.createStatement' was converted to 'SupportClass.TransactionManager.manager.CreateStatement' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javasqlConnectioncreateStatement'"
                System.Data.OleDb.OleDbCommand stmt = SupportClass.TransactionManager.manager.CreateStatement(conn);
                //UPGRADE_TODO: Interface 'java.sql.ResultSet' was converted to 'System.Data.OleDb.OleDbDataReader' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javasqlResultSet'"
                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);
            }
        }
Exemple #3
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>
        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);
            }
        }
 public static void Load(this DataObject dataObj, OleDbDataReader reader)
 {
     try
     {
         foreach (ColumnDefinition columnDef in dataObj.ColumnDefs())
         {
             if (reader.GetValue(columnDef.ColumnIndex) != DBNull.Value)
             {
                 switch (columnDef.ColumnFieldType)
                 {
                     case ColumnDefinition.FieldType.String:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetString(columnDef.ColumnIndex);
                         break;
                     case ColumnDefinition.FieldType.Int32:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetInt32(columnDef.ColumnIndex);
                         break;
                     case ColumnDefinition.FieldType.Boolean:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = reader.GetBoolean(columnDef.ColumnIndex);
                         break;
                 }
             }
             else //default values for nulls
             {
                 switch (columnDef.ColumnFieldType)
                 {
                     case ColumnDefinition.FieldType.String:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = string.Empty;
                         break;
                     case ColumnDefinition.FieldType.Int32:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = 0;
                         break;
                     case ColumnDefinition.FieldType.Boolean:
                         dataObj.GetColumnValues()[columnDef.ColumnIndex] = false;
                         break;
                 }
             }
         }
     }
     catch (Exception e)
     {
         //TODO: what to do here?
     }
 }
Exemple #5
0
        // Constructor for searched volunteer
        public Availability(uint gvoid)
        {
            // Declarations
            uint gvaid = 0, reqhours = 0, modifiedby = 0;
            bool mon = false, tues = false, wed = false, thur = false, fri = false, fillin = false;
            DateTime datemodified = new DateTime(1901, 1, 1), start = new DateTime(1901, 1, 1), end = new DateTime(1901, 1, 1);

            // Command
            string query = string.Format("SELECT gva_id, gva_start, gva_end, gva_req_hours, gva_mon, gva_tues, gva_wed, gva_thur, gva_fri, gva_fill_in, date_modified, modified_by " +
                                            "FROM gfrc_volunteer_avail WHERE gvo_id = {0}", gvoid);

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        UInt32.TryParse(rdr.GetValue(0).ToString(), out gvaid);
                        start = rdr.GetDateTime(1);
                        if (!DateTime.TryParse(rdr.GetValue(2).ToString(), out end))
                            end = new DateTime(1901, 1, 1);
                        UInt32.TryParse(rdr.GetValue(3).ToString(), out reqhours);
                        mon = rdr.GetBoolean(4);
                        tues = rdr.GetBoolean(5);
                        wed = rdr.GetBoolean(6);
                        thur = rdr.GetBoolean(7);
                        fri = rdr.GetBoolean(8);
                        fillin = rdr.GetBoolean(9);
                        if (!DateTime.TryParse(rdr.GetValue(10).ToString(), out datemodified))
                            datemodified = new DateTime(1901, 1, 1);
                        if (!UInt32.TryParse(rdr.GetValue(11).ToString(), out modifiedby))
                            modifiedby = 0;
                    }
                }
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            _gvaID = gvaid;
            _gvoID = gvoid;
            _Start = start;
            _End = end;
            _ReqHours = reqhours;
            _Mon = mon;
            _Tues = tues;
            _Wed = wed;
            _Thur = thur;
            _Fri = fri;
            _FillIn = fillin;
            _DateModified = datemodified;
            _ModifiedBy = modifiedby;
        }
Exemple #6
0
        // Constructor for searched volunteer
        public Volunteer(uint gvoid)
        {
            // Declarations
            uint modifiedby = 0;
            string name = null, address = null, postal = null, email = null, home = null, mobile = null;
            string status = null, referred = null, refdoc = null, poldoc = null, application = null;
            bool police = false, induction = false;
            DateTime datemodified = new DateTime(1901, 1, 1), dob = new DateTime(1901, 1, 1);

            // Command
            string query = string.Format("SELECT gvo_name, gvo_address, gvo_postal_address, gvo_email, gvo_home_ph, gvo_mobile_ph, gvo_dob, gvo_status, gvo_referred, gvo_referred_doc, " +
                                            "gvo_police, gvo_police_doc, gvo_induction, gvo_application, date_modified, modified_by FROM gfrc_volunteer" +
                                            " WHERE (gvo_id = {0})", gvoid);

            try
            {
                using (conn)
                {
                    conn.Open();
                    cmd = new OleDbCommand(query, conn);
                    rdr = cmd.ExecuteReader();

                    while (rdr.Read())
                    {
                        name = rdr.GetString(0);
                        address = rdr.GetString(1);
                        postal = rdr.GetString(2);
                        email = rdr.GetString(3);
                        home = rdr.GetString(4);
                        mobile = rdr.GetString(5);
                        dob = rdr.GetDateTime(6);
                        status = rdr.GetString(7);
                        referred = rdr.GetString(8);
                        refdoc = rdr.GetString(9);
                        police = rdr.GetBoolean(10);
                        poldoc = rdr.GetString(11);
                        induction = rdr.GetBoolean(12);
                        application = rdr.GetString(13);
                        if (!DateTime.TryParse(rdr.GetValue(14).ToString(), out datemodified))
                            datemodified = new DateTime(1901, 1, 1);
                        if (!UInt32.TryParse(rdr.GetValue(15).ToString(), out modifiedby))
                            modifiedby = 0;
                    }
                }
            }
            catch (Exception e)
            {
                name = "";
                address = "";
                postal = "";
                email = "";
                home = "";
                mobile = "";
                dob = new DateTime(1901, 1, 1);
                status = "";
                referred = "";
                refdoc = "";
                police = false;
                poldoc = "";
                induction = false;
                application = "";
                datemodified = new DateTime(1901, 1, 1);
                modifiedby = 0;
            }
            finally
            {
                if (rdr != null)
                    rdr.Close();
            }
            if (conn != null)
            {
                conn.Close();
            }

            _gvoID = gvoid;
            _Name = name;
            _Address = address;
            _PostalAddress = postal;
            _Email = email;
            _HomePh = home;
            _MobilePh = mobile;
            _DOB = dob;
            _Status = status;
            _Referred = referred;
            _ReferredDoc = refdoc;
            _Police = police;
            _PoliceDoc = poldoc;
            _Induction = induction;
            _Application = application;
            _DateModified = datemodified;
            _ModifiedBy = modifiedby;
        }