Android Open Source - vitdroid-android G Faculty






From Project

Back to project page vitdroid-android.

License

The source code is released under:

Apache License

If you think the Android project vitdroid-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.googlecode.android.widgets.DateSlider;
import android.content.ContentValues;
/*from   ww w . j a  v  a2 s  .c o  m*/

import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class GFaculty
{
  public static final String KEY_DATES="dates";
  

  private static final String TAG = "DBAdapter";
  private static final String DATABASE_NAME = "gFaculty_database";
  private static final String DATABASE_TABLE = "gattend2";
  private static final int DATABASE_VERSION = 1;
  static String date="dates";
  static String querystring;
  static String DATABASE_CREATE;
  static String subs[]={"rahul","raja","hass","awesome"};
  static String tablename="gattend2";
  
  
  private final Context context;
  private DatabaseHelper DBHelper;
  private SQLiteDatabase db;
  
  public GFaculty(Context ctx)
  {
    System.out.println("in Context");
  this.context = ctx;
  DBHelper = new DatabaseHelper(context);
  }
  
  
  private static class DatabaseHelper extends SQLiteOpenHelper
  {
  DatabaseHelper(Context context)
  {
    
  super(context, DATABASE_NAME, null, DATABASE_VERSION);
  System.out.println("IN DataHelper");
  }
  
  
  
  
  
  
  /*public static final String DATABASE_CREATE="Create Table attendance(dates varchar2(50), s1 varchar2(200)," +
  "s2 varchar2(200), s3 varchar2(200), s4 varchar2(200),s5 varchar2(200),s6 varchar2(200)," +
  " s7 varchar2(200), s8 varchar2(200)," +
  "s9 varchar2(200),s10 varchar2(200),s11 varchar2(200),s12 varchar2(200),s13 varchar2(200),s14 varchar2(200)," +
  "s15 varchar2(200),s16 varchar2(200))";*/
    
  //public static final String DATABASE_Query1="insert into Details values("anshul","","","","","","","","","","","","","","","","","");";

  
  
  @Override
  public void onCreate(SQLiteDatabase db)
  {
    
    Log.d("rahul","on create of attndnc");
    func();
  System.out.println("in oncreate outer");  
  try {
    Log.d("i am thr quey",DATABASE_CREATE);
    db.execSQL(DATABASE_CREATE);
    
    System.out.println("In oncreate inner");
  
    } catch (SQLException e) {
  e.printStackTrace();
  }
  
  }
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
  {
    System.out.println("in onupgrade");
  Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
  + newVersion + ", which will destroy all old data");
  db.execSQL("DROP TABLE IF EXISTS contacts");
  
  
  onCreate(db);
  }
  }
  
  public long updatecontact(String date, String subject, String status) {
    // TODO Auto-generated method stub
    ContentValues cv = new ContentValues();
    cv.put(subject,status );
    return db.update(DATABASE_TABLE, cv, KEY_DATES +" = '"+date+"'", null);
  
  }

  public  int insertContact(String dates,String subjectname,String value)
      
  {
    System.out.println("inside checking");
    System.out.println(dates);
    System.out.println(subjectname);
    System.out.println(value);
  ContentValues initialValues = new ContentValues();
  initialValues.put(KEY_DATES,dates);
  initialValues.put(subjectname,value);
  
  
  int x= (int) db.insert(tablename, null, initialValues);
  System.out.println("error is"+x);
  return x;
  }
  
    public GFaculty open() throws SQLException
  {
    System.out.println("Get Writable Database");
  db = DBHelper.getWritableDatabase();
  return this;
  }
    public Cursor get()
    {
      return db.query(DATABASE_TABLE, new String[] {KEY_DATES}, null, null, null, null, KEY_DATES + " ASC");
    }
  
  //---closes the database---
  public void close()
  {
    System.out.println("In close");
  DBHelper.close();
  }

  
  
  public Cursor getAllContacts()
  {
    System.out.println("in adapter");
  //System.out.println(user_category);
  
    String q="Select * from gattend2";
    return db.rawQuery(q,null);
    
  }
  public Cursor getAllContacts2(String user_category)
  {
    System.out.println("in adapter");
  System.out.println(user_category);
  
    String q="Select description from calendar_info where dateto = ?";
    return db.rawQuery(q, new String[]{user_category});
    
  }
  
  static void func()
  {
    //int length=global.subjects.length;
    //System.out.println("length yr"+length); 
  
  querystring =date+" VARCHAR(30) unique ,";
    Log.d("dat is",date);
    int k;
    int length=global.guestsubjects.length;
    for( k=0;k<length-1;k++)
    {
      querystring += global.guestsubjects[k];
            querystring +=" VARCHAR(200)";
            querystring +=",";
    }
     querystring+= global.guestsubjects[length-1] +" VARCHAR(200)";
     
     
     DATABASE_CREATE="Create Table "+ tablename + "("+querystring+");";
     Log.d("qyery is",DATABASE_CREATE);
     
     Log.d("rhul","table created");
  }
  public void deleteDatabse() {
       
    context.deleteDatabase(DATABASE_NAME);
       //db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE );
  }
     
}




Java Source Code List

