GetDateTime() public method

public GetDateTime ( int i ) : System.DateTime
i int
return System.DateTime
示例#1
0
 public Person(MySql.Data.MySqlClient.MySqlDataReader reader)
 {
     navyid     = Convert.ToString(reader["navyid"]);
     statuscode = Convert.ToString(reader["statuscode"]);
     yearin     = Convert.ToString(reader["yearin"]);
     batt       = Convert.ToString(reader["batt"]);
     company    = Convert.ToString(reader["company"]);
     name       = Convert.ToString(reader["name"]);
     sname      = Convert.ToString(reader["sname"]);
     id8        = Convert.ToString(reader["id8"]);
     unit3      = Convert.ToString(reader["unit3"]);
     unitname   = Convert.ToString(reader["unitname"]);
     ask        = Convert.ToString(reader["ask"]);
     oldyearin  = Convert.ToString(reader["oldyearin"]);
     regdate    = reader.GetDateTime("regdate");
     movedate   = reader.GetDateTime("movedate");
     //stitle = Core.DataDefinition.GetStatusSTitle(statuscode);
     stitle   = Convert.ToString(reader["stitle"]);
     postname = Convert.ToString(reader["postname"]);
     unit4    = Convert.ToString(reader["unit4name"]);
     item     = Convert.ToString(reader["sxitem"]);
     percent  = Convert.ToString(reader["percent"]);
     educname = Convert.ToString(reader["educname"]);
     skill    = Convert.ToString(reader["skill"]);
     platoon  = Convert.ToString(reader["platoon"]);
     pseq     = Convert.ToString(reader["pseq"]);
     unit1    = Convert.ToString(reader["unit1name"]);
     unit2    = Convert.ToString(reader["unit2name"]);
 }
示例#2
0
        public List <Person> getPersons()
        {
            List <Person> personList = new List <Person>();

            MySql.Data.MySqlClient.MySqlDataReader mySqlReader = null;
            string sqlString = "SELECT * from tbl_personnel";
            var    cmd       = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn);

            try
            {
                mySqlReader = cmd.ExecuteReader();
                while (mySqlReader.Read())
                {
                    Person p = new Person();
                    p.ID        = mySqlReader.GetInt32(0);
                    p.FirstName = mySqlReader.GetString(1);
                    p.LastName  = mySqlReader.GetString(2);
                    p.PayRate   = mySqlReader.GetFloat(3);
                    p.StartDate = mySqlReader.GetDateTime(4);
                    p.EndDate   = mySqlReader.GetDateTime(5);
                    personList.Add(p);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("MySQL exception");
                Console.WriteLine(ex);
                Console.WriteLine(ex.Data);
            }
            return(personList);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            con.Open();
            cmduser = new MySqlCommand("select login_prev,login_curr from login_hist where login_name='" + Session["loginname"].ToString()+"'" , con);
            druser = cmduser.ExecuteReader();
            druser.Read();
            if (druser.IsDBNull(0))
            {
                logdate.Text = druser.GetDateTime("login_curr").ToShortDateString();
                logtime.Text = druser.GetDateTime("login_curr").ToShortTimeString();
            }
            else
            {
                logdate.Text = druser.GetDateTime("login_prev").ToShortDateString();
                logtime.Text = druser.GetDateTime("login_prev").ToShortTimeString();
            }

            druser.Close();

           }
        catch (Exception ex)
        {
            CreateLogFile log1 = new CreateLogFile();
            log1.ErrorLog(Server.MapPath("../Logs/Errorlog"), "Page Load method of Admin_Index for " + Session["loginname"] + ":" + ex.Message);
        }
        finally
        {
            con.Close();
        }
    }
示例#4
0
        // overload 2/9/2011 fix load history in new month
        public bool CheckMonthlyDocIsApprove(POSMySQL.POSControl.CDBUtil dbUtil, MySql.Data.MySqlClient.MySqlConnection conn,
                                             DateTime dateFrom, DateTime dateTo)
        {
            this.DocumentTypeId = 7;
            string sql = " SELECT DocumentDate, DocumentID FROM document WHERE documenttypeid=" + this.DocumentTypeId + " AND shopid=" + this.ShopId +
                         " AND DocumentStatus=1 AND DocumentDate BETWEEN '" + dateFrom.ToString("yyyy-MM-dd", dateProvider) + "' AND '" + dateTo.ToString("yyyy-MM-dd", dateProvider) + "'";

            MySql.Data.MySqlClient.MySqlDataReader reader = dbUtil.sqlRetrive(sql, conn);
            if (reader.Read())
            {
                this.DocumentDate = reader.GetDateTime("DocumentDate");
                this.DocumentId   = reader.GetInt32("DocumentID");
                reader.Close();
                return(false); // Approved
            }
            else
            {
                sql = " SELECT DocumentDate, DocumentID FROM document WHERE documenttypeid=" + this.DocumentTypeId + " AND shopid=" + this.ShopId +
                      " AND DocumentStatus=2 AND DocumentDate BETWEEN '" + dateFrom.ToString("yyyy-MM-dd", dateProvider) + "' AND '" + dateTo.ToString("yyyy-MM-dd", dateProvider) + "'";
                reader.Close();
                reader = dbUtil.sqlRetrive(sql, conn);
                if (reader.Read())
                {
                    this.DocumentDate = reader.GetDateTime("DocumentDate");
                    this.DocumentId   = reader.GetInt32("DocumentID");
                    reader.Close();
                    return(true); // Not Approve
                }
                else
                {
                    reader.Close();
                }
            }
            return(false);
        }
