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;
        }
 private void cbbVideoName_SelectedValueChanged(object sender, EventArgs e)
 {
     DaoVideo daoVideo = new DaoVideo();
     daoVideo.openConnection();
     if (cbbVideoName.SelectedValue != null)
     {
         if (cbbVideoName.SelectedValue is int)
         {
             int selectedVideoCode = (int)cbbVideoName.SelectedValue;
             if(!updating)
                 video = daoVideo.getVideoByCode((int)cbbVideoName.SelectedValue);
             if (video != null)
             {
                 btnEditVideo.Enabled = true;
      //                       MessageBox.Show("selected ... changed");
                 fillVideoInfo(video);
             }
         }
     }
     daoVideo.closeConnection();
 }