예제 #1
0
  /**
   * * 返回多少天后的具体日期
   *
   * @param year
   * @param mouth
   * @param date
   * @return
   */
  public static String getForMyBrithdayToDate(long day) {

    Calendar calendar = Calendar.getInstance(Locale.US);
    calendar.setTime(new Date());

    long now = calendar.getTimeInMillis();

    long nextBirthMillionSeconds = day * 24 * 60 * 60 * 1000;
    long kk = now + nextBirthMillionSeconds;
    Date date2 = new Date();
    date2.setTime(kk);
    Calendar ca = Calendar.getInstance();
    ca.set(Calendar.YEAR, date2.getYear() + 1900);
    ca.set(Calendar.MONTH, date2.getMonth() + 1 - 1); // 也可以填数字,0-11,一月为0
    ca.set(Calendar.DAY_OF_MONTH, date2.getDay() + 1);
    lunner kkq = new lunner(ca);
    String str =
        (date2.getYear() + 1900)
            + "年"
            + (date2.getMonth() + 1)
            + "月"
            + (date2.getDay() + 1)
            + "日("
            + kkq.toString()
            + ")";
    return str;
  }
예제 #2
0
 @SuppressWarnings("deprecation")
 public static boolean isDayChanged(long lastScan) {
   Date last = new Date(lastScan);
   Date now = new Date();
   long lastlong = Date.UTC(last.getYear(), last.getMonth(), last.getDay(), 0, 0, 0);
   long nowlong = Date.UTC(now.getYear(), now.getMonth(), now.getDay(), 0, 0, 0);
   return lastlong != nowlong;
 }
예제 #3
0
    public boolean isLastInSection(int position) {
      if (position == getCount() - 1) return true;

      Date date1 = new Date(getItem(position).getTimestamp() * 1000);
      Date date2 = new Date(getItem(position + 1).getTimestamp() * 1000);

      return ((date1.getYear() != date2.getYear())
          || (date1.getMonth() != date2.getMonth())
          || (date1.getDay() != date2.getDay()));
    }
예제 #4
0
    private boolean isFirstInSection(int position) {
      if (position == 0) return true;

      Date date1 = new Date(getItem(position).getTimestamp() * 1000);
      Date date2 = new Date(getItem(position - 1).getTimestamp() * 1000);

      return ((date1.getYear() != date2.getYear())
          || (date1.getMonth() != date2.getMonth())
          || (date1.getDay() != date2.getDay()));
    }
예제 #5
0
 @Test
 public void testSaveDate() {
   Date d = new Date();
   java.util.Date dt = new java.util.Date();
   dao.save(d);
   System.out.println(dt.getDay() + "-" + dt.getMonth() + "-" + dt.getYear());
   assertEquals(new Integer(1), d.getId());
   assertEquals(dt.getDay(), d.getDay());
   assertEquals(dt.getMonth(), d.getMonth());
   assertEquals(dt.getYear(), d.getYear());
 }
 public static String agregarGasto(
     Date fecha,
     int tipoDoc,
     String numDoc,
     String descripcion,
     float montoTotal,
     ArrayList<InsumoAlmacen> insumos,
     String ruc) {
   int numDocumento;
   try {
     numDocumento = Integer.parseInt(numDoc);
   } catch (Exception e) {
     return "Error: El numero de documento solo puede contener numeros";
   }
   Gastos g = new Gastos(0, fecha.getDay(), fecha.getMonth(), fecha.getYear(), montoTotal);
   g.setGasDes("Pago por insumos");
   g.setGasNumDoc(numDocumento);
   g.setGasNBol(numDocumento);
   g.setTipDocCod(new TipoDocumento(tipoDoc));
   g.setEmpDni(new Empleado(Integer.parseInt(ManejoSesion.getDNI())));
   g.setProvRuc(new Proveedor(ruc));
   g.setTipGasCod(new TipoGasto(1));
   if (new GestionarGastosImplementacion().agregarGasto(g)) {
     for (InsumoAlmacen ins : insumos) {
       IngresoKardexControlador.agregarIngresoKardex(
           g.getGasCod(), ins.getCodInsumo(), ins.getCantidad(), ins.getPrecio());
     }
     return "CORRECTO";
   } else {
     return "No se pudo agregar el gasto";
   }
 }