示例#5
0
 public void LoadFromDB(MySqlDataReader reader)
 {
     if (reader.Read())
     {
         RegDate = reader.GetDateTime(0);
         LastLoginDate = reader.GetDateTime(1);
         ContinuousCount = reader.GetByte(2);
         DailyCount = reader.GetByte(3);
     }
 }
示例#6
0
        public ArrayList getTrips()
        {
            MySql.Data.MySqlClient.MySqlConnection conn;
            string myConnectionString = ConfigurationManager.ConnectionStrings["PhpMySqlRemoteDB"].ConnectionString;

            conn = new MySql.Data.MySqlClient.MySqlConnection();
            try
            {
                conn.ConnectionString = myConnectionString;
                conn.Open();

                ArrayList tripArray = new ArrayList();

                MySql.Data.MySqlClient.MySqlDataReader mySQLReader = null;

                string sqlString = "SELECT * FROM Trips";
                MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn);

                mySQLReader = cmd.ExecuteReader();
                while (mySQLReader.Read())
                {
                    Trip t = new Trip();

                    t.TripID                       = mySQLReader.GetInt32(0);
                    t.Username                     = mySQLReader.GetString(1);
                    t.From_City_Country            = mySQLReader.GetString(2);
                    t.To_City_Country              = mySQLReader.GetString(3);
                    t.TransportationType           = mySQLReader.GetString(4);
                    t.OutboundTripDetails_Day      = mySQLReader.GetDateTime(5);
                    t.OutboundTripDetails_Time     = mySQLReader.GetTimeSpan(6);
                    t.OutboundTripDetails_Duration = mySQLReader.GetFloat(7);
                    t.AddAReturnTrip               = mySQLReader.GetBoolean(8);
                    t.ReturnTripDetails_Day        = mySQLReader.GetDateTime(9);
                    t.ReturnTripDetails_Time       = mySQLReader.GetTimeSpan(10);
                    t.ReturnTripDetails_Duration   = mySQLReader.GetFloat(11);
                    t.AvailableWeight              = mySQLReader.GetFloat(12);
                    t.ExcludedCategories           = mySQLReader.GetString(13);
                    t.TripNote                     = mySQLReader.GetString(14);

                    tripArray.Add(t);
                }
                return(tripArray);
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
        public static ZaposleniRadnoMjestoDTO readerToZaposleniRadnoMjestoDTO(MySqlDataReader reader)
        {
            ZaposleniRadnoMjestoDTO zaposleniRadnoMjesto=new ZaposleniRadnoMjestoDTO();
            zaposleniRadnoMjesto.DatumZaposlenja=reader.GetDateTime("datumZaposlenja");
            try
            {
                zaposleniRadnoMjesto.DatumOtkaza = reader.GetDateTime("datumOtkaza");
            }
            catch
            {

            }
            return zaposleniRadnoMjesto;
        }
示例#8
0
 public static DateTime SafeGetDateTime(MySqlDataReader reader, string colName)
 {
     if (!reader.IsDBNull(reader.GetOrdinal(colName)))
         return reader.GetDateTime(colName);
     else
         return default(DateTime);
 }
示例#9
0
 public static DateTime SafeGetDateTime(MySqlDataReader reader, int colIndex)
 {
     if (!reader.IsDBNull(colIndex))
         return reader.GetDateTime(colIndex);
     else
         return default(DateTime);
 }
 public static StavkaKnjigeTrgovineNaVelikoDTO readerToStavkaKnjigeTrgovineNaVeliko(MySqlDataReader reader)
 {
     StavkaKnjigeTrgovineNaVelikoDTO stavka = new StavkaKnjigeTrgovineNaVelikoDTO();
     stavka.RedniBroj = reader.GetInt32("RedniBroj");
     stavka.PoslovnaGodina = reader.GetInt32("PoslovnaGodina");
     stavka.Datum = reader.GetDateTime("Datum");
     return stavka;
 }
示例#11
0
		Message ReadMessage (MySqlDataReader r)
		{
			return new Message {
				Id = new Guid (r.GetString ("Id")),
				From = r.GetString ("From"),
				Text = r.GetString ("Text"),
				Time = r.GetDateTime ("Time"),
			};
		}
示例#12
0
 public override void Fill(MySql.Data.MySqlClient.MySqlDataReader dr)
 {
     _ID                 = dr.GetInt32(db_ID);
     _InstructorID       = dr.GetInt32(db_InstructorID);
     _SectionID          = dr.GetInt32(db_SectionID);
     _IsPrimary          = dr.GetBoolean(db_IsPrimary);
     _TeachingPercentage = dr.GetInt32(db_TeachingPercentage);
     _DateArchived       = dr.GetDateTime(db_DateArchived);
 }
示例#13
0
 public static ProjekcijaDTO readerToProjekcijaDTO(MySqlDataReader reader,FilmDTO film)
 {
     ProjekcijaDTO projekcija = new ProjekcijaDTO();
     projekcija.Id = reader.GetInt32("idProjekcija");
     projekcija.Vrijeme = reader.GetDateTime("vrijemeProjekcija");
     projekcija.Cijena = reader.GetDouble("cijenaProjekcija");
     projekcija.Film =film;
     projekcija.Sala = MySqlSalaDAO.readerToSalaDTO(reader);
     return projekcija;
 }
        protected Evenement GetEvenementFromDataReader(MySqlDataReader dataReader)
        {
            int evenementId = dataReader.GetInt32("evenement_id");
            Lokatie lokatie = (Lokatie)Enum.Parse(typeof(Lokatie), dataReader.GetString("lokatie"));
            DateTime datum = dataReader.GetDateTime("datum");
            string evenementNaam = dataReader.GetString("evenementnaam");

            Evenement evenement = new Evenement { ID = evenementId, Datum = datum, Lokatie = lokatie, Naam = evenementNaam };
            return evenement;
        }
示例#15
0
 public static RezervacijaDTO readerToRezervacijaDTO(MySqlDataReader reader)
 {
     RezervacijaDTO rezervacija = new RezervacijaDTO();
     rezervacija.Id = reader.GetInt32("idRezervacija");
     rezervacija.VrijemeRezervacije = reader.GetDateTime("vrijemeRezervacija");
     rezervacija.Opis = reader["opisRezervacija"].ToString();
     rezervacija.Aktivna = reader.GetInt32("aktivnaRezervacija");
     rezervacija.Zaposleni = MySqlZaposleniDAO.readerToZaposleni(reader);
     return rezervacija;
 }
示例#16
0
 public static ProjekcijaDTO readerToProjekcijaDTO(MySqlDataReader reader, SalaDTO sala)
 {
     ProjekcijaDTO projekcija = new ProjekcijaDTO();
     projekcija.Id = reader.GetInt32("idProjekcija");
     projekcija.Vrijeme = reader.GetDateTime("vrijemeProjekcija");
     projekcija.Cijena = reader.GetDouble("cijenaProjekcija");
     projekcija.Film = new MySqlFilmDAO().getById(reader.GetInt32("idFilm"));
     projekcija.Sala = sala;
     return projekcija;
 }
        protected Student GetStudentFromDataReader(MySqlDataReader dataReader)
        {
            int studentenID = dataReader.GetInt32("student_id");
            string naam = dataReader.GetString("studentnaam");
            DateTime geboorteDatum = dataReader.GetDateTime("geboortedatum");
            int studiePunten = dataReader.GetInt32("studiepunten");

            Student student = new Student { ID = studentenID, Naam = naam, GeboorteDatum = geboorteDatum, StudiePunten = studiePunten };

            return student;
        }
示例#18
0
 public static Albaran GetAlbaran(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("NUMALBAR")))
         return null;
     Albaran a = new Albaran();
     a.CodTipom = rdr.GetString("CODTIPOM");
     a.NumAlbar = rdr.GetInt32("NUMALBAR");
     a.FechaAlb = rdr.GetDateTime("FECHAALB");
     a.TotalAlb = rdr.GetDecimal("TOTALALB");
     return a;
 }