com.googlecode.android.widgets.DateSlider.AlternativeDateSlider.java
com.googlecode.android.widgets.DateSlider.Attendance.java
com.googlecode.android.widgets.DateSlider.Attendanceboth.java
com.googlecode.android.widgets.DateSlider.BackGroundDialogs.java
com.googlecode.android.widgets.DateSlider.Base64.java
com.googlecode.android.widgets.DateSlider.CustomDateSlider.java
com.googlecode.android.widgets.DateSlider.DBAdapter2.java
com.googlecode.android.widgets.DateSlider.DBAdapter3.java
com.googlecode.android.widgets.DateSlider.DBAdapter5.java
com.googlecode.android.widgets.DateSlider.DBAdapter6.java
com.googlecode.android.widgets.DateSlider.DBAdapter.java
com.googlecode.android.widgets.DateSlider.DBAdaptergrades.java
com.googlecode.android.widgets.DateSlider.DBAdapterlinks.java
com.googlecode.android.widgets.DateSlider.DateSlider.java
com.googlecode.android.widgets.DateSlider.DateTimeSlider.java
com.googlecode.android.widgets.DateSlider.DefaultDateSlider.java
com.googlecode.android.widgets.DateSlider.Demo.java
com.googlecode.android.widgets.DateSlider.FacultyCabin.java
com.googlecode.android.widgets.DateSlider.Faculty.java
com.googlecode.android.widgets.DateSlider.GAttendance.java
com.googlecode.android.widgets.DateSlider.GDBAdapter5.java
com.googlecode.android.widgets.DateSlider.GDBAdapter6.java
com.googlecode.android.widgets.DateSlider.GDBAdapter.java
com.googlecode.android.widgets.DateSlider.GFaculty.java
com.googlecode.android.widgets.DateSlider.GMarks.java
com.googlecode.android.widgets.DateSlider.GStudent.java
com.googlecode.android.widgets.DateSlider.GuestLogin.java
com.googlecode.android.widgets.DateSlider.GuestMainscreen.java
com.googlecode.android.widgets.DateSlider.Login.java
com.googlecode.android.widgets.DateSlider.Mainscreen.java
com.googlecode.android.widgets.DateSlider.MarkAttendance.java
com.googlecode.android.widgets.DateSlider.Marks.java
com.googlecode.android.widgets.DateSlider.MinimalDemo.java
com.googlecode.android.widgets.DateSlider.MonthYearDateSlider.java
com.googlecode.android.widgets.DateSlider.MyService2.java
com.googlecode.android.widgets.DateSlider.MyService4.java
com.googlecode.android.widgets.DateSlider.MyService5.java
com.googlecode.android.widgets.DateSlider.MyService.java
com.googlecode.android.widgets.DateSlider.ObservableScrollView2.java
com.googlecode.android.widgets.DateSlider.ObservableScrollView.java
com.googlecode.android.widgets.DateSlider.QuizRem3.java
com.googlecode.android.widgets.DateSlider.QuizRem4.java
com.googlecode.android.widgets.DateSlider.Quiz.java
com.googlecode.android.widgets.DateSlider.Refresh.java
com.googlecode.android.widgets.DateSlider.SMainScreen.java
com.googlecode.android.widgets.DateSlider.ScrollLayout.java
com.googlecode.android.widgets.DateSlider.ScrollViewListener2.java
com.googlecode.android.widgets.DateSlider.ScrollViewListener.java
com.googlecode.android.widgets.DateSlider.ServiceManager.java
com.googlecode.android.widgets.DateSlider.Settings.java
com.googlecode.android.widgets.DateSlider.SimpleGestureFilter.java
com.googlecode.android.widgets.DateSlider.SliderContainer.java
com.googlecode.android.widgets.DateSlider.Student.java
com.googlecode.android.widgets.DateSlider.TimeObject.java
com.googlecode.android.widgets.DateSlider.TimeSlider.java
com.googlecode.android.widgets.DateSlider.ViewflipActivity.java
com.googlecode.android.widgets.DateSlider.labeler.DayDateLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.DayLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.HourLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.Labeler.java
com.googlecode.android.widgets.DateSlider.labeler.MinuteLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.MonthLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.MonthYearLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.TimeLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.Util.java
com.googlecode.android.widgets.DateSlider.labeler.WeekLabeler.java
com.googlecode.android.widgets.DateSlider.labeler.YearLabeler.java
com.googlecode.android.widgets.DateSlider.timeview.DayTimeLayoutView.java
com.googlecode.android.widgets.DateSlider.timeview.TimeLayoutView.java
com.googlecode.android.widgets.DateSlider.timeview.TimeTextView.java
com.googlecode.android.widgets.DateSlider.timeview.TimeView.java
com.googlecode.android.widgets.DateSlider.global.java
com.googlecode.android.widgets.DateSlider.grades.java
com.googlecode.android.widgets.DateSlider.notif2.java
com.googlecode.android.widgets.DateSlider.notif.java
com.googlecode.android.widgets.DateSlider.pbl.java
com.googlecode.android.widgets.DateSlider.sample.java
in.ac.vit.vitdroid.DBAdaptergrades.java
in.ac.vit.vitdroid.DBAdapterlinks.java