private StaffingModel AddOrUpdate(StaffingAddUpdateViewModel data) { StaffingModel prod = new StaffingModel { job_title_id = data.job_title_id, job_title_name = !string.IsNullOrEmpty(data.job_title_name) ? data.job_title_name.Trim() : string.Empty, epic_position = (!string.IsNullOrEmpty(data.epic_position) && data.epic_position == "Y") ? true : false, total_no_of_positions = (int)data.total_no_of_positions != 0 ? (int)data.total_no_of_positions : 1, no_of_positions_filled = (int)data.no_of_positions_filled != 0 ? (int)data.no_of_positions_filled : 0, job_location_id = data.job_location_id, job_location_name = !string.IsNullOrEmpty(data.job_location_name) ? data.job_location_name.Trim() : string.Empty, date_job_received = data.date_job_received != null || data.date_job_received != DateTime.MinValue ? data.date_job_received : null, client_id = data.client_id, client_name = !string.IsNullOrEmpty(data.client_name) ? data.client_name.Trim() : string.Empty, client_manager_id = data.client_manager_id, client_manager_name = !string.IsNullOrEmpty(data.client_manager_name) ? data.client_manager_name.Trim() : string.Empty, job_description = !string.IsNullOrEmpty(data.job_description) ? data.job_description.Trim() : string.Empty, assigned_to_whom_id = data.assigned_to_whom_id, assigned_to_whom_name = !string.IsNullOrEmpty(data.assigned_to_whom_name) ? data.assigned_to_whom_name.Trim() : string.Empty, account_manager_id = data.account_manager_id, account_manager_name = !string.IsNullOrEmpty(data.account_manager_name) ? data.account_manager_name.Trim() : string.Empty, position_status_id = data.position_status_id, follow_up_action = !string.IsNullOrEmpty(data.follow_up_action) ? data.follow_up_action.Trim() : string.Empty, position_type_id = data.position_type_id, rate_range_w2 = !string.IsNullOrEmpty(data.rate_range_w2) ? data.rate_range_w2.Trim() : string.Empty, rate_range_c2c_1099 = !string.IsNullOrEmpty(data.rate_range_c2c_1099) ? data.rate_range_c2c_1099.Trim() : string.Empty, duration = !string.IsNullOrEmpty(data.duration) ? data.duration.Trim() : string.Empty, t_e_paid = (!string.IsNullOrEmpty(data.t_e_paid) && data.t_e_paid == "Yes") ? true : false, job_closed_date = data.job_closed_date != null || data.job_closed_date != DateTime.MinValue ? data.job_closed_date : null }; return(prod); }
private async Task <int> UpdateStaffing(StaffingAddUpdateViewModel data) { StaffingModel prod = AddOrUpdate(data); var resp = await _staffingProcessor.Update(data.staffing_id, prod, CurrentUserId, CurrentDateTime); return(resp.data); }
public async Task <ActionResult> UpdateStaffing(int id) { StaffingAddUpdateViewModel vm = new StaffingAddUpdateViewModel { positiontype_list = await _lookupsProcesor.GetPositionTypes(), positionstatus_list = await _lookupsProcesor.GetPositionStatus() }; ResponseDataModel <StaffingModel> userresp = await _staffingProcessor.GetById(id); StaffingModel user = userresp.data; if (userresp.success == false || userresp.data == null) { vm.error_message = userresp.message; return(View("AddNewStaffing", vm)); } vm.staffing_id = user.staffing_id; vm.job_title_id = user.job_title_id; vm.job_title_name = user.job_title_name; vm.epic_position = user.epic_position == true ? "Y" : "N"; vm.total_no_of_positions = user.total_no_of_positions; vm.no_of_positions_filled = user.no_of_positions_filled; vm.job_location_id = user.job_location_id; vm.job_location_name = user.job_location_name; vm.date_job_received = user.date_job_received != null ? user.date_job_received : null; vm.client_id = user.client_id; vm.client_name = user.client_name; vm.client_manager_id = user.client_manager_id; vm.client_manager_name = user.client_manager_name; vm.job_description = user.job_description; vm.assigned_to_whom_id = user.assigned_to_whom_id; vm.assigned_to_whom_name = user.assigned_to_whom_name; vm.account_manager_id = user.account_manager_id; vm.account_manager_name = user.account_manager_name; vm.position_status_id = user.position_status_id; vm.follow_up_action = user.follow_up_action; vm.position_type_id = user.position_type_id; vm.rate_range_w2 = user.rate_range_w2; vm.rate_range_c2c_1099 = user.rate_range_c2c_1099; vm.duration = user.duration; vm.t_e_paid = user.t_e_paid == true ? "Yes" : "No"; vm.job_closed_date = user.job_closed_date != null ? user.job_closed_date : null; return(View("AddNewStaffing", vm)); }
public StaffingViewModel(StaffingModel model) : base(false) { this.model = model; model.ActionEmployees += Model_ActionEmployees; foreach (PositionDto position in model.Positions.Values) { Positions.Add(position); } foreach (EmployeeDto employee in model.Employees.Values) { AddingEmployee(employee); } }
public async Task <StaffingModel> GetById(int id) { using (var db = new InternalSystemEntities()) { var data = await db.staffings.FindAsync(id); if (data == null || data.staffing_id == 0) { return(null); } var model = new StaffingModel() { staffing_id = data.staffing_id, job_title_id = data.job_title_id, epic_position = data.epic_position, total_no_of_positions = data.total_no_of_positions, no_of_positions_filled = data.no_of_positions_filled, job_location_id = data.job_location_id.HasValue ? data.job_location_id.Value : 0, date_job_received = data.date_job_received != null || data.date_job_received != DateTime.MinValue ? data.date_job_received : null, client_id = data.client_id.HasValue ? data.client_id.Value : 0, client_manager_id = data.client_manager_id.HasValue ? data.client_manager_id.Value : 0, job_description = data.job_description, assigned_to_whom_id = data.assigned_to_whom_id.HasValue ? data.assigned_to_whom_id.Value : 0, account_manager_id = data.account_manager_id.HasValue ? data.account_manager_id.Value : 0, position_status_id = data.position_status_id.HasValue ? data.position_status_id.Value : 0, follow_up_action = data.follow_up_action, position_type_id = data.position_type_id.HasValue ? data.position_type_id.Value : 0, rate_range_w2 = data.rate_range_w2, rate_range_c2c_1099 = data.rate_range_c2c_1099, duration = data.duration, t_e_paid = data.t_e_paid, job_closed_date = data.job_closed_date != null || data.job_closed_date != DateTime.MinValue ? data.job_closed_date : null }; var job_title = await db.job_title.FindAsync(data.job_title_id); if (job_title == null || job_title.job_title_id == 0) { model.job_title_name = string.Empty; } else { model.job_title_name = job_title.job_title_name; } var job_location = await db.job_location.FindAsync(data.job_location_id); if (job_location == null || job_location.job_location_id == 0) { model.job_location_name = string.Empty; } else { model.job_location_name = job_location.job_location_name; } var clients = await db.clients.FindAsync(data.client_id); if (clients == null || clients.client_id == 0) { model.client_name = string.Empty; } else { model.client_name = clients.client_name; } var assigned_to_whom = await db.assigned_to_whom.FindAsync(data.assigned_to_whom_id); if (assigned_to_whom == null || assigned_to_whom.assigned_to_whom_id == 0) { model.assigned_to_whom_name = string.Empty; } else { model.assigned_to_whom_name = assigned_to_whom.assigned_to_whom_name; } var account_manager = await db.account_manager.FindAsync(data.account_manager_id); if (account_manager == null || account_manager.account_manager_id == 0) { model.account_manager_name = string.Empty; } else { model.account_manager_name = account_manager.account_manager_name; } var client_manager = await db.client_manager.FindAsync(data.client_manager_id); if (client_manager == null || client_manager.client_manager_id == 0) { model.client_manager_name = string.Empty; } else { model.client_manager_name = client_manager.client_manager_name; } return(model); } }
public async Task <int> Update(int id, StaffingModel data, int adminId, DateTime currentDt) { using (var db = new InternalSystemEntities()) { var staffing = await db.staffings.FindAsync(id); if (staffing == null || staffing.staffing_id == 0) { return(0); } staffing.staffing_id = id; staffing.epic_position = data.epic_position; staffing.total_no_of_positions = data.total_no_of_positions; staffing.no_of_positions_filled = data.no_of_positions_filled; staffing.date_job_received = data.date_job_received != null ? data.date_job_received : null; staffing.job_description = data.job_description; staffing.position_status_id = data.position_status_id; staffing.follow_up_action = data.follow_up_action; staffing.position_type_id = data.position_type_id; staffing.rate_range_w2 = data.rate_range_w2; staffing.rate_range_c2c_1099 = data.rate_range_c2c_1099; staffing.duration = data.duration; staffing.t_e_paid = data.t_e_paid; staffing.is_active = true; staffing.last_updated_by_user_id = adminId; staffing.last_updated_datetime = currentDt; staffing.job_closed_date = data.job_closed_date != null ? data.job_closed_date : null; int newId = await GetJobTitleId(data.job_title_name); if (newId != 0) { staffing.job_title_id = newId; } newId = await GetJobLocationId(data.job_location_name); if (newId != 0) { staffing.job_location_id = newId; } newId = await GetClientId(data.client_name); if (newId != 0) { staffing.client_id = newId; } newId = await GetAssignedToWhomId(data.assigned_to_whom_name); if (newId != 0) { staffing.assigned_to_whom_id = newId; } newId = await GetAccountManagerNameId(data.account_manager_name); if (newId != 0) { staffing.account_manager_id = newId; } newId = await GetClientManagerNameId(data.client_manager_name); if (id != 0) { staffing.client_manager_id = newId; } await db.SaveChangesAsync(); return(staffing.staffing_id); } }
public async Task <int> Insert(StaffingModel data, int adminId, DateTime currentDt) { staffing _staffing = new staffing { epic_position = data.epic_position, total_no_of_positions = data.total_no_of_positions, no_of_positions_filled = data.no_of_positions_filled, date_job_received = data.date_job_received != null || data.job_closed_date != DateTime.MinValue ? data.date_job_received : null, job_description = data.job_description, position_status_id = data.position_status_id, follow_up_action = data.follow_up_action, position_type_id = data.position_type_id, rate_range_w2 = data.rate_range_w2, rate_range_c2c_1099 = data.rate_range_c2c_1099, duration = data.duration, t_e_paid = data.t_e_paid, job_closed_date = data.job_closed_date != null || data.job_closed_date != DateTime.MinValue ? data.date_job_received : null, is_active = true, created_by_user_id = adminId, created_datetime = currentDt, last_updated_by_user_id = adminId, last_updated_datetime = currentDt }; int id = await GetJobTitleId(data.job_title_name); if (id != 0) { _staffing.job_title_id = id; } id = await GetJobLocationId(data.job_location_name); if (id != 0) { _staffing.job_location_id = id; } id = await GetClientId(data.client_name); if (id != 0) { _staffing.client_id = id; } id = await GetAssignedToWhomId(data.assigned_to_whom_name); if (id != 0) { _staffing.assigned_to_whom_id = id; } id = await GetAccountManagerNameId(data.account_manager_name); if (id != 0) { _staffing.account_manager_id = id; } id = await GetClientManagerNameId(data.client_manager_name); if (id != 0) { _staffing.client_manager_id = id; } using (var db = new InternalSystemEntities()) { db.staffings.Add(_staffing); int cnt = await db.SaveChangesAsync(); return(_staffing.staffing_id); } }
public async Task <int> Update(int id, StaffingModel data, int adminId, DateTime currentDt) { return(await _data.Update(id, data, adminId, currentDt)); }
public async Task <int> Insert(StaffingModel data, int adminId, DateTime currentDt) { return(await _data.Insert(data, adminId, currentDt)); }
public async Task <ResponseDataModel <int> > Update(int id, StaffingModel data, int adminId, DateTime currentDt) { return(new ResponseDataModel <int> { data = await _repository.Update(id, data, adminId, currentDt) }); }