示例#19
0
 public static Post Parse(MySqlDataReader reader)
 {
     Post result = null;
     if (reader.HasRows)
     {
         result = new Post(
             reader.GetInt32("idpost"),
             reader.GetDateTime("created"),
             reader.GetString("message"));
     }
     return result;
 }
示例#20
0
 private static ProjectMember FillProjectMember(MySqlDataReader dr)
 {
     ProjectMember p = new ProjectMember();
     p = new ProjectMember();
     p.EmpProj = dr.GetInt32("EmpProj");
     p.ProjID = dr.GetInt32("ProjID");
     p.EmpID = dr.GetInt32("EmpID");
     p.Role = dr.GetString("Role");
     p.TotalHours = dr.GetDecimal("TotalHours");
     p.StartDate = dr.GetDateTime("StartDate");
     p.EndDate = dr["EndDate"] as DateTime?;
     return p;
 }
示例#21
0
 public static KartaDTO readerToKartaDTO(MySqlDataReader reader, ProjekcijaDTO projekcija)
 {
     KartaDTO karta = new KartaDTO();
     karta.Id = reader.GetInt32("idKarta");
     karta.DatumProdaje = reader.GetDateTime("datumProdaje");
     karta.Cijena = reader.GetFloat("cijenaKarta");
     karta.BrojReda = reader.GetInt32("brojReda");
     karta.BrojSjedista = reader.GetInt32("brojSjedista");
     karta.Zaposleni = MySqlZaposleniDAO.readerToZaposleni(reader);
     karta.Projekcija = projekcija;
     //karta.Rezervacija = MySqlRezervacijaDAO.readerToRezervacijaDTO(reader);
     karta.Status = MySqlStatusKartaDAO.readerToStatusKartaDTO(reader);
     return karta;
 }
