Timesheet data is returning no value with psi
-
18 iunie 2010 14:11
To whom it may concern:
I had been using the sdk to work with psi. I am new to psi. Trying to read some data off the project server. I was able to read it with no problem. Now, I am putting the program together. It does contains two records in the database. But with the current code I have, I am not returning any value. Am I doing something wrong? Any help will my truly appreciate.
Thanks,
kkmick
public static void ReadTimeSheet()
{
List<string> timesheethold = new List<string>();
SqlConnection conn;
SqlDataReader sdr;conn = new SqlConnection("Data Source=xxx;Initial Catalog=Prod_ProjectServer_Reporting; Integrated Security=SSPI");
conn.Open();string sqlString = "select t.perioduid, startdate, enddate, timesheetuid, OwnerResourceNameUID from msp_timesheetperiod t inner join msp_timesheet m on t.perioduid= m.perioduid and m.timesheetstatusid=3";
SqlCommand cmd = new SqlCommand(sqlString, conn);sdr = cmd.ExecuteReader();
while(sdr.Read())
{
sPeriodGuid =sdr[0].ToString();
sStartDate = sdr[1].ToString();
sEndDate = sdr[2].ToString();
sTimesheetUid = sdr[3].ToString();
sResourceUid = sdr[4].ToString();
timesheethold.Add (sPeriodGuid);
timesheethold.Add(sStartDate);
timesheethold.Add(sEndDate);
timesheethold.Add(sTimesheetUid);
timesheethold.Add(sResourceUid);
}string str;
foreach (object obj in timesheethold)
{
sPeriodGuid = timesheethold[0].ToString();
sStartDate = timesheethold[1].ToString();
sEndDate = timesheethold[2].ToString();
sTimesheetUid = timesheethold[3].ToString();
sResourceUid = timesheethold[4].ToString();
//declare the dataset
WebSvcTimesheet.TimesheetDataSet timesheetDs;//Resource Credentials
resource.Url = PROJECT_SERVER_URI + RESOURCE_SERVICE_PATH;
resource.Credentials = CredentialCache.DefaultCredentials;//Timesheet Credentials
timesheet.Url = PROJECT_SERVER_URI + TIMESHEET_SERVICE_PATH;
timesheet.Credentials = CredentialCache.DefaultCredentials;
// AdminWebSvc.Admin adminSvc = new AdminWebSvc.Admin();
admin.Url = PROJECT_SERVER_URI + ADMIN_SERVICE_PATH;
admin.UseDefaultCredentials = true;DateTime startDate = Convert.ToDateTime(sStartDate);
DateTime finishDate = Convert.ToDateTime(sEndDate);Guid gPeriodGuid = new Guid(sPeriodGuid);
Guid gResourceGuid = new Guid(sResourceUid);
XXXProjectServerExport.WebSvcAdmin.TimePeriodDataSet timeperiodDs = admin.ReadPeriods(xxxProjectServerExport.WebSvcAdmin.PeriodState.All);timesheetDs = timesheet.ReadTimesheetByPeriod(gResourceGuid, gPeriodGuid, xxxProjectServerExport.WebSvcTimesheet.Navigation.Current);
foreach (WebSvcTimesheet.TimesheetDataSet.ActualsRow actual in timesheetDs.Actuals){
decimal billable_overtime_milliseconds = actual.TS_ACT_OVT_VALUE;
decimal billable_milliseconds = actual.TS_ACT_VALUE;
decimal non_billable_overtime_milliseconds = actual.TS_ACT_NON_BILLABLE_OVT_VALUE;
decimal non_billable_milliseconds = actual.TS_ACT_NON_BILLABLE_VALUE;
}
}
Toate mesajele
-
22 iunie 2010 09:41
Hi kkmick,
try this code to read your timesheet.
public static void ReadTimeSheet()
{
//Timesheet Credentials
timeSheetWS.Url = PROJECT_SERVER_URI + TIMESHEET_SERVICE_PATH;
timeSheetWS.Credentials = CredentialCache.DefaultCredentials;
WebSvcTimesheet.TimesheetListDataSet timeSheetList = timeSheetWS.ReadTimesheetList(userUID, date, date, 1);
Guid timeSheetUID = (Guid)timeSheetList.Tables[0].Rows[timeSheetList.Tables[0].Rows.Count - 1]["TS_UID"];
WebSvcTimesheet.TimesheetDataSet timeSheetDS = timeSheetWS.ReadTimesheet(timeSheetUID);foreach (WebSvcTimesheet.TimesheetDataSet.ActualsRow actual in timesheetDs.Actuals)
{
decimal billable_overtime_milliseconds = actual.TS_ACT_OVT_VALUE;decimal billable_milliseconds = actual.TS_ACT_VALUE;
decimal non_billable_overtime_milliseconds = actual.TS_ACT_NON_BILLABLE_OVT_VALUE;
decimal non_billable_milliseconds = actual.TS_ACT_NON_BILLABLE_VALUE;
}
}Best regards,
Jorge.
[ The ultimate for Project Server 2007 || http://www.projecttimesheet.com/about-en.php ]
- Marcat ca răspuns de Christophe FiessingerMicrosoft Employee, Owner 22 iunie 2010 13:24
-
22 iunie 2010 13:31
Hi Jorge:
Thanks again. I really appreicate your assistance. You have been absolutely very helpful.
Thanks,
kkmick.
-
23 iunie 2010 20:36
Hi Jorge:
The code that you gave me it works perfectly. I really appreciate your help with it.
Thanks,
kkmick
- Marcat ca răspuns de kkmick 23 iunie 2010 20:36