Example #1
0
        public List <entTask> listartask()
        {
            SqlCommand     cmd   = null;
            SqlDataReader  dr    = null;
            List <entTask> Lista = null;

            try
            {
                SqlConnection conexion = Conexion.Instancia.conecta();
                cmd = new SqlCommand("spListarTask", conexion);

                cmd.CommandType = CommandType.StoredProcedure;
                conexion.Open();
                dr    = cmd.ExecuteReader();
                Lista = new List <entTask>();
                while (dr.Read())
                {
                    entTask task = new entTask();
                    task.Id_Task        = Convert.ToInt32(dr["Id_Task"].ToString());
                    task.Cod_Task       = dr["Cod_Task"].ToString();
                    task.Descrip_Task   = dr["Descrip_Task"].ToString();
                    task.Date_StartTask = dr["Date_StartTask"].ToString();
                    task.Date_EndTask   = dr["Date_EndTask"].ToString();
                    task.Status_Task    = dr["Status_Task"].ToString();
                    Lista.Add(task);
                }
            }

            catch (Exception) { throw; }
            finally { cmd.Connection.Close(); }
            return(Lista);
        }
Example #2
0
        public entTask BuscarTask2(int idtask)
        {
            SqlCommand    cmd  = null;
            SqlDataReader dr   = null;
            entTask       task = null;

            try
            {
                SqlConnection cn = Conexion.Instancia.conecta();
                cmd = new SqlCommand("spBuscarTask2", cn);
                cmd.Parameters.AddWithValue("@prmidTask", idtask);
                cmd.CommandType = CommandType.StoredProcedure;
                cn.Open();
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    task                = new entTask();
                    task.Id_Task        = Convert.ToInt32(dr["Id_Task"]);
                    task.Cod_Task       = dr["Cod_Task"].ToString();
                    task.Descrip_Task   = dr["Descrip_Task"].ToString();
                    task.Date_StartTask = dr["Date_StartTask"].ToString();
                    task.Date_EndTask   = dr["Date_EndTask"].ToString();
                    task.Status_Task    = dr["Status_Task"].ToString();
                }
            }
            catch (Exception) { throw; }
            finally { cmd.Connection.Close(); }
            return(task);
        }
Example #3
0
 private void dgvTask_CellClick_2(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         int     idtask = Convert.ToInt32(dgvTask.CurrentRow.Cells[0].Value);
         entTask task   = null;
         task                    = negTask.Instancia.BuscarTask2(idtask);
         txtIdTask.Text          = task.Id_Task.ToString();
         txtCodigoTask.Text      = task.Cod_Task.ToString();
         txtDescriptTask.Text    = task.Descrip_Task.ToString();
         dtpFechInicioTask.Value = Convert.ToDateTime(task.Date_StartTask);
         dtpFechFinTask.Value    = Convert.ToDateTime(task.Date_EndTask);
         txtEstadoTask.Text      = task.Status_Task.ToString();
         txtBuscarTask.Text      = "";
         if (task.Status_Task == "B")
         {
             txtEstadoTask.BackColor = Color.Red;
         }
         else
         {
             txtEstadoTask.BackColor = Color.Green;
         }
         AccionBotones(true, false, false, true, true);
         accion.bloquartxt(this.tabPage1, false);
         accion.bloqueardtp(this.tabPage1, false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #4
0
        private void btnGrabar_Click_2(object sender, EventArgs e)
        {
            try
            {
                entTask t           = new entTask();
                int     tipoedicion = 1;
                if (txtIdTask.Text != "")
                {
                    tipoedicion = 2; t.Id_Task = Convert.ToInt32(txtIdTask.Text);
                }

                t.Descrip_Task   = txtDescriptTask.Text;
                t.Date_StartTask = Convert.ToString(dtpFechInicioTask.Value.ToString("yyyy/MM/dd"));
                t.Date_EndTask   = Convert.ToString(dtpFechFinTask.Value.ToString("yyyy/MM/dd"));
                t.Status_Task    = "A";
                int r = negTask.Instancia.mantenimientotask(t, tipoedicion);
                LlenarGrip();
                MessageBox.Show("Tarea insertada correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                AccionBotones(true, false, false, true, false);
                accion.bloquartxt(this.tabPage1, false);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #5
0
 public entTask BuscarTask2(int idtask)
 {
     try
     {
         entTask task = null;
         task = datTask.Instancia.BuscarTask2(idtask);
         if (task == null)
         {
             throw new ApplicationException("No hay registros");
         }
         return(task);
     }
     catch (Exception) { throw; }
 }
Example #6
0
        public int mantenimientotask(entTask t, int tipoedicion)
        {
            try
            {
                String CadXml = "";
                CadXml += "<task ";
                CadXml += "idtask='" + t.Id_Task + "' ";
                CadXml += "descriptask='" + t.Descrip_Task + "' ";
                CadXml += "datestarttask='" + t.Date_StartTask + "' ";
                CadXml += "dateendtask='" + t.Date_EndTask + "' ";
                CadXml += "statustask='" + t.Status_Task + "' ";
                CadXml += "tipoedicion='" + tipoedicion + "' /> ";

                CadXml = "<root>" + CadXml + "</root>";
                int resultado = datTask.Instancia.mantenimientotask(CadXml);
                if (resultado <= 0)
                {
                    throw new ApplicationException("Error al cargar las tareas");
                }
                return(resultado);
            }
            catch (Exception) { throw; }
        }