Exemplo n.º 1
0
        protected void btnInformarProblema_Click(object sender, EventArgs e)
        {
            int suspendedStatusId = 9;

            if (string.IsNullOrWhiteSpace(txtDescription.Text))
            {
                lblMessage.Text = "Causa de problema no puede ser vacío";
            }
            else
            {
                ProcessedTask processedTask = new ProcessedTask()
                {
                    Id = int.Parse(lblInternalId.Text)
                };
                if (processedTask.Read() && processedTask.TaskAssignment.ReceiverUser.Id == ((User)Session["ses"]).Id)
                {
                    processedTask.IdTaskStatus = suspendedStatusId;
                    processedTask.Commentary   = txtDescription.Text;
                    processedTask.Update();
                    Response.Redirect("VerTareasActivas.aspx");
                }
                else
                {
                    lblMessage.Text = "Error desconocido.";
                }
            }
        }
        protected void btnRechazar_Click(object sender, EventArgs e)
        {
            int rejectedStatusId = 5;

            if (string.IsNullOrWhiteSpace(txtDescription.Text))
            {
                lblMessage.Text = "Motivo de rechazo no puede ser vacío";
            }
            else
            {
                ProcessedTask processedTask = new ProcessedTask()
                {
                    Id = int.Parse(lblInternalId.Text)
                };
                if (processedTask.Read() && processedTask.TaskAssignment.ReceiverUser.Id == ((User)Session["ses"]).Id)
                {
                    processedTask.IdTaskStatus = rejectedStatusId;
                    processedTask.Commentary   = txtDescription.Text;
                    processedTask.Update();
                    Response.Redirect("TareasAsignadas.aspx");
                }
                else
                {
                    lblMessage.Text = "Error desconocido.";
                }
            }
        }
        protected void btnEditar_Click(object sender, EventArgs e)
        {
            int      reassignedStatusId = 4;
            DateTime startDate;
            DateTime endDate;

            if (string.IsNullOrWhiteSpace(txtDescripcion.Text) || string.IsNullOrWhiteSpace(txtNombreTarea.Text) || DateTime.TryParse(txtFechaInicio.Text, out startDate) == false || DateTime.TryParse(txtFechaFin.Text, out endDate) == false)
            {
                lblMessage.Text = "Los datos ingresados son inválidos";
            }
            else
            {
                ProcessedTask processedTask = new ProcessedTask()
                {
                    Id = int.Parse(lblInternalId.Text)
                };
                if (processedTask.Read() && processedTask.TaskAssignment.AssignerUser.Id == ((User)Session["ses"]).Id)
                {
                    if (processedTask.TaskAssignment.Task.IsPredefined == false)
                    {
                        processedTask.TaskAssignment.Task.Name        = txtNombreTarea.Text;
                        processedTask.TaskAssignment.Task.Description = txtDescripcion.Text;
                        processedTask.TaskAssignment.Task.Update();
                    }
                    processedTask.Commentary                  = null;
                    processedTask.StartDate                   = startDate;
                    processedTask.EndDate                     = endDate;
                    processedTask.AssignationDate             = DateTime.Now;
                    processedTask.IdTaskStatus                = reassignedStatusId;
                    processedTask.TaskAssignment.ReceiverUser = new User(int.Parse(ddlResponsable.SelectedValue));
                    processedTask.TaskAssignment.Update();
                    processedTask.TaskAssignment.Task.Update();
                    processedTask.Update();
                    Response.Redirect("AdministrarTareaRechazada.aspx");
                }
                else
                {
                    lblMessage.Text = "Error desconocido.";
                }
            }
        }
Exemplo n.º 4
0
        protected void btnSubFinalizar_Click(object sender, EventArgs e)
        {
            int          CompleteTaskId = 3;
            int          errorCode      = -1;
            LinkButton   button         = (LinkButton)sender;
            RepeaterItem item           = (RepeaterItem)button.NamingContainer;
            int          rowTaskId      = GetRowTaskId(item);

            if (rowTaskId != errorCode)
            {
                ProcessedTask processedTask = new ProcessedTask()
                {
                    Id = rowTaskId
                };
                processedTask.Read();
                processedTask.IdTaskStatus = CompleteTaskId;
                processedTask.Update();
            }

            Response.Redirect("VerTareasActivas.aspx");
        }
        protected void btnSubAceptar_Click(object sender, EventArgs e)
        {
            int          InProcessId = 2;
            int          errorCode   = -1;
            LinkButton   button      = (LinkButton)sender;
            RepeaterItem item        = (RepeaterItem)button.NamingContainer;
            int          rowTaskId   = GetRowTaskId(item);

            if (rowTaskId != errorCode)
            {
                ProcessedTask processedTask = new ProcessedTask()
                {
                    Id = rowTaskId
                };
                processedTask.Read();
                processedTask.IdTaskStatus = InProcessId;
                processedTask.Update();
            }

            Response.Redirect("TareasAsignadas.aspx");
        }
        protected void btnSubEliminarProblema_Click(object sender, EventArgs e)
        {
            divEditarInfo.Visible = false;
            int          failedId  = 7;
            int          errorCode = -1;
            LinkButton   button    = (LinkButton)sender;
            RepeaterItem item      = (RepeaterItem)button.NamingContainer;
            int          rowTaskId = GetRowTaskId(item, failedId);

            if (rowTaskId != errorCode)
            {
                ProcessedTask processedTask = new ProcessedTask()
                {
                    Id = rowTaskId
                };
                processedTask.Read();
                processedTask.IdTaskStatus = failedId;
                processedTask.Update();
            }

            Response.Redirect("AdministrarTareaRechazada.aspx");
        }