public EmployeeContactViewModel returnEmergencyContactList(int Id) { EmployeeContactViewModel model = new EmployeeContactViewModel(); model.Id = Id; var data = _db.Employe_EmergencyContacts.Where(x => x.EmployeeID == Id && x.Archived == false).ToList(); if (data.Count > 0) { foreach (var item in data) { var value = _otherSettingMethod.getSystemListValueById(item.Relationship); EmergencyContactsViewModel dd = new EmergencyContactsViewModel(); dd.Id = item.Id; dd.Name = item.Name; dd.EmployeeId = item.EmployeeID; if (value != null) { dd.RelationshipValue = value.Value; } dd.Telephone = item.Telephone; model.EmergencyContactsList.Add(dd); } } return(model); }
public ActionResult Index(int EmployeeId) { EmployeeContactViewModel model = new EmployeeContactViewModel(); model.Id = EmployeeId; return(View(model)); }
public void SaveContactSet(EmployeeContactViewModel model) { AspNetUser AddUser = _db.AspNetUsers.Where(x => x.Id == model.Id).FirstOrDefault(); EmployeeAddressInfo AddressInfo = _db.EmployeeAddressInfoes.Where(x => x.UserId == model.Id).FirstOrDefault(); EmployeeBankInfo BankInfo = _db.EmployeeBankInfoes.Where(x => x.UserId == model.Id).FirstOrDefault(); //step 4 AddUser.WorkPhone = model.WorkPhone; AddUser.WorkMobile = model.WorkMobile; //Address Details AddressInfo.CountryId = model.Country; AddressInfo.StateId = model.State; AddressInfo.TownId = model.Town; AddressInfo.AirportId = model.Airport; AddressInfo.HousNumber = model.HouseNumber; AddressInfo.PostCode = model.Postcode; AddressInfo.PersonalPhone = model.PersonalPhone; AddressInfo.PersonalMobile = model.PersonalMobile; AddressInfo.PersonalEmail = model.PersonalEmail; //Bank details BankInfo.BankAddress = model.Address; BankInfo.BankName = model.BankName; BankInfo.BankCode = model.BankCode; BankInfo.AccountNumber = model.AccountNumber; BankInfo.OtherAccountInformation = model.OtherAccountInformation; BankInfo.AccountName = model.AccountName; BankInfo.BankAddress = model.BankAddress; BankInfo.IBAN_No = model.IBAN_Number; BankInfo.SWIFT_Code = model.SWIF_Code; _db.SaveChanges(); }
public ActionResult SaveEmergencyContacts(EmergencyContactsViewModel model) { _EmployeeContactMethod.saveEmergencyContact(model, SessionProxy.UserId); // EmployeeContactViewModel Model = returnEmergencyContactList(model.EmployeeId); // return PartialView("_partialEmergencyContactList", Model); EmployeeContactViewModel models = _EmployeeContactMethod.employeeDetailsById(model.EmployeeId); return(PartialView("_PartialEmployeeContactsRecord", models)); }
public ActionResult DeleteEmergencyContact(int Id, int EmployeeId) { var data = _db.Employe_EmergencyContacts.Where(x => x.Id == Id).FirstOrDefault(); data.Archived = true; data.LastModified = DateTime.Now; data.UserIDLastModifiedBy = SessionProxy.UserId; _db.SaveChanges(); EmployeeContactViewModel Model = returnEmergencyContactList(EmployeeId); return(PartialView("_partialEmergencyContactList", Model)); }
public ActionResult EmergencyContactsList(int Id) { EmployeeContactViewModel Model = returnEmergencyContactList(Id); return(PartialView("_partialEmergencyContactList", Model)); }
public ActionResult ContectRecordRecord(int EmployeeId) { EmployeeContactViewModel model = _EmployeeContactMethod.employeeDetailsById(EmployeeId); return(PartialView("_PartialEmployeeContactsRecord", model)); }
public ActionResult UpdateContactsRecord(EmployeeContactViewModel model) { _EmployeeContactMethod.SaveContactSet(model); model = _EmployeeContactMethod.employeeDetailsById(model.Id); return(PartialView("_PartialEmployeeContactsRecord", model)); }
public EmployeeContactViewModel employeeDetailsById(int Id) { EmployeeContactViewModel Companysetting = new EmployeeContactViewModel(); Companysetting.Id = Id; var model = _db.AspNetUsers.Where(x => x.Id == Id).FirstOrDefault(); EmployeeAddressInfo AddressInfo = _db.EmployeeAddressInfoes.Where(x => x.UserId == model.Id).FirstOrDefault(); EmployeeBankInfo BankInfo = _db.EmployeeBankInfoes.Where(x => x.UserId == model.Id).FirstOrDefault(); Companysetting.Id = model.Id; if (AddressInfo != null) { if (AddressInfo.TownId != 0) { var city = _db.Cities.Where(x => x.Id == AddressInfo.TownId).FirstOrDefault(); var state = _db.States.Where(x => x.Id == city.StateId).FirstOrDefault(); var country = _db.Countries.Where(x => x.Id == state.CountryId).FirstOrDefault(); Companysetting.Country = country.Id; Companysetting.CountryValue = country.Name; Companysetting.State = state.Id; Companysetting.StateValue = state.Name; Companysetting.Town = (int)AddressInfo.TownId; Companysetting.TownValue = city.Name; } if (AddressInfo.AirportId != null && AddressInfo.AirportId > 0) { var airport = _db.Airports.Where(x => x.Id == AddressInfo.AirportId).FirstOrDefault(); Companysetting.Airport = (int)AddressInfo.AirportId; Companysetting.AirportValue = airport.Name; } } if (BankInfo != null) { Companysetting.Address = BankInfo.BankAddress; Companysetting.WorkPhone = model.WorkPhone; Companysetting.WorkMobile = model.WorkMobile; Companysetting.HouseNumber = AddressInfo.HousNumber; Companysetting.Postcode = AddressInfo.PostCode; Companysetting.PersonalPhone = AddressInfo.PersonalPhone; Companysetting.PersonalMobile = AddressInfo.PersonalMobile; Companysetting.PersonalEmail = AddressInfo.PersonalEmail; Companysetting.BankName = BankInfo.BankName; Companysetting.BankCode = BankInfo.BankCode; Companysetting.IBAN_Number = BankInfo.IBAN_No; Companysetting.SWIF_Code = BankInfo.SWIFT_Code; Companysetting.AccountNumber = BankInfo.AccountNumber; Companysetting.OtherAccountInformation = BankInfo.OtherAccountInformation; Companysetting.AccountName = BankInfo.AccountName; Companysetting.BankAddress = BankInfo.BankAddress; Companysetting.EmployeeId = Convert.ToInt32(AddressInfo.UserId); } foreach (var item in _db.Countries.ToList()) { if (AddressInfo != null) { if (AddressInfo.CountryId == item.Id) { Companysetting.CountryList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString(), Selected = true }); } else { Companysetting.CountryList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } } } foreach (var item in _db.States.ToList()) { if (AddressInfo != null) { if (AddressInfo.StateId == item.Id) { Companysetting.StateList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString(), Selected = true }); } else { Companysetting.StateList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } } } foreach (var item in _db.Cities.ToList()) { if (AddressInfo != null) { if (AddressInfo.TownId == item.Id) { Companysetting.TownList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString(), Selected = true }); } else { Companysetting.TownList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } } } foreach (var item in _db.Airports.ToList()) { if (AddressInfo != null) { if (AddressInfo.AirportId == item.Id) { Companysetting.AirportList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString(), Selected = true }); } else { Companysetting.AirportList.Add(new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); } } } return(Companysetting); }