public async Task <IActionResult> Edit(int id, [Bind("EmploymentDetailsId,UsersId,OrganizationName,OrganizationAddress,OrganizationType,PositionHeld,EmploymentType,EmploymentStatus,EmploymentDate,LastDayAtJob,Stateid,CreatedOn")] EmploymentDetails employmentDetails)
        {
            if (id != employmentDetails.EmploymentDetailsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(employmentDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmploymentDetailsExists(employmentDetails.EmploymentDetailsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(Ok(true));
            }
            //ViewData["UsersId"] = new SelectList(_context.Users, "UsersId", "AccountNumber", employmentDetails.UsersId);
            return(Ok(false));
        }
        public ActionResult QuickViewEmployment(string UserID)
        {
            int uid  = db.UserProfiles.Where(x => x.MyAppID == UserID).FirstOrDefault().UserID;
            var data = db.Get_Employment(uid).ToList();
            List <EmploymentDetails> lst = new List <EmploymentDetails>();

            foreach (var i in data)
            {
                EmploymentDetails d = new EmploymentDetails();
                d.EmpDetailID  = i.EmpDetailID;
                d.EmployerName = i.EmployerName;
                d.UserID       = i.UserID;
                d.TypeID       = i.TypeID;
                d.Type         = i.Type;
                d.Designation  = i.Desgignation;


                if (i.Type == "Current Employer" && i.DateTo == null)
                {
                    d.DateFrom = i.DateFrom.Value;
                    d.DateTo   = null;
                    d.Gap      = "From " + DateCommonFunctions.GetShortDateFormat(i.DateFrom.Value) + " To Present";
                }
                else
                {
                    d.DateFrom = i.DateFrom.Value;
                    d.DateTo   = i.DateTo.Value;
                    d.Gap      = "From " + DateCommonFunctions.GetShortDateFormat(i.DateFrom.Value) + " To " + DateCommonFunctions.GetShortDateFormat(i.DateTo.Value);
                }

                lst.Add(d);
            }

            return(PartialView("_ucEmployment", lst));
        }
示例#3
0
        public EmploymentDetails GetJobById(string Id)
        {
            SqlParameter[]    param = { new SqlParameter("@flag", SqlDbType.VarChar, 50)
                                        {
                                            Value = "getEmploymentById"
                                        }
                                        ,                            new SqlParameter("@EmployeeId", SqlDbType.Int)
                                        {
                                            Value = Id
                                        } };
            DataRow           result = SqlHelper.ExecuteDataRow("spEmployee", param);
            EmploymentDetails obj    = new EmploymentDetails();

            obj.Id         = Convert.ToInt32(result["Id"]);
            obj.EmployeeId = Convert.ToInt32(result["EmpId"]);

            obj.JobId            = Convert.ToInt32(result["DesignationId"]);
            obj.DepartmentId     = Convert.ToInt32(result["DepartmentId"]);
            obj.StartDate        = Convert.ToDateTime(result["StartDate"]);
            obj.EndDate          = Convert.ToDateTime(result["EndDate"]);
            obj.ShiftId          = Convert.ToInt32(result["ShiftId"]);
            obj.EmploymentTypeId = Convert.ToInt32(result["EmploymentTypeId"]);

            obj.ContractExpiry = Convert.ToDateTime(result["ContractExpiry"]);
            obj.ContractFile   = Convert.ToString(result["ContractFile"]);

            return(obj);
        }
示例#4
0
        public static bool UpdateEmploymentDetails(EmploymentDetails EmploymentDetails)
        {
            SqlConnection connection      = ConnectionString.GetConnection();
            string        updatestatement =
                "UPDATE [Goke's Rentals].[dbo].[Tenant] " +
                "SET Employer = @Employer, JobTitle = @JobTitle " +
                "WHERE TenantID = @TenantID";
            SqlCommand updatecommand =
                new SqlCommand(updatestatement, connection);

            updatecommand.Parameters.AddWithValue("@TenantID", EmploymentDetails.TenantID);
            updatecommand.Parameters.AddWithValue("@Employer", EmploymentDetails.Employer);
            updatecommand.Parameters.AddWithValue("@JobTitle", EmploymentDetails.JobTitle);
            try
            {
                connection.Open();
                int count = updatecommand.ExecuteNonQuery();
                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
示例#5
0
        public bool EmploymentDetails(EmploymentDetails req)
        {
            var Message = $" EmploymentDetails About page visited at {DateTime.Now}";

            _logger.LogInformation("EmploymentDetails Message displayed: {Message}", Message);
            _log4net.Debug(" EmploymentDetails Login API " + Message);

            try
            {
                if (req.EmployeedFrom.HasValue)
                {
                    _log4net.Info("EmploymentDetails invoked:: " + req.EmployeedFrom);
                    req.EmployeedFrom = DateTime.Now;
                }
                _log4net.Info("EmploymentDetails 2222invoked:: " + req.EmployeedFrom);


                _context.EmploymentDetails.Add(req);
                _context.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public ActionResult ViewEmployment(int UserID)
        {
            var data = db.Get_Employment(UserID).ToList();
            List <EmploymentDetails> lst = new List <EmploymentDetails>();

            foreach (var i in data)
            {
                EmploymentDetails d = new EmploymentDetails();
                d.EmpDetailID  = i.EmpDetailID;
                d.EmployerName = i.EmployerName;
                d.UserID       = i.UserID;
                d.TypeID       = i.TypeID;
                d.Type         = i.Type;
                d.Designation  = i.Desgignation;


                if (i.Type == "Current Employer" && i.DateTo == null)
                {
                    d.DateFrom = i.DateFrom.Value;
                    d.DateTo   = null;
                    d.Gap      = "From " + DateCommonFunctions.GetShortDateFormat(i.DateFrom.Value) + " To Present";
                }
                else
                {
                    d.DateFrom = i.DateFrom.Value;
                    d.DateTo   = i.DateTo.Value;
                    d.Gap      = "From " + DateCommonFunctions.GetShortDateFormat(i.DateFrom.Value) + " To " + DateCommonFunctions.GetShortDateFormat(i.DateTo.Value);
                }

                lst.Add(d);
            }

            return(PartialView("_ucEmployment", lst));
        }
示例#7
0
        public EmploymentDetails UpdateEmpDetails(EmploymentDetails _employmentDetails)
        {
            var EmpDetails = dbContext.EmploymentDetails.Attach(_employmentDetails);

            EmpDetails.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            dbContext.SaveChanges();
            return(_employmentDetails);
        }
示例#8
0
        public ActionResult EmploymentDetailsEdit(string empId)
        {
            ViewBag.Department      = new SelectList(iDropDownService.GetDropDowns("department"), "Id", "DisplayName");
            ViewBag.Designation     = new SelectList(iDropDownService.GetDropDowns("designation"), "Id", "DisplayName");
            ViewBag.Shift           = new SelectList(iDropDownService.GetDropDowns("shift"), "Id", "DisplayName");
            ViewBag.EmploymentTypes = new SelectList(iDropDownService.GetDropDowns("employment-Types"), "Id", "DisplayName");

            EmploymentDetails obj = iEmployee.GetJobById(empId);

            return(PartialView(obj));
        }
示例#9
0
        public static EmploymentDetails UserInputEmploymentDetails(int TenantID, string Employer, string JobTitle)
        {
            EmploymentDetails EmploymentDetails = new EmploymentDetails
            {
                TenantID = TenantID, //Hardcoded Value
                Employer = Employer,
                JobTitle = JobTitle
            };

            return(EmploymentDetails);
        }
        public async Task <IActionResult> Create([Bind("EmploymentDetailsId,UsersId,OrganizationName,OrganizationAddress,OrganizationType,PositionHeld,EmploymentType,EmploymentStatus,EmploymentDate,LastDayAtJob,Stateid,CreatedOn")] EmploymentDetails employmentDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employmentDetails);
                await _context.SaveChangesAsync();

                return(Ok(true));
            }
            //ViewData["UsersId"] = new SelectList(_context.Users, "UsersId", "AccountNumber", employmentDetails.UsersId);
            return(Ok(false));
        }
示例#11
0
        public IHttpActionResult Post(EmploymentDetails employmentDetails)
        {
            _command.Send(new RegisterEmploymentDetails()
            {
                UserId                   = employmentDetails.UserId,
                CurrentEmployment        = employmentDetails.CurrentEmployment,
                CurrentPosition          = employmentDetails.CurrentPosition,
                NationalInsuranceNumber  = employmentDetails.NationalInsuranceNumber,
                NetSalary                = employmentDetails.NetSalary,
                YearsWithCurrentEmployer = employmentDetails.YearsWithCurrentEmployer
            });

            return(Ok());
        }
示例#12
0
        public DbResult UpdateEmployment(EmploymentDetails obj, string flag)
        {
            SqlParameter[] param = { new SqlParameter("@flag", SqlDbType.VarChar,                         50)
                                     {
                                         Value = flag
                                     }
                                     ,                         new SqlParameter("@Id",               SqlDbType.Int)
                                     {
                                         Value = obj.Id
                                     }
                                     ,                         new SqlParameter("@EmployeeId",       SqlDbType.Int)
                                     {
                                         Value = obj.EmployeeId
                                     }
                                     ,                         new SqlParameter("@DesignationId",    SqlDbType.Int)
                                     {
                                         Value = obj.JobId
                                     }
                                     ,                         new SqlParameter("@DepartmentId",     SqlDbType.Int)
                                     {
                                         Value = obj.DepartmentId
                                     }
                                     ,                         new SqlParameter("@StartDate",        SqlDbType.DateTime)
                                     {
                                         Value = obj.StartDate
                                     }
                                     ,                         new SqlParameter("@EndDate",          SqlDbType.DateTime)
                                     {
                                         Value = obj.ContractExpiry
                                     }
                                     ,                         new SqlParameter("@ShiftId",          SqlDbType.Int)
                                     {
                                         Value = obj.ShiftId
                                     }
                                     ,                         new SqlParameter("@EmploymentTypeId", SqlDbType.Int)
                                     {
                                         Value = obj.EmploymentTypeId
                                     }
                                     ,                         new SqlParameter("@ContractFile",     SqlDbType.VarChar, 50)
                                     {
                                         Value = obj.ContractFile
                                     }

                                     ,                         new SqlParameter("@userId",           SqlDbType.NVarChar, 128)
                                     {
                                         Value = SessionHelper.GetUserID()
                                     } };
            return(SqlHelper.ParseDbResult("spEmployee", param));
        }
示例#13
0
        public static EmploymentDetails GetEmploymentDetails(int tenantID)
        {
            SqlConnection connection = ConnectionString.GetConnection();

            string selectStatement
                = "SELECT Employer, JobTitle  "
                  + "FROM [Goke's Rentals].[dbo].[Tenant] "
                  + "WHERE TenantID = @TenantID";


            SqlCommand selectCommand =
                new SqlCommand(selectStatement, connection);

            selectCommand.Parameters.AddWithValue("@TenantID", tenantID);

            try
            {
                connection.Open();
                SqlDataReader     reader  = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
                EmploymentDetails details = new EmploymentDetails();

                if (reader.Read())
                {
                    details.Employer = reader["Employer"].ToString();
                    details.JobTitle = reader["JobTitle"].ToString();

                    return(details);
                }
                else
                {
                    return(details);
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                connection.Close();
            }
        }
示例#14
0
        public IActionResult UpdateEmploymentInfo(string employer, string jobTitle)
        {
            var tenantID = CookieHandler.GetCurrentUserID(Request.Cookies["AuthToken"]);
            EmploymentDetails details = new EmploymentDetails();

            details.TenantID = tenantID;
            details.Employer = employer;
            details.JobTitle = jobTitle;

            bool success = false;

            success = SQLStatements.UpdateEmploymentDetails(details);

            if (success)
            {
                return(Json(new { success = true, }));
            }
            else
            {
                return(Json(new { success = false, error = "An unknown error occured." }));
            }
        }
示例#15
0
 public DbResult UpdateEmployment(EmploymentDetails obj, string flag)
 {
     return(repo.UpdateEmployment(obj, flag));
 }
示例#16
0
 public EmploymentDetails AddEmpDetails(EmploymentDetails _employmentDetails)
 {
     dbContext.EmploymentDetails.Add(_employmentDetails);
     dbContext.SaveChanges();
     return(_employmentDetails);
 }
示例#17
0
        public ActionResult EmploymentDetailsEdit(EmploymentDetails obj, HttpPostedFileBase UploadFile)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ViewBag.Department      = new SelectList(iDropDownService.GetDropDowns("department"), "Id", "DisplayName");
                    ViewBag.Designation     = new SelectList(iDropDownService.GetDropDowns("designation"), "Id", "DisplayName");
                    ViewBag.Shift           = new SelectList(iDropDownService.GetDropDowns("shift"), "Id", "DisplayName");
                    ViewBag.EmploymentTypes = new SelectList(iDropDownService.GetDropDowns("employment-Types"), "Id", "DisplayName");

                    if (UploadFile != null && UploadFile.ContentLength > 0) //size
                    {
                        var supportedTypes = new[] { ".txt", ".doc", ".docx", ".pdf", ".xls", ".xlsx" };

                        var name          = Path.GetFileName(UploadFile.FileName);
                        var fileName      = Path.GetFileNameWithoutExtension(UploadFile.FileName);
                        var fileExtension = Path.GetExtension(name);
                        if (!supportedTypes.Contains(fileExtension))
                        {
                            return(Json(new
                            {
                                ErrorCode = 1,
                                Message = "Unsupported Format",
                                Id = 0,
                                JsonRequestBehavior.AllowGet
                            }));
                        }

                        //5 MB = 5242880 Bytes(in binary)
                        if (UploadFile.ContentLength > 5242880)
                        {
                            return(Json(new
                            {
                                ErrorCode = 1,
                                Message = "File size must be below 5MB",
                                Id = 0,
                                JsonRequestBehavior.AllowGet
                            }));
                        }

                        var newFileName = "_" + DateTime.Now.ToString("ddmmyyyy") + "_" + obj.EmployeeId + fileName;
                        obj.ContractFile = newFileName;
                        string folder   = ConfigurationManager.AppSettings["HrFile"];
                        var    filePath = Path.Combine(Server.MapPath(folder), newFileName + fileExtension);

                        UploadFile.SaveAs(filePath);
                        ModelState.Clear();
                    }


                    var result = iEmployee.UpdateEmployment(obj, "u-employment");
                    return(Json(new
                    {
                        ErrorCode = result.ErrorCode,
                        Message = result.Msg,
                        Id = result.Id,
                        JsonRequestBehavior.AllowGet
                    }));
                }
                catch (Exception ex)
                {
                    return(Json(new { ErrorCode = 1, Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
            Response.TrySkipIisCustomErrors = true;
            string messages = string.Join("; ", ModelState.Values
                                          .SelectMany(x => x.Errors)
                                          .Select(x => x.ErrorMessage));

            return(Json(new { ErrorCode = 1, Message = messages }, JsonRequestBehavior.AllowGet));
        }