예제 #7
0
 /** {@inheritDoc} */
 @Override
 public void setAnswer(String answer) {
   dateAnswer = new Date(answer);
   if (isViewActive()) {
     dp.updateDate(dateAnswer.getYear(), dateAnswer.getMonth(), dateAnswer.getDay());
   }
 }
 public static String agregarGasto(
     int tipo, Date fecha, int tipoDoc, String numDoc, String descripcion, String monto) {
   float montoTotal;
   int numDocumento;
   try {
     montoTotal = Float.parseFloat(monto);
   } catch (Exception e) {
     return "Ingrese un monto valido";
   }
   try {
     numDocumento = Integer.parseInt(numDoc);
   } catch (Exception e) {
     return "El numero de documento solo puede contener numeros";
   }
   if (ValidacionGeneral.precioValido(montoTotal)) {
     Gastos g = new Gastos(1, fecha.getDay(), fecha.getMonth(), fecha.getYear(), montoTotal);
     g.setGasNumDoc(numDocumento);
     g.setTipDocCod(new TipoDocumento(tipoDoc));
     g.setEmpDni(new Empleado(Integer.parseInt(ManejoSesion.getDNI())));
     g.setProvRuc(new Proveedor("00000000001"));
     g.setTipGasCod(new TipoGasto(tipo));
     new GestionarGastosImplementacion().agregarGasto(g);
     return "CORRECTO";
   } else {
     return "Ingrese un monto valido";
   }
 }
  @Override
  protected Result doRecurring(
      Money money, CreditCard creditCard, Schedule schedule, Map<String, Object> options) {
    Rbs rbs = new Rbs(settings);

    RbsRequest cRequest = new RbsRequest(RequestType.CREATE);
    Date startDate = schedule.getStartDate();
    cRequest
        .setPaymentType(PaymentType.CC)
        .setCardData(creditCard.getNumber(), creditCard.getVerificationValue())
        .setStartDate(
            Integer.toString(startDate.getMonth()),
            Integer.toString(startDate.getDay()),
            Integer.toString(startDate.getYear()))
        .setAmount(money.getAmount().toString())
        .setPaymentCount(Integer.toString(schedule.getTotalOccurences()));

    switch (schedule.getEach()) {
      case MONTH:
        cRequest.setFrequency(PaymentFrequency.MONTHLY);
        break;
      case YEAR:
        cRequest.setFrequency(PaymentFrequency.ANNUALLY);
        break;
      default:
        throw new NotImplementedException();
    }

    RbsResponse cResponse = rbs.run(cRequest);
    return extractResult(cResponse);
  }
