public void EditAPayGrade() { // Pay grade data #region string payGrade = "Manger - Level2"; string payGrade2 = "Manager - Level 2"; #endregion Home.GoTo(); Home.LoginAsAdmin(); // Create a pay grade Menu.Admin.Job.PayGrades.GoTo(); PayGrade.AddPayGrade(payGrade); // Edit a pay grade Menu.Admin.Job.PayGrades.GoTo(); PayGrade.EditPayGrade(payGrade, payGrade2); Menu.Admin.Job.PayGrades.GoTo(); Assert.IsTrue(PayGrade.PayGradeCorrectlyAssigned(payGrade2), $"The Pay Grade {payGrade2} was not correctly edited."); // Cleanup Menu.Admin.Job.PayGrades.GoTo(); PayGrade.DeletePayGrade(payGrade); Home.Logout(); }
public void AddCurrencyToAPayGrade() { // Pay grade data #region string payGrade = "Manager - Level 2"; string currency = "USD - United States Dollar"; decimal minSalary = 50000.00m; decimal maxSalary = 65000.00m; #endregion Home.GoTo(); Home.LoginAsAdmin(); Menu.Admin.Job.PayGrades.GoTo(); // Create a new pay grade PayGrade.AddPayGrade(payGrade); // Assign a currency to a pay grade PayGrade.AssignedCurrencies.AssignCurrency(payGrade, currency, minSalary, maxSalary); Assert.IsTrue(PayGrade.AssignedCurrencies.CurrencyCorrectlyAssigned(payGrade, currency, minSalary, maxSalary), $"The Currency {currency} with parameters Minimum Salary {minSalary} and Maximum Salary {maxSalary} was not added correctly to Pay Grade {payGrade}."); // Cleanup Menu.Admin.Job.PayGrades.GoTo(); PayGrade.DeletePayGrade(payGrade); Home.Logout(); }
public async Task <IActionResult> Edit(Guid id, [Bind("Id,JobId,GradeName,Price,DateCreated,DateUpdated,DateModified,IsDeleted")] PayGrade payGrade) { if (id != payGrade.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(payGrade); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PayGradeExists(payGrade.Id)) { return(NotFound()); } else { throw; } } return(Redirect("/Jobs")); //RedirectToAction(nameof(Index)); } ViewData["JobId"] = new SelectList(_context.Job, "Id", "Id", payGrade.JobId); return(View(payGrade)); }
public async Task <IActionResult> Create([Bind("Id,JobId,GradeName,Price,DateCreated,DateUpdated,DateModified,IsDeleted")] PayGrade payGrade) { if (ModelState.IsValid) { //var JobId = _context.Job.Where(x => x.JobTitle.Id == payGrade.JobId).FirstOrDefault().Id; // payGrade.JobId = JobId; var userId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); Organisation org; var otheruser = _context.OtherUsers.Where(x => x.UserId == userId).FirstOrDefault(); if (otheruser == null) { org = _context.Organisation.Where(m => m.ApplicationUserId == userId).FirstOrDefault(); } else { org = _context.Organisation.Where(m => m.ApplicationUserId == otheruser.HostId).FirstOrDefault(); } payGrade.Id = Guid.NewGuid(); _context.Add(payGrade); await _context.SaveChangesAsync(); return(Redirect("/Jobs")); //RedirectToAction(nameof(Index)); } ViewData["JobId"] = new SelectList(_context.Job, "Id", "Id", payGrade.JobId); return(View(payGrade)); }
public IHttpActionResult PutPayGrades(int id, PayGrade payGrades) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != payGrades.id) { return(BadRequest()); } db.Entry(payGrades).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PayGradesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void DeleteCurrencyAssignedToAPayGrade() { // Pay grade data #region string payGrade = "Manager - Level 3"; // Original data string currency = "USD - United States Dollar"; decimal minSalary = 50000.00m; decimal maxSalary = 65000.00m; #endregion Home.GoTo(); Home.LoginAsAdmin(); Menu.Admin.Job.PayGrades.GoTo(); // Create a new pay grade PayGrade.AddPayGrade(payGrade); // Assign a currency to a pay grade PayGrade.AssignedCurrencies.AssignCurrency(payGrade, currency, minSalary, maxSalary); // Edit a currency assigned to a pay grade Menu.Admin.Job.PayGrades.GoTo(); PayGrade.AssignedCurrencies.DeleteAssignedCurrency(payGrade, currency); Assert.IsTrue(PayGrade.AssignedCurrencies.CurrencyCorrectlyDeleted(payGrade, currency), $"The Currency {currency} was not deleted correctly from Pay Grade {payGrade}."); //Cleanup Menu.Admin.Job.PayGrades.GoTo(); PayGrade.DeletePayGrade(payGrade); Home.Logout(); }
public HttpResponseMessage UpdatePayGrade(HttpRequestMessage request, [FromBody] PayGrade payGradeModel) { return(GetHttpResponse(request, () => { var payGrade = _CoreService.UpdatePayGrade(payGradeModel); return request.CreateResponse <PayGrade>(HttpStatusCode.OK, payGrade); })); }
public IHttpActionResult PostPayGrades(PayGrade payGrades) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PayGrades.Add(payGrades); db.SaveChanges(); return(CreatedAtRoute("DefaultApiPost", new { id = payGrades.id }, payGrades)); }
public static PayGrade GetPayGrdaeById(int recordId) { DataRow PayGradeRow = PayGradeDataAccess.GetInstance.GetPayGradeById(recordId); PayGrade ThePayGrade = new PayGrade(); ThePayGrade.PayGradeID = int.Parse(PayGradeRow["PayGradeID"].ToString()); ThePayGrade.PayGradeDescription = PayGradeRow["PayGradeDescription"].ToString(); ThePayGrade.IsActive = bool.Parse(PayGradeRow["IsActive"].ToString()); return(ThePayGrade); }
public async Task <string> UpdatePayGrade(int id, PayGrade payGrade) { try { var res = await _repository.UpdatePayGrade(id, payGrade); return(res); } catch (Exception ex) { throw ex; } }
public async Task <PayGrade> CreateNewPayGrade(PayGrade payGrade) { try { var res = await _repository.CreateNewPayGrade(payGrade); return(res); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage GetPayGrade(HttpRequestMessage request, int payGradeId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; PayGrade payGrade = _CoreService.GetPayGrade(payGradeId); // notice no need to create a seperate model object since PayGrade entity will do just fine response = request.CreateResponse <PayGrade>(HttpStatusCode.OK, payGrade); return response; })); }
public IHttpActionResult DeletePayGrades(int id) { PayGrade payGrades = db.PayGrades.Find(id); if (payGrades == null) { return(NotFound()); } db.PayGrades.Remove(payGrades); db.SaveChanges(); return(Ok(payGrades)); }
public async Task <PayGrade> CreateNewPayGrade(PayGrade payGrade) { try { _context.PayGrades.Add(payGrade); await _context.SaveChangesAsync(); return(payGrade); } catch (Exception ex) { throw ex; } }
public IHttpActionResult GetPayGrades(int id) { PayGrade payGrades = db.PayGrades.Find(id); if (payGrades == null) { return(NotFound()); } return(Ok(new DropDownDTO { id = payGrades.id.ToString(), description = payGrades.DisplayText })); }
public async Task <IActionResult> PostNewPayGrade([FromBody] PostNewPayGrade postNewPayGrade) { if (postNewPayGrade == null) { return(Json(new { msg = "No Data" } )); } var orgId = getOrg(); var organisationDetails = await _context.Organisations.Where(x => x.Id == orgId).FirstOrDefaultAsync(); int noOfEmployee = _context.Users.Where(x => x.OrganisationId == orgId).Count(); try { PayGrade newPayGrade = new PayGrade() { Id = Guid.NewGuid(), PayGradeName = postNewPayGrade.PayGradeName, Currency = postNewPayGrade.Currency, MinimumSalary = postNewPayGrade.MinimumSalary, MaximumSalary = postNewPayGrade.MaximumSalary, OrganisationId = orgId }; _context.Add(newPayGrade); _context.SaveChanges(); return(Json(new { msg = "Success" } )); } catch (Exception ee) { } return(Json( new { msg = "Fail" })); }
public int DeletePayGrade(PayGrade thePayGrade) { int ReturnValue = 0; SqlCommand DeleteCommand = new SqlCommand(); DeleteCommand.CommandType = CommandType.StoredProcedure; DeleteCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; DeleteCommand.Parameters.Add(GetParameter("@PayGradeID", SqlDbType.Int, thePayGrade.PayGradeID)); DeleteCommand.CommandText = "pHRM_PayGrades_Delete"; ExecuteStoredProcedure(DeleteCommand); ReturnValue = int.Parse(DeleteCommand.Parameters[0].Value.ToString()); return(ReturnValue); }
public async Task <IActionResult> UpdatePayGrade(int PayGradeId, PayGrade payGrade) { try { var res = await _service.UpdatePayGrade(PayGradeId, payGrade); if (res != null) { return(Ok(res)); } return(StatusCode(StatusCodes.Status204NoContent)); } catch (Exception ex) { throw; } }
public async Task <IActionResult> CreatePayGrade(PayGrade payGrade) { try { var response = await _service.CreateNewPayGrade(payGrade); if (response != null) { return(Ok(response)); } return(StatusCode(StatusCodes.Status204NoContent)); } catch (Exception ex) { throw ex; } }
public int InsertPayGrade(PayGrade thePayGrade) { int ReturnValue = 0; SqlCommand InsertCommand = new SqlCommand(); InsertCommand.CommandType = CommandType.StoredProcedure; InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; InsertCommand.Parameters.Add(GetParameter("@PayGradeDescription", SqlDbType.VarChar, thePayGrade.PayGradeDescription)); InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); InsertCommand.CommandText = "pHRM_PayGrades_Insert"; ExecuteStoredProcedure(InsertCommand); ReturnValue = int.Parse(InsertCommand.Parameters[0].Value.ToString()); return(ReturnValue); }
public int UpdatePayGrade(PayGrade thePayGrade) { int ReturnValue = 0; SqlCommand UpdateCommand = new SqlCommand(); UpdateCommand.CommandType = CommandType.StoredProcedure; UpdateCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; UpdateCommand.Parameters.Add(GetParameter("@PayGradeID", SqlDbType.Int, thePayGrade.PayGradeID)); UpdateCommand.Parameters.Add(GetParameter("@PayGradeDescription", SqlDbType.VarChar, thePayGrade.PayGradeDescription)); UpdateCommand.Parameters.Add(GetParameter("@IsActive", SqlDbType.Bit, thePayGrade.IsActive)); UpdateCommand.Parameters.Add(GetParameter("@ModifiedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); UpdateCommand.CommandText = "pHRM_PayGrades_Update"; ExecuteStoredProcedure(UpdateCommand); ReturnValue = int.Parse(UpdateCommand.Parameters[0].Value.ToString()); return(ReturnValue); }
public async Task <string> UpdatePayGrade(int id, PayGrade payGrade) { try { var res = await _context.PayGrades.FirstOrDefaultAsync(m => m.PayGradeId == id); res.PayGradeName = payGrade.PayGradeName; res.MinSalary = payGrade.MinSalary; res.MaxSalary = payGrade.MaxSalary; _context.Update(res); await _context.SaveChangesAsync(); return("Updated Record"); } catch (Exception ex) { throw ex; } }
public static List <PayGrade> GetPayGrades(string searchText) { List <PayGrade> PayGradeList = new List <PayGrade>(); DataTable PayGradeTable = new DataTable(); PayGradeTable = PayGradeDataAccess.GetInstance.GetPayGrade(searchText); foreach (DataRow dr in PayGradeTable.Rows) { PayGrade ThePayGrade = new PayGrade(); ThePayGrade.PayGradeID = int.Parse(dr["PayGradeID"].ToString()); ThePayGrade.PayGradeDescription = dr["PayGradeDescription"].ToString(); PayGradeList.Add(ThePayGrade); } return(PayGradeList); }
public void DeleteAPayGrade() { // Pay grade data #region string payGrade = "Manager - Level 2"; #endregion Home.GoTo(); Home.LoginAsAdmin(); Menu.Admin.Job.PayGrades.GoTo(); PayGrade.AddPayGrade(payGrade); Menu.Admin.Job.PayGrades.GoTo(); PayGrade.DeletePayGrade(payGrade); Assert.IsTrue(PayGrade.PayGradeCorrectlyDeleted(payGrade), $"The Pay Grade {payGrade} was not correctly deleted."); Home.Logout(); }
public HttpResponseMessage DeletePayGrade(HttpRequestMessage request, [FromBody] int payGradeId) { return(GetHttpResponse(request, () => { HttpResponseMessage response = null; // not that calling the WCF service here will authenticate access to the data PayGrade payGrade = _CoreService.GetPayGrade(payGradeId); if (payGrade != null) { _CoreService.DeletePayGrade(payGradeId); response = request.CreateResponse(HttpStatusCode.OK); } else { response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No payGrade found under that ID."); } return response; })); }
public static int InsertPayGrade(PayGrade thePayGrade) { return(PayGradeDataAccess.GetInstance.InsertPayGrade(thePayGrade)); }
public PayGrade UpdatePayGrade(PayGrade payGrade) { return(Channel.UpdatePayGrade(payGrade)); }
public static PayGrade CreatePayGrade(long ID, string grade, decimal baseSallary, decimal sallaryCap, decimal maxRaiseRate, decimal minRaiseRate) { PayGrade payGrade = new PayGrade(); payGrade.ID = ID; payGrade.Grade = grade; payGrade.BaseSallary = baseSallary; payGrade.SallaryCap = sallaryCap; payGrade.MaxRaiseRate = maxRaiseRate; payGrade.MinRaiseRate = minRaiseRate; return payGrade; }
public int DeletePayGrade(PayGrade thePayGrade) { return(PayGradeIntegration.DeletePayGrade(thePayGrade)); }
public static int DeletePayGrade(PayGrade thePayGrade) { return(PayGradeDataAccess.GetInstance.DeletePayGrade(thePayGrade)); }
public void AddToPayGrades(PayGrade payGrade) { base.AddObject("PayGrades", payGrade); }
public int UpdatePayGrade(PayGrade thePayGrade) { return(PayGradeIntegration.UpdatePayGrade(thePayGrade)); }