Beispiel #1
0
        private psaUser.psaWorkdayResource Assemble(LinqToExcel.Row myRow)
        {
            psaUser.psaWorkdayResource myResource = new psaUser.psaWorkdayResource();
            myResource.careerInterests = myRow["Career Interests"].ToString();
            myResource.citizenship = myRow["Citizenship Status"].ToString();
            myResource.city = myRow["Work Address - City"].ToString();
            myResource.continuousServiceDate = DateTime.Parse(myRow["Continuous Service Date"].ToString());
            myResource.continuousServiceDateSpecified = true;
            myResource.costCenter = myRow["Cost Center - ID"].ToString();
            myResource.country = myRow["Work Address - Country"].ToString();
            string tmpEmail = myRow["Email - Primary Work"].ToString().Replace("@", "=");
            myResource.email = tmpEmail + "@example.com";
            myResource.firstName = myRow["Preferred Name - First Name"].ToString();
            myResource.lastName = myRow["Preferred Name - Last Name"].ToString();
            myResource.location = myRow["Work Address - Country"].ToString(); ;// myRow["Location"].ToString();
            myResource.managerId = myRow["Manager - Level 01 ID"].ToString();
            myResource.mobile = myRow["Mobile Phone"].ToString();
            myResource.phone = myRow["Phone - Primary Work"].ToString();
            myResource.startDate = DateTime.Parse(myRow["Original Hire Date"].ToString());
            myResource.startDateSpecified = true;
            myResource.state = myRow["Work Address - State/Province"].ToString();
            myResource.stateWitholding = myRow["State Withholding (Resident) - State"].ToString();

            string tempStreet = myRow["Work Address - Formatted Line 1"].ToString().TrimEnd() + "," + myRow["Work Address - Formatted Line 2"].ToString().TrimEnd() + "," + myRow["Work Address - Formatted Line 3"].ToString().TrimEnd();
            myResource.street = tempStreet;

            myResource.title = myRow["Position"].ToString();
            myResource.workdDayEmployeeId = myRow["Employee ID"].ToString();
            myResource.zip = myRow["Work Address - Postal Code"].ToString();
            myResource.currencyISOCode = myRow["Currency for Primary Position"].ToString();
            myResource.company = getCompanyData(myResource.costCenter);//"Manhattan Associates - India";
            myResource.contingentWorkerType = myRow["Contingent Worker Type"].ToString();
            myResource.departmentOwnerId = myRow["Manager - Level 03 ID"].ToString();

            DateTime temp;

            bool success = DateTime.TryParse(myRow["Last Day of Work"].ToString(), out temp);

            myResource.endDate = temp;
            myResource.endDateSpecified = success;

            myResource.groupLeadAltManagerId = myRow["Manager - Level 02 ID"].ToString();
            myResource.isContingentWorker = myRow["Worker is Contingent Worker"].Cast<bool>();
            myResource.isContingentWorkerSpecified = true;
            myResource.resourceRole = myRow["Work Experience"].ToString();
            myResource.techCode = myRow["Workday Account"].ToString();
            myResource.tenure = myRow["Length of Service in Months"].ToString();
            myResource.workerType = myRow["Position Worker Type"].ToString();

            //?????????????????????????????????
            //myResource.resourceStatus = myRow[""].ToString();
            // myResource.level = myRow[""].ToString();
            //myResource.timeType = myRow[""].ToString();
            myResource.weeklyScheduledHours = "40";// myRow[""].ToString();

            return myResource;
        }
Beispiel #2
0
 protected string getNewValue(mapping p_mapp,LinqToExcel.Row p_row)
 {
     string new_value = string.Empty;
     if (!p_mapp.new_name.Equals("DEFAULT"))
     {
         //TODO 應該是要用e_name 而不是new_name
         //這樣每家客戶不同時,就都要修正 Orz
         switch (p_mapp.new_name)
         {
             case "外勞人數":
             case "引進方式":
                 new_value = p_row[p_mapp.new_name].Value == DBNull.Value
                     ? "0"
                     : p_row[p_mapp.new_name].Value.ToString();
                 break;
             case "性別":
                 new_value = p_row[p_mapp.new_name] == "女" ? "'F'" : "'M'";
                 break;
             case "生日":
             case "入境日":
             case "護照期限":
             case "聘可期限":
             case "居留期限":
             case "護照效期":
             case "出生日期":
             case "入境日期":
             case "實際離境日":
             case "居留證效期":
             case " 招募函發函日期":
             case "聘雇許可函發函日期":
                 if (p_row[p_mapp.new_name].Value == DBNull.Value)
                 {
                     new_value = "{^//}";
                 }
                 else
                 {
                     new_value = "{^" + Convert.ToDateTime(p_row[p_mapp.new_name]).ToShortDateString() + "}";
                 }
                 break;
             case "外勞狀態":
                 new_value = "1";
                 break;
             default:
                 new_value = string.Format("'{0}'"
                     , p_row[p_mapp.new_name] == null ? string.Empty : p_row[p_mapp.new_name]);
                 break;
         }
     }
     else
     {
         if (p_mapp.e_name.Equals("CUST_SN") || p_mapp.e_name.Equals("LBR_SN"))
         {
             new_value = cust_sn.ToString();
         }
         else
         {
             new_value = getDefaultValue(p_mapp.field_type);
         }
     }
     return new_value;
 }
Beispiel #3
0
        private psaUser.psaWorkdayPTO AssemblePTO(LinqToExcel.Row myRow)
        {
            psaUser.psaWorkdayPTO myPTO = new psaUser.psaWorkdayPTO();

            myPTO.dayOfWeek = DateTime.Parse(myRow["Date"]).DayOfWeek.ToString() ;
            myPTO.hours = System.Convert.ToInt32(myRow["Requested"].Value);
            myPTO.hoursSpecified = true;
            myPTO.timeOffDate = DateTime.Parse(myRow["Date"]);
            myPTO.timeOffDateSpecified=true;
            myPTO.workDayPTOId = myRow["Spreadsheet Key"].ToString();
            myPTO.workdDayEmployeeId = myRow["Employee"].ToString();

            return myPTO;
        }
Beispiel #4
0
 private string[] GenerateValuesFromExcelRowNoHeader(LinqToExcel.RowNoHeader row)
 {
     string[] values = new String[row.ToArray().Length];
     var count = 0;
     foreach (var value in row.ToArray())
     {
         values[count] = value.ToString();
         count++;
     }
     return values;
 }