Beispiel #1
0
        public List <Informe_EstadosOT> Listado_EstadoOT(string Ot, string nombreOT, string Cliente, DateTime FechaInicio, DateTime FechaTermino, string Estado, int Procedimiento)
        {
            List <Informe_EstadosOT> lista = new List <Informe_EstadosOT>();
            Conexion   conexion            = new Conexion();
            SqlCommand cmd = conexion.AbrirConexionIntranet();
            string     not = "";

            try
            {
                if (cmd != null)
                {
                    cmd.CommandText = "Logistica_InformeEstadoOT";
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@OT", Ot);
                    cmd.Parameters.AddWithValue("@NombreOT", nombreOT);
                    cmd.Parameters.AddWithValue("@Cliente", Cliente);
                    cmd.Parameters.AddWithValue("@FechaInicio", FechaInicio);
                    cmd.Parameters.AddWithValue("@FechaTermino", FechaTermino);
                    cmd.Parameters.AddWithValue("@Estado", Estado);
                    cmd.Parameters.AddWithValue("@Procedimiento", Procedimiento);
                    cmd.CommandTimeout = 99999999;
                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        Informe_EstadosOT p = new Informe_EstadosOT();
                        p.OT           = reader["NumOrdem"].ToString();
                        not            = p.OT;
                        p.NombreOT     = reader["descricao"].ToString().ToLower();
                        p.Cliente      = reader["nomeCliente"].ToString().ToLower();
                        p.FechaEmision = Convert.ToDateTime(reader["dtEmissao"].ToString()).ToString("dd/MM/yyyy");
                        p.FechaEntrega = ((reader["FechaEntrega"].ToString() == null || reader["FechaEntrega"].ToString() == "") ? "" : Convert.ToDateTime(reader["FechaEntrega"].ToString()).ToString("dd/MM/yyyy HH:mm"));
                        p.Tiraje       = Convert.ToInt32(reader["Tiraje"].ToString()).ToString("N0").Replace(",", ".");
                        p.Estado       = reader["Estado"].ToString();
                        lista.Add(p);
                    }
                }
            }catch (Exception ex)
            {
                string a = not;
            }
            conexion.CerrarConexion();
            return(lista);
        }
Beispiel #2
0
        protected void ibExcel_Click(object sender, ImageClickEventArgs e)
        {
            string oot = "";

            try
            {
                List <Informe_EstadosOT> lista = new List <Informe_EstadosOT>();
                if (RadGrid1.Items.Count > 0)
                {
                    for (int i = 0; i < RadGrid1.Items.Count; i++)
                    {
                        Informe_EstadosOT p = new Informe_EstadosOT();
                        p.OT           = RadGrid1.Items[i]["OT"].Text;
                        oot            = p.OT;
                        p.NombreOT     = RadGrid1.Items[i]["NombreOT"].Text;
                        p.Cliente      = RadGrid1.Items[i]["Cliente"].Text;
                        p.FechaEmision = RadGrid1.Items[i]["FechaEmision"].Text;
                        p.FechaEntrega = RadGrid1.Items[i]["FechaEntrega"].Text.Replace("&nbsp;", "");
                        p.Tiraje       = RadGrid1.Items[i]["Tiraje"].Text.Replace(".", "");
                        p.Estado       = RadGrid1.Items[i]["Estado"].Text;
                        lista.Add(p);
                    }
                    GridView GridView1 = new GridView();
                    GridView1.DataSource = lista;
                    GridView1.DataBind();
                    GridView1.HeaderStyle.BackColor = System.Drawing.Color.Blue;
                    GridView1.HeaderStyle.ForeColor = System.Drawing.Color.White;

                    ExportToExcel("Estados_OT", "", GridView1);
                }
            }
            catch (Exception ex)
            {
                string a = oot;
            }
        }