diff --git a/Week3-Project/gaurav_singh024/backend/.gitignore b/Week3-Project/gaurav_singh024/backend/.gitignore new file mode 100644 index 0000000..c456c4a --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/.gitignore @@ -0,0 +1,25 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +/build/ diff --git a/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/MavenWrapperDownloader.java b/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 0000000..47336fd --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,114 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +*/ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.channels.Channels; +import java.nio.channels.ReadableByteChannel; +import java.util.Properties; + +public class MavenWrapperDownloader { + + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: : " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/maven-wrapper.jar b/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..01e6799 Binary files /dev/null and b/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/maven-wrapper.jar differ diff --git a/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/maven-wrapper.properties b/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..cd0d451 --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip diff --git a/Week3-Project/gaurav_singh024/backend/mvnw b/Week3-Project/gaurav_singh024/backend/mvnw new file mode 100644 index 0000000..5551fde --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/mvnw @@ -0,0 +1,286 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven2 Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" + # TODO classpath? +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + wget "$jarUrl" -O "$wrapperJarPath" + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + curl -o "$wrapperJarPath" "$jarUrl" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/Week3-Project/gaurav_singh024/backend/mvnw.cmd b/Week3-Project/gaurav_singh024/backend/mvnw.cmd new file mode 100644 index 0000000..e5cfb0a --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/mvnw.cmd @@ -0,0 +1,161 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" +FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + echo Found %WRAPPER_JAR% +) else ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" + echo Finished downloading %WRAPPER_JAR% +) +@REM End of extension + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/Week3-Project/gaurav_singh024/backend/pom.xml b/Week3-Project/gaurav_singh024/backend/pom.xml new file mode 100644 index 0000000..c2a53c7 --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.1.2.RELEASE + + + com.example + java-api-week3 + 0.0.1-SNAPSHOT + java-api-week3 + Demo project for Spring Boot + + + 1.8 + + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-web + + + + com.microsoft.sqlserver + mssql-jdbc + runtime + + + org.apache.derby + derby + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/Employee.java b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/Employee.java new file mode 100644 index 0000000..c54542f --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/Employee.java @@ -0,0 +1,81 @@ +package com.example.demo; + +public class Employee { + int ID; + String Code; + String Name; + int DesignationId; + String EmailId; + String Address; + String Contact; + int DepartmentId; + public int getID() { + return ID; + } + public void setID(int iD) { + ID = iD; + } + public String getCode() { + return Code; + } + public void setCode(String code) { + Code = code; + } + public String getName() { + return Name; + } + public void setName(String name) { + Name = name; + } + public int getDesignationId() { + return DesignationId; + } + public void setDesignationId(int designationId) { + DesignationId = designationId; + } + public String getEmailId() { + return EmailId; + } + public void setEmailId(String emailId) { + EmailId = emailId; + } + public String getAddress() { + return Address; + } + public void setAddress(String address) { + Address = address; + } + public String getContact() { + return Contact; + } + public void setContact(String contact) { + Contact = contact; + } + public int getDepartmentId() { + return DepartmentId; + } + public void setDepartmentId(int departmentId) { + DepartmentId = departmentId; + } + public Employee() { + ID = 0; + Code = null; + Name = null; + DesignationId = 0; + EmailId = null; + Address = null; + Contact = null; + DepartmentId = 0; + } + public Employee(int id, String code, String name, int designationId, String emailId, String address, String contact, + int departmentId) { + ID = id; + Code = code; + Name = name; + DesignationId = designationId; + EmailId = emailId; + Address = address; + Contact = contact; + DepartmentId = departmentId; + } +} diff --git a/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/JavaprojectApplication.java b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/JavaprojectApplication.java new file mode 100644 index 0000000..d0f188c --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/JavaprojectApplication.java @@ -0,0 +1,13 @@ +package com.example.demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class JavaprojectApplication { + + public static void main(String[] args) { + SpringApplication.run(JavaprojectApplication.class, args); + } + +} diff --git a/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/Login.java b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/Login.java new file mode 100644 index 0000000..e16e5db --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/Login.java @@ -0,0 +1,37 @@ +package com.example.demo; + +public class Login { + +int Id; +String Email; +String Password; + + +public int getId() { + return Id; +} +public void setId(int id) { + Id = id; +} +public String getEmail() { + return Email; +} +public void setEmail(String email) { + Email = email; +} +public String getPassword() { + return Password; +} +public void setPassword(String password) { + Password = password; +} +public Login(int id, String email, String password) { + this.setId(id); + this.setEmail(email); + this.setPassword(password); +} +public Login() { + super(); + // TODO Auto-generated constructor stub +} +} diff --git a/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/Employeecontroller.java b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/Employeecontroller.java new file mode 100644 index 0000000..b95c6a1 --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/Employeecontroller.java @@ -0,0 +1,141 @@ +package com.example.demo.controllers; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.example.demo.Employee; + +@CrossOrigin +@Controller +public class Employeecontroller { + @RequestMapping(method = RequestMethod.DELETE, value="/Employee/{id}") + @ResponseBody + public void DeleteDep(@RequestBody @PathVariable("id") String id) { + Connection con; + try { + String dbURL = "jdbc:sqlserver://CYG236\\SQLEXPRESS;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query = "delete from Employee where ID="+id; + stmt.execute(query); + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + @RequestMapping(method = RequestMethod.POST, value="/Employee") + @ResponseBody + public void AddDep(@RequestBody Employee lc) { + Connection con; + try { + String dbURL = "jdbc:sqlserver://CYG236\\SQLEXPRESS;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query = "insert into Employee values('"+lc.getID()+"','"+lc.getCode()+"','"+lc.getName()+"','"+lc.getDesignationId()+"','"+lc.getEmailId()+"','"+lc.getAddress()+"','"+lc.getContact()+"','"+lc.getDesignationId()+"');"; + stmt.execute(query); + } + } + catch(Exception e) { + e.printStackTrace(); + } + + + } + @RequestMapping(method = RequestMethod.PUT, value="/Employee/{id}") + @ResponseBody + public void UpdateDep(@RequestBody Employee lc,@PathVariable("id") String id) { + Connection con; + try { + String dbURL = "jdbc:sqlserver://CYG236\\SQLEXPRESS;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query = "update Employee set Code='"+lc.getCode()+"', Name = '"+lc.getName()+"', DesignationId = '"+lc.getDesignationId()+"', EmailId = '"+lc.getEmailId()+"', Address = '"+lc.getAddress()+"', Contact = '"+lc.getContact()+"', DepartmentId = '"+lc.getDepartmentId()+"'where ID ='"+ id+"';"; + stmt.execute(query); + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + @RequestMapping(method= RequestMethod.GET, value="/Employee") + @ResponseBody + public List getlogincredentials(){ + Connection con; + List EmployeeList= new ArrayList(); + ResultSet rs = null; + try { + String dbURL = "jdbc:sqlserver://CYG236\\SQLEXPRESS;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query5 = "select * from Employee"; + rs=stmt.executeQuery(query5); + while(rs.next()) + { + EmployeeList.add(new Employee(rs.getInt("ID"),rs.getString("Code"),rs.getString("Name"),rs.getInt("DesignationId"),rs.getString("Contact"),rs.getString("Address"),rs.getString("EmailId"),rs.getInt("DepartmentId"))); + } + return EmployeeList; + } + } + catch(Exception e) { + e.printStackTrace(); + } + return EmployeeList; + } + + @RequestMapping(method= RequestMethod.GET, value="/Employee/{id}") + @ResponseBody + public Employee getEmployeeById(@PathVariable("id") String id){ + Connection con; + List Employeelist= new ArrayList(); + Employee emp= new Employee(); + ResultSet rs = null; + try { + String dbURL = "jdbc:sqlserver://CYG236\\SQLEXPRESS;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query5 = "select * from Employee where ID="+id; + rs=stmt.executeQuery(query5); + while(rs.next()) + { + emp.setID(rs.getInt("ID")); + emp.setCode(rs.getString("Code")); + emp.setEmailId(rs.getString("EmailId")); + emp.setContact(rs.getString("Contact")); + emp.setName(rs.getString("Name")); + emp.setAddress(rs.getString("Address")); + emp.setDepartmentId(rs.getInt("DepartmentId")); + emp.setDesignationId(rs.getInt("DesignationId")); + Employeelist.add(emp); + } + } + } + catch(Exception e) { + e.printStackTrace(); + } + return Employeelist.get(0); + } + +} diff --git a/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/Logincontroller.java b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/Logincontroller.java new file mode 100644 index 0000000..30b25e8 --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/Logincontroller.java @@ -0,0 +1,139 @@ +package com.example.demo.controllers; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.example.demo.Login; + +@CrossOrigin +@Controller +public class Logincontroller { + @RequestMapping(method = RequestMethod.DELETE, value="/Login/{id}") + @ResponseBody + public void DeleteDep(@RequestBody @PathVariable("id") String id) { + Connection con; + try { + String dbURL = "jdbc:sqlserver://CYG190;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query = "delete from Login where Id ="+id+""; + stmt.execute(query); + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + @RequestMapping(method = RequestMethod.POST, value="/Login") + @ResponseBody + public Login AddDep(@RequestBody Login lc) { + Connection con; + try { + String dbURL = "jdbc:sqlserver://CYG190;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query = "insert into Login values('"+lc.getId()+"','"+lc.getEmail()+"','"+lc.getPassword()+"')"; + stmt.execute(query); + } + } + catch(Exception e) { + e.printStackTrace(); + + } + return lc; + + } + @RequestMapping(method = RequestMethod.PUT, value="/Login/{id}") + @ResponseBody + public void UpdateDep(@RequestBody Login lc,@PathVariable("id") String id) { + Connection con; + try { + String dbURL = "jdbc:sqlserver://CYG190;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query = "update Login set Password='"+lc.getPassword()+"', Email = '"+lc.getEmail()+"'where Id ='"+ id+"';"; + stmt.execute(query); + } + } + catch(Exception e) { + e.printStackTrace(); + } + } + @RequestMapping(method= RequestMethod.GET, value="/Login") + @ResponseBody + public List getlogincredentials(){ + Connection con; + List Login_CredentialList= new ArrayList(); + ResultSet rs = null; + try { + String dbURL = "jdbc:sqlserver://CYG190;database=Corporate"; + String user = "sa"; + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query5 = "select * from Login"; + rs=stmt.executeQuery(query5); + while(rs.next()) + { + Login_CredentialList.add(new Login(rs.getInt("Id"),rs.getString("Email"),rs.getString("Password"))); + } + return Login_CredentialList; + } + } + catch(Exception e) { + e.printStackTrace(); + } + return Login_CredentialList; + } + + @RequestMapping(method= RequestMethod.GET, value="/Login/{id}") + @ResponseBody + public Login getLogin_CredentialById(@PathVariable("id") String id){ + Connection con; + List Login_CredentialList= new ArrayList(); + ResultSet rs=null; + try { + String dbURL = "jdbc:sqlserver://CYG190;database=Corporate"; + String user = "sa"; + + con = DriverManager.getConnection(dbURL, user, "password"); + if(con != null) { + Statement stmt = con.createStatement(); + String query5 = "select * from Login where Id="+id+""; + rs=stmt.executeQuery(query5); + + + + while(rs.next()) + { + Login_CredentialList.add(new Login(rs.getInt("Id"),rs.getString("Email"),rs.getString("Password"))); + } + return Login_CredentialList.get(0); + + } + } + catch(Exception e) { + e.printStackTrace(); + } + return Login_CredentialList.get(0); + } + +} diff --git a/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/package-info.java b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/package-info.java new file mode 100644 index 0000000..ff66ddd --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/main/java/com/example/demo/controllers/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author vidit.mathur + * + */ +package com.example.demo.controllers; \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/backend/src/main/resources/application.properties b/Week3-Project/gaurav_singh024/backend/src/main/resources/application.properties new file mode 100644 index 0000000..124d82c --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/main/resources/application.properties @@ -0,0 +1,3 @@ +server.port=8084 +spring.profiles.active=@spring.profiles.active@ + diff --git a/Week3-Project/gaurav_singh024/backend/src/test/java/com/example/demo/JavaprojectApplicationTests.java b/Week3-Project/gaurav_singh024/backend/src/test/java/com/example/demo/JavaprojectApplicationTests.java new file mode 100644 index 0000000..8a3b8ff --- /dev/null +++ b/Week3-Project/gaurav_singh024/backend/src/test/java/com/example/demo/JavaprojectApplicationTests.java @@ -0,0 +1,16 @@ +package com.example.demo; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class JavaprojectApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/Week3-Project/gaurav_singh024/frontEnd/.gitignore b/Week3-Project/gaurav_singh024/frontEnd/.gitignore new file mode 100644 index 0000000..5cf5fb6 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/.gitignore @@ -0,0 +1,3 @@ +EmployeesAPI/.vs +EmployeesAPI/EmployeesAPI/bin +EmployeesAPI/EmployeesAPI/obj diff --git a/Week3-Project/gaurav_singh024/frontEnd/CSS/listcss.css b/Week3-Project/gaurav_singh024/frontEnd/CSS/listcss.css new file mode 100644 index 0000000..378b268 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/CSS/listcss.css @@ -0,0 +1,74 @@ +body{ + overflow:scroll; + font-family: arial, sans-serif; +} + +.header { + overflow: hidden; + background-color: #f1f1f1; + padding: 20px 10px; +} + +.header a { + float: left; + color: black; + text-align: center; + padding: 12px; + text-decoration: none; + font-size: 18px; + line-height: 25px; + border-radius: 4px; +} + +.header a.logo { + font-size: 25px; + font-weight: bold; +} + +.header a:hover { + background-color: #ddd; + color: black; +} + +.header a.active { + background-color: dodgerblue; + color: white; +} + +.header-right { + float: right; +} + +table { + border-collapse: collapse; + width: 100%; +} + +td, th { + border: 1px solid #dddddd; + text-align: left; + padding: 8px; +} + +caption{ + font-size: 40px; + color:darkblue; + line-height: 1.8; +} + +#employee th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #4CAF50; + color: white; +} + +#employee tr:nth-child(even){background-color: #f2f2f2;} + +#employee tr:hover {background-color: #ddd;} + +img{ + height: 40px; +} + diff --git a/Week3-Project/gaurav_singh024/frontEnd/CSS/loginstyle.css b/Week3-Project/gaurav_singh024/frontEnd/CSS/loginstyle.css new file mode 100644 index 0000000..ed97bfb --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/CSS/loginstyle.css @@ -0,0 +1,165 @@ +* { + + margin:0; + + padding:0; + + font-family: 'Source Sans Pro', sans-serif; + +} + + +body { + + background:#2c3e50; + +} +img{ + padding-left: 10px; + padding-top: +} + +form { + + position:relative; + + width:360px; + + height:260px; + margin:50px auto; + + text-align:center; + + background:#ecf0f1; + + padding:40px; + + -webkit-border-radius:20px 0 0 0; + + -moz-border-radius:20px 0 0 0; + + border-radius:20px 0 0 0; + + -webkit-box-shadow: 0px 1px 0px #ad392d, inset 0px 1px 0px white; + + -moz-box-shadow: 0px 1px 0px #ad392d, inset 0px 1px 0px white; + + box-shadow: 0px 1px 0px #ad392d, inset 0px 1px 0px white; + + box-shadow: 20px 20px 20px; + +} + + +h4 { + + font-family: 'Source Sans Pro', sans-serif; + + font-size:2em; + + font-weight:300; + + margin-bottom:25px; + + color:#7f8c8d; + + text-shadow:1px 1px 0px white; + +} + + +input { + + display:block; + + width:315px; + + padding:14px; + + -webkit-border-radius:6px; + + -moz-border-radius:6px; + + border-radius:6px; + + border:0; + + margin-bottom:12px; + + color:#7f8c8d; + + font-weight:600; + + font-size:16px; + +} + + +input:focus { + + background:#fafafa; + +} + + + +li { + + position:absolute; + + right:40px; + + bottom:62px; + + list-style:none; + +} + + +a, a:visited { + + text-decoration:none; + + color:#7f8c8d; + + font-weight:400; + + text-shadow:1px 1px 0px white; + + -webkit-transition: all .3s ease-in-out; + + -moz-transition: all .3s ease-in-out; + + transition: all .3s ease-in-out; + +} + + +.button { + + position:relative; + + float:left; + + width:145px; + + margin-top:10px; + + background:#3498db; + + color:#fff; + + font-weight:400; + + text-shadow:1px 1px 0px #2d7baf; + + box-shadow:0px 3px 0px #2d7baf; + + -webkit-transition: all .3s ease-in-out; + + -moz-transition: all .3s ease-in-out; + + transition: all .3s ease-in-out; + +} + diff --git a/Week3-Project/gaurav_singh024/frontEnd/CSS/registercss.css b/Week3-Project/gaurav_singh024/frontEnd/CSS/registercss.css new file mode 100644 index 0000000..2c38d67 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/CSS/registercss.css @@ -0,0 +1,168 @@ +*, *:before, *:after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; + +} + +body{ + overflow:scroll; +} + +.header { + overflow: hidden; + background-color: #f1f1f1; + padding: 20px 10px; +} + +.header a { + float: left; + color: black; + text-align: center; + padding: 12px; + text-decoration: none; + font-size: 18px; + line-height: 25px; + border-radius: 4px; +} + +.header a.logo { + font-size: 25px; + font-weight: bold; +} + +.header a:hover { + background-color: #ddd; + color: black; +} + +.header a.active { + background-color: dodgerblue; + color: white; +} + +.header-right { + float: right; +} + +body { + font-family: 'Nunito', sans-serif; + color: #384047; +} + +form { + max-width: 500px; + margin: 10px auto; + padding: 10px 20px; + background: #ccff99; + border-radius: 8px; +} +img{ + height: 40px; +} + +h2 { + margin: 0 0 30px 0; + text-align: center; +} + +input[type="text"], +input[type="password"], +input[type="date"], +input[type="datetime"], +input[type="email"], +input[type="number"], +input[type="search"], +input[type="tel"], +input[type="time"], +input[type="date"], +input[type="url"], +textarea, +select { + background: rgba(255,255,255,0.1); + border: none; + font-size: 16px; + height: auto; + margin: 0; + outline: 0; + padding: 15px; + width: 100%; + background-color: #e8eeef; + color: #8a97a0; + box-shadow: 0 1px 0 rgba(0,0,0,0.03) inset; + margin-bottom: 30px; +} + +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + margin: 0; +} + +input[type="radio"], +input[type="checkbox"] { + margin: 0 4px 8px 0; +} + +select { + padding: 6px; + height: 32px; + border-radius: 2px; +} + +button { + padding: 19px 39px 18px 39px; + color: #FFF; + background-color: #4bc970; + font-size: 18px; + text-align: center; + font-style: normal; + border-radius: 5px; + width: 100%; + border: 1px solid #3ac162; + border-width: 1px 1px 3px; + box-shadow: 0 -1px 0 rgba(255,255,255,0.1) inset; + margin-bottom: 10px; +} + +fieldset { + margin-bottom: 30px; + border: none; +} + +legend { + font-size: 1.4em; + margin-bottom: 10px; +} + +label { + display: block; + margin-bottom: 8px; +} + +label.light { + font-weight: 300; + display: inline; +} + +.number { + background-color: #5fcf80; + color: #fff; + height: 30px; + width: 30px; + display: inline-block; + font-size: 0.8em; + margin-right: 4px; + line-height: 30px; + text-align: center; + text-shadow: 0 1px 0 rgba(255,255,255,0.2); + border-radius: 100%; +} + +@media screen and (min-width: 480px) { + + form { + max-width: 900px; + } + +} \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/dashboard.html b/Week3-Project/gaurav_singh024/frontEnd/dashboard.html new file mode 100644 index 0000000..4a09acf --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/dashboard.html @@ -0,0 +1,22 @@ + + + + + Cyber Group India | Dashboard + + + + + +

Welcome to HRMS

+ + \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/images/background.png b/Week3-Project/gaurav_singh024/frontEnd/images/background.png new file mode 100644 index 0000000..bd23e9e Binary files /dev/null and b/Week3-Project/gaurav_singh024/frontEnd/images/background.png differ diff --git a/Week3-Project/gaurav_singh024/frontEnd/images/logo.png b/Week3-Project/gaurav_singh024/frontEnd/images/logo.png new file mode 100644 index 0000000..7cfc009 Binary files /dev/null and b/Week3-Project/gaurav_singh024/frontEnd/images/logo.png differ diff --git a/Week3-Project/gaurav_singh024/frontEnd/images/pattern_bg.jpg b/Week3-Project/gaurav_singh024/frontEnd/images/pattern_bg.jpg new file mode 100644 index 0000000..9359c65 Binary files /dev/null and b/Week3-Project/gaurav_singh024/frontEnd/images/pattern_bg.jpg differ diff --git a/Week3-Project/gaurav_singh024/frontEnd/index.html b/Week3-Project/gaurav_singh024/frontEnd/index.html new file mode 100644 index 0000000..fb6a8aa --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/index.html @@ -0,0 +1,44 @@ + + + + + + + + + + Cyber Group India | Login + + + + + + + + + + + + + +
Cyber Group India Limited
+
+ +

Sign In

+ + + + + +
  • Forgot your password?
  • + + + +
    + + + + + + + diff --git a/Week3-Project/gaurav_singh024/frontEnd/js/delete.js b/Week3-Project/gaurav_singh024/frontEnd/js/delete.js new file mode 100644 index 0000000..0436caf --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/js/delete.js @@ -0,0 +1,14 @@ +function deleteEmployee(id){ + var element = Number(id); + $.ajax({ + type: "DELETE", + url: "http://localhost:8084/api/Employee/"+element, + contentType:"application/json", + success: function(){ + window.location = "list.html"; + } + error:function(){ + alert("Unable to delete due to referencing!!!"); + } + }); +} \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/js/list.js b/Week3-Project/gaurav_singh024/frontEnd/js/list.js new file mode 100644 index 0000000..ac81b3b --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/js/list.js @@ -0,0 +1,41 @@ +function getEmployee(){ + $.ajax({ + url: 'http://localhost:8084/api/Employee/', + type: 'GET', + dataType: 'json', + success: function(res){ + console.log(res); + $.each(res, function (i, item) { + var rows = "" + + "" + item.Name + "" + + "" + item.Email + "" + + "" + item.PhoneNumber + "" + + "" + item.BloodGroup + "" + + "" + item.DOB + "" + + "" + + "" + + "" + + ""; + $('#employee').append(rows); + }); + } + }); +} +function deleteEmployee(id){ + var del_id = Number(id); + console.log(del_id); + $.ajax({ + type: "DELETE", + url: "http://localhost:8084/api/Employees/"+del_id, + contentType:"application/json", + success: function(){ + window.location = "list.html"; + }, + failure:function(){ + alert("Unable to delete..!"); + } + }); +} +function updateEmployee(id){ + window.location="update.html?id="+id; +} \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/js/login.js b/Week3-Project/gaurav_singh024/frontEnd/js/login.js new file mode 100644 index 0000000..87b1c87 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/js/login.js @@ -0,0 +1,16 @@ +function loggin(){ + $.ajax({ + + url: "http://localhost:8084/Employee/{id}.val(), + type: 'GET', + dataType: 'json', + success: function(res){ + if(res.Password==$('#pass').val()) { + window.location = "dashboard.html"; + } + else{ + alert("Incorrect User-ID or password!!!"); + } + } + }); + } \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/js/loginList.js b/Week3-Project/gaurav_singh024/frontEnd/js/loginList.js new file mode 100644 index 0000000..0f26017 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/js/loginList.js @@ -0,0 +1,38 @@ +function getEmployee(){ + $.ajax({ + url: 'http://localhost:8084/api/Login/', + type: 'GET', + dataType: 'json', + success: function(res){ + console.log(res); + $.each(res, function (i, item) { + var rows = "" + + "" + item.ID + "" + + "" + item.EmployeeID + "" + + "" + + "" + + "" + + ""; + $('#employee').append(rows); + }); + } + }); +} +function deleteLogin(id){ + var del_id = Number(id); + console.log(del_id); + $.ajax({ + type: "DELETE", + url: "http://localhost:8084/api/Login/"+del_id, + contentType:"application/json", + success: function(){ + window.location = "loginList.html"; + }, + failure:function(){ + alert("Unable to delete..!"); + } + }); +} +function updateEmployee(id){ + window.location="update.html?id="+id; +} \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/js/register.js b/Week3-Project/gaurav_singh024/frontEnd/js/register.js new file mode 100644 index 0000000..b437cfe --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/js/register.js @@ -0,0 +1,34 @@ +function setEmployee(){ + regData = { + "Logins": [], + "Name": $('#name').val(), + "Email": $('#mail').val(), + "PhoneNumber": $('#mail').val(), + "FathersName": $('#fname').val(), + "MothersName": $('#mname').val(), + "DOB": $('#user_dob').val(), + "Gender": $('#gender').val(), + "BloodGroup": $('#blood').val(), + "Qualification": $('#qualif').val(), + "Nationality": $('#nationality').val(), + "AadharNumber": $('#aadhar').val(), + "PanNumber": $('#pan').val(), + "Bio": $('#bio').val(), + "JobRole": $('#job').val() + }; + $.ajax({ + type : "POST", + url : "http://localhost:8084/api/Employee/", + dataType : "json", + data : regData, + success : function (msg) { + if (msg) { + alert("Somebody" + name + " was added in list !"); + location.reload(true); + } + else { + alert("Cannot add to list !"); + } + } + }); +} \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/js/update.js b/Week3-Project/gaurav_singh024/frontEnd/js/update.js new file mode 100644 index 0000000..1469a15 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/js/update.js @@ -0,0 +1,77 @@ +function loadInfo(){ + var url = new URL(window.location.href); + var id = url.searchParams.get("id"); + id=Number(id); + document.getElementById("uid").value=id; + $.ajax({ + url: 'http://localhost:8084/api/Employee/'+id, + type: 'GET', + dataType: 'json', + success: function(item){ + $('#name').val(item['Name']); + $('#mail').val(item['Email']); + $('#phone').val(item['PhoneNumber']); + $('#fname').val(item['FathersName']); + $('#mname').val(item['MothersName']); + $('#user_dob').val(item['DOB']); + $('#gender').val(item['Gender']); + $('#blood').val(item['BloodGroup']); + $('#qualif').val(item['Qualification']); + $('#nationality').val(item['Nationality']); + $('#aadhar').val(item['AadharNumber']); + $('#pan').val(item['PanNumber']); + $('#bio').val(item['Bio']); + $('#job').val(item['JobRole']); + } + }); +} + +function updateEmployee(){ + var url = new URL(window.location.href); + var id = url.searchParams.get("id"); + id=Number(id); + console.log(id); + regData = { + "Logins": [], + "ID":id, + "Name": $('#name').val(), + "Email": $('#mail').val(), + "PhoneNumber": $('#phone').val(), + "FathersName": $('#fname').val(), + "MothersName": $('#mname').val(), + "DOB": $('#user_dob').val(), + "Gender": $('#gender').val(), + "BloodGroup": $('#blood').val(), + "Qualification": $('#qualif').val(), + "Nationality": $('#nationality').val(), + "AadharNumber": $('#aadhar').val(), + "PanNumber": $('#pan').val(), + "Bio": $('#bio').val(), + "JobRole": $('#job').val() + }; + $.ajax({ + type : "PUT", + url : "http://localhost:8084/api/Employee/"+id, + dataType : "json", + data : regData, + error:function(e){ + alert(e); + }, + success : function (msg) { + if (msg) { + window.location ="list.html"; + } + else { + + alert("Cannot update !"); + window.location ="list.html"; + + } + } + }); +} + + + + + diff --git a/Week3-Project/gaurav_singh024/frontEnd/list.html b/Week3-Project/gaurav_singh024/frontEnd/list.html new file mode 100644 index 0000000..683215f --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/list.html @@ -0,0 +1,33 @@ + + + + Cyber Group India | Employee List + + + + + + +
    + + + + + + + + + +
    NameMail-idContactBlood GroupD.O.B.
    + + + diff --git a/Week3-Project/gaurav_singh024/frontEnd/loginList.html b/Week3-Project/gaurav_singh024/frontEnd/loginList.html new file mode 100644 index 0000000..b9c23c2 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/loginList.html @@ -0,0 +1,30 @@ + + + + Cyber Group India | Employee List + + + + + + +
    + + + + + + +
    Login IDEmployee ID
    + + + \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/register.html b/Week3-Project/gaurav_singh024/frontEnd/register.html new file mode 100644 index 0000000..a5f2055 --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/register.html @@ -0,0 +1,156 @@ + + + + + Cyber Group India | Register + + + + + + + + + +
    +
    +

    Register

    +

    +
    + 1Your basic info + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + 2Your profile + + + + + +
    + +
    + + \ No newline at end of file diff --git a/Week3-Project/gaurav_singh024/frontEnd/update.html b/Week3-Project/gaurav_singh024/frontEnd/update.html new file mode 100644 index 0000000..b2a8aeb --- /dev/null +++ b/Week3-Project/gaurav_singh024/frontEnd/update.html @@ -0,0 +1,116 @@ + + + + + Cyber Group India | Register + + + + + + + +
    +
    +

    Update Info

    +

    +
    + 1Your basic info + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + 2Your profile + + + + + +
    + +
    + + \ No newline at end of file