示例#22
0
 public static ZaposleniDTO readerToZaposleni(MySqlDataReader reader)
 {
     ZaposleniDTO zapoleni = new ZaposleniDTO();
     zapoleni.Id = reader.GetInt32("idZaposleni");
     zapoleni.Ime = reader["ime"].ToString();
     zapoleni.Prezime = reader["prezime"].ToString();
     zapoleni.DatumRodjenja = reader.GetDateTime("datumRodjenja");
     zapoleni.KorisnickoIme = reader["korisnickoIme"].ToString();
     zapoleni.Lozinka = reader["lozinka"].ToString();
     zapoleni.Telefon = reader["telefon"].ToString();
     zapoleni.Email = reader["e_mail"].ToString();
     zapoleni.Aktivan = reader.GetInt32("aktivan");
     return zapoleni;
 }
示例#23
0
        private static WeekSummary MapWeekSummary(MySqlDataReader dr)
        {
            var weekSummary = new WeekSummary
                {
                    LastGamePlayed = dr.GetDateTime("lastGamePlayed"),
                    Season = dr.GetInt32("season"),
                    SeasonType = (SeasonType) dr.GetInt32("type"),
                    Week = dr.GetInt32("week")
                };

            weekSummary.LastGamePlayed = weekSummary.LastGamePlayed.AddDays(ConfigSettings.GameTimeOffSetInDays);

            return weekSummary;
        }
示例#24
0
        public Person getPerson(long ID)
        {
            Person p = new Person();

            p.FirstName = "Phil";
            p.LastName  = "Anderson";
            MySql.Data.MySqlClient.MySqlDataReader mySqlReader = null;
            string sqlString = "SELECT * from tbl_personnel where ID = " + ID.ToString();

            MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn);
            try
            {
                mySqlReader = cmd.ExecuteReader();
                if (mySqlReader.Read())
                {
                    p.ID        = mySqlReader.GetInt32(0);
                    p.FirstName = mySqlReader.GetString(1);
                    p.LastName  = mySqlReader.GetString(2);
                    p.PayRate   = mySqlReader.GetFloat(3);
                    p.StartDate = mySqlReader.GetDateTime(4);
                    p.EndDate   = mySqlReader.GetDateTime(5);
                }
                else
                {
                }
            }
            catch (Exception ex) {
                Trace.WriteLine("SQL Exception");
                Trace.WriteLine(ex);
                Trace.WriteLine(ex.Data);
            }
            finally
            {
            }

            return(p);
        }
示例#25
0
        public Session createSessionFromDataReader(MySqlDataReader dr)
        {
            Session session;
            String userLogin;
            int code = 0;
            DateTime date;
            String dateString;
            Video video;
            String mode;
            String comment;

            float evaluetion;

            if (dr.Equals(DBNull.Value)) return null;

            if (!dr["comment"].Equals(DBNull.Value))
                comment = dr.GetString("comment");
            else
                comment = "";

            if (dr["code"].Equals(DBNull.Value)) return null;
            code = dr.GetInt32("code");

            if (dr["userLogin"].Equals(DBNull.Value)) return null;
            userLogin = dr.GetString("userLogin");

            if (!dr["evaluetion"].Equals(DBNull.Value))
                evaluetion = (float)Convert.ToDouble(dr.GetDecimal("evaluetion"));
            else
                evaluetion = 0;

            DaoVideo daoVideo = new DaoVideo();
            daoVideo.openConnection();

            video = daoVideo.getVideoByCode(dr.GetInt32("videoCode"));

            date = dr.GetDateTime("date");
            dateString = date.Day + "/" + date.Month + "/" + date.Year;

            if (!dr["modeCode"].Equals(DBNull.Value))
                mode = getModeByCode(dr.GetInt32("modeCode"));
            else
                mode = "";

            session = new Session(userLogin, video, dateString, evaluetion, mode, comment);
            session.setCode(code);
            return session;
        }
