예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }