Example #1
0
        public int Update()
        {
            int rowsUpdated = 0;

            try
            {
                EmployeeBusinessData        dataLayer       = new EmployeeBusinessData();
                Dictionary <string, Object> empBusinessData = new Dictionary <string, Object>();
                Dictionary <string, Object> empDict2        = (Dictionary <string, Object>)Deserializer(dataLayer.GetByID(_employeeID));
                empBusinessData["departmentid"] = _departmentid;
                empBusinessData["email"]        = _email;
                empBusinessData["employeeid"]   = _employeeID;
                empBusinessData["firstname"]    = _firstName;
                empBusinessData["lastname"]     = _lastName;
                empBusinessData["phoneno"]      = _phoneNo;
                empBusinessData["title"]        = _title;
                empBusinessData["entity"]       = empDict2["entity"];
                _entity     = Serializer(empBusinessData);
                rowsUpdated = dataLayer.Update(_entity);
            }
            catch (Exception e)
            {
                ErrorRoutine(e, "EmployeeBusinessUser", "Update");
            }
            return(rowsUpdated);
        }//end Update
Example #2
0
        public List <EmployeeBusinessUser> GetAll()
        {
            List <EmployeeBusinessUser> empList = new List <EmployeeBusinessUser>();

            try
            {
                EmployeeBusinessData empData = new EmployeeBusinessData();
                List <Employee>      rawList = empData.GetAll();
                foreach (Employee emp in rawList)
                {
                    EmployeeBusinessUser fullEmployee = new EmployeeBusinessUser();
                    fullEmployee._departmentid = emp.DepartmentID;
                    fullEmployee._email        = emp.Email;
                    fullEmployee._employeeID   = emp.EmployeeID;
                    fullEmployee._firstName    = emp.FirstName;
                    fullEmployee._lastName     = emp.LastName;
                    fullEmployee._phoneNo      = emp.PhoneNo;
                    fullEmployee._title        = emp.Title;
                    empList.Add(fullEmployee);
                }
            }
            catch (Exception e)
            {
                ErrorRoutine(e, "EmployeeBusinessUser", "GetAll");
            }
            return(empList);
        }//end GetAll
Example #3
0
        }//end Update

        public int Delete(int employeeid)
        {
            int rowsDeleted = 0;

            try
            {
                EmployeeBusinessData empBusinessData = new EmployeeBusinessData();

                rowsDeleted = empBusinessData.Delete(employeeid);
            }
            catch (Exception e)
            {
                ErrorRoutine(e, "EmployeeBusinessUser", "Delete");
            }
            return(rowsDeleted);
        }
Example #4
0
        public int Create()
        {
            int primaryKey = 0;

            try
            {
                Dictionary <string, Object> empBusinessData = new Dictionary <string, object>();
                EmployeeBusinessData        dataLayer       = new EmployeeBusinessData();
                empBusinessData.Add("title", _title);
                empBusinessData.Add("firstname", _firstName);
                empBusinessData.Add("lastname", _lastName);
                empBusinessData.Add("phoneno", _phoneNo);
                empBusinessData.Add("email", _email);
                empBusinessData.Add("departmentid", _departmentid);
                _entity    = Serializer(empBusinessData);
                primaryKey = dataLayer.Create(_entity);
            }
            catch (Exception e)
            {
                ErrorRoutine(e, "EmployeeBusinessUser", "Create");
            }
            return(primaryKey);
        }
Example #5
0
        }//end GetAll

        public EmployeeBusinessUser GetByID(int employeeid)
        {
            Dictionary <string, Object> dataLayerDict;

            try
            {
                EmployeeBusinessData dataLayer = new EmployeeBusinessData();
                dataLayerDict = (Dictionary <string, Object>)Deserializer(dataLayer.GetByID(employeeid));
                //EmployeeBusinessData empBusData = new EmployeeBusinessData();
                //Dictionary<string, Object> empBusData.GetByID(employeeid);
                _title        = Convert.ToString(dataLayerDict["title"]);
                _firstName    = Convert.ToString(dataLayerDict["firstname"]);
                _lastName     = Convert.ToString(dataLayerDict["lastname"]);
                _departmentid = Convert.ToInt32(dataLayerDict["departmentid"]);
                _employeeID   = Convert.ToInt32(dataLayerDict["employeeid"]);
                _email        = Convert.ToString(dataLayerDict["email"]);
                _phoneNo      = Convert.ToString(dataLayerDict["phoneno"]);
            }
            catch (Exception e)
            {
                ErrorRoutine(e, "EmployeeBusinessUser", "GetByID");
            }
            return(this);
        }