예제 #10
0
  private static void writeHeader(IMap map, BufferedWriter out) throws IOException {
    Date now = new Date();
    String id =
        "geodss."
            + now.getYear()
            + now.getMonth()
            + now.getDay()
            + now.getHours()
            + now.getMinutes(); // $NON-NLS-1$

    append(
        0, out, "<OWSContext id=\"" + id + "\" version=\"0.0.13\" "); // $NON-NLS-1$ //$NON-NLS-2$
    append(0, out, "    xmlns=\"http://www.opengis.net/oc\""); // $NON-NLS-1$
    append(0, out, "    xmlns:ogc=\"http://www.opengis.net/ogc\""); // $NON-NLS-1$
    append(0, out, "    xmlns:ows=\"http://www.opengis.net/ows\""); // $NON-NLS-1$
    append(0, out, "    xmlns:param=\"http;//www.opengis.net/param\""); // $NON-NLS-1$
    append(0, out, "    xmlns:sld=\"http://www.opengis.net/sld\""); // $NON-NLS-1$
    append(0, out, "    xmlns:xlink=\"http://www.w3.org/1999/xlink\""); // $NON-NLS-1$
    append(0, out, "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""); // $NON-NLS-1$
    append(
        0,
        out,
        "    xsi:schemaLocation=\"http://www.opengis.net/oc oc_0_0_13.xsd\""); //$NON-NLS-1$
    append(0, out, "    >"); // $NON-NLS-1$
  }
예제 #11
0
 // fill fields on dialog
 private void fillFields() {
   SimpleDateFormat mySimpleDateFormat = new SimpleDateFormat("dd/mm/yyyy");
   Person person = PersonController.getPerson(selectedID);
   Date date = new Date();
   System.out.println(person.getDay());
   String[] arrstr = person.getDay().split("-");
   int day = Integer.parseInt(arrstr[0]);
   int month = Integer.parseInt(arrstr[1]);
   int year = Integer.parseInt(person.getYear());
   day = date.getDay();
   month = date.getMonth();
   year = date.getYear();
   txtId.setText(person.getId());
   txtPName.setText(person.getName());
   txtBorn.setText(person.getBorn());
   if (person.getSex() == "Male") {
     radMale.setSelected(true);
   } else {
     radFemale.setSelected(true);
   }
   if (person.getIsdirector().equals("1")) {
     isDirector.setSelected(true);
   } else {
     isDirector.setSelected(false);
   }
   if (person.getIsstar().equals("1")) {
     isStar.setSelected(true);
   } else {
     isStar.setSelected(false);
   }
   jxDate.setDate(date);
 }
예제 #12
0
 @Override
 public void firstDay(Date currentDate, Date today, int firstDay) {
   int decal = (today.getDay() + 7 - firstDay) % 7;
   currentDate.setYear(today.getYear());
   currentDate.setMonth(today.getMonth());
   currentDate.setDate(today.getDate() - decal);
   final Date date = getFirstDateOfWeek(today, firstDay);
   currentDate.setTime(date.getTime());
 }
예제 #13
0
  /**
   * Calculates the number of the week that includes the given date.
   *
   * @param date A date
   * @param firstDay The first day of the week (such as {@link #SUNDAY}, {@link #MONDAY} or anything
   *     else).
   * @return The number of the week that includes <code>date</code>.
   */
  private static int getWeekNumber(Date date, int firstDay) {
    int daysToThursday = 4 - date.getDay();

    if (date.getDay() < firstDay) daysToThursday -= 7;

    final Date thursday =
        new Date(date.getYear(), date.getMonth(), date.getDate() + daysToThursday);

    final Date januaryFourth = new Date(thursday.getYear(), 0, 4);
    final int daysToMonday = 1 - januaryFourth.getDay(); // Essayer avec le
    // 1er jour de
    // la
    // semaine
    final Date monday = new Date(thursday.getYear(), 0, 4 + daysToMonday);

    final double diff = Math.floor((thursday.getTime() - monday.getTime()) / (1000 * 60 * 60 * 24));
    return (int) Math.ceil(diff / 7.0);
  }
예제 #14
0
 public void setDate(Date date) {
   int year;
   if (date.getYear() < 70) {
     year = (70 + 1900);
   } else {
     year = (date.getYear() + 1900);
   }
   setTime(year, date.getMonth() + 1, date.getDay() + 1);
 }
예제 #15
0
  /**
   * 根据生日获取年龄
   *
   * @param birthday
   * @return
   */
  public static int getAge(Date birthday) {
    if (birthday == null) {
      return 0;
    }
    if (birthday.getYear() > getDateDetail(System.currentTimeMillis())[0]) {
      birthday.setYear(birthday.getYear() - TimeUtil.SYSTEM_START_DATE[0]);
    }

    return getAge(new int[] {birthday.getYear(), birthday.getMonth(), birthday.getDay()});
  }
예제 #16
0
  public static String getUXMessageTime(long time) {
    long between = (long) (System.currentTimeMillis() / 1000 - time);

    Date messageDate = new Date(time * 1000L);
    Date currentDate = new Date(System.currentTimeMillis());

    SimpleDateFormat sdf = new SimpleDateFormat("kk:mm", Locale.getDefault());
    sdf.setTimeZone(TimeZone.getTimeZone("GMT+3"));
    String numberDate = sdf.format(messageDate);

    if (messageDate.getDay() == currentDate.getDay()) return "today at " + " " + numberDate;
    else if (Math.abs(messageDate.getDate() - currentDate.getDate()) == 1) // TODO
    return "yesterday at " + " " + numberDate;
    else {
      sdf = new SimpleDateFormat("dd LLL kk:mm", Locale.getDefault());
      sdf.setTimeZone(TimeZone.getTimeZone("GMT+3"));
      return sdf.format(messageDate);
    }

    // Resources resources = VKMessenger.getInstance().getResources();
    // Logs.info(null, "Time: "+(time/60));
  }
예제 #17
0
  private void editMitarbeiterstunde(Mitarbeiter mb) {
    Date actual = new Date();

    Timestamp ts = new Timestamp(actual.getTime());
    MitarbeiterstundenDao dao = new MitarbeiterstundenDao();

    List<Mitarbeiterstunde> stunden = dao.getMitarbeiterstundenByMitarbeiter(mb); // €NDERN
    System.out.println("ich bin noch hier: stunden hat " + stunden.size());
    for (Mitarbeiterstunde m : stunden) {
      Timestamp stamp = m.getAngekommen();
      Date datum = new Date(stamp.getTime());
      System.out.println(datum.toString());
      Date aktuelles = new Date();
      if (datum.getYear() == aktuelles.getYear()
          && datum.getMonth() == aktuelles.getMonth()
          && datum.getDay() == aktuelles.getDay()) {
        m.setGegangen(new Timestamp(aktuelles.getTime()));

        dao.saveOrUpdate(m);
        return;
      }
    }
  }
예제 #18
0
 long calculateNextTime(long l) {
   Date date = new Date(l);
   Date date1 = new Date(date.getYear(), date.getMonth(), date.getDate());
   date1.setTime(date1.getTime() + (long) seconds * 1000L);
   for (;
       date1.getTime() <= date.getTime() || date1.getDay() != day;
       date1.setTime(date1.getTime() + 0x5265c00L)) {}
   if (lastTime > 0L && time == 0L && date.getDay() == day) {
     Date date2 = new Date(lastTime);
     if (date2.getYear() != date.getYear()
         || date2.getMonth() != date.getMonth()
         || date2.getDate() != date.getDate()) {
       Date date3 = new Date(date.getYear(), date.getMonth(), date.getDate());
       date3.setTime(date3.getTime() + (long) seconds * 1000L);
       if (date3.before(date)) {
         time = date.getTime() - 1L;
         return time;
       }
     }
   }
   time = date1.getTime();
   return time;
 }
  @SuppressLint("SimpleDateFormat")
  @SuppressWarnings("deprecation")
  private static void setupSmartAlarm(MethodHookParam param, int timeout) {
    if (((Intent) param.args[0]).getBooleanExtra("alarmSet", false)) {
      Context context = (Context) XposedHelpers.getObjectField(param.thisObject, "mContext");
      String nextAlarm =
          Settings.System.getString(
              context.getContentResolver(), android.provider.Settings.System.NEXT_ALARM_FORMATTED);
      DateFormat sdf = new SimpleDateFormat("EEE hh:mm aa");
      Date alarmDate = null;
      try {
        alarmDate = sdf.parse(nextAlarm);
      } catch (ParseException e) {
        e.printStackTrace();
      }
      int alarmDay = alarmDate.getDay();
      Calendar now = Calendar.getInstance();
      Date currentDate = now.getTime();
      int todayDay = currentDate.getDay();
      int daysDiff = 0;
      if (todayDay > alarmDay) {
        daysDiff = ((7 + (alarmDay - todayDay)) % 7) + 1;
      } else {
        daysDiff = ((7 + (alarmDay - todayDay)) % 7);
      }
      now.add(Calendar.DATE, daysDiff);
      Date alarmFulldate = now.getTime();
      alarmFulldate.setHours(alarmDate.getHours());
      alarmFulldate.setMinutes(alarmDate.getMinutes());
      alarmFulldate.setSeconds(0);
      long millis = alarmFulldate.getTime() - new Date().getTime();

      if (millis > (timeout * 60 * 1000)) {
        ((Intent) param.args[0]).putExtra("alarmSet", false);
      }
    }
  }
예제 #20
0
  private void Actializar() {
    java.util.Date Fecha = new Date();
    int dia, mes, ano, horas, minutes;
    dia = Fecha.getDay();
    mes = Fecha.getMonth();
    ano = Fecha.getYear();
    horas = Fecha.getHours();
    minutes = Fecha.getMinutes();

    this.jTextField1.setText(
        String.valueOf(horas)
            + ":"
            + String.valueOf(minutes)
            + "   "
            + String.valueOf(dia)
            + "/"
            + String.valueOf(mes)
            + "/"
            + String.valueOf(ano));
  }
예제 #21
0
 /**
  * 得到广告条某天的预估值(预估表中的值)
  *
  * @param advbarId
  * @param bookDate
  * @return
  */
 public static synchronized int getAdvbarFutureFlight(int advbarId, Date bookDate) {
   FutureFlight futureFlightEty = new FutureFlight();
   futureFlightEty.setAdvbarId(advbarId);
   futureFlightEty.setCreateTime(new Date());
   List<FutureFlight> futureList =
       BookCommonInstance.futureFlightDao.selectAdvbarFutureFlight(futureFlightEty); // 预估量
   int futureFlight = 0;
   if (futureList.size() > 0) {
     futureFlightEty = futureList.get(0);
     int c = bookDate.getDay() - futureFlightEty.getCreateTime().getDay();
     if (c < 0) c = (-1) * c;
     if (c % 7 == 0) futureFlight = futureFlightEty.getNum1();
     else if (c % 7 == 1) futureFlight = futureFlightEty.getNum2();
     else if (c % 7 == 2) futureFlight = futureFlightEty.getNum3();
     else if (c % 7 == 3) futureFlight = futureFlightEty.getNum4();
     else if (c % 7 == 4) futureFlight = futureFlightEty.getNum5();
     else if (c % 7 == 5) futureFlight = futureFlightEty.getNum6();
     else if (c % 7 == 6) futureFlight = futureFlightEty.getNum7();
   }
   return futureFlight;
 }
예제 #22
0
파일: History.java 프로젝트: dannl/emotion
 protected List<HistoryItem> loadFromLocal() throws DataSource.DataLoadingException {
   final File cacheFile = getCacheFile(mType);
   try {
     final String content = SimpleIOUtils.loadContent(new FileInputStream(cacheFile));
     final JSONArray jsonArray = new JSONArray(content);
     final List<HistoryItem> records = new ArrayList<>();
     for (int i = 0; i < jsonArray.length(); i++) {
       final JSONObject json = jsonArray.getJSONObject(i);
       final HistoryItem record = HistoryItem.fromJson(json);
       if (record != null) {
         records.add(record);
       }
     }
     if (records.isEmpty()) {
       return records;
     } else {
       final HistoryItem firstCache = records.get(0);
       final Date date = firstCache.getDate();
       final long deltaTime = System.currentTimeMillis() - date.getTime();
       int dayOfWeek = 3;
       if (mType == Lottery.Type.SSQ) {
         dayOfWeek = 4;
       }
       if (deltaTime < 2 * ONE_DAY
           // 周3是3.
           || (date.getDay() == dayOfWeek && deltaTime < 3 * ONE_DAY)) {
         //                        mDLTs = lotteryRecords;
         mHistoryCache.put(mType, records);
         return mHistoryCache.get(mType);
       }
       final List<HistoryItem> newer = mDataSource.getNewSince(records.get(0));
       records.addAll(0, newer);
       mHistoryCache.put(mType, records);
       saveToLocal();
       return records;
     }
   } catch (IOException | JSONException ignored) {
   }
   return null;
 }
예제 #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.date_time_picker);

    final TimePicker timePicker = (TimePicker) findViewById(R.id.time_picker);
    timePicker.setIs24HourView(true);

    final DatePicker datePicker = (DatePicker) findViewById(R.id.date_picker);

    Intent intent = getIntent();
    Date date = new Date();
    int day = intent.getIntExtra("day", date.getDay());
    int month = intent.getIntExtra("month", date.getMonth() + 1) - 1;
    int year = intent.getIntExtra("year", date.getYear());

    int hours = intent.getIntExtra("hours", date.getHours());
    int minutes = intent.getIntExtra("minutes", date.getMinutes());

    timePicker.setCurrentHour(hours);
    timePicker.setCurrentMinute(minutes);

    datePicker.updateDate(year, month, day);

    Button setDateTimeButton = (Button) findViewById(R.id.date_time_set);
    setDateTimeButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent intent = new Intent();
            intent.putExtra("day", datePicker.getDayOfMonth());
            intent.putExtra("month", datePicker.getMonth() + 1);
            intent.putExtra("year", datePicker.getYear());
            intent.putExtra("hours", timePicker.getCurrentHour());
            intent.putExtra("minutes", timePicker.getCurrentMinute());
            setResult(RESULT_OK, intent);
            finish();
          }
        });
  }
예제 #24
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    Logger.D(TAG, "onCreate");

    getWindow().setFlags(RhodesService.WINDOW_FLAGS, RhodesService.WINDOW_MASK);
    setContentView(AndroidR.layout.datetime);

    Bundle extras = this.getIntent().getExtras();

    _callback = extras.getString(INTENT_EXTRA_PREFIX + "callback");
    _init = new Date(extras.getLong(INTENT_EXTRA_PREFIX + "init") * 1000);
    _fmt = extras.getInt(INTENT_EXTRA_PREFIX + "fmt");
    _opaque = extras.getByteArray(INTENT_EXTRA_PREFIX + "opaque");

    this.setTitle(extras.getString(INTENT_EXTRA_PREFIX + "title"));

    _datePicker = (DatePicker) findViewById(AndroidR.id.datePicker);
    _timePicker = (TimePicker) findViewById(AndroidR.id.timePicker);
    _okButton = (Button) findViewById(AndroidR.id.okButton);
    _cancelButton = (Button) findViewById(AndroidR.id.cancelButton);

    _okButton.setOnClickListener(mOkListener);
    _cancelButton.setOnClickListener(mCancelListener);

    _datePicker.init(_init.getYear() + 1900, _init.getMonth(), _init.getDay(), null);
    _timePicker.setCurrentHour(_init.getHours());
    _timePicker.setCurrentMinute(_init.getMinutes());

    switch (_fmt) {
      case FORMAT_DATE:
        _timePicker.setVisibility(View.INVISIBLE);
        break;
      case FORMAT_TIME:
        _datePicker.setVisibility(View.INVISIBLE);
        break;
      case FORMAT_DATE_TIME:
        break;
    }
  }
