private void writetodb() {

    for (int index = 0; index < list.size(); index++) {
      Attendance detail = list.get(index);

      if (Login.getUserid() == detail.getId()) {
        if (detail.getDate().equalsIgnoreCase(date)) ;
        {
          if (detail.getIntime() == null) {
            detail.setIntime(intime);
            int latemin = DaysDifference.getTimeDifference("09:00:00", intime);
            if (latemin > 0) {
              detail.setLatemin(latemin);
            }
          } else if (detail.getOuttime() == null) {
            detail.setOuttime(outtime);
          }
        }
      }
    }

    try {
      AttendanceStorge.writingToUserAttendanceDB(list);

    } catch (Exception exp) {
      System.out.println("Cannot write to database");
    }
    setbutton();
  }
  public void initialdata() {
    int id = Login.getUserid();
    Fetch fetch = new Fetch(id);
    Date d = new Date();
    d.getDate();
    DateFormat outdate;
    outdate = DateFormat.getDateInstance();
    date = outdate.format(d);
    boolean check = false;

    for (int index = 0; index < list.size(); index++) {
      Attendance detail = list.get(index);

      if (Login.getUserid() == detail.getId()) {
        if (detail.getDate().equalsIgnoreCase(date)) {
          if (detail.getIntime() != null || detail.getOuttime() != null) {
            check = true;
            //
          }
        }
      }
    }
    if (check == false) {

      Attendance ref = new Attendance(id, fetch.getName(), date, null, null, 0);
      list.add(ref);

      try {
        AttendanceStorge.writingToUserAttendanceDB(list);

      } catch (Exception exp) {
        System.out.println("Cannot write to database");
      }
    }
    setbutton();
  }