Exemplo n.º 1
0
 public static string actionToExecuteStatic(string status, string comment)
 {
     try
     {
         bool active = checkActiveSessionStatic();
         if (active)
         {
             if (comment == null)
             {
                 return("null");
             }
             string    timesheetString = (string)HttpContext.Current.Session["CONSULTED_TIMESHEET_HRM"];
             Timesheet timesheet       = new Timesheet(Int64.Parse(timesheetString));
             timesheet.comment = comment;
             timesheet.status  = status;
             UpdateTimesheetStatusCommand cmd = new UpdateTimesheetStatusCommand(timesheet);
             cmd.Execute();
             int result = cmd.GetResult();
             if (result == 200)
             {
                 return("ok");
             }
             else
             {
                 return("reject");
             }
         }
         return("");
     }
     catch (Exception ex)
     {
         return("error");
     }
 }
Exemplo n.º 2
0
 public void actionToExecute(string status, string comment)
 {
     try
     {
         bool active = checkActiveSession();
         if (active)
         {
             string    timesheetString = (string)HttpContext.Current.Session["CONSULTED_TIMESHEET_HRM"];
             Timesheet timesheet       = new Timesheet(Int64.Parse(timesheetString));
             timesheet.comment = comment;
             timesheet.status  = status;
             UpdateTimesheetStatusCommand cmd = new UpdateTimesheetStatusCommand(timesheet);
             cmd.Execute();
             int result = cmd.GetResult();
             if (result == 200)
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "randomText", "sweetAlertNoRedirect('Se ha actualizado la hoja de tiempo exitosamente', 'success')", true);
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, this.GetType(), "randomText", "errorSweetAlert('No se ha podido actualizar la hoja de trabajo', 'error')", true);
             }
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "randomText", "errorSweetAlert('Se ha generado un error procesando su solicitud', 'error')", true);
     }
 }