コード例 #1
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";
            GeneratePDF pdf = new GeneratePDF();

            pdf.ManipulatePdf("C:\\Users\\Norman\\Documents\\pdf\\simple_table.pdf");
            return(View());
        }
コード例 #2
0
        public int GetClientes(String id, String id2, string id3, string id4)
        {
            //id=email
            //id2=cliente
            //id3=es email?
            //id4=sucursal


            int res = 0;

            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["promovil_rest.Properties.Settings.Conexion"].ConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("sp_select_estado_cuenta", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@cliente", SqlDbType.VarChar).Value  = id2.ToString();
                    cmd.Parameters.Add("@sucursal", SqlDbType.VarChar).Value = id4.ToString();
                    if (con.State != ConnectionState.Open)
                    {
                        con.Open();
                    }
                    SqlDataAdapter adp = new SqlDataAdapter();
                    adp.TableMappings.Add("Table", "cuentas");
                    adp.SelectCommand = cmd;
                    adp.Fill(ds);

                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                }
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (id3 == "1")
                {
                    string fecha = DateTime.Now.ToString("yyyy-MM-dd");
                    list = datasetToJson(ds);
                    string cliente = list[0].Cliente.ToString();
                    pdf = new GeneratePDF();

                    string path = "C:\\Estados de cuenta\\" + cliente + fecha + ".pdf";
                    // string path = "C:\\Users\\Norman\\Documents\\Cotizaciones\\" + cliente + fecha + ".pdf";

                    pdf.ManipulatePdf(path, list);
                    email(BODY + fecha, path, id, cliente);
                }
                res = 1;
            }
            return(res);
        }