GetChar() public method

Gets the value of the specified column as a single character.
public GetChar ( int i ) : char
i int
return char
        private TrackingEntry readEntry(MySqlDataReader reader)
        {
            TrackingEntry currentEntry = new TrackingEntry();

            currentEntry.entryID = reader.GetInt32(0);
            currentEntry.taggerID = reader.GetInt32(1);
            currentEntry.type = reader.GetChar(2);
            currentEntry.isTagged = reader.GetBoolean(3);
            currentEntry.taggerName = reader.GetString(4);
            currentEntry.entryDate = ((DateTime)reader.GetMySqlDateTime(5)).ToString("yyyy-MM-dd HH:mm:ss");

            if (reader.IsDBNull(6))
                currentEntry.tagNumber = -1;
            else
                currentEntry.tagNumber = reader.GetInt32(6);

            currentEntry.species = reader.GetString(7);

            if (reader.IsDBNull(8))
                currentEntry.city = "";
            else
                currentEntry.city = reader.GetString(8);

            if (reader.IsDBNull(9))
                currentEntry.state = "";
            else
                currentEntry.state = reader.GetString(9);

            if (reader.IsDBNull(10))
                currentEntry.country = "";
            else
                currentEntry.country = reader.GetString(10);

            if (reader.IsDBNull(11))
                currentEntry.longitude = "";
            else
                currentEntry.longitude = reader.GetString(11);

            if (reader.IsDBNull(12))
                currentEntry.latitude = "";
            else
                currentEntry.latitude = reader.GetString(12);

            if (reader.IsDBNull(13))
                currentEntry.temperature = "";
            else
                currentEntry.temperature = reader.GetString(13);

            if (reader.IsDBNull(14))
                currentEntry.precipitation = "";
            else
                currentEntry.precipitation = reader.GetString(14);

            if (reader.IsDBNull(15))
                currentEntry.windSpeed = "";
            else
                currentEntry.windSpeed = reader.GetString(15);

            if (reader.IsDBNull(16))
                currentEntry.windDirection = "";
            else
                currentEntry.windDirection = reader.GetString(16);

            return currentEntry;
        }
示例#2
0
 private Employee constructEmployee(MySqlDataReader staffReader)
 {
     Employee newEmployee = new Employee();
     newEmployee.NINo = staffReader.GetString("National_Insurance_Number");
     newEmployee.FirstName = staffReader.GetString("First_Name");
     newEmployee.LastName = staffReader.GetString("Last_Name");
     newEmployee.Position = staffReader.GetString("Position");
     newEmployee.Gender = staffReader.GetChar("Gender");
     newEmployee.DateStarted = staffReader.GetDateTime("Date_Started");
     newEmployee.DateFinished = SafeGetDateTime(staffReader, "Date_Finished");
     newEmployee.PVGDate = staffReader.GetDateTime("PVG_Date");
     newEmployee.HolidaysEntitled = staffReader.GetInt16("Holidays_Entitled");
     newEmployee.HolidaysTaken = staffReader.GetInt16("Holidays_Taken");
     newEmployee.WeeksHours = staffReader.GetInt16("Hours");
     newEmployee.Address = constructAddress(staffReader);
     newEmployee.DOB = staffReader.GetDateTime("DOB");
     newEmployee.Salary = staffReader.GetDecimal("Salary");
     newEmployee.HomePhone = staffReader.GetString("Home_Phone");
     newEmployee.MobilePhone = staffReader.GetString("Mobile_Phone");
     newEmployee.Email = staffReader.GetString("Email");
     newEmployee.Training = SafeGetString(staffReader, "Training");
     newEmployee.Medical = constructMedical(staffReader);
     //EC...
     return newEmployee;
 }
示例#3
0
        private Parent constructParent(MySqlDataReader parentReader)
        {
            Parent newParent = new Parent();
            newParent.ParentID = parentReader.GetInt32("Parent_ID");
            newParent.FirstName = parentReader.GetString("First_Name");
            newParent.LastName = parentReader.GetString("Last_Name");
            newParent.Title = parentReader.GetString("Title");
            newParent.Gender = parentReader.GetChar("Gender");
            newParent.HomePhone = parentReader.GetString("Home_Phone");
            newParent.WorkPhone = parentReader.GetString("Work_Phone");
            newParent.MobilePhone = parentReader.GetString("Mobile_Phone");
            newParent.HomeAddress = constructMultipleAddress(parentReader, "home");
            newParent.WorkAddress = constructMultipleAddress(parentReader, "work");
            //newParent.Spouse = childReader.GetInt16(10);
            newParent.Email = SafeGetString(parentReader, "Email");

            //Neglecting list of children?

            return newParent;
        }
示例#4
0
        private EmergencyContact constructEmergencyContact(MySqlDataReader ECReader)
        {
            EmergencyContact newEC = new EmergencyContact();
            newEC.ContactID = ECReader.GetInt32("Contact_ID");
            newEC.Title = ECReader.GetString("Title");
            newEC.FirstName = ECReader.GetString("First_Name");
            newEC.LastName = ECReader.GetString("Last_Name");
            newEC.Relationship = ECReader.GetString("Relationship");
            newEC.HomePhone = ECReader.GetString("Home_Phone");
            newEC.WorkPhone = ECReader.GetString("Work_Phone");
            newEC.MobilePhone = ECReader.GetString("Mobile_Phone");
            newEC.HomeAddress = constructMultipleAddress(ECReader, "home");
            newEC.WorkAddress = constructMultipleAddress(ECReader, "work");
            newEC.Gender = ECReader.GetChar("Gender");
            newEC.Email = ECReader.GetString("Email");

            return newEC;
        }
