Ejemplo n.º 1
0
        internal PayrollRequest UpdateEmployeeRequest(PayrollEncoder encoder, object[] args)
        {
            var requestBody = new JsonDoc()
                              .Set("ClientCode", encoder.Encode(ClientCode))
                              .Set("EmployeeId", EmployeeId)
                              .Set("EmploymentStatus", EnumConverter.GetDescription(EmploymentStatus))
                              .Set("HireDate", HireDate)
                              //.Set("TerminationDate", TerminationDate)
                              //.Set("TerminationReasonId", TerminationReasonId)
                              .Set("EmployeeNumber", EmployeeNumber)
                              .Set("EmploymentCategory", EnumConverter.GetDescription(EmploymentCategory))
                              .Set("TimeClockId", TimeClockId)
                              .Set("FirstName", FirstName)
                              .Set("LastName", encoder.Encode(LastName))
                              .Set("MiddleName", MiddleName)
                              .Set("SSN", encoder.Encode(Ssn))
                              .Set("Address1", encoder.Encode(Address1))
                              .Set("Address2", Address2)
                              .Set("City", City)
                              .Set("StateCode", StateCode)
                              .Set("ZipCode", encoder.Encode(ZipCode))
                              .Set("MaritalStatus", EnumConverter.GetDescription(MaritalStatus))
                              .Set("BirthDate", encoder.Encode(BirthDay))
                              .Set("Gender", EnumConverter.GetDescription(Gender))
                              .Set("PayGroupId", PayGroupId)
                              .Set("PayTypeCode", EnumConverter.GetDescription(PayTypeCode))
                              .Set("HourlyRate", encoder.Encode(HourlyRate))
                              .Set("PerPaySalary", encoder.Encode(PerPaySalary))
                              .Set("WorkLocationId", WorkLocationId).ToString();

            return(new PayrollRequest {
                Endpoint = @"/api/pos/employee/UpdateEmployee",
                RequestBody = requestBody
            });
        }
Ejemplo n.º 2
0
        internal static PayrollRequest SignIn(string username, string password, PayrollEncoder encoder)
        {
            var request = new JsonDoc()
                          .Set("Username", username)
                          .Set("Password", encoder.Encode(password));

            return(new PayrollRequest {
                Endpoint = "/api/pos/session/signin",
                RequestBody = request.ToString()
            });
        }
Ejemplo n.º 3
0
        internal PayrollRequest PostPayrollRequest(PayrollEncoder encoder, object[] args)
        {
            var payrollRecords = _records.Select(p => p.ToJson(encoder)).ToList();

            var requestBody = string.Format("[{0}]", string.Join(",", payrollRecords));

            return(new PayrollRequest {
                Endpoint = @"/api/pos/timeclock/PostPayData",
                RequestBody = requestBody
            });
        }
Ejemplo n.º 4
0
        internal PayrollRequest GetClientInfoRequest(PayrollEncoder encoder, object[] args)
        {
            var request = new JsonDoc()
                          .Set("FederalEin", encoder.Encode(FederalEin))
                          .ToString();

            return(new PayrollRequest {
                Endpoint = "/api/pos/client/getclients",
                RequestBody = request
            });
        }
Ejemplo n.º 5
0
 internal string ToJson(PayrollEncoder encoder)
 {
     return(new JsonDoc()
            .Set("RecordId", RecordId)
            .Set("ClientCode", encoder.Encode(ClientCode))
            .Set("EmployeeId", EmployeeId)
            .Set("PayItemLaborFields", PayItemLaborFields)
            .Set("PayItemTitle", PayItemTitle)
            .Set("Hours", Hours)
            .Set("Dollars", Dollars)
            .Set("PayRate", PayRate)
            .ToString());
 }
Ejemplo n.º 6
0
 public PayrollResponse(string rawResponse, PayrollEncoder encoder) : base(rawResponse)
 {
     Results = new List <TResult>();
     if (RawResults != null)
     {
         foreach (var result in RawResults)
         {
             var item = Activator.CreateInstance(typeof(TResult)) as TResult;
             item.FromJson(result, encoder);
             Results.Add(item);
         }
     }
 }
Ejemplo n.º 7
0
        internal PayrollRequest TerminateEmployeeRequest(PayrollEncoder encoder, object[] args)
        {
            var requestBody = new JsonDoc()
                              .Set("ClientCode", encoder.Encode(ClientCode))
                              .Set("EmployeeId", EmployeeId)
                              .Set("TerminationDate", TerminationDate?.ToString("MM/dd/yyyy"))
                              .Set("TerminationReasonId", TerminationReasonId)
                              .Set("InactivateDirectDepositAccounts", DeactivateAccounts ? 1 : 0)
                              .ToString();

            return(new PayrollRequest {
                Endpoint = @"/api/pos/employee/TerminateEmployee",
                RequestBody = requestBody
            });
        }
Ejemplo n.º 8
0
        internal PayrollRequest GetEmployeeRequest(PayrollEncoder encoder, object[] args)
        {
            var requestBody = new JsonDoc()
                              .Set("ClientCode", encoder.Encode(ClientCode))
                              .Set("EmployeeId", EmployeeId)
                              .Set("ActiveEmployeeOnly", Active)
                              .Set("EmployeeOffset", EmployeeOffset)
                              .Set("EmployeeCount", EmployeeCount)
                              .Set("FromDate", FromDate?.ToString("MM/dd/yyyy HH:mm:ss"))
                              .Set("ToDate", ToDate?.ToString("MM/dd/yyyy HH:mm:ss"))
                              .Set("PayTypeCode", EnumConverter.GetDescription(PayTypeCode))
                              .ToString();

            return(new PayrollRequest {
                Endpoint = (EmployeeId != null) ? "/api/pos/employee/GetEmployee" : "/api/pos/employee/GetEmployees",
                RequestBody = requestBody
            });
        }