예제 #25
0
 public boolean write() {
   try {
     Properties configFile = new Properties();
     configFile.load(new FileInputStream(settingsFile));
     configFile.put("SMTP_Host", mSMTPHost);
     configFile.put("SMTP_Port", mSMTPPort);
     configFile.put("POP3_Host", mPOP3Host);
     configFile.put("POP3_Port", mPOP3Port);
     configFile.put("From", mFrom);
     configFile.put("Password", mPass);
     configFile.put("Name", mName);
     configFile.put("Mails_Location", mMailsLocation);
     configFile.put("Contacts_Location", mContactsLocation);
     // TODO : There are some wrong and deprecated usage of date formatting, fix it.
     configFile.put(
         "Last_Update",
         Integer.toString(mLastUpdate.getYear() + 1900)
             + "/"
             + Integer.toString(mLastUpdate.getMonth())
             + "/"
             + Integer.toString(mLastUpdate.getDay())
             + "-"
             + Integer.toString(mLastUpdate.getHours())
             + "-"
             + Integer.toString(mLastUpdate.getMinutes())
             + "-"
             + Integer.toString(mLastUpdate.getSeconds()));
     FileOutputStream out = new FileOutputStream(settingsFile);
     // TODO : There is a usage of ini save method that deprecated.
     configFile.save(out, "properties updated");
   } catch (Exception e) {
     System.out.println("Write Exception:" + e.getMessage());
     return false;
   }
   return true;
 }
