P
Parth
Hi,
I am developing cutom app using PSI and i want to insert timesheet data that
i have Achieved using QueueUpdateTimesheet and i am doing it Succesfully,
So when i am looking at my PWA site i am able to see it in progress,
But also i want to Submit my timesheet so that i am using
QueueSubmitTimesheet method but befotre that i have to have approve the
timesheet for NonProjectTime for that i am using ApproveNonProjectTime Method
which is in return giving me Error.
can anybody help me out with this??
Following is my code
try
{
da = new SqlDataAdapter("select ResourceNameUID from
msp_timesheetResource where ResourceName='" +
HttpContext.Current.User.Identity.Name.Substring(i) + "'", con);
ds.Clear();
da.Fill(ds);
Guid a = new Guid(ds.Tables[0].Rows[0][0].ToString());
Guid b = new Guid(Label1.Text); //Period UID
Guid p = new Guid(Label2.Text); //Timesheet UID
abc();
AdminWebSvc.TimePeriodDataSet timeperiodDs =
adminSvc.ReadPeriods(AdminWebSvc.PeriodState.Open);
//AdminWebSvc.TimePeriodDataSet.TimePeriodsRow timePeriodsRow =
timeperiodDs.TimePeriods.FindByWPRD_UID(b);
timesheetDs = timeSheet.ReadTimesheet(p);
WbsvTimesheet.TimesheetDataSet.LinesRow[] approvalNeeded =
(WbsvTimesheet.TimesheetDataSet.LinesRow[])timesheetDs.Lines.Select("TS_LINE_CLASS_NEED_APPROVAL = true");
if (approvalNeeded.Length < 1)
{
throw (new ApplicationException("No lines requiring approval
were found on the timesheet.\r\nChange your server settings so that one
default admin type requires approval."));
}
else
{
try
{
Guid jobUid1 = Guid.NewGuid();
abc();
timeSheet.ApproveNonProjectTime(new Guid[] {
approvalNeeded[0].TS_LINE_UID}, null);
timeSheet.QueueSubmitTimesheet(jobUid1, p, a, "This
won't work the first time.");
WaitJob(jobUid1);
}
catch (Exception ex)
{
throw (new ApplicationException("Some Error duuring
nonProject Timesheet Approval Or Submitting Unsuccesful."));
}
}
ScriptManager.RegisterStartupScript(this, this.GetType(),
"alert", "window.alert('Timesheet Submitted.');", true);
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this, this.GetType(),
"alert", "window.alert('Error: During Timesheet Creation.');", true);
}
I am developing cutom app using PSI and i want to insert timesheet data that
i have Achieved using QueueUpdateTimesheet and i am doing it Succesfully,
So when i am looking at my PWA site i am able to see it in progress,
But also i want to Submit my timesheet so that i am using
QueueSubmitTimesheet method but befotre that i have to have approve the
timesheet for NonProjectTime for that i am using ApproveNonProjectTime Method
which is in return giving me Error.
can anybody help me out with this??
Following is my code
try
{
da = new SqlDataAdapter("select ResourceNameUID from
msp_timesheetResource where ResourceName='" +
HttpContext.Current.User.Identity.Name.Substring(i) + "'", con);
ds.Clear();
da.Fill(ds);
Guid a = new Guid(ds.Tables[0].Rows[0][0].ToString());
Guid b = new Guid(Label1.Text); //Period UID
Guid p = new Guid(Label2.Text); //Timesheet UID
abc();
AdminWebSvc.TimePeriodDataSet timeperiodDs =
adminSvc.ReadPeriods(AdminWebSvc.PeriodState.Open);
//AdminWebSvc.TimePeriodDataSet.TimePeriodsRow timePeriodsRow =
timeperiodDs.TimePeriods.FindByWPRD_UID(b);
timesheetDs = timeSheet.ReadTimesheet(p);
WbsvTimesheet.TimesheetDataSet.LinesRow[] approvalNeeded =
(WbsvTimesheet.TimesheetDataSet.LinesRow[])timesheetDs.Lines.Select("TS_LINE_CLASS_NEED_APPROVAL = true");
if (approvalNeeded.Length < 1)
{
throw (new ApplicationException("No lines requiring approval
were found on the timesheet.\r\nChange your server settings so that one
default admin type requires approval."));
}
else
{
try
{
Guid jobUid1 = Guid.NewGuid();
abc();
timeSheet.ApproveNonProjectTime(new Guid[] {
approvalNeeded[0].TS_LINE_UID}, null);
timeSheet.QueueSubmitTimesheet(jobUid1, p, a, "This
won't work the first time.");
WaitJob(jobUid1);
}
catch (Exception ex)
{
throw (new ApplicationException("Some Error duuring
nonProject Timesheet Approval Or Submitting Unsuccesful."));
}
}
ScriptManager.RegisterStartupScript(this, this.GetType(),
"alert", "window.alert('Timesheet Submitted.');", true);
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this, this.GetType(),
"alert", "window.alert('Error: During Timesheet Creation.');", true);
}