private void Print(List<Item> items)
        {
            bsp.openPDF();
            if (items.Count % 2 == 0)
            {
                int count = 0;
                while(count < items.Count)
                {
                    bsp.addToPDF(items[count], items[count +1]);
                    count = count + 2;
                }
            }
            else
            {
                int count = items.Count;
                int index = 0;
                while (count > 0)
                {

                    if (count >=2)
                    {
                        bsp.addToPDF(items[index], items[index + 1]);
                        count = count - 2;
                        index += 2;
                    }
                    else if(count ==1)
                    {
                        bsp.addToPDFWithOneItem(items[index]);
                        count = count - 1;
                        index -= 1;
                    }
                }
            }
            bsp.closePDF();
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            PresupuestoEntidad presupuesto = new PresupuestoEntidad();
            List<DetallePresupuestoEntidad> listaDetalle = new List<DetallePresupuestoEntidad>();
            List<MatrizEntidad> listaMatrices = (List<MatrizEntidad>)Session["carritoPresupuesto"];

            decimal total = (decimal)Session["totalPresupuesto"];

            presupuesto.cliente = int.Parse(ddlClientes.SelectedValue);
            presupuesto.numero = int.Parse(txtnumeroPresupuesto.Text);
            presupuesto.fecha = DateTime.Parse(txtFechaPresupuesto.Text);
            presupuesto.fechaEntrega = DateTime.Parse(FechaEntrega.Text);
            presupuesto.periodoVigencia = DateTime.Parse(FechaVencimiento.Text);
            presupuesto.total = total;

            foreach (var matriz in listaMatrices)
            {
                DetallePresupuestoEntidad detalle = new DetallePresupuestoEntidad();
                string nombreMatriz = matriz.nombreArchivo;
                detalle.idMatriz = MatrizGestor.buscarIdMatriz(nombreMatriz);
                detalle.cantidad = matriz.cantidad;
                detalle.precio = matriz.precio;
                detalle.subtotal = matriz.subTotal;
                listaDetalle.Add(detalle);
            }
            PresupuestoGestor.guardarPresupuesto(presupuesto, listaDetalle);

            resetearTodo();
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //我这在后台模拟数据库数据 你看下
            List<Produce> listp = new List<Produce>();

            for (int i = 0; i < 6; i++)
            {
                Produce p = new Produce();

                p.Id = i + 1;
                p.Pname = "厂家" + i + 1;
                p.Paddress = "厂家地址" + i;
                p.PPersong = "张三" + i;
                listp.Add(p);
            }

            List<Goods> listgoods = new List<Goods>();
            for (int i = 0; i < 6; i++)
            {
                Goods g = new Goods();
                g.goodsdecription = "ddd" + i;
                g.goodsnum = "goods" + i;
                g.goodsname = "goods" + i + "2";
                g.Id = i + 1;
                //g.goodsPId = listp.Single(p => p.Id == 3).Paddress;
                listgoods.Add(g);
            }
            GridView1.DataSource = listgoods;
            GridView1.DataBind();

            int u = 1;
        }
        protected void Unnamed1_Click(object sender, EventArgs e)
        {
            string connStr = "server=130.207.114.235;user=cs4400_group8;database=cs4400_group8;password=u_f9gAnL;";
            MySqlConnection conn = new MySqlConnection(connStr);
            try
            {
                Console.WriteLine("Connecting to MySQL...");
                conn.Open();

                //string sql = "SELECT Name, HeadOfState FROM Country WHERE Continent=@Continent";
                string sql = "SELECT name FROM category";
                MySqlCommand cmd = new MySqlCommand(sql, conn);

                //Console.WriteLine("Enter a continent e.g. 'North America', 'Europe': ");
                //string user_input = Console.ReadLine();

                //cmd.Parameters.AddWithValue("@Continent", user_input);

                MySqlDataReader rdr = cmd.ExecuteReader();
                List<string> categories = new List<string>();

                while (rdr.Read())
                {
                    categories.Add(rdr["Name"].ToString());
                }
                rdr.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            conn.Close();
            Console.WriteLine("Done.");
        }
 public string[] GetCompletionList(string prefixText)
 {
     Database db = DatabaseFactory.CreateDatabase();
     DbCommand dbCommand = db.GetSqlStringCommand("select top 9 username FROM UserInfo where username like '" + prefixText + "%'");
     DataSet ds = db.ExecuteDataSet(dbCommand);
     List<string> items = new List<string>();
     foreach (DataRow dr in ds.Tables[0].Rows)
     {
         items.Add(dr["username"].ToString());
     }
     return items.ToArray();
 }
        public List<Debt> Parce(Array[] db)
        {
            Debt debt = new Debt();
            ConvertToClass convert = new ConvertToClass();
            List<Debt> debtList = new List<Debt>();

            for (int i = 0; i < db.Length; i++)
            {
                //debt = convert.ConvertToClass(userDebt);
                debtList[i] = debt;
            }
            return debtList;
        }
 public int PrintSheets(List<string> itemNumbers, string destinationPath, string templatePath, string temporaryPath)
 {
     bsp = new BidSheetPrinter();
     bsp.formPath = templatePath;
     bsp.savePath = destinationPath;
     bsp.tempFilePath = temporaryPath;
     List<Item> itemList = new List<Item>();
     Item t;
     foreach(string i in itemNumbers)
     {
         t = dao.getItemByNumber(i);
         itemList.Add(t);
     }
     Print(itemList);
     return 1;
 }
        public string[] GetCompletionList(string prefixText)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand("select username FROM UserInfo where username like '" + prefixText + "%'");
            DataSet ds = db.ExecuteDataSet(dbCommand);
            //SqlConnection _sqlConnection = new SqlConnection();
            //_sqlConnection.ConnectionString = ConfigurationManager.AppSettings["Conn"];
            //_sqlConnection.Open();
            //SqlDataAdapter da = new SqlDataAdapter();
            //da.SelectCommand = new SqlCommand("_selectWords FROM [AutoComplete] where Words like '" + prefixText + "%'", _sqlConnection);
            //DataSet ds = new DataSet();
            //da.Fill(ds);

            List<string> items = new List<string>();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                items.Add(dr["Words"].ToString());
            }
            return items.ToArray();
        }
        protected void grdMatrices_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (Session["carritoPresupuesto"] == null)
            {
                Session["carritoPresupuesto"] = new List<MatrizEntidad>();
            }

            List<MatrizEntidad> lista = (List<MatrizEntidad>)Session["carritoPresupuesto"];
            int indice = e.RowIndex;
            GridViewRow fila = grdMatricesPresupuesto.Rows[indice];
            MatrizEntidad m = new MatrizEntidad();
            m.nombreArchivo = fila.Cells[1].Text;
            m.cantidadColores = int.Parse(fila.Cells[2].Text);
            m.cantidadPuntadas = int.Parse(fila.Cells[3].Text);
            m.precio = decimal.Parse(fila.Cells[4].Text);
            m.fechaCreacion = DateTime.Parse(fila.Cells[5].Text);
            m.apliqueBooleano = bool.Parse(fila.Cells[6].Text);
            m.tamaño = MatrizGestor.obtenerId(fila.Cells[7].Text);

            foreach (var matriz in lista)
            {
                if (m.nombreArchivo == matriz.nombreArchivo)
                {
                    matriz.cantidad++;
                    matriz.subTotal = matriz.precio * matriz.cantidad;
                    cargarCarrito();
                    cargarTotal();
                    return;
                }
            }

            m.subTotal = m.precio;
            m.cantidad = 1;
            lista.Add(m);
            cargarCarrito();
            cargarTotal();
            btnGuardar.Visible = true;
            btnCancelar.Visible = true;
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid userId = (Guid)(Membership.GetUser().ProviderUserKey);

                markers = new List<Problem>();
                foreach (var problem in mdb.Problems)
                {
                    var isSolved = problem.SolutionsPerUsers.Where(x => x.Usuario.aspnet_User.UserId == userId);
                    if ( isSolved.FirstOrDefault() == null)
                        markers.Add(problem);
                    else
                    {
                        //Color 74FF2E
                        problem.MarkerIcon = problem.MarkerIconSolved;
                        markers.Add(problem);
                    }

                }
                rptMarkers.DataSource = markers;
                rptMarkers.DataBind();

                edges = new List<Edge>();
                foreach (var edge in mdb.MapEdges)
                {
                    Problem sp = mdb.Problems.Where(x => x.IdUva == edge.IdSourceProblem).FirstOrDefault();
                    Problem tp = mdb.Problems.Where(x => x.IdUva == edge.IdDestProblem).FirstOrDefault();
                    Edge ed = new Edge();

                    ed.SourceLat = sp.Latitude;
                    ed.SourceLng = sp.Longitude;
                    ed.DstLat = tp.Latitude;
                    ed.DstLng = tp.Longitude;
                    edges.Add(ed);

                }

                rptEdges.DataSource = edges;
                rptEdges.DataBind();
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            FacturaEntidad factura = new FacturaEntidad();
            List<DetalleFacturaEntidad> listaDetalle = new List<DetalleFacturaEntidad>();
            List<MatrizEntidad> listaMatrices = (List<MatrizEntidad>) Session["carrito"];

            decimal total = (decimal) Session["total"];
            if(cbxDescuento.Checked == true)
            {
                total = (decimal) (((double)total) - (((double)total) * 0.15));
            }

            factura.cliente = int.Parse(ddlClientes.SelectedValue);
            factura.vendedor = int.Parse(ddlVendedor.SelectedValue);
            factura.tipo = int.Parse(ddlTipoFactura.SelectedValue);
            factura.numero = int.Parse(txtnumeroFactura.Text);
            factura.fecha = DateTime.Parse(txtFechaFactura.Text);
            factura.total = total;
            factura.descuentoBit = 0;
            if(cbxDescuento.Checked == true)
            {
                factura.descuentoBit = 1;
            }

            foreach (var matriz in listaMatrices)
            {
                DetalleFacturaEntidad detalle = new DetalleFacturaEntidad();
                string nombreMatriz = matriz.nombreArchivo;
                detalle.idMatriz = MatrizGestor.buscarIdMatriz(nombreMatriz);
                detalle.cantidad = matriz.cantidad;
                detalle.precio = matriz.precio;
                detalle.subtotal = matriz.subTotal;
                listaDetalle.Add(detalle);
            }
            FacturaGestor.guardarFactura(factura,listaDetalle);

            resetearTodo();
        }
Beispiel #12
0
        //Select statement
        public List<string>[] Select()
        {
            string query = "SELECT * FROM state";

            //Create a list to store the result
            List<string>[] list = new List<string>[3];
            list[0] = new List<string>();
            list[1] = new List<string>();
            list[2] = new List<string>();

            //Open connection
            if (this.OpenConnection() == true)
            {
                //Create Command
                MySqlCommand cmd = new MySqlCommand(query, connection);
                //Create a data reader and Execute the command
                MySqlDataReader dataReader = cmd.ExecuteReader();

                //Read the data and store them in the list
                while (dataReader.Read())
                {
                    list[0].Add(dataReader["state"] + "");
                }

                //close Data Reader
                dataReader.Close();

                //close Connection
                this.CloseConnection();

                //return list to be displayed
                return list;
            }
            else
            {
                return list;
            }
        }
Beispiel #13
0
        //
        private List<ClasesNuevas> CargarClases(string sMes, string sAni, string sUnidad)
        {
            List<ClasesNuevas> ListaClases = new List<ClasesNuevas>();

            using (SqlConnection cnn1 = new SqlConnection(ConString))
            {
                cnn1.Open();
                string sSQL1 = "EXEC dbo.pObtenerMes '" + sMes + "','" + sAni + "','" + sUnidad + "'";
                SqlCommand cmd1 = new SqlCommand(sSQL1, cnn1);
                SqlDataReader rd1 = cmd1.ExecuteReader();

                string sFecha = ""; string sDia = "";

                while (rd1.Read())
                {
                    sFecha = rd1[0].ToString(); sDia = rd1[1].ToString();

                    using (SqlConnection cnn2 = new SqlConnection(ConString))
                    {
                        cnn2.Open();
                        string sSQL2 = "SELECT Codigo, Nombre, Cupos, '" + sFecha + "' AS Dia, Hora, 'Habilitada', '" + sUnidad + "', '1', Docente FROM dbo.ClaseBase WHERE Estado=1 AND Dia='" + sDia + "' AND Unidad='" + sUnidad + "'";
                        SqlCommand cmd2 = new SqlCommand(sSQL2, cnn2);
                        SqlDataReader rd2 = cmd2.ExecuteReader();

                        while (rd2.Read())
                        {
                            ClasesNuevas UnaClase = new ClasesNuevas();
                            UnaClase.Codigo = int.Parse(rd2[0].ToString());
                            UnaClase.Nombre = rd2[1].ToString();
                            UnaClase.Cupos = rd2[2].ToString();
                            UnaClase.Dia = rd2[3].ToString();
                            UnaClase.Hora = rd2[4].ToString();
                            UnaClase.Estado = rd2[5].ToString();
                            UnaClase.Unidad = rd2[6].ToString();
                            UnaClase.Asignado = rd2[7].ToString();
                            UnaClase.Docente = rd2[8].ToString();

                            ListaClases.Add(UnaClase);
                        }
                        cmd2.Dispose();
                        cnn2.Close();
                        cnn2.Dispose();
                    }
                }
                cmd1.Dispose();
                cnn1.Close();
                cnn1.Dispose();
            }
            return ListaClases;
        }
Beispiel #14
0
 //
 private void BindGrid(List<ClasesNuevas> LasClases)
 {
     GridView1.DataSource = LasClases;
     GridView1.DataBind();
     lblMensaje.Visible = false; lblMensaje.Text = "";
     PanelVista.Visible = true;
 }