示例#1
0
        /// <summary>
        /// This is a sample specific finder method for Entity1.
        /// If you want to delete or rename the method think about changing the xml in the BDC model file as well.
        /// </summary>
        /// <param name="id"></param>
        /// <returns>Entity1</returns>
        public static EntityEmployeeData ReadItem(string PersonalNumber)
        {
            EmployeeBasic      basicInfo    = null;
            EmployeeDetail     detailedInfo = null;
            EntityEmployeeData ret          = new EntityEmployeeData();

            SharePointLogger logger  = new SharePointLogger();
            TestConfigTh     config  = new TestConfigTh();
            TestLicense      license = new TestLicense();


            using (EmployeeRepositorySAPDotNet rep = new EmployeeRepositorySAPDotNet(config, logger, license))
            {
                List <EmployeeBasic> empList = rep.getEmployeeBasicList();
                foreach (EmployeeBasic emp in empList)
                {
                    if (emp.PersonalNumber.ToLower().Trim().Equals(PersonalNumber.ToLower().Trim()))
                    {
                        basicInfo = emp;
                    }
                }
                if (basicInfo != null)
                {
                    detailedInfo = rep.getEmployeeDetailedInfo(PersonalNumber);
                }
            }

            if (basicInfo != null)
            {
                ret = new EntityEmployeeData(basicInfo, detailedInfo);
            }

            return(ret);
        }
示例#2
0
        public List <EmployeeBasic> getEmployeeBasicList(string surname, string lastname, string job, string organisation)
        {
            string surnameSearch      = surname.Equals(string.Empty) ? "*" : surname;
            string lastnameSearch     = lastname.Equals(string.Empty) ? "*" : lastname;
            string jobSearch          = job.Equals(string.Empty) ? "*" : job;
            string organisationSearch = organisation.Equals(string.Empty) ? "*" : organisation;

            List <EmployeeBasic> result      = new List <EmployeeBasic>();
            RfcDestination       destination = (RfcDestination)(TestConfigSAPDotNet.getConnectionObject());

            try
            {
                RfcRepository repo         = destination.Repository;
                IRfcFunction  employeeList = repo.CreateFunction(Constants.BAPI_EMPLOYEE_GETLIST);
//                employeeList.SetValue(Constants.SEARCH_DATE, DateTime.Now.ToShortDateString());

                employeeList.SetValue(Constants.JOB_SEARK, jobSearch);
                employeeList.SetValue(Constants.ORG_SEARK, organisationSearch);
                employeeList.SetValue(Constants.SUR_NAME_SEARK, surnameSearch);
                employeeList.SetValue(Constants.LST_NAME_SEARK, lastnameSearch);

                employeeList.Invoke(destination);
                IRfcTable employees = employeeList.GetTable(Constants.EMPLOYEE_LIST);

                for (int cuIndex = 0; cuIndex < employees.RowCount; cuIndex++)
                {
                    employees.CurrentIndex = cuIndex;

                    var PERNR    = employees.GetString(Constants.PERNR);
                    var ENAME    = employees.GetString(Constants.ENAME);
                    var ORG_ID   = employees.GetString(Constants.ORG_ID);
                    var ORG_TEXT = employees.GetString(Constants.ORG_TEXT);
                    var JOB_ID   = employees.GetString(Constants.JOB_ID);
                    var JOB_TEXT = employees.GetString(Constants.JOB_TEXT);

                    EmployeeBasic empBasic = new EmployeeBasic()
                    {
                        Name             = ENAME,
                        JobID            = JOB_ID,
                        JobName          = JOB_TEXT,
                        OrganisationID   = ORG_TEXT,
                        OrganisationName = ORG_TEXT,
                        PersonalNumber   = PERNR
                    };

                    result.Add(empBasic);
                }
            }
            catch (Exception ex)
            {
                _loggingManager.ThrowException(ex, DOTNETSAPErrorSeverity.High);
            }
            finally
            {
            }

            return(result);
        }
