public async Task <bool> EditIndividual(Guid id, IndividualModel model) { Individual individual = await _db.Individuals.FirstOrDefaultAsync(p => p.Id == id); if (individual != null) { if (model.LastName != null) { individual.LastName = model.LastName; } if (model.TypeDocument != null) { individual.TypeDocument = model.TypeDocument; } if (model.NumberDocument != null) { individual.NumberDocument = model.NumberDocument; } if (model.Salary != null) { individual.Salary = (double)model.Salary; } _db.Individuals.Update(individual); await _db.SaveChangesAsync(); return(true); } return(false); }
public async Task <ActionResult <IndividualModel> > Put(int id, IndividualModel model) { var existing = await _repository.GetIndividualAsync(id); if (existing == null) { return(NotFound(_localizer["Individual Could not be found"])); } _mapper.Map(model, existing); if (model.CityId != 0) { var city = await _repository.GetCityByIdAsync(model.CityId); if (city == null) { return(BadRequest(_localizer["City with the given Id could not be found"])); } existing.CityId = city.Id; existing.City = city; } if (await _repository.SaveChangesAsync()) { return(Ok(_mapper.Map <IndividualModel>(existing))); } return(BadRequest()); }
public async Task <ActionResult <IndividualModel> > Post(IndividualModel model) { var individual = _mapper.Map <Individual>(model); if (model.CityId != 0) { var city = await _repository.GetCityByIdAsync(model.CityId); if (city == null) { return(BadRequest(_localizer["City with the given Id could not be found"])); } individual.City = city; individual.CityId = city.Id; } _repository.Add(individual); if (await _repository.SaveChangesAsync()) { var url = _linkGenerator.GetPathByAction("Get", "Individuals", new { id = individual.Id }); return(Created(url, _mapper.Map <IndividualModel>(individual))); } return(BadRequest()); }
public async Task CreateAsync(IndividualModel model) { var individual = _mapper.Map <Individual>(model); // TODO: a lot of things.... like image handling, self recursive many to many relationships, etc. await _context.Individuals.AddAsync(individual); await _context.SaveChangesAsync(); }
public void UpdatePerformanceClauses(IndividualModel individual) { // clear this.MomentaDb.ClearIndividualPerformanceClause(individual.IndividualId); // loop through and add foreach (var clause in individual.PerformanceClauses) { this.MomentaDb.SetIndividualPerformanceClause(individual.IndividualId, clause.PerformanceClauseId); } }
public void Create(IndividualModel model) { var individual = new Individual { Iin = model.Iin, FirstName = model.FirstName, LastName = model.LastName, Patronymic = model.Patronymic }; _dbContext.Individuals.Add(individual); _dbContext.SaveChanges(); }
protected void btnSubmit_OnClick(object sender, EventArgs e) { var model = new IndividualModel { Iin = iin.Text, FirstName = fName.Text, LastName = lName.Text, Patronymic = pName.Text }; _individualService.Create(model); IndividualsGV.DataBind(); }
public async Task <IActionResult> CreateAsync(IndividualModel model) { try { await _individualService.CreateAsync(model); return(RedirectToAction("Index")); } catch (Exception ex) { _logger.LogError(ex, ex.Message); throw; } return(View(model)); }
public async Task <Individual> CreateIndividual(IndividualModel model, User user) { Individual individual = new Individual { Name = model.Name, LastName = model.LastName, Patronymic = model.Patronymic, Salary = model.Salary, UserID = user.Id, User = user, NumberDocument = model.NumberDocument, TypeDocument = model.TypeDocument, DateOfBirth = model.DateOfBirth }; _db.Individuals.Add(individual); await _db.SaveChangesAsync(); Individual ind = await _db.Individuals.FirstOrDefaultAsync(p => p.UserID == user.Id); return(ind); }
public long SaveIndIns(IndividualModel objIndModel) { long returnCode = -1; using (TransactionScope transactionScope = new TransactionScope()) { try { returnCode = objMotorAppDAL.SaveIndIns(objIndModel); transactionScope.Complete(); transactionScope.Dispose(); } catch (Exception ex) { transactionScope.Dispose(); throw ex; } return(returnCode); } }
public IndividualModel GetIndividual(int id) { var data = this.MomentaDb.GetIndividual(id).First(); return(IndividualModel.PopulateIndividualModel(data)); }
public void UpdateIndividual(IndividualModel model) { DateTime?retentionStartDate; if (model.RetentionStartDate == null) { retentionStartDate = null; } else { retentionStartDate = Convert.ToDateTime(model.RetentionStartDate); } this.MomentaDb.UpdateIndividual( model.IndividualId, model.StartDate, model.EndDate, model.FullMomentaRate, model.AssociateRate, model.Retention, model.RetentionPeriodId, model.RetentionCharge, model.RetentionPayAway, model.TimeSheetApproverId, model.Monday, model.MondayOvertime, model.Tuesday, model.TuesdayOvertime, model.Wednesday, model.WednesdayOvertime, model.Thursday, model.ThursdayOvertime, model.Friday, model.FridayOvertime, model.Saturday, model.SaturdayOvertime, model.Sunday, model.SundayOvertime, model.WorkingHours, model.OverTimePayAway, model.OverTimePayRatio, model.IncentiveDaysMaxWorked, model.IncentiveDaysCountedAs, //model.AdditionalCaseRate, model.OneOffPmtAmount, model.OneofPaymentDate, model.ExpenseAccomodation, model.ExpenseSubsistence, model.ExpenseTravel, model.ExpenseParking, model.ExpenseMileage, model.ExpenseOther, model.Suspended, model.TravelFullDay, model.CancelFullDay, model.TravelHalfDay, model.CancelHalfDay, model.NoticeAmount, model.NoticeIntervalId, model.Hourly, model.OverproductionCharge, model.OverproductionPayAway, retentionStartDate, model.OverTimeCharge ); this.MomentaDb.ResetAuditModifiedTime(model.AssociateId, model.RoleId, null); this.UpdatePerformanceClauses(model); }
public void UpdateIndividual(IndividualModel model) { DateTime? retentionStartDate; if (model.RetentionStartDate == null) { retentionStartDate = null; } else { retentionStartDate = Convert.ToDateTime(model.RetentionStartDate); } this.MomentaDb.UpdateIndividual( model.IndividualId, model.StartDate, model.EndDate, model.FullMomentaRate, model.AssociateRate, model.Retention, model.RetentionPeriodId, model.RetentionCharge, model.RetentionPayAway, model.TimeSheetApproverId, model.Monday, model.MondayOvertime, model.Tuesday, model.TuesdayOvertime, model.Wednesday, model.WednesdayOvertime, model.Thursday, model.ThursdayOvertime, model.Friday, model.FridayOvertime, model.Saturday, model.SaturdayOvertime, model.Sunday, model.SundayOvertime, model.WorkingHours, model.OverTimePayAway, model.OverTimePayRatio, model.IncentiveDaysMaxWorked, model.IncentiveDaysCountedAs, //model.AdditionalCaseRate, model.OneOffPmtAmount, model.OneofPaymentDate, model.ExpenseAccomodation, model.ExpenseSubsistence, model.ExpenseTravel, model.ExpenseParking, model.ExpenseMileage, model.ExpenseOther, model.Suspended, model.TravelFullDay, model.CancelFullDay, model.TravelHalfDay, model.CancelHalfDay, model.NoticeAmount, model.NoticeIntervalId, model.Hourly, model.OverproductionCharge, model.OverproductionPayAway, retentionStartDate, model.OverTimeCharge ); this.MomentaDb.ResetAuditModifiedTime(model.AssociateId, model.RoleId, null); this.UpdatePerformanceClauses(model); }
private IndividualModel SavePerformanceClauses(IndividualModel item, string clauses) { try { item.PerformanceClauses = new List<MomentaRecruitment.Common.Models.PerformanceClauseModel>(); if (clauses.Trim().Length > 0) { var clauseIds = (clauses ?? "").Split(',').Select<string, int>(int.Parse).ToList<int>(); foreach (int id in clauseIds) { item.PerformanceClauses.Add(this.individualService.GetPerformanceClause(id)); } } } catch (Exception) { //do nothing - invalid clause data } return item; }
public JsonResult UpdateIndividual(IndividualModel item, string clauses) { try { item = SavePerformanceClauses(item, clauses); this.individualService.UpdateIndividual(item); return this.Json(true); } catch (Exception ex) { string Message = ex.InnerException.Message; if (Message.Contains("Retainer timesheet")) { ErrorSignal.FromCurrentContext().Raise(ex); Message = "Data not saved, valid retainer timesheet already exist with-in this date range."; return this.Json(Message); ; } ErrorSignal.FromCurrentContext().Raise(ex); return this.Json(Message); } }
public DataTable ConvertToInvidual(IndividualModel _objIndIns) { try { DataTable _dt = new DataTable(); _dt.Columns.Add("QuotationNo", typeof(string)); _dt.Columns.Add("PolicyNo", typeof(string)); _dt.Columns.Add("IssueDate", typeof(DateTime)); _dt.Columns.Add("Branch", typeof(string)); _dt.Columns.Add("PolicyStartDate", typeof(DateTime)); _dt.Columns.Add("PolicyEndDate", typeof(DateTime)); _dt.Columns.Add("NameofthePlan", typeof(string)); _dt.Columns.Add("SumAssured", typeof(long)); _dt.Columns.Add("DateofBirth", typeof(DateTime)); _dt.Columns.Add("Age", typeof(int)); _dt.Columns.Add("Gender", typeof(string)); _dt.Columns.Add("Broker_AgentCode", typeof(string)); _dt.Columns.Add("LifeAssuredName", typeof(string)); _dt.Columns.Add("LifeAssuredName_Arabic", typeof(string)); _dt.Columns.Add("AssuredGender", typeof(string)); _dt.Columns.Add("AssuredDateofBirth", typeof(DateTime)); _dt.Columns.Add("AssuredCountryofBirth", typeof(string)); _dt.Columns.Add("AssuredCivilID", typeof(string)); _dt.Columns.Add("AssuredBldgNo_Street", typeof(string)); _dt.Columns.Add("AssuredPostBox", typeof(string)); _dt.Columns.Add("AssuredPostalCode", typeof(string)); _dt.Columns.Add("AssuredCity", typeof(string)); _dt.Columns.Add("AssuredResPhoneNo", typeof(string)); _dt.Columns.Add("AssuredMobileNo", typeof(string)); _dt.Columns.Add("AssuredEMail", typeof(string)); _dt.Columns.Add("Marketer", typeof(string)); _dt.Columns.Add("IssueFrom", typeof(string)); _dt.Columns.Add("Referral", typeof(string)); _dt.Columns.Add("ReferralRemarks", typeof(string)); _dt.Columns.Add("NomineeName", typeof(string)); _dt.Columns.Add("NomineeName_Arabic", typeof(string)); _dt.Columns.Add("NomineeGender", typeof(string)); _dt.Columns.Add("NomineeDOB", typeof(DateTime)); _dt.Columns.Add("NomineeCountryofBirth", typeof(string)); _dt.Columns.Add("NomineeCivilID", typeof(string)); _dt.Columns.Add("NomineeBldgNo_Street", typeof(string)); _dt.Columns.Add("NomineePostBox", typeof(string)); _dt.Columns.Add("NomineePostalCode", typeof(string)); _dt.Columns.Add("NomineeCity", typeof(string)); _dt.Columns.Add("NomineeResPhoneNo", typeof(string)); _dt.Columns.Add("NomineeOfficePhoneNo", typeof(string)); _dt.Columns.Add("NomineeMobileNo", typeof(string)); _dt.Columns.Add("NomineeEMail", typeof(string)); _dt.Columns.Add("AppointeeName", typeof(string)); _dt.Columns.Add("AppointeeAge", typeof(int)); _dt.Columns.Add("AppointeeContactNo", typeof(string)); _dt.Columns.Add("RelationshiptotheNominee", typeof(string)); _dt.Columns.Add("AppointeeCivilIDNo", typeof(string)); DataRow _dr; _dr = _dt.NewRow(); _dr["QuotationNo"] = _objIndIns.QuotationNo; _dr["PolicyNo"] = _objIndIns.PolicyNo; _dr["IssueDate"] = _objIndIns.IssueDate; _dr["Branch"] = _objIndIns.Branch; _dr["PolicyStartDate"] = _objIndIns.PolicyStartDate; _dr["PolicyEndDate"] = _objIndIns.PolicyEndDate; _dr["NameofthePlan"] = _objIndIns.NameofthePlan; _dr["SumAssured"] = _objIndIns.SumAssured; _dr["DateofBirth"] = _objIndIns.DateofBirth; _dr["Age"] = _objIndIns.Age; _dr["Gender"] = _objIndIns.Gender; _dr["Broker_AgentCode"] = _objIndIns.Broker_AgentCode; _dr["LifeAssuredName"] = _objIndIns.LifeAssuredName; _dr["LifeAssuredName_Arabic"] = _objIndIns.LifeAssuredName_Arabic; _dr["AssuredGender"] = _objIndIns.AssuredGender; _dr["AssuredDateofBirth"] = _objIndIns.AssuredDateofBirth; _dr["AssuredCountryofBirth"] = _objIndIns.AssuredCountryofBirth; _dr["AssuredCivilID"] = _objIndIns.AssuredCivilID; _dr["AssuredBldgNo_Street"] = _objIndIns.AssuredBldgNo_Street; _dr["AssuredPostBox"] = _objIndIns.AssuredPostBox; _dr["AssuredPostalCode"] = _objIndIns.AssuredPostalCode; _dr["AssuredCity"] = _objIndIns.AssuredCity; _dr["AssuredResPhoneNo"] = _objIndIns.AssuredResPhoneNo; _dr["AssuredMobileNo"] = _objIndIns.AssuredMobileNo; _dr["AssuredEMail"] = _objIndIns.AssuredEMail; _dr["Marketer"] = _objIndIns.Marketer; _dr["IssueFrom"] = _objIndIns.IssueFrom; _dr["Referral"] = _objIndIns.Referral; _dr["ReferralRemarks"] = _objIndIns.ReferralRemarks; _dr["NomineeName"] = _objIndIns.NomineeName; _dr["NomineeName_Arabic"] = _objIndIns.NomineeName_Arabic; _dr["NomineeGender"] = _objIndIns.NomineeGender; _dr["NomineeDOB"] = _objIndIns.NomineeDOB; _dr["NomineeCountryofBirth"] = _objIndIns.NomineeCountryofBirth; _dr["NomineeCivilID"] = _objIndIns.NomineeCivilID; _dr["NomineeBldgNo_Street"] = _objIndIns.NomineeBldgNo_Street; _dr["NomineePostBox"] = _objIndIns.NomineePostBox; _dr["NomineePostalCode"] = _objIndIns.NomineePostalCode; _dr["NomineeCity"] = _objIndIns.NomineeCity; _dr["NomineeResPhoneNo"] = _objIndIns.NomineeResPhoneNo; _dr["NomineeOfficePhoneNo"] = _objIndIns.NomineeOfficePhoneNo; _dr["NomineeMobileNo"] = _objIndIns.NomineeMobileNo; _dr["NomineeEMail"] = _objIndIns.NomineeEMail; _dr["AppointeeName"] = _objIndIns.AppointeeName; _dr["AppointeeAge"] = _objIndIns.AppointeeAge; _dr["AppointeeContactNo"] = _objIndIns.AppointeeContactNo; _dr["RelationshiptotheNominee"] = _objIndIns.RelationshiptotheNominee; _dr["AppointeeCivilIDNo"] = _objIndIns.AppointeeCivilIDNo; _dt.Rows.Add(_dr); return(_dt); } catch (Exception ex) { throw; } }
public void Edit(int id, IndividualModel model) { throw new NotImplementedException(); }