public void B110_Create() { using var agentTester = AgentTester.CreateWaf <Startup>(); var v = new PerformanceReview { Date = new DateTime(2020, 06, 15, 0, 0, 0, DateTimeKind.Utc), Outcome = "ME", Notes = "Solid performance :-)", Reviewer = "*****@*****.**", }; // Create value. v = agentTester.Test <PerformanceReviewAgent, PerformanceReview>() .ExpectStatusCode(HttpStatusCode.Created) .ExpectChangeLogCreated() .ExpectETag() .ExpectUniqueKey() .ExpectValue(_ => v, "EmployeeId") .ExpectEvent("my.hr.performancereview", "created") .Run(a => a.CreateAsync(v, 3.ToGuid())).Value !; Assert.AreEqual(3.ToGuid(), v.EmployeeId); // Check the value was created properly. agentTester.Test <PerformanceReviewAgent, PerformanceReview?>() .ExpectStatusCode(HttpStatusCode.OK) .ExpectValue(_ => v) .Run(a => a.GetAsync(v.Id)); }
public void B110_Create() { var v = new PerformanceReview { Date = new DateTime(2020, 06, 15), OutcomeSid = "ME", Notes = "Solid performance :-)", Reviewer = "*****@*****.**", }; // Create value. v = AgentTester.Test <PerformanceReviewAgent, PerformanceReview>() .ExpectStatusCode(HttpStatusCode.Created) .ExpectChangeLogCreated() .ExpectETag() .ExpectUniqueKey() .ExpectValue(_ => v, "EmployeeId") .ExpectEvent("My.Hr.PerformanceReview.*", "Created") .Run(a => a.CreateAsync(v, 3.ToGuid())).Value !; Assert.AreEqual(3.ToGuid(), v.EmployeeId); // Check the value was created properly. AgentTester.Test <PerformanceReviewAgent, PerformanceReview?>() .ExpectStatusCode(HttpStatusCode.OK) .ExpectValue(_ => v) .Run(a => a.GetAsync(v.Id)); }
public async Task <IActionResult> CreateAsync([FromRoute] int orgId, [FromRoute] int empId, [FromBody] CreatePerformanceReviewRequest request) { var userOrgId = AuthenticationService.GetLoggedInUserOrgId(); var userRole = AuthenticationService.GetLoggedInUserRole(); if (userRole == UserRole.Admin && orgId != userOrgId) { return(NotFound()); } if (!(await OrganizationRepository.ExistsAsync(orgId))) { return(NotFound()); } var userId = AuthenticationService.GetLoggedInUserId(); var performanceReview = new PerformanceReview() { Name = request.Name, OrganizationId = orgId, EmployeeId = empId, }; await PerformanceReviewRepository.CreateAsync(performanceReview); return(CreatedAtAction(nameof(GetById), new { orgId = orgId, empId = empId, id = performanceReview.Id }, Mapper.Map <PerformanceReviewDto>(performanceReview))); }
public async Task <PerformanceReview> UpdateAsync(PerformanceReview value, Guid id) => await ManagerInvoker.Current.InvokeAsync(this, async() => { await value.Validate().Mandatory().RunAsync(throwOnError: true).ConfigureAwait(false); value.Id = id; Cleaner.CleanUp(value); await value.Validate().Entity().With <IValidator <PerformanceReview> >().RunAsync(throwOnError: true).ConfigureAwait(false); return(Cleaner.Clean(await _dataService.UpdateAsync(value).ConfigureAwait(false))); }, BusinessInvokerArgs.Update).ConfigureAwait(false);
public Task <PerformanceReview> UpdateAsync(PerformanceReview value, Guid id) { value.Validate(nameof(value)).Mandatory().Run().ThrowOnError(); return(ManagerInvoker.Current.InvokeAsync(this, async() => { ExecutionContext.Current.OperationType = OperationType.Update; value.Id = id; Cleaner.CleanUp(value); value.Validate(nameof(value)).Entity(PerformanceReviewValidator.Default).Run().ThrowOnError(); return Cleaner.Clean(await _dataService.UpdateAsync(value).ConfigureAwait(false)); })); }
public async Task A130_Validate_BeforeStarting() { var pr = new PerformanceReview { EmployeeId = 1.ToGuid(), Date = DateTime.Now.AddYears(-2), OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; await ValidationTester.Test() .ConfigureServices(_testSetup !) .ExpectMessages("Date must not be prior to the Employee starting.") .CreateAndRunAsync <IValidator <PerformanceReview>, PerformanceReview>(pr); }
public async Task A140_Validate_AfterTermination() { var pr = new PerformanceReview { EmployeeId = 2.ToGuid(), Date = DateTime.Now, OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; await ValidationTester.Test() .ConfigureServices(_testSetup !) .ExpectMessages("Date must not be after the Employee has terminated.") .CreateAndRunAsync <IValidator <PerformanceReview>, PerformanceReview>(pr); }
public void A140_Validate_AfterTermination() { var pr = new PerformanceReview { EmployeeId = 2.ToGuid(), Date = DateTime.Now, OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; ValidationTester.Test() .AddScopedService(_referenceData) .AddScopedService(_employeeManager) .ExpectMessages("Date must not be after the Employee has terminated.") .Run(() => PerformanceReviewValidator.Default.Validate(pr)); }
public void A130_Validate_BeforeStarting() { var pr = new PerformanceReview { EmployeeId = 1.ToGuid(), Date = DateTime.Now.AddYears(-2), OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; ValidationTester.Test() .AddScopedService(_referenceData) .AddScopedService(_employeeManager) .ExpectMessages("Date must not be prior to the Employee starting.") .Run(() => PerformanceReviewValidator.Default.Validate(pr)); }
public async Task A170_Validate_CreateOK() { var pr = new PerformanceReview { EmployeeId = 2.ToGuid(), Date = DateTime.Now.AddMonths(-3), OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; // Need to set the OperationType to Create to exercise logic. await ValidationTester.Test() .ConfigureServices(_testSetup !) .OperationType(Beef.OperationType.Create) .CreateAndRunAsync <IValidator <PerformanceReview>, PerformanceReview>(pr); }
public void A170_Validate_CreateOK() { var pr = new PerformanceReview { EmployeeId = 2.ToGuid(), Date = DateTime.Now.AddMonths(-3), OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; // Need to set the OperationType to Create to exercise logic. ValidationTester.Test() .OperationType(Beef.OperationType.Create) .AddScopedService(_referenceData) .AddScopedService(_employeeManager) .AddScopedService(_perfReviewManager) .Run(() => PerformanceReviewValidator.Default.Validate(pr)); }
public async Task A160_Validate_EmployeeImmutable() { var pr = new PerformanceReview { Id = 1.ToGuid(), EmployeeId = 1.ToGuid(), Date = DateTime.Now.AddMonths(-3), OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; // Need to set the OperationType to Update to exercise logic. await ValidationTester.Test() .ConfigureServices(_testSetup !) .OperationType(Beef.OperationType.Update) .ExpectMessages("Employee is not allowed to change; please reset value.") .CreateAndRunAsync <IValidator <PerformanceReview>, PerformanceReview>(pr); }
public void A160_Validate_EmployeeImmutable() { var pr = new PerformanceReview { Id = 1.ToGuid(), EmployeeId = 1.ToGuid(), Date = DateTime.Now.AddMonths(-3), OutcomeSid = "ME", Reviewer = "*****@*****.**", Notes = "Thumbs up!" }; // Need to set the OperationType to Update to exercise logic. ValidationTester.Test() .OperationType(Beef.OperationType.Update) .AddScopedService(_referenceData) .AddScopedService(_perfReviewManager) .ExpectMessages("Employee is not allowed to change; please reset value.") .Run(() => PerformanceReviewValidator.Default.Validate(pr)); }
public async Task A120_Validate_BadData() { var pr = new PerformanceReview { EmployeeId = 404.ToGuid(), Date = DateTime.Now.AddDays(1), OutcomeSid = "XX", Reviewer = new string('X', 5000), Notes = new string('X', 5000) }; await ValidationTester.Test() .ConfigureServices(_testSetup !) .ExpectMessages( "Date must be less than or equal to today.", "Outcome is invalid.", "Employee is not found; a valid value is required.", "Reviewer must not exceed 256 characters in length.", "Notes must not exceed 4000 characters in length.") .CreateAndRunAsync <IValidator <PerformanceReview>, PerformanceReview>(pr); }
public void A120_Validate_BadData() { var pr = new PerformanceReview { EmployeeId = 404.ToGuid(), Date = DateTime.Now.AddDays(1), OutcomeSid = "XX", Reviewer = new string('X', 5000), Notes = new string('X', 5000) }; ValidationTester.Test() .AddScopedService(_referenceData) .AddScopedService(_employeeManager) .ExpectMessages( "Date must be less than or equal to today.", "Outcome is invalid.", "Employee is not found; a valid value is required.", "Reviewer must not exceed 256 characters in length.", "Notes must not exceed 4000 characters in length.") .Run(() => PerformanceReviewValidator.Default.Validate(pr)); }
public Message SaveControlToDB(FormCollection form, PerformanceReview pr, bool isInsert) { Message msg = null; List<EForm_Detail> detailList = new List<EForm_Detail>(); string EformID = form.Get("Hidden1"); for (int i = 0; i < form.Count; i++) { string controlID = form.GetKey(i); bool flag = false; foreach (String str in control) { if (controlID.StartsWith(str)) { flag = true; break; } } if (flag) { CRM.Models.EForm_Detail detailItem = new Models.EForm_Detail(); string value = form.Get(controlID); if (controlID.StartsWith("CheckBox")) { value = value.Split(Convert.ToChar(","))[0]; } detailItem.ControlID = controlID; detailItem.Value = value; detailItem.EFormID = Int32.Parse(EformID); detailList.Add(detailItem); } } CRM.Models.EformDao efDao = new EformDao(); msg = isInsert == true ? efDao.Inser(detailList, pr) : efDao.Update(detailList, pr); return msg; }
/// <summary> /// Checks whether user owns the performance review or not /// - Super Admin can access all /// - Org Admin can access only its own org's performance reviews /// - Org Employee can access only its own performance reviews /// </summary> /// <param name="review"></param> /// <returns></returns> private bool DoesOwnPerformanceReview(PerformanceReview review) { var userRole = AuthenticationService.GetLoggedInUserRole(); var userId = AuthenticationService.GetLoggedInUserId(); var userOrgId = AuthenticationService.GetLoggedInUserOrgId(); if (userRole == UserRole.SuperAdmin) { return(true); } if (userRole == UserRole.Admin && userOrgId == review.OrganizationId) { return(true); } if (userRole == UserRole.Employee && userOrgId == review.OrganizationId && userId == review.EmployeeId) { return(true); } return(false); }
public IActionResult Create([FromBody] PerformanceReview value, Guid employeeId) { return(new WebApiPost <PerformanceReview>(this, () => _manager.CreateAsync(WebApiActionBase.Value(value), employeeId), operationType: OperationType.Create, statusCode: HttpStatusCode.Created, alternateStatusCode: null)); }
public int CreatePerformance(PerformanceReview p) { return(accessor.AddPerformance(p)); }
public Message Inser(List<EForm_Detail> objList, PerformanceReview pr, PRComment comment) { Message msg = null; DbTransaction trans = null; try { dbContext.Connection.Open(); trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; new PerformanceReviewDao().UpdateResolution(pr, comment); msg = Inser(objList); trans.Commit(); } catch (Exception) { // Show system error msg = new Message(MessageConstants.E0007, MessageType.Error); trans.Rollback(); } return msg; }
public Message Update(List<EForm_Detail> newList, PerformanceReview pr) { Message msg = null; DbTransaction trans = null; bool canSuccess = true; try { dbContext.Connection.Open(); trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; List<EForm_Detail> oldList = dbContext.EForm_Details.Where(e => e.EFormID == newList[0].EFormID).ToList(); dbContext.EForm_Details.DeleteAllOnSubmit(oldList); dbContext.EForm_Details.InsertAllOnSubmit(newList); dbContext.SubmitChanges(); new PerformanceReviewDao().UpdateHolder(pr); if (canSuccess) { // Show succes message msg = new Message(MessageConstants.I0001, MessageType.Info, "Performance Review \"" + pr.ID + "\"", "updated"); trans.Commit(); } else { trans.Rollback(); } } catch (Exception) { canSuccess = false; if (trans != null) trans.Rollback(); // Show system error msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
public Message Inser(List<EForm_Detail> objList, PerformanceReview pr) { Message msg = null; DbTransaction trans = null; try { dbContext.Connection.Open(); trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; new PerformanceReviewDao().UpdateHolder(pr); msg = Inser(objList); if (msg.MsgType != MessageType.Error) { msg = new Message(MessageConstants.I0001, MessageType.Info, "Performance Review \"" + pr.ID + "\"", "added"); trans.Commit(); } } catch (Exception) { // Show system error msg = new Message(MessageConstants.E0007, MessageType.Error); trans.Rollback(); } return msg; }
public Task <WebApiAgentResult <PerformanceReview> > UpdateAsync(PerformanceReview value, Guid id, WebApiRequestOptions?requestOptions = null) => PutAsync <PerformanceReview>("api/v1/reviews/{id}", Beef.Check.NotNull(value, nameof(value)), requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <Guid>("id", id) });
public void AddPerformanceReviewMeeting(EventViewModel eventData, int Userid, int OrganizationId) { Event evenT = Mapper.Map <EventDataModel, Event>(eventData.EventDataModel); evenT.AddedBy = Userid; if (evenT.EventID == 0) { evenT.OrganizationID = OrganizationId; base.Insert(evenT); _unitOfWork.Save(); //setting parent event id with all the events for recurring events base.RepositoryContext.SP_SetParentEventId(eventData.EventDataModel.Reviewee, OrganizationId, evenT.EventID); if (eventData.IsAppointmnet) { Appointment appointment = new Appointment(); appointment.EventId = evenT.EventID; appointment.Event = evenT; appointment.OrganizationID = OrganizationId; this._IAppointmentRepository.Add(appointment, Userid, OrganizationId); } PerformanceReview review = new PerformanceReview(); review.OrganizationID = OrganizationId; review.EventID = evenT.EventID; review.RevieweeUserID = eventData.EventDataModel.Reviewee; review.RecurrencePattern = eventData.EventDataModel.RecurrencePattern; review.RecurrenceEndDate = eventData.EventDataModel.RecurrenceEndDate; if (!string.IsNullOrWhiteSpace(eventData.EventDataModel.RecurrencePattern)) { review.NextReviewDate = CommonMethods.GenerateNextDateFromCronExpression(eventData.EventDataModel.RecurrencePattern); } review.ReviewerUserID = Userid; this._IPerformanceReviewRepository.Add(review, Userid, OrganizationId); _unitOfWork.Save(); this._IRoleResponsibilityRepository.SetRoleResponsibilityOfPerformanceReview(eventData.EventDataModel.Reviewee, review.PerformanceReviewID, OrganizationId); } else { base.Update(evenT); _unitOfWork.Save(); PerformanceReview review = base.RepositoryContext.PerformanceReviews.Where(x => x.EventID == evenT.EventID).FirstOrDefault(); review.RecurrencePattern = eventData.EventDataModel.RecurrencePattern; review.RecurrenceEndDate = eventData.EventDataModel.RecurrenceEndDate; if (!string.IsNullOrWhiteSpace(eventData.EventDataModel.RecurrencePattern)) { review.NextReviewDate = CommonMethods.GenerateNextDateFromCronExpression(eventData.EventDataModel.RecurrencePattern); } this._IPerformanceReviewRepository.Update(review, Userid, OrganizationId); } // for recuurencing event if (!string.IsNullOrWhiteSpace(eventData.EventDataModel.RecurrencePattern)) { base.RepositoryContext.SP_DeletePerformanceReviewEvent(Userid, OrganizationId, eventData.EventDataModel.Reviewee); Event nextEvent = new Event(); nextEvent.Date = CommonMethods.GenerateNextDateFromCronExpression(eventData.EventDataModel.RecurrencePattern); nextEvent.EventType = eventData.EventDataModel.EventType; nextEvent.EventSubType = eventData.EventDataModel.EventSubType; nextEvent.StartTime = eventData.EventDataModel.StartTime; nextEvent.EndTime = eventData.EventDataModel.EndTime; nextEvent.OrganizationID = OrganizationId; nextEvent.Recurring = true; nextEvent.LocationID = eventData.EventDataModel.LocationID; nextEvent.AddedBy = Userid; base.Insert(nextEvent); _unitOfWork.Save(); base.RepositoryContext.SP_SetParentEventId(eventData.EventDataModel.Reviewee, OrganizationId, nextEvent.EventID); foreach (EventAttendeeDataModel model in eventData.EventAttendeeDataModel) { var data = Mapper.Map <EventAttendeeDataModel, EventAttendee>(model); data.EventID = nextEvent.EventID; data.OrganizationId = OrganizationId; _IEventAttendeeRepository.Add(data, Userid, OrganizationId); } } if (evenT.EventID > 0) { //base.RepositoryContext.SP_DeletePerformanceReview(evenT.EventID, OrganizationId); base.RepositoryContext.SP_DeleteEventAgenda(evenT.EventID, OrganizationId); //base.RepositoryContext.SP_DeleteEventAttendees(evenT.EventID, OrganizationId); } foreach (EventAttendeeDataModel model in eventData.EventAttendeeDataModel) { var data = Mapper.Map <EventAttendeeDataModel, EventAttendee>(model); data.EventID = evenT.EventID; data.OrganizationId = OrganizationId; _IEventAttendeeRepository.Add(data, Userid, OrganizationId); } foreach (AgendaDataModel model in eventData.AgendaDataModel) { model.SourceID = evenT.EventID; var data = Mapper.Map <AgendaDataModel, Agendum>(model); data.OrganizationID = OrganizationId; data.CreatedDate = DateTime.Now; data.RevieweeUserId = eventData.EventDataModel.Reviewee; _IAgendaRepository.Add(data, Userid, OrganizationId); } foreach (ObjectiveViewModel model in eventData.ObjectiveViewModel) { var data = Mapper.Map <ObjectiveViewModel, Objective>(model); data.SourceId = evenT.EventID; data.OrganizationId = OrganizationId; data.ObjectiveSource = "P"; data.CreatedDate = DateTime.Now; data.RevieweeUserId = eventData.EventDataModel.Reviewee; _IObjectiveRepository.Add(data, Userid, OrganizationId); } foreach (ActionDataModel model in eventData.ActionDataModel) { model.SourceID = evenT.EventID; var data = Mapper.Map <ActionDataModel, Angular2_AspDotNet.Data.Action>(model); if (model.ActionID == 0) { data.CreatedDate = DateTime.Now; data.RevieweeUserId = eventData.EventDataModel.Reviewee; data.OrganizationID = OrganizationId; _IActionRepository.Add(data, Userid, OrganizationId); } else { _IActionRepository.Update(data, Userid, OrganizationId); base.RepositoryContext.Sp_DeleteActionResponsiblePerson(model.ActionID); } foreach (ActionResponsiblePersonDataModel resposibleModel in model.ActionResponsiblePersonDataModel) { var childData = Mapper.Map <ActionResponsiblePersonDataModel, ActionResponsiblePerson>(resposibleModel); childData.Action = data; childData.AddedBy = LoggedInUserID; childData.OrganizationId = OrganizationId; _IActionResponsiblePersonRepository.Add(childData, Userid, OrganizationId); } } _unitOfWork.Save(); }
/// <summary> /// Get list for manager /// </summary> /// <param name="empNameOrId"></param> /// <param name="status"></param> /// <param name="needSetup"></param> /// <returns></returns> public Message UpdateResolution(PerformanceReview objUI, PRComment objComment) { Message msg = null; DbTransaction trans = null; dbContext.Connection.Open(); trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; try { PerformanceReview objDb = GetById(objUI.ID); if (objDb != null) { objDb.WFResolutionID = objUI.WFResolutionID; objDb.AssignID = objUI.ManagerID; objDb.AssignRole = objUI.AssignRole; objDb.InvolveID = objUI.InvolveID; objDb.InvolveRole = objUI.InvolveRole; objDb.InvolveDate = objUI.InvolveDate; objDb.InvolveResolution = objUI.InvolveResolution; objDb.UpdatedBy = objUI.UpdatedBy; objDb.UpdateDate = DateTime.Now; if (objComment != null) { InsertComment(objComment); } dbContext.SubmitChanges(); msg = new Message(MessageConstants.I0001, MessageType.Info, "Performance Review '" + objUI.ID + "'", "updated"); trans.Commit(); } } catch { if (trans != null) trans.Rollback(); // Show system error msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
/// <summary> /// Update performance review /// </summary> /// <param name="per">PerformanceReview</param> /// <returns>Message</returns> public Message UpdatePerformanceReviewForHr(PerformanceReview objUI) { Message msg = null; try { if (objUI != null) { PerformanceReview objDb = GetById(objUI.ID); if (objDb != null) { if (objDb.UpdateDate.ToString() == objUI.UpdateDate.ToString()) { objDb.WFStatusID = objUI.WFStatusID; objDb.WFResolutionID = objUI.WFResolutionID; objDb.AssignID = objUI.AssignID; objDb.AssignRole = objUI.AssignRole; objDb.InvolveID = objUI.InvolveID; objDb.InvolveRole = objUI.InvolveRole; objDb.InvolveDate = objUI.InvolveDate; objDb.InvolveResolution = objUI.InvolveResolution; objDb.UpdateDate = DateTime.Now; dbContext.SubmitChanges(); msg = new Message(MessageConstants.I0001, MessageType.Info, "Performance review '" + objUI.ID + "'", "updated"); } else { msg = new Message(MessageConstants.E0025, MessageType.Error, "Performance review '" + objUI.ID + "'"); } } } } catch { msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
/// <summary> /// Update holder message /// </summary> /// <param name="prUI">PerformanceReview</param> /// <returns>Message</returns> public Message UpdateHolder(PerformanceReview prUI) { try { PerformanceReview prDB = GetById(prUI.ID); prDB.AssignID = prUI.AssignID; prDB.AssignRole = prUI.AssignRole; prDB.InvolveID = prUI.InvolveID; prDB.InvolveDate = prUI.InvolveDate; prDB.InvolveResolution = prUI.InvolveResolution; prDB.InvolveRole = prUI.InvolveRole; prDB.WFResolutionID = prUI.WFResolutionID; dbContext.SubmitChanges(); return new Message(MessageConstants.I0001, MessageType.Info, prDB.ID, "updated"); } catch { return new Message(MessageConstants.E0007, MessageType.Error); } }
public Message Update(PerformanceReview pr, string eformMasterId) { Message msg = null; EmployeeDao empDao = new EmployeeDao(); EformDao eformDao = new EformDao(); DbTransaction trans = null; try { if (dbContext.Connection.State == System.Data.ConnectionState.Closed) { dbContext.Connection.Open(); } trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; EForm oldEform = null; PerformanceReview prDB = GetById(pr.ID); //Update eform EForm eform = new EForm(); if (!pr.EForm.MasterID.Equals(eformMasterId)) { //Delete old eform oldEform = pr.EForm; //Insert new eform eform.MasterID = eformMasterId; eform.PersonID = pr.EmployeeID; eform.PersonType = (int)Constants.PersonType.Employee; eform.FormIndex = 1; eform.CreateDate = DateTime.Now; eform.CreatedBy = pr.CreatedBy; dbContext.EForms.InsertOnSubmit(eform); dbContext.SubmitChanges(); pr.EForm = eform; } //Update performance Review prDB.AssignID = pr.AssignID; prDB.EForm = pr.EForm; prDB.AssignRole = pr.AssignRole; prDB.CCEmail = pr.CCEmail; prDB.InvolveDate = pr.InvolveDate; prDB.InvolveID = pr.InvolveID; prDB.InvolveResolution = pr.InvolveResolution; prDB.InvolveRole = pr.InvolveRole; prDB.NextReviewDate = pr.NextReviewDate; prDB.PRDate = pr.PRDate; prDB.UpdateDate = DateTime.Now; prDB.UpdatedBy = pr.UpdatedBy; prDB.WFResolutionID = pr.WFResolutionID; if(oldEform!=null) dbContext.EForms.DeleteOnSubmit(oldEform); dbContext.SubmitChanges(); msg = new Message(MessageConstants.I0001, MessageType.Info, "Performance Review \"" + pr.ID + "\"", "updated"); trans.Commit(); } catch { trans.Rollback(); msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
/// <summary> /// Insert performance review /// </summary> /// <param name="pr">PerformanceReview</param> /// <param name="eformMasterId">string</param> /// <returns>Message</returns> public Message Insert(PerformanceReview pr, string eformMasterId) { Message msg = null; EmployeeDao empDao = new EmployeeDao(); EformDao eformDao = new EformDao(); DbTransaction trans = null; try { if (dbContext.Connection.State == System.Data.ConnectionState.Closed) { dbContext.Connection.Open(); } trans = dbContext.Connection.BeginTransaction(); dbContext.Transaction = trans; EForm eform = new EForm(); eform.MasterID = eformMasterId; eform.PersonID = pr.EmployeeID; eform.PersonType = (int)Constants.PersonType.Employee; eform.FormIndex = 1; eform.CreateDate = DateTime.Now; eform.CreatedBy = pr.CreatedBy; dbContext.EForms.InsertOnSubmit(eform); dbContext.SubmitChanges(); pr.ID = GetNewPrId(pr.EmployeeID); pr.EFormID = eform.ID; dbContext.PerformanceReviews.InsertOnSubmit(pr); msg = new Message(MessageConstants.I0001, MessageType.Info, "PR", "setup"); dbContext.SubmitChanges(); trans.Commit(); } catch { trans.Rollback(); msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
public IActionResult Create([FromBody] PerformanceReview value, Guid employeeId) => new WebApiPost <PerformanceReview>(this, () => _manager.CreateAsync(WebApiActionBase.Value(value), employeeId), operationType: OperationType.Create, statusCode: HttpStatusCode.Created, alternateStatusCode: null, locationUri: (r) => new Uri($"/api/v1/reviews/{r.Id}", UriKind.Relative));
public int EditPerformance(PerformanceReview p) { return(accessor.UpdatePerformance(p)); }
public IActionResult Update([FromBody] PerformanceReview value, Guid id) { return(new WebApiPut <PerformanceReview>(this, () => _manager.UpdateAsync(WebApiActionBase.Value(value), id), operationType: OperationType.Update, statusCode: HttpStatusCode.OK, alternateStatusCode: null)); }
public void Update(PerformanceReview entity, int LoggedInUserId, int LoggedInOrganizationId) { base.Update(entity); _unitOfWork.Save(); }
public Task <WebApiAgentResult <PerformanceReview> > CreateAsync(PerformanceReview value, Guid employeeId, WebApiRequestOptions?requestOptions = null) => PostAsync <PerformanceReview>("api/v1/employees/{employeeId}/reviews", Beef.Check.NotNull(value, nameof(value)), requestOptions: requestOptions, args: new WebApiArg[] { new WebApiArg <Guid>("employeeId", employeeId) });