public bool UpdateEmployeeBadge(EmployeeBadge badge) { //Update an existing badge bool updated = false; try { updated = new EmployeeBadgeGateway().UpdateBadge(badge); } catch (Exception ex) { throw new FaultException <HRFault>(new HRFault(ex.Message), "Service Error"); } return(updated); }
public bool AddEmployeeBadge(EmployeeBadge badge) { //Add a new badge bool added = false; try { added = new EmployeeBadgeGateway().CreateBadge(badge); } catch (Exception ex) { throw new FaultException <HRFault>(new HRFault(ex.Message), "Service Error"); } return(added); }
public bool UpdateBadge(EmployeeBadge badge) { //Update an existing badge bool updated = false; try { updated = new DataService().ExecuteNonQuery(SQL_CONNID, USP_BADGE_UPDATE, new object[] { badge.IDNumber, badge.LastName, badge.FirstName, badge.Middle, badge.Suffix, badge.Department, badge.Location, badge.SubLocation, badge.Status }); } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } return(updated); }
public bool UpdateEmployeeBadge(EmployeeBadge badge) { // bool updated = false; EmployeeBadgeServiceClient client = new EmployeeBadgeServiceClient(); try { updated = client.UpdateEmployeeBadge(badge); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(updated); }
public EmployeeBadge GetEmployeeBadge(int idNumber) { // EmployeeBadge badge = null; EmployeeBadgeServiceClient client = new EmployeeBadgeServiceClient(); try { badge = client.GetEmployeeBadge(idNumber); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <HRFault> hfe) { client.Abort(); throw new ApplicationException(hfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(badge); }
public bool CreateBadge(EmployeeBadge badge) { //Add a new badge bool created = false; try { created = new DataService().ExecuteNonQuery(SQL_CONNID, USP_BADGE_NEW, new object[] { badge.LastName, badge.FirstName, badge.Middle, badge.Suffix, badge.Department, badge.Location, badge.SubLocation, badge.Status, (badge.HireDate != DateTime.MinValue ? badge.HireDate : null as object), badge.SSN }); } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } return(created); }
public EmployeeBadge GetEmployeeBadge(int idNumber) { // EmployeeBadge badge = null; try { DataSet ds = new EmployeeBadgeGateway().ReadBadge(idNumber); if (ds != null) { BadgeDataset _badges = new BadgeDataset(); _badges.Merge(ds); badge = new EmployeeBadge(_badges.BadgeTable[0]); } } catch (Exception ex) { throw new FaultException <HRFault>(new HRFault(ex.Message), "Service Error"); } return(badge); }