示例#5
0
        private Child constructChild(MySqlDataReader childrenReader)
        {
            Child newChild = new Child();
            newChild.ChildID = childrenReader.GetInt32("Child_Id");
            newChild.FirstName = childrenReader.GetString("First_Name");
            newChild.LastName = childrenReader.GetString("Last_Name");
            newChild.Gender = childrenReader.GetChar("Gender");
            newChild.DOB = childrenReader.GetDateTime("DOB");

            newChild.FirstLanguage = childrenReader.GetString("First_Language");
            newChild.RoomAttending = childrenReader.GetString("Room_Attending");
            //newChild.Sibling = SafeGetInt(childrenReader, "Sibling");
            newChild.DateApplied = childrenReader.GetDateTime("Date_Applied");
            newChild.DateLeft = SafeGetDateTime(childrenReader, "Date_Left");
            newChild.Attendance = constructAttendance(childrenReader);
            newChild.ExtraDays = childrenReader.GetInt16("Extra_Days");
            newChild.Teas = childrenReader.GetInt16("Teas");
            newChild.MedicalInfo = constructMedical(childrenReader);

            //newChild.ParentsIDs.Add(childrenReader.GetInt16(16));
            //newChild.EmergencyContactsIDs.Add(childrenReader.GetInt16(16));
            //Get parents
            //foreach (int parentID in selectChildsParentIDs(newChild.ChildID))
            //    newChild.Parents.Add(constructParent(childrenReader, 16));

            ////Get Emergency Contacts
            //foreach (int contactID in selectChildsContactIDs(newChild.ChildID))
            //    newChild.EmergencyContacts.Add(selectEmergencyContact(contactID), 30);
            return newChild;
        }
        private void LoadLine(MySqlDataReader rdr)
        {
            string temp = "";

            if(!rdr.IsDBNull(0)) { line_no = rdr.GetInt32(0); ORDER_ARRAY[rowCount, CONST_LINE_NO] = line_no.ToString(); }
            if (!rdr.IsDBNull(1)) { part_id = rdr.GetString(1); ORDER_ARRAY[rowCount, CONST_PARTID] = part_id; }
            if (!rdr.IsDBNull(2)) { desc = rdr.GetString(2); ORDER_ARRAY[rowCount, CONST_DESC] = desc; }
            if (!rdr.IsDBNull(3)) { ordered_qty = rdr.GetInt32(3); ORDER_ARRAY[rowCount, CONST_ORDERED] = ordered_qty.ToString(); }
            if (!rdr.IsDBNull(4)) { unit_price = rdr.GetFloat(4); ORDER_ARRAY[rowCount, CONST_PRICE] = unit_price.ToString(); }
            if (!rdr.IsDBNull(5)) { mod = rdr.GetChar(5); ORDER_ARRAY[rowCount, CONST_MOD] = mod.ToString(); }
            if (!rdr.IsDBNull(6)) { gst = Math.Round(rdr.GetDouble(6), 2); ORDER_ARRAY[rowCount, CONST_GST] = gst.ToString(); }
            if (!rdr.IsDBNull(7)) { pst = Math.Round(rdr.GetDouble(7), 2); ORDER_ARRAY[rowCount, CONST_PST] = pst.ToString(); }
            if (!rdr.IsDBNull(8)) { notes = rdr.GetString(8); ORDER_ARRAY[rowCount, CONST_NOTES] = notes; }

            bool cust = false;
            if (mod == 'C')
                cust = true;
            DataGridViewCheckBoxColumn checkColumn = new DataGridViewCheckBoxColumn();
            checkColumn.Name = "X";
            checkColumn.HeaderText = "X";
            checkColumn.Width = 50;
            checkColumn.ReadOnly = false;
            checkColumn.FillWeight = 10; //if the datagridview is resized (on form resize) the checkbox won't take up too much; value is relative to the other columns' fill values

            dgOrderForm.Rows.Add(line_no.ToString(), cust, part_id, "", desc, ordered_qty.ToString(), unit_price.ToString(), gst.ToString(), pst.ToString(), notes);

            MAX_LINE = Convert.ToInt32(line_no);
        }
 private static List<Object> DescomponerPersona(MySqlDataReader personaBD)
 {
     List<Object> listaPersona = new List<Object>();
     while (personaBD.Read())
     {
         listaPersona.Add(personaBD.GetInt32(0));
         listaPersona.Add(personaBD.GetString(1));
         listaPersona.Add(personaBD.GetString(2));
         listaPersona.Add(personaBD.GetString(3));
         if (personaBD.IsDBNull(4))
         {
             listaPersona.Add(null);
         }
         else
         {
             listaPersona.Add(personaBD.GetInt32(4));
         }
         listaPersona.Add(personaBD.GetChar(5));
     }
     return listaPersona;
 }
        private static List<Object> DescomponerPersonas(MySqlDataReader personaBD)
        {
            List<Object> listaPersona = new List<Object>();
            while (personaBD.Read())
            {
                Persona persona = new Persona();
                persona.IdPersona = personaBD.GetInt32(0);
                persona.NombreCompleto = personaBD.GetString(1);
                persona.ApellidoPaterno = personaBD.GetString(2);
                if (personaBD.IsDBNull(3))
                {
                    persona.ApellidoMaterno = "";
                }
                else {
                    persona.ApellidoMaterno = personaBD.GetString(3);
                }
                if (personaBD.IsDBNull(5))
                {
                    persona.Sexo = ' ';
                }
                else
                {
                    persona.Sexo = personaBD.GetChar(5);
                }


                listaPersona.Add(persona);
            }
            return listaPersona;
        }