예제 #26
0
파일: DateTest.java 프로젝트: djbone/j2objc
 /** @tests java.util.Date#getDay() */
 public void test_getDay() {
   // Test for method int java.util.Date.getDay()
   Date d = new GregorianCalendar(1998, Calendar.OCTOBER, 13, 19, 9).getTime();
   assertEquals("Returned incorrect day", 2, d.getDay());
 }
  @RequestMapping(value = "/applicantUpdate", method = RequestMethod.POST)
  public String updateApplicant(
      @ModelAttribute("applicant") ApplicantBean applicant,
      Model model,
      HttpServletRequest request,
      HttpServletResponse response,
      @RequestParam("imageFileEdit") MultipartFile file1) {
    String msg = null;
    Long duplicateId = 0l;
    try {
      response.setCharacterEncoding("UTF-8");

      duplicateId =
          appService.updateDuplicateCheck(
              applicant.getFnameEdit(), applicant.getApplicant_IdEdit());
      if (duplicateId == 0) {

        String dbResumePath = null;

        if (file1.getBytes().length > 0) {

          InputStream inputStream = file1.getInputStream();
          String resumesFile = servletContext.getRealPath("/Resumes");
          Date date = new Date();
          String dt =
              date.getYear()
                  + date.getMonth()
                  + date.getDay()
                  + date.getHours()
                  + date.getMinutes()
                  + date.getSeconds()
                  + ""
                  + System.currentTimeMillis();
          String originalPath = resumesFile + "\\" + dt + ".txt";

          java.io.OutputStream outputStream = new FileOutputStream(new File(originalPath));
          int read = 0;
          byte[] bytes = new byte[1024];

          while ((read = inputStream.read(bytes)) != -1) {
            outputStream.write(bytes, 0, read);
          }
          outputStream.flush();
          inputStream.close();
          outputStream.close();
          dbResumePath = originalPath;
          System.out.println("with in if file iss===" + dbResumePath);
        } else {

          dbResumePath = applicant.getDbDocPath();
          System.out.println("with in else file iss===" + dbResumePath);
        }

        applicant.setDocPath(dbResumePath);

        msg = appService.updateApplicant(applicant);
        if (msg.equals("S")) {
          request.setAttribute("applicantUpdate", "Applicant Data is updated Successfully");
        } else {
          request.setAttribute("applicantUpdateError", "Applicant Data is not updated properly");
        }
      } else {

        request.setAttribute("applicantValues", "hello");
        request.setAttribute(
            "applicantUpdateDuplicate",
            "Applicant Name is already exists. Please try some other name");
        return "applicantHome";
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    model.addAttribute("applicant", new ApplicantBean());
    return "applicantHome";
  }
 private static Timestamp getSimpleTime(Date date) {
   return new Timestamp((new Date(date.getYear(), date.getMonth(), date.getDay())).getTime());
 }
예제 #29
0
파일: aeu.java 프로젝트: sheytoon/Fanoos
 private void a(Date date) {
   int i = 10;
   int year = date.getYear() + 1900;
   int month = date.getMonth() + 1;
   int date2 = date.getDate();
   int day = date.getDay();
   r5 = new int[12];
   int[] iArr = new int[] {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
   iArr[0] = 0;
   iArr[1] = 31;
   iArr[2] = 60;
   iArr[3] = 91;
   iArr[4] = 121;
   iArr[5] = 152;
   iArr[6] = 182;
   iArr[7] = 213;
   iArr[8] = 244;
   iArr[9] = 274;
   iArr[10] = 305;
   iArr[11] = 335;
   if (year % 4 != 0) {
     this.c = r5[month - 1] + date2;
     if (this.c > 79) {
       this.c -= 79;
       if (this.c <= 186) {
         switch (this.c % 31) {
           case ve.CropImageView_guidelines /*0*/:
             this.d = this.c / 31;
             this.c = 31;
             break;
           default:
             this.d = (this.c / 31) + 1;
             this.c %= 31;
             break;
         }
         this.e = year - 621;
       } else {
         this.c -= 186;
         switch (this.c % 30) {
           case ve.CropImageView_guidelines /*0*/:
             this.d = (this.c / 30) + 6;
             this.c = 30;
             break;
           default:
             this.d = (this.c / 30) + 7;
             this.c %= 30;
             break;
         }
         this.e = year - 621;
       }
     } else {
       if (year > 1996 && year % 4 == 1) {
         i = 11;
       }
       this.c = i + this.c;
       switch (this.c % 30) {
         case ve.CropImageView_guidelines /*0*/:
           this.d = (this.c / 30) + 9;
           this.c = 30;
           break;
         default:
           this.d = (this.c / 30) + 10;
           this.c %= 30;
           break;
       }
       this.e = year - 622;
     }
   } else {
     this.c = iArr[month - 1] + date2;
     if (year >= 1996) {
       i = 79;
     } else {
       i = 80;
     }
     if (this.c > i) {
       this.c -= i;
       if (this.c <= 186) {
         switch (this.c % 31) {
           case ve.CropImageView_guidelines /*0*/:
             this.d = this.c / 31;
             this.c = 31;
             break;
           default:
             this.d = (this.c / 31) + 1;
             this.c %= 31;
             break;
         }
         this.e = year - 621;
       } else {
         this.c -= 186;
         switch (this.c % 30) {
           case ve.CropImageView_guidelines /*0*/:
             this.d = (this.c / 30) + 6;
             this.c = 30;
             break;
           default:
             this.d = (this.c / 30) + 7;
             this.c %= 30;
             break;
         }
         this.e = year - 621;
       }
     } else {
       this.c += 10;
       switch (this.c % 30) {
         case ve.CropImageView_guidelines /*0*/:
           this.d = (this.c / 30) + 9;
           this.c = 30;
           break;
         default:
           this.d = (this.c / 30) + 10;
           this.c %= 30;
           break;
       }
       this.e = year - 622;
     }
   }
   switch (this.d) {
     case ve.CropImageView_fixAspectRatio /*1*/:
       this.b =
           "\u00d9\ufffd\u00d8\u00b1\u00d9\u02c6\u00d8\u00b1\u00d8\u00af\u00d9\u0160\u00d9\u2020";
       break;
     case ve.CropImageView_aspectRatioX /*2*/:
       this.b =
           "\u00d8\u00a7\u00d8\u00b1\u00d8\u00af\u00d9\u0160\u00d8\u00a8\u00d9\u2021\u00d8\u00b4\u00d8\u00aa";
       break;
     case ve.CropImageView_aspectRatioY /*3*/:
       this.b = "\u00d8\u00ae\u00d8\u00b1\u00d8\u00af\u00d8\u00a7\u00d8\u00af";
       break;
     case ve.CropImageView_imageResource /*4*/:
       this.b = "\u00d8\u00aa\u00d9\u0160\u00d8\u00b1";
       break;
     case Node.CDSECT /*5*/:
       this.b = "\u00d9\u2026\u00d8\u00b1\u00d8\u00af\u00d8\u00a7\u00d8\u00af";
       break;
     case Node.ENTITY_REF /*6*/:
       this.b = "\u00d8\u00b4\u00d9\u2021\u00d8\u00b1\u00d9\u0160\u00d9\u02c6\u00d8\u00b1";
       break;
     case Node.IGNORABLE_WHITESPACE /*7*/:
       this.b = "\u00d9\u2026\u00d9\u2021\u00d8\u00b1";
       break;
     case Node.PROCESSING_INSTRUCTION /*8*/:
       this.b = "\u00d8\u00a2\u00d8\u00a8\u00d8\u00a7\u00d9\u2020";
       break;
     case Node.COMMENT /*9*/:
       this.b = "\u00d8\u00a2\u00d8\u00b0\u00d8\u00b1";
       break;
     case Node.DOCDECL /*10*/:
       this.b = "\u00d8\u00af\u00d9\u0160";
       break;
     case nv.Toolbar_titleMargins /*11*/:
       this.b = "\u00d8\u00a8\u00d9\u2021\u00d9\u2026\u00d9\u2020";
       break;
     case nv.Toolbar_titleMarginStart /*12*/:
       this.b = "\u00d8\u00a7\u00d8\u00b3\u00d9\ufffd\u00d9\u2020\u00d8\u00af";
       break;
   }
   switch (day) {
     case ve.CropImageView_guidelines /*0*/:
       this.a = "\u00d9\u0160\u00da\u00a9\u00d8\u00b4\u00d9\u2020\u00d8\u00a8\u00d9\u2021";
     case ve.CropImageView_fixAspectRatio /*1*/:
       this.a = "\u00d8\u00af\u00d9\u02c6\u00d8\u00b4\u00d9\u2020\u00d8\u00a8\u00d9\u2021";
     case ve.CropImageView_aspectRatioX /*2*/:
       this.a = "\u00d8\u00b3\u00d9\u2021 \u00d8\u00b4\u00d9\u2020\u00d8\u00a8\u00d9\u2021";
     case ve.CropImageView_aspectRatioY /*3*/:
       this.a =
           "\u00da\u2020\u00d9\u2021\u00d8\u00a7\u00d8\u00b1\u00d8\u00b4\u00d9\u2020\u00d8\u00a8\u00d9\u2021";
     case ve.CropImageView_imageResource /*4*/:
       this.a =
           "\u00d9\u00be\u00d9\u2020\u00d8\u00ac \u00d8\u00b4\u00d9\u2020\u00d8\u00a8\u00d9\u2021";
     case Node.CDSECT /*5*/:
       this.a = "\u00d8\u00ac\u00d9\u2026\u00d8\u00b9\u00d9\u2021";
     case Node.ENTITY_REF /*6*/:
       this.a = "\u00d8\u00b4\u00d9\u2020\u00d8\u00a8\u00d9\u2021";
     default:
   }
 }
예제 #30
0
public class DatingCalendarData {

  private static CalendarEvent[] records;
  private static Date today = new Date();
  private static int year = today.getYear();
  private static int month = today.getMonth();
  private static int start = today.getDate() - today.getDay();

  public static CalendarEvent[] getRecords() {
    if (records == null) {
      records = getNewRecords();
    }
    return records;
  }

  public static CalendarEvent[] getNewRecords() {
    return new CalendarEvent[] {
      new CalendarEvent(
          1,
          "Meeting",
          "Shareholders meeting: monthly forecast report",
          new Date(year, month, start + 2, 9, 0, 0),
          new Date(year, month, start + 2, 14, 0, 0)),
      new CalendarEvent(
          2,
          "Realtor",
          "Breakfast with realtor to discuss moving plans",
          new Date(year, month, start + 3, 8, 0, 0),
          new Date(year, month, start + 3, 10, 0, 0)),
      new CalendarEvent(
          3,
          "Soccer",
          "Little league soccer finals",
          new Date(year, month, start + 4, 13, 0, 0),
          new Date(year, month, start + 4, 16, 0, 0)),
      new CalendarEvent(
          4,
          "Sleep",
          "Catch up on sleep",
          new Date(year, month, start + 4, 5, 0, 0),
          new Date(year, month, start + 4, 9, 0, 0)),
      new CalendarEvent(
          5,
          "Inspection",
          "Home inspector coming",
          new Date(year, month, start + 4, 10, 0, 0),
          new Date(year, month, start + 4, 12, 0, 0),
          false,
          "testStyle"),
      new CalendarEvent(
          6,
          "Airport run",
          "Pick James up from the airport",
          new Date(year, month, start + 4, 1, 0, 0),
          new Date(year, month, start + 4, 3, 0, 0)),
      new CalendarEvent(
          7,
          "Dinner Party",
          "Prepare elaborate meal for friends",
          new Date(year, month, start + 4, 17, 0, 0),
          new Date(year, month, start + 4, 20, 0, 0)),
      new CalendarEvent(
          8,
          "Poker",
          "Poker at Steve's house",
          new Date(year, month, start + 4, 21, 0, 0),
          new Date(year, month, start + 4, 23, 0, 0)),
      new CalendarEvent(
          9,
          "Meeting",
          "Board of directors meeting: discussion of next months strategy",
          new Date(year, month, start + 5, 11, 0, 0),
          new Date(year, month, start + 5, 15, 0, 0))
    };
  }
}