Exemple #1
0
        private void Upt()
        {
            var conteo = 0;

            for (var i = 0; i < gr_documentos.Rows.Count; i++)
            {
                var row = gr_documentos.Rows[i];

                var idFamilia         = Convert.ToInt32(dlFamilia.SelectedValue);
                var idCliente         = Convert.ToInt32(dlClientes.SelectedValue);
                var idDocumento       = Convert.ToInt32(gr_documentos.DataKeys[row.RowIndex].Values[0]);
                var dlSiguienteEstado = (DropDownList)gr_documentos.Rows[i].FindControl("dlEstados");

                var doc = new DocumentoCambioEstado
                {
                    IdDocumento           = idDocumento,
                    IdCliente             = idCliente,
                    IdFamilia             = idFamilia,
                    SiguienteCodigoEstado = Convert.ToInt32(dlSiguienteEstado.SelectedValue)
                };

                if (dlSiguienteEstado.SelectedValue != "0")
                {
                    new DocumentoCambioEstadoBC().AddDocumentosCambioEstado(doc);
                    conteo += 1;
                }
                else
                {
                    new DocumentoCambioEstadoBC().DelDocumentosCambioEstado(doc);
                }
            }

            Mensaje("Existen " + conteo + " Documentos que cambian estado.");
        }
Exemple #2
0
 public List <DocumentoCambioEstado> GetAllDocumentosCambioEstado(int idFamilia, int idCliente)
 {
     try
     {
         using (var sqlConn = new SqlConnection(this.strConn))
         {
             sqlConn.Open();
             var cmd = new SqlCommand(strConn, sqlConn);
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             cmd.CommandText = "sp_get_documentoCambioEstado";
             cmd.Parameters.AddWithValue("@id_cliente", idCliente);
             cmd.Parameters.AddWithValue("@id_familia", idFamilia);
             var reader = cmd.ExecuteReader();
             var lista  = new List <DocumentoCambioEstado>();
             while (reader.Read())
             {
                 var d = new DocumentoCambioEstado();
                 d.IdDocumento           = Convert.ToInt32(reader["id_documento"]);
                 d.IdCliente             = Convert.ToInt32(reader["id_cliente"]);
                 d.SiguienteCodigoEstado = Convert.ToInt32(reader["siguiente_codigo_estado"]);
                 d.IdFamilia             = Convert.ToInt32(reader["id_familia"]);
                 d.NombreDocumento       = reader["nombre"].ToString();
                 lista.Add(d);
             }
             return(lista);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
 public void DelDocumentosCambioEstado(DocumentoCambioEstado doc)
 {
     try
     {
         using (var sqlConn = new SqlConnection(this.strConn))
         {
             sqlConn.Open();
             var cmd = new SqlCommand(strConn, sqlConn);
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             cmd.CommandText = "sp_del_documento_cambioEstado";
             cmd.Parameters.AddWithValue("@id_documento", doc.IdDocumento);
             cmd.Parameters.AddWithValue("@id_familia", doc.IdFamilia);
             cmd.Parameters.AddWithValue("@id_cliente", doc.IdCliente);
             cmd.ExecuteNonQuery();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #4
0
 public void DelDocumentosCambioEstado(DocumentoCambioEstado doc)
 {
     new DocumentoCambioEstadoDAC().DelDocumentosCambioEstado(doc);
 }
Exemple #5
0
 public void AddDocumentosCambioEstado(DocumentoCambioEstado doc)
 {
     new DocumentoCambioEstadoDAC().AddDocumentosCambioEstado(doc);
 }