Ejemplo n.º 9
0
        internal override void FromJson(JsonDoc doc, PayrollEncoder encoder)
        {
            Func <object, DateTime> dateConverter = (date) => {
                return(DateTime.Parse(date.ToString()));
            };

            ClientCode          = encoder.Decode(doc.GetValue <string>("ClientCode"));
            EmployeeId          = doc.GetValue <int>("EmployeeId");
            EmploymentStatus    = doc.GetValue("EmploymentStatus", EnumConverter.FromDescription <EmploymentStatus>);
            HireDate            = doc.GetValue("HireDate", dateConverter);
            TerminationDate     = doc.GetValue("TerminationDate", dateConverter);
            TerminationReasonId = doc.GetValue <string>("TerminationReasonId");
            EmployeeNumber      = doc.GetValue <string>("EmployeeNumber");
            EmploymentCategory  = doc.GetValue("EmploymentCategory", EnumConverter.FromDescription <EmploymentCategory>);
            TimeClockId         = doc.GetValue <int>("TimeClockId");
            FirstName           = doc.GetValue <string>("FirstName");
            LastName            = encoder.Decode(doc.GetValue <string>("LastName"));
            MiddleName          = doc.GetValue <string>("MiddleName");
            Ssn           = encoder.Decode(doc.GetValue <string>("Ssn"));
            Address1      = encoder.Decode(doc.GetValue <string>("Address1"));
            Address2      = doc.GetValue <string>("Address2");
            City          = doc.GetValue <string>("City");
            StateCode     = doc.GetValue <string>("StateCode");
            ZipCode       = encoder.Decode(doc.GetValue <string>("ZipCode"));
            MaritalStatus = doc.GetValue("MaritalStatus", EnumConverter.FromDescription <MaritalStatus>);

            // Birthday
            string birthday = encoder.Decode(doc.GetValue <string>("BirthDay"));

            if (!string.IsNullOrEmpty(birthday))
            {
                BirthDay = DateTime.Parse(birthday);
            }

            Gender         = doc.GetValue("Gender", EnumConverter.FromDescription <Gender>);
            PayGroupId     = doc.GetValue <int>("PayGroupId");
            PayTypeCode    = doc.GetValue("PayTypeCode", EnumConverter.FromDescription <PayTypeCode>);
            HourlyRate     = decimal.Parse(encoder.Decode(doc.GetValue <string>("HourlyRate")));
            PerPaySalary   = decimal.Parse(encoder.Decode(doc.GetValue <string>("PerPaySalary")));
            WorkLocationId = doc.GetValue <int>("WorkLocationId");
        }
Ejemplo n.º 10
0
        internal PayrollRequest GetCollectionRequestByType(PayrollEncoder encoder, object[] args)
        {
            var endpoints = new Dictionary <Type, string> {
                { typeof(TerminationReason), @"/api/pos/termination/GetTerminationReasons" },
                { typeof(WorkLocation), @"/api/pos/worklocation/GetWorkLocations" },
                { typeof(LaborField), @"/api/pos/laborField/GetLaborFields" },
                { typeof(PayGroup), @"/api/pos/payGroup/GetPayGroups" },
                { typeof(PayItem), @"/api/pos/payItem/GetPayItems" }
            };

            var type = args[0] as Type;

            var requestBody = new JsonDoc()
                              .Set("ClientCode", encoder.Encode(ClientCode))
                              .ToString();

            return(new PayrollRequest {
                Endpoint = endpoints[type],
                RequestBody = requestBody
            });
        }
Ejemplo n.º 11
0
        internal override void FromJson(JsonDoc doc, PayrollEncoder encoder)
        {
            base.FromJson(doc, encoder);

            if (Description == null)
            {
                Description = doc.GetValue <string>("LaborFieldTitle");
            }

            if (doc.Has("laborfieldLookups"))
            {
                Lookup = new List <LaborFieldLookup>();
                foreach (var lookup in doc.GetEnumerator("laborfieldLookups"))
                {
                    Lookup.Add(new LaborFieldLookup {
                        Description = lookup.GetValue <string>("laborFieldDescription"),
                        Value       = lookup.GetValue <string>("laborFieldValue")
                    });
                }
            }
        }
Ejemplo n.º 12
0
 internal override void FromJson(JsonDoc doc, PayrollEncoder encoder)
 {
     Id          = doc.GetValue <string>(_idField);
     Description = doc.GetValue <string>(_descriptionField);
 }
Ejemplo n.º 13
0
 internal override void FromJson(JsonDoc doc, PayrollEncoder encoder)
 {
     SessionToken = doc.GetValue <string>("SessionToken");
     ErrorMessage = doc.GetValue <string>("ErrorMessage");
 }
Ejemplo n.º 14
0
 internal abstract void FromJson(JsonDoc doc, PayrollEncoder encoder);
Ejemplo n.º 15
0
 internal override void FromJson(JsonDoc doc, PayrollEncoder encoder)
 {
     ClientCode = doc.GetValue("ClientCode", encoder.Decode);
     ClientName = doc.GetValue <string>("ClientName");
     FederalEin = int.Parse(doc.GetValue("FederalEin", encoder.Decode));
 }
Ejemplo n.º 16
0
 internal override void FromJson(JsonDoc doc, PayrollEncoder encoder)
 {
     base.FromJson(doc, encoder);
     Frequency = doc.GetValue("payFrequency", EnumConverter.FromDescription <PayGroupFrequency>);
 }
Ejemplo n.º 17
0
 internal override void FromJson(JsonDoc doc, PayrollEncoder encoder)
 {
     throw new NotImplementedException();
 }