示例#26
0
        public Shipment getShipment(long shipmentId)
        {
            MySql.Data.MySqlClient.MySqlConnection conn;
            string myConnectionString = ConfigurationManager.ConnectionStrings["PhpMySqlRemoteDB"].ConnectionString;

            conn = new MySql.Data.MySqlClient.MySqlConnection();
            try
            {
                conn.ConnectionString = myConnectionString;
                conn.Open();

                Shipment sh = new Shipment();
                MySql.Data.MySqlClient.MySqlDataReader mySQLReader = null;

                string sqlString = "SELECT * FROM Shipments WHERE ShipmentID = " + shipmentId.ToString();
                MySql.Data.MySqlClient.MySqlCommand cmd = new MySql.Data.MySqlClient.MySqlCommand(sqlString, conn);

                mySQLReader = cmd.ExecuteReader();
                if (mySQLReader.Read())
                {
                    sh.ShipmentID        = mySQLReader.GetInt32(0);
                    sh.TripID            = mySQLReader.GetInt32(1);
                    sh.Username          = mySQLReader.GetString(2);
                    sh.From_City_Country = mySQLReader.GetString(3);
                    sh.To_City_Country   = mySQLReader.GetString(4);
                    sh.IWantItBefore     = mySQLReader.GetDateTime(5);
                    sh.ShipmentName      = mySQLReader.GetString(6);
                    sh.ShipmentNote      = mySQLReader.GetString(7);

                    return(sh);
                }
                else
                {
                    return(null);
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
示例#27
0
文件: Guild.cs 项目: Dextan/Estrella
        public Guild(MySqlDataReader reader, MySqlConnection con)
        {
            ID = reader.GetInt32("ID");
            Name = reader.GetString("GuildName");
               // _Password = (byte[])reader.GetValue("Password");
            _Password = new byte[12];
            AllowGuildWar = reader.GetBoolean("AllowGuildWar");
            Message = reader.GetString("GuildMessage");
            MessageCreateTime = reader.GetDateTime(8);
            MessageCreaterID = reader.GetInt32("CreaterID");
            CreateTime = DateTime.Now;//read later
            GuildMoney = reader.GetInt64("GuildMoney");

            Members = new List<GuildMember>();
            ThreadLocker = new object();
            GuildStore = new GuildStorage(this);
            Load();
        }
示例#28
0
 public static KartaDTO readerToKartaDTO(MySqlDataReader reader)
 {
     KartaDTO karta = new KartaDTO();
     karta.Id = reader.GetInt32("idKarta");
     karta.DatumProdaje = reader.GetDateTime("datumProdaje");
     karta.Cijena = reader.GetFloat("cijenaKarta");
     karta.BrojReda = reader.GetInt32("brojReda");
     karta.BrojSjedista = reader.GetInt32("brojSjedista");
     karta.Zaposleni = MySqlZaposleniDAO.readerToZaposleni(reader);
     SalaDTO sala = MySqlSalaDAO.readerToSalaDTO(reader);
     karta.Projekcija = MySqlProjekcijaDAO.readerToProjekcijaDTO(reader, sala);
     karta.Status = MySqlStatusKartaDAO.readerToStatusKartaDTO(reader);
     if (karta.Status.Naziv.Equals("rezervisana"))
     {
         karta.Rezervacija = MySqlRezervacijaDAO.readerToRezervacijaDTO(reader);
     }
     return karta;
 }
示例#29
0
        public Guild(MySqlConnection con, MySqlDataReader reader)
            : this()
        {
            ID = reader.GetInt32("ID");
            Name = reader.GetString("GuildName");
            // _Password = (byte[])reader.GetValue("Password");
            _Password = new byte[12];
            AllowGuildWar = reader.GetBoolean("AllowGuildWar");

            Message = reader.GetString("GuildMessage");
            MessageCreateTime = reader.GetDateTime(8);
            CreateTime = DateTime.Now;//read later

            WorldCharacter creater;
            if (!CharacterManager.Instance.GetCharacterByID(reader.GetInt32("GuildMessageCreater"), out creater))
                throw new InvalidOperationException("Can't find character which created guild message. Character ID: " + reader.GetInt32("GuildMessageCreater"));

            MessageCreater = creater;

            Load();
        }
示例#30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string name;
        try
        {
            name=Session["loginname"].ToString();
            con.Open();
            cmduser = new MySqlCommand("select login_date,login_time from login_hist where rowid=(select max(rowid)-1 from login_hist where login_name='" + name + "')", con);
            druser = cmduser.ExecuteReader();
            if (druser.Read())
            {
                logdate.Text = druser.GetDateTime("login_date").ToShortDateString();
                logtime.Text = druser.GetString("login_time");
            }
            else
            {
                logdate.Text = "0000-00-00";
                logtime.Text = "00:00:00";
            }
            druser.Close();

            //to count the number of student registered
            cmduser = new MySqlCommand("select count(username) from forum_users where branch=(select branch from forum_users where username='******'))",con);
            druser = cmduser.ExecuteReader();
            druser.Read();
            studcnt.Text = string.IsNullOrEmpty(druser.GetInt32(0).ToString()) ? "0" : druser.GetInt32(0).ToString();
            druser.Close();

            con.Close();
        }
        catch (Exception ex)
        {
            CreateLogFile errlog = new CreateLogFile();
            errlog.ErrorLog(Server.MapPath("../Logs/Errorlog"), "Page Load of HeaderFooter Page for " + Session["loginname"] + ":" + ex.Message);

        }
    }
示例#31
0
        public virtual MySqlSchemaCollection GetProcedures(string[] restrictions)
        {
            MySqlSchemaCollection dt = new MySqlSchemaCollection("Procedures");

            dt.AddColumn("SPECIFIC_NAME", typeof(string));
            dt.AddColumn("ROUTINE_CATALOG", typeof(string));
            dt.AddColumn("ROUTINE_SCHEMA", typeof(string));
            dt.AddColumn("ROUTINE_NAME", typeof(string));
            dt.AddColumn("ROUTINE_TYPE", typeof(string));
            dt.AddColumn("DTD_IDENTIFIER", typeof(string));
            dt.AddColumn("ROUTINE_BODY", typeof(string));
            dt.AddColumn("ROUTINE_DEFINITION", typeof(string));
            dt.AddColumn("EXTERNAL_NAME", typeof(string));
            dt.AddColumn("EXTERNAL_LANGUAGE", typeof(string));
            dt.AddColumn("PARAMETER_STYLE", typeof(string));
            dt.AddColumn("IS_DETERMINISTIC", typeof(string));
            dt.AddColumn("SQL_DATA_ACCESS", typeof(string));
            dt.AddColumn("SQL_PATH", typeof(string));
            dt.AddColumn("SECURITY_TYPE", typeof(string));
            dt.AddColumn("CREATED", typeof(DateTime));
            dt.AddColumn("LAST_ALTERED", typeof(DateTime));
            dt.AddColumn("SQL_MODE", typeof(string));
            dt.AddColumn("ROUTINE_COMMENT", typeof(string));
            dt.AddColumn("DEFINER", typeof(string));

            StringBuilder sql = new StringBuilder("SELECT * FROM mysql.proc WHERE 1=1");

            if (restrictions != null)
            {
                if (restrictions.Length >= 2 && restrictions[1] != null)
                {
                    sql.AppendFormat(CultureInfo.InvariantCulture,
                                     " AND db LIKE '{0}'", restrictions[1]);
                }
                if (restrictions.Length >= 3 && restrictions[2] != null)
                {
                    sql.AppendFormat(CultureInfo.InvariantCulture,
                                     " AND name LIKE '{0}'", restrictions[2]);
                }
                if (restrictions.Length >= 4 && restrictions[3] != null)
                {
                    sql.AppendFormat(CultureInfo.InvariantCulture,
                                     " AND type LIKE '{0}'", restrictions[3]);
                }
            }

            MySqlCommand cmd = new MySqlCommand(sql.ToString(), connection);

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    MySqlSchemaRow row = dt.AddRow();
                    row["SPECIFIC_NAME"]   = reader.GetString("specific_name");
                    row["ROUTINE_CATALOG"] = DBNull.Value;
                    row["ROUTINE_SCHEMA"]  = reader.GetString("db");
                    row["ROUTINE_NAME"]    = reader.GetString("name");
                    string routineType = reader.GetString("type");
                    row["ROUTINE_TYPE"]   = routineType;
                    row["DTD_IDENTIFIER"] = StringUtility.ToLowerInvariant(routineType) == "function" ?
                                            (object)reader.GetString("returns") : DBNull.Value;
                    row["ROUTINE_BODY"]       = "SQL";
                    row["ROUTINE_DEFINITION"] = reader.GetString("body");
                    row["EXTERNAL_NAME"]      = DBNull.Value;
                    row["EXTERNAL_LANGUAGE"]  = DBNull.Value;
                    row["PARAMETER_STYLE"]    = "SQL";
                    row["IS_DETERMINISTIC"]   = reader.GetString("is_deterministic");
                    row["SQL_DATA_ACCESS"]    = reader.GetString("sql_data_access");
                    row["SQL_PATH"]           = DBNull.Value;
                    row["SECURITY_TYPE"]      = reader.GetString("security_type");
                    row["CREATED"]            = reader.GetDateTime("created");
                    row["LAST_ALTERED"]       = reader.GetDateTime("modified");
                    row["SQL_MODE"]           = reader.GetString("sql_mode");
                    row["ROUTINE_COMMENT"]    = reader.GetString("comment");
                    row["DEFINER"]            = reader.GetString("definer");
                }
            }

            return(dt);
        }
        public void setProperty(MySqlDataReader reader)
        {
            this._Name = reader.GetString(reader.GetOrdinal("Name"));
            this._Engine = reader.GetString(reader.GetOrdinal("Engine"));
            this._Version = reader.GetInt64(reader.GetOrdinal("Version"));
            this._Row_format = reader.GetString(reader.GetOrdinal("Row_format"));
            if (!reader.IsDBNull(reader.GetOrdinal("Rows")))
            {
                this._Rows = reader.GetInt64(reader.GetOrdinal("Rows"));
            }
            this._Avg_row_length = reader.GetInt64(reader.GetOrdinal("Avg_row_length"));
            this._Data_length = reader.GetInt64(reader.GetOrdinal("Data_length"));
            this._Max_data_length = reader.GetInt64(reader.GetOrdinal("Max_data_length"));
            this._Index_length = reader.GetInt64(reader.GetOrdinal("Index_length"));
            this._Data_free = reader.GetInt64(reader.GetOrdinal("Data_free"));
            if (!reader.IsDBNull(reader.GetOrdinal("Auto_increment")))
            {
                this._Auto_increment = reader.GetInt64(reader.GetOrdinal("Auto_increment"));
            }

            if (!reader.IsDBNull(reader.GetOrdinal("Create_time")))
            {
                this._Create_time = reader.GetDateTime(reader.GetOrdinal("Create_time"));
            }
            if (!reader.IsDBNull(reader.GetOrdinal("Update_time")))
            {
                this._Update_time = reader.GetDateTime(reader.GetOrdinal("Update_time"));
            }

            if (!reader.IsDBNull(reader.GetOrdinal("Check_time")))
            {
                this._Check_time = reader.GetDateTime(reader.GetOrdinal("Check_time"));
            }
            this._Collation = reader.GetString(reader.GetOrdinal("Collation"));
            if (!reader.IsDBNull(reader.GetOrdinal("Checksum")))
            {
                this._Checksum = reader.GetInt64(reader.GetOrdinal("Checksum"));
            }
            this._Create_options = reader.GetString(reader.GetOrdinal("Create_options"));
            this._Comment = reader.GetString(reader.GetOrdinal("Comment"));
        }
 private DateTime GetDateTime(MySqlDataReader reader, int ordinalNumber)
 {
     return dateTimeUseUtc ?
         reader.GetDateTime(ordinalNumber, true) :
         reader.GetDateTime(ordinalNumber);
 }
 private DateTime GetDateTime(MySqlDataReader reader, String columnName)
 {
     return dateTimeUseUtc ?
         reader.GetDateTime(columnName, true) :
         reader.GetDateTime(columnName);
 }
