public List <CompanyEmployeeDomain> GetAllEmployeesByCompanyId(EmployeeProfileRequest model, ref int TotalCount) { List <CompanyEmployeeDomain> companyEmployeeList = null; int totalCount = 0; try { DataProvider.ExecuteCmd(GetConnection, "dbo.UserProfile_GetByCompanyId" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@companyId", model.companyId); // server side pagination paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); }, map : delegate(IDataReader reader, short set) { var singleUser = new CompanyEmployeeDomain(); int startingIndex = 0; //startingOrdinal totalCount = reader.GetSafeInt32(startingIndex++); singleUser.UserId = reader.GetSafeString(startingIndex++); singleUser.Email = reader.GetSafeString(startingIndex++); singleUser.FirstName = reader.GetSafeString(startingIndex++); singleUser.LastName = reader.GetSafeString(startingIndex++); singleUser.url = reader.GetSafeString(startingIndex++); singleUser.userRole = reader.GetSafeString(startingIndex++); singleUser.Name = reader.GetSafeString(startingIndex++); singleUser.PhoneNumber = reader.GetSafeString(startingIndex++); if (companyEmployeeList == null) { companyEmployeeList = new List <CompanyEmployeeDomain>(); } companyEmployeeList.Add(singleUser); }); } catch (Exception ex) { throw ex; } return(companyEmployeeList); }
public void NotifyAllCompanyUsers(NotificationInsertRequest model, List <CompanyEmployeeDomain> NotificationList) { //Instantialize a new NotifySmsRequest NotifySMSRequest companyUser = new NotifySMSRequest(); EmployeeProfileRequest Employee = new EmployeeProfileRequest(); Employee.companyId = model.CompanyId; //List<CompanyEmployeeDomain> notificationList = _UserProfileService.GetEmployeesByCompanyId(Employee.companyId); foreach (CompanyEmployeeDomain employee in NotificationList) { model.UserId = employee.UserId; model.CompanyId = employee.CompanyId; companyUser.Phone = employee.PhoneNumber; //Send out text message try { NotifySMSService.SendBidNotification(companyUser); } catch (ArgumentException) { companyUser.Phone = ""; } catch (Exception) { } SignalRHub.SendNotification(model); } }