Ejemplo n.º 1
0
 private void fillData(string id)
 {
     try
     {
         bll.SearchPlatoID(id);
         TextBoxID.Text               = id;
         TextBoxPriceU.Text           = bll.SearchPlatoID(id).Precio + "";
         TextBoxNameU.Text            = bll.SearchPlatoID(id).Nombre;
         TextBoxFullDescriptionU.Text = bll.SearchPlatoID(id).Descripcion;
         TextBoxTimeToPrepareU.Text   = bll.SearchPlatoID(id).TiempoPreparacionMinutos.ToString();
         if (bll.SearchPlatoID(id).HabilitadoSN.ToUpper().Equals("S"))
         {
             CheckBoxEnabledU.Checked = true;
         }
         else
         {
             CheckBoxEnabledU.Checked = false;
         }
         if (bll.SearchPlatoID(id).Fotografia != null)
         {
             byte[] image        = (byte[])bll.SearchPlatoID(id).Fotografia;
             string base64String = Convert.ToBase64String(image, 0, image.Length);
             Image1.ImageUrl = String.Format(@"data:image/jpeg;base64,{0}", base64String);
         }
     }
     catch (Exception ex)
     {
         alertException(ex.Message, ex);
     }
 }
Ejemplo n.º 2
0
        private void loadOrders()
        {
            List <LineaOrden> dt = orderLines;

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Codigo de Plato");
            dataTable.Columns.Add("Nombre");
            dataTable.Columns.Add("Precio Unidad");
            dataTable.Columns.Add("Cantidad");
            dataTable.Columns.Add("Precio SubTotal");

            int totalLabel = 0;
            int i          = -1;

            if (dt != null)
            {
                foreach (LineaOrden item in dt.ToList())
                {
                    i++;
                    Plato p = bll.SearchPlatoID(item.PlatoID.ToString());

                    float asd    = (float)Convert.ToDouble(p.Precio);
                    int   price1 = Convert.ToInt32(asd);

                    int price = (Int32.Parse(item.Cantidad + "") * price1);


                    dataTable.Rows.Add(item.PlatoID, p.Nombre, p.Precio, item.Cantidad, price);

                    dt[i].Precio = price;
                    totalLabel  += price;
                }
                Label1.Visible = true;
                Label2.Text    = (totalLabel + "");
            }
            else
            {
                Label1.Visible = false;
                Label2.Visible = false;
            }
            orderLines = dt;



            GridView2.DataSource = dataTable;
            GridView2.DataBind();
        }