Beispiel #1
0
        public VentasDetail(int id)
        {
            InitializeComponent();
            Venta_Info = Sell.Get(id);

            Product_List = Product.Get_All().Where(product => product.Quantity > 0).ToList();
            Client_List  = Client.Get_All();

            Product_Info = Product.Get(Venta_Info.Product_Id);
            Client_Info  = Client.Get(Venta_Info.Client_Id);
        }
Beispiel #2
0
        public void Show_Annualy()
        {
            List <Sell> sells = Sell.Get_Annualy_Sells();

            Annualy_Chart.Chart        = Create_Bar_Chart_Based_On_Sells(sells);
            Sells_cost_Annual.Text     = "$" + string.Format("{0:#.00}", sells.Sum(sell => Product.Get(sell.Product_Id).Cost *sell.Amount));
            Sells_earnings_Annual.Text = "$" + string.Format("{0:#.00}", sells.Sum(sell =>
            {
                Product product = Product.Get(sell.Product_Id);
                return((product.Price - product.Cost) * sell.Amount);
            }
                                                                                   ));
        }
Beispiel #3
0
 private BarChart Create_Bar_Chart_Based_On_Sells(List <Sell> sells)
 {
     return(new BarChart
     {
         Entries = sells.ConvertAll(sell =>
         {
             string color = Product.Get(sell.Product_Id).Color;
             return new Microcharts.Entry(sell.Amount)
             {
                 Label = Product.Get(sell.Product_Id).Name,
                 ValueLabel = sell.Amount.ToString(),
                 Color = SKColor.Parse(color)
             };
         })
     });
 }
Beispiel #4
0
        private async void Update_Product(object sender, EventArgs e)
        {
            try
            {
                Product_Info.Name      = Name_Entry.Text;
                Product_Info.Price     = float.Parse(Price_Entry.Text);
                Product_Info.Quantity  = int.Parse(Quantity_Entry.Text);
                Product_Info.Photo_Url = Photo_Entry.Text;
                Product_Info.Cost      = float.Parse(Cost_Entry.Text);
                Product_Info.Update();
                Return_To_List();
            }
            catch
            {
                await DisplayAlert("Error", "Faltan valores por llenar para el producto", "Cancel");

                Product_Info = Product.Get(Product_Info.Id);
                OnAppearing();
            }
        }
Beispiel #5
0
 public ProductDetail(int id)
 {
     InitializeComponent();
     Product_Info = Product.Get(id);
 }