Ejemplo n.º 1
0
        private async void RestoreDefaults_Click(object sender, RoutedEventArgs e)
        {
            var settings = new MetroDialogSettings()
            {
                //Affirmative is set to no because button theming

                AffirmativeButtonText = "No",
                NegativeButtonText    = "Yes",
            };
            var result = await this.ShowMessageAsync("Are you sure?", "This will reset all saved settings and restore to default", MessageDialogStyle.AffirmativeAndNegative, settings);

            if (result == MessageDialogResult.Negative)
            {
                Properties.Settings.Default.Reset();
                SetThemeElements(new TemplateUISettings()
                {
                    Color      = Properties.Settings.Default.Color,
                    IsDarkMode = Properties.Settings.Default.IsDarkMode,
                    FontFamily = Properties.Settings.Default.FontFamily,
                    FontSize   = Properties.Settings.Default.FontSize
                });
                ProductReader.Rebuild();
                ItemsReset = true;
                this.PreferencesSave_Click(sender, e);
            }
        }
        public ActionResult Add(int IdProdotto)
        {
            if (Session["logged"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            var             User                   = (Account)Session["user"];
            string          fileProdotti           = Server.MapPath(@"/App_Data/Prodotti.txt");
            string          fileIndicePrenotazioni = Server.MapPath(@"/App_Data/Prenotazioni_Last_Id.txt");
            string          filePrenotazioni       = Server.MapPath(@"/App_Data/Prenotazioni.txt");
            var             productReader          = new ProductReader();
            var             indexManager           = new IndexManager();
            var             reservationWriter      = new ReservationWriter();
            IList <Product> listaProdotti          = productReader.Read(fileProdotti);

            Product prodotto = listaProdotti.FirstOrDefault(e => e.Id == IdProdotto);

            if (prodotto != null)
            {
                int    indicePrenotazione = indexManager.Read(fileIndicePrenotazioni) + 1;
                string linea = $"{indicePrenotazione}|{DateTime.Now}|{User.Id}|{prodotto.Id}|{prodotto.Nome}|{prodotto.Prezzo}|{false}|{false}";
                reservationWriter.Append(filePrenotazioni, linea);
                indexManager.Write(fileIndicePrenotazioni, indicePrenotazione);
            }

            return(RedirectToAction("Detail", "Account"));
        }
Ejemplo n.º 3
0
 private void RebuildDataList()
 {
     DataList.Items.Clear();
     foreach (var item in ProductReader.GetProductsList(DataRadioButton))
     {
         DataList.Items.Add(item);
     }
 }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            ImportProductsRequest list = ProductReader.GetProduct("sample.csv");

            var t = PostProduct.PostURI(new Uri("http://dev.shopiconnect.com/api/productImport/ImportDeltaProducts"), list);

            /* HTTPCLIENT'lı fonksiyon için => */
            // var t = Task.Run(() => ReadCsv.ProductReader.PostURI(new Uri("http://dev.shopiconnect.com/api/productImport/ImportDeltaProducts"),list));
            //t.Wait();
        }
Ejemplo n.º 5
0
        private void ProductRadio_Checked(object sender, RoutedEventArgs e)
        {
            RadioButton rb = sender as RadioButton;

            DataRadioButton = rb.Name.Replace("Radio", "");
            DataList.Items.Clear();
            foreach (var item in ProductReader.GetProductsList(DataRadioButton))
            {
                DataList.Items.Add(item);
            }
        }
        public ActionResult Index()
        {
            var                     reader               = new ProductReader();
            var                     productFilePath      = Server.MapPath(@"/App_Data/Prodotti.txt");
            List <Product>          productList          = reader.Read(productFilePath);
            List <ProductViewModel> productListViewModel = productList.Select(
                product => new ProductViewModelFactory(product)
                .SetImageFolder("/Images/")
                .Build()
                ).ToList();

            return(View(productListViewModel));
        }
Ejemplo n.º 7
0
        private void RemoveItem_Click(object sender, RoutedEventArgs e)
        {
            if (DataList.SelectedItem != null)
            {
                DataList.Items.Remove(DataList.SelectedItem);
            }
            List <string> products = new List <string>();

            foreach (string s in DataList.Items)
            {
                products.Add(s);
            }
            ProductReader.SetProductsList(products.ToArray(), DataRadioButton);
            ItemRemoved = true;
        }
Ejemplo n.º 8
0
 private async void AddProductEntry_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(DataRadioButton) || string.IsNullOrEmpty(DataEntryBox.Text))
     {
         await this.ShowMessageAsync("Try again, Sport", "One or more fields are empty");
     }
     else
     {
         string s = DataEntryBox.Text;
         ProductReader.AddEntry(DataRadioButton, s);
         DataEntryBox.Clear();
         RebuildDataList();
         DataList.SelectedIndex = DataList.Items.IndexOf(s);
         DataList.ScrollIntoView(DataList.SelectedItem);
         ItemAdded = true;
     }
 }
Ejemplo n.º 9
0
        private List <ProductReader> GetProductReaders(List <Product> allProducts, bool check)
        {
            List <ProductReader> productReaders = new List <ProductReader>();
            List <string>        dates          = new List <string>();

            foreach (Product product in allProducts)
            {
                //MessageBox.Show($"{product.DateOnly} / {product.IsDefective} / {product.QRCodeData}");
                if (product.IsDefective != check)
                {
                    continue;
                }

                if (!dates.Contains(product.DateOnly))
                {
                    dates.Add(product.DateOnly);
                    ProductReader productReader = new ProductReader();
                    productReader.DateOnly = product.DateOnly;
                    productReader.Count   += 1;
                    if (check == false)
                    {
                        productReader.IsDefective = "정상";
                    }
                    else
                    {
                        productReader.IsDefective = "오류";
                    }

                    productReaders.Add(productReader);
                }
                else
                {
                    string dateOnly = dates.Find(x => x == product.DateOnly);
                    int    index    = productReaders.FindIndex(x => x.DateOnly == dateOnly);
                    if (index != -1)
                    {
                        productReaders[index].Count += 1;
                    }
                }
            }

            return(productReaders);
        }
Ejemplo n.º 10
0
 private void FillComboBoxes()
 {
     foreach (var item in ProductReader.GetImaging())
     {
         ImagingBox.Items.Add(item);
     }
     foreach (var item in ProductReader.GetPMS())
     {
         PMSBox.Items.Add(item);
     }
     foreach (var item in ProductReader.GetBridges())
     {
         BridgesBox.Items.Add(item);
     }
     foreach (var item in ProductReader.GetDevices())
     {
         DevicesBox.Items.Add(item);
     }
     foreach (var item in ProductReader.GetDrivers())
     {
         DriversBox.Items.Add(item);
     }
 }
Ejemplo n.º 11
0
 public ProductsController()
 {
     _reader = new ProductReader();
 }