示例#35
0
 private void Load(MySqlDataReader reader)
 {
     CharacterID = reader.GetInt32("ID");
     RegisterDate = reader.GetDateTime("RegisterDate");
     IsChatBlocked = reader.GetBoolean("ChatBlock");
     Rank = (GuildAcademyRank)reader.GetByte("Rank");
 }
示例#36
0
        private static Tests.Models.ChangeTrackingEmployee Load(MySql.Data.MySqlClient.MySqlDataReader reader)
        {
            var result = new Tests.Models.ChangeTrackingEmployee();

            if (reader.IsDBNull(0))
            {
                result.CreatedDate = null;
            }
            else
            {
                result.CreatedDate = reader.GetDateTime(0);
            }
            if (reader.IsDBNull(1))
            {
                result.EmployeeKey = null;
            }
            else
            {
                result.EmployeeKey = (System.Nullable <System.Int64>)reader.GetValue(1);
            }
            if (reader.IsDBNull(2))
            {
                result.FirstName = null;
            }
            else
            {
                result.FirstName = reader.GetString(2);
            }
            if (reader.IsDBNull(3))
            {
                result.LastName = null;
            }
            else
            {
                result.LastName = reader.GetString(3);
            }
            if (reader.IsDBNull(4))
            {
                result.ManagerKey = null;
            }
            else
            {
                result.ManagerKey = reader.GetInt32(4);
            }
            if (reader.IsDBNull(5))
            {
                result.MiddleName = null;
            }
            else
            {
                result.MiddleName = reader.GetString(5);
            }
            if (reader.IsDBNull(6))
            {
                result.Title = null;
            }
            else
            {
                result.Title = reader.GetString(6);
            }
            if (reader.IsDBNull(7))
            {
                result.UpdatedDate = null;
            }
            else
            {
                result.UpdatedDate = reader.GetDateTime(7);
            }
            ((System.ComponentModel.IChangeTracking)result).AcceptChanges();
            return(result);
        }