示例#3
0
 public EntityEmployeeData(EmployeeBasic empBasic)
 {
     PersonalNumber   = empBasic.PersonalNumber;
     Name             = empBasic.Name;
     OrganisationID   = empBasic.OrganisationID;
     OrganisationName = empBasic.OrganisationName;
     JobID            = empBasic.JobID;
     JobName          = empBasic.JobName;
 }
示例#4
0
        public EntityEmployeeData(EmployeeBasic empBasic, EmployeeDetail empDetail)
        {
            PersonalNumber   = empBasic.PersonalNumber;
            Name             = empBasic.Name;
            OrganisationID   = empBasic.OrganisationID;
            OrganisationName = empBasic.OrganisationName;
            JobID            = empBasic.JobID;
            JobName          = empBasic.JobName;

            NamePrefix  = empDetail.NamePrefix;
            FirstName   = empDetail.FirstName;
            LastName    = empDetail.LastName;
            Language    = empDetail.Language;
            Nationality = empDetail.Nationality;
            DateOfBith  = empDetail.DateOfBith;
            PlaceOfBith = empDetail.PlaceOfBith;
            Gender      = empDetail.Gender;
            Country     = empDetail.Country;
        }
示例#5
0
        public List <EmployeeBasic> getEmployeeBasicList(string surname, string lastname, string job, string organisation)
        {
            string surnameSearch      = surname.Equals(string.Empty) ? "*" : surname;
            string lastnameSearch     = lastname.Equals(string.Empty) ? "*" : lastname;
            string jobSearch          = job.Equals(string.Empty) ? "*" : job;
            string organisationSearch = organisation.Equals(string.Empty) ? "*" : organisation;

            List <EmployeeBasic> result = new List <EmployeeBasic>();
            var connection = new R3Connection(_configManager.getConnectionString());

            try
            {
                connection.Open();

                var function = connection.CreateFunction(Constants.BAPI_EMPLOYEE_GETLIST);
                function.Exports[Constants.SEARCH_DATE].ParamValue    = DateTime.Now.ToShortDateString();
                function.Exports[Constants.JOB_SEARK].ParamValue      = jobSearch;
                function.Exports[Constants.JOB_SEARK].ParamValue      = jobSearch;
                function.Exports[Constants.ORG_SEARK].ParamValue      = organisationSearch;
                function.Exports[Constants.SUR_NAME_SEARK].ParamValue = surnameSearch;
                function.Exports[Constants.LST_NAME_SEARK].ParamValue = lastnameSearch;

                function.Execute();

                var table = function.Tables[Constants.EMPLOYEE_LIST];

                if (table != null && table.Rows.Count > 0)
                {
                    foreach (RFCStructure row in table.Rows)
                    {
                        var PERNR    = (string)row[Constants.PERNR];
                        var ENAME    = (string)row[Constants.ENAME];
                        var ORG_ID   = (string)row[Constants.ORG_ID];
                        var ORG_TEXT = (string)row[Constants.ORG_TEXT];
                        var JOB_ID   = (string)row[Constants.JOB_ID];
                        var JOB_TEXT = (string)row[Constants.JOB_TEXT];

                        EmployeeBasic empBasic = new EmployeeBasic()
                        {
                            Name             = ENAME,
                            JobID            = JOB_ID,
                            JobName          = JOB_TEXT,
                            OrganisationID   = ORG_TEXT,
                            OrganisationName = ORG_TEXT,
                            PersonalNumber   = PERNR
                        };

                        result.Add(empBasic);
                    }
                }
            }
            catch (Exception ex)
            {
                _loggingManager.ThrowException(ex, DOTNETSAPErrorSeverity.High);
            }
            finally
            {
                if (connection != null && connection.Ping())
                {
                    connection.Close();
                }
            }

            return(result);
        }
示例#6
0
 public ActionResult Update(EmployeeBasic request)
 {
     return(Ok());
 }