示例#37
0
        private static UserRecord MapUserRecord(MySqlDataReader dr)
        {
            var record = new UserRecord();

            record.Id = dr.GetInt64("id");
            record.LastUpdated = dr.GetDateTime("lastUpdated");
            record.Losses = dr.GetInt32("losses");
            record.RecordType = (RecordType)dr.GetInt32("type");
            record.Ties = dr.GetInt32("ties");
            record.UserId = dr.GetInt64("userId");
            record.UserName = dr.GetString("userName");
            record.Wins = dr.GetInt32("wins");

            if (!dr.IsDBNull(dr.GetOrdinal("season")))
            {
                record.Season = dr.GetInt32("season");
            }

            if (!dr.IsDBNull(dr.GetOrdinal("seasonType")))
            {
                record.SeasonType = (SeasonType) dr.GetInt32("seasonType");
            }

            if (!dr.IsDBNull(dr.GetOrdinal("week")))
            {
                record.Week = dr.GetInt32("week");
            }

            return record;
        }
示例#38
0
		//
		// GetUserFromReader
		//    A helper function that takes the current row from the MySqlDataReader
		//    and hydrates a MembershiUser from the values. Called by the 
		//    MembershipUser.GetUser implementation.
		//
		private MembershipUser GetUserFromReader(MySqlDataReader reader)
		{
			object providerUserKey = new Guid(reader.GetValue(0).ToString());
			string username = reader.IsDBNull(1) ? "" : reader.GetString(1);
			string email = reader.IsDBNull(2) ? "" : reader.GetString(2);
			string passwordQuestion = reader.IsDBNull(3) ? "" : reader.GetString(3);
			string comment = reader.IsDBNull(4) ? "" : reader.GetString(4);
			bool isApproved = reader.IsDBNull(5) ? false : reader.GetBoolean(5);
			bool isLockedOut = reader.IsDBNull(6) ? false : reader.GetBoolean(6);
			DateTime creationDate = reader.IsDBNull(7) ? DateTime.Now : reader.GetDateTime(7);
			DateTime lastLoginDate = reader.IsDBNull(8) ? DateTime.Now : reader.GetDateTime(8);
			DateTime lastActivityDate = reader.IsDBNull(9) ? DateTime.Now : reader.GetDateTime(9);
			DateTime lastPasswordChangedDate = reader.IsDBNull(10) ? DateTime.Now : reader.GetDateTime(10);
			DateTime lastLockedOutDate = reader.IsDBNull(11) ? DateTime.Now : reader.GetDateTime(11);

			return new MembershipUser(
				this.Name,
				username,
				providerUserKey,
				email,
				passwordQuestion,
				comment,
				isApproved,
				isLockedOut,
				creationDate,
				lastLoginDate,
				lastActivityDate,
				lastPasswordChangedDate,
				lastLockedOutDate
				);
		}
示例#39
0
        private MembershipUser GetUserFromReader(MySqlDataReader reader)
        {
            object providerUserKey = reader.GetInt32("userId");
              string username = reader.GetString("name");

              string email = null;
              if (!reader.IsDBNull(reader.GetOrdinal("Email")))
            email = reader.GetString("Email");

              string passwordQuestion = "";
              if (!(reader.GetValue(reader.GetOrdinal("PasswordQuestion")) == DBNull.Value))
            passwordQuestion = reader.GetString("PasswordQuestion");

              string comment = "";
              if (!(reader.GetValue(reader.GetOrdinal("Comment")) == DBNull.Value))
            comment = reader.GetString("Comment");

              bool isApproved = reader.GetBoolean("IsApproved");
              bool isLockedOut = reader.GetBoolean("IsLockedOut");
              DateTime creationDate = reader.GetDateTime("CreationDate");
              DateTime lastLoginDate = new DateTime();
              if (!(reader.GetValue(reader.GetOrdinal("LastLoginDate")) == DBNull.Value))
            lastLoginDate = reader.GetDateTime("LastLoginDate");

              DateTime lastActivityDate = reader.GetDateTime("LastActivityDate");
              DateTime lastPasswordChangedDate = reader.GetDateTime("LastPasswordChangedDate");
              DateTime lastLockedOutDate = new DateTime();
              if (!(reader.GetValue(reader.GetOrdinal("LastLockedoutDate")) == DBNull.Value))
            lastLockedOutDate = reader.GetDateTime("LastLockedoutDate");

              MembershipUser u =
              new MembershipUser(Name, username, providerUserKey, email, passwordQuestion, comment, isApproved,
                             isLockedOut, creationDate, lastLoginDate, lastActivityDate, lastPasswordChangedDate,
                             lastLockedOutDate);
              return u;
        }
示例#40
0
        static void Main(string[] args)
        {
            string cs = "server=localhost;userid=root;password=;database=employees";

            using var connexion = new MySql.Data.MySqlClient.MySqlConnection(cs);

            connexion.Open();

            Console.WriteLine($"MySQL Version: {connexion.ServerVersion}");

            var stm = "SELECT * FROM salaries LIMIT 10";
            var cmd = new MySql.Data.MySqlClient.MySqlCommand(stm, connexion);

            using MySql.Data.MySqlClient.MySqlDataReader rdr = cmd.ExecuteReader();

            while (rdr.Read())
            {
                Console.WriteLine("{0} {1} {2} {3}", rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetDateTime(2), rdr.GetDateTime(3));
            }
        }