private void save_Click(object sender, RoutedEventArgs e) { foreach (SaleListItem item in addlist.Items) { SaleSet newSale = new SaleSet(); Ramdom r = new Ramdom(); newSale.Id = r.RandomString(32); newSale.Client_ID = ClientID; newSale.Product_ID = item.ProductID; newSale.PriceforClient = Convert.ToInt32(item.ClientPrice); newSale.PriceClientOffered = 0; newSale.FinalPrice = 0; newSale.LastEmailDate = new DateTime(1900, 1, 1); if (item.SendEmail) { if (Email.SendEmail(ClientID, item.ProductID, item.ClientPrice)) { newSale.LastEmailDate = DateTime.Now; } else { MessageBox.Show("El mensaje con informacion sobre el producto " + item.Name + " no pudo ser enviado"); } } _dataDC.SaleSet.AddObject(newSale); } _dataDC.SaveChanges(); Close(); }
static public void checkNotifications(ProductsSet p) { Model1Container _dataDC = ModelSingleton.getDataDC; Boolean newinserted = false; foreach (ProductsSet Product in _dataDC.ProductsSet.Where(S => S.Enbusca == "True" && p.Producto.ToLower().Contains(S.Producto.ToLower()) && (p.Marca.ToLower().Contains(S.Marca) || S.Marca == "") && (p.Modelo.ToLower().Contains(S.Modelo.ToLower()) || S.Modelo == "") && p.Precio <= S.Precio && p.Año >= S.Año ) ) { if (_dataDC.SaleSet.Where(S => S.Client_ID == Product.Proveedor_ID && S.Product_ID == p.Id).Count() == 0) { if (_dataDC.NotificationSet.Where(S => S.ProductID == p.Id && S.SearchID == Product.Id).Count() == 0) { NotificationSet newNotification = new NotificationSet(); Ramdom r = new Ramdom(); newNotification.ID = r.RandomString(32); newNotification.ProductID = p.Id; newNotification.SearchID = Product.Id; _dataDC.AddToNotificationSet(newNotification); newinserted = true; } } } if (newinserted) { _dataDC.SaveChanges(); } }
private void button1_Click(object sender, RoutedEventArgs e) { ProveedorSet pro = new ProveedorSet(); List<ProveedorSet> lp = _dataDC.ProveedorSet.ToList(); Ramdom r = new Ramdom(); pro.Id = r.RandomString(32); //pro.Apellido = direccionTextBox.Text; //pro.Descripcion = descripcionTextBox.Text; //pro.Direccion = direccionTextBox.Text; //pro.Email = emailTextBox.Text; //pro.Nombre = nombreTextBox.Text; //pro.TelefonoF = telefonoFTextBox.Text; //pro.TelefonoM = telefonoMTextBox.Text; //_dataDC.ProveedorSet.AddObject(pro); //_dataDC.SaveChanges(); }
private void button1_Click(object sender, RoutedEventArgs e) { ProveedorSet pro = new ProveedorSet(); List <ProveedorSet> lp = _dataDC.ProveedorSet.ToList(); Ramdom r = new Ramdom(); pro.Id = r.RandomString(32); //pro.Apellido = direccionTextBox.Text; //pro.Descripcion = descripcionTextBox.Text; //pro.Direccion = direccionTextBox.Text; //pro.Email = emailTextBox.Text; //pro.Nombre = nombreTextBox.Text; //pro.TelefonoF = telefonoFTextBox.Text; //pro.TelefonoM = telefonoMTextBox.Text; //_dataDC.ProveedorSet.AddObject(pro); //_dataDC.SaveChanges(); }
private void Accept_Click(object sender, RoutedEventArgs e) { foreach (NotificationListItem NTC in addlist.Items) { Boolean EmailSent = false; if (NTC.SendEmail) { EmailSent = Email.SendEmail(NTC.ClientID, _product.Id, NTC.ClientPrice); } if (NTC.RequestProduct) { SaleSet newSale = new SaleSet(); Ramdom r = new Ramdom(); newSale.Id = r.RandomString(32); newSale.Client_ID = NTC.ClientID; newSale.Product_ID = _product.Id; newSale.PriceforClient = Convert.ToInt32(NTC.ClientPrice); newSale.PriceClientOffered = 0; newSale.FinalPrice = 0; if (EmailSent) { newSale.LastEmailDate = DateTime.Now; } else { newSale.LastEmailDate = new DateTime(1900, 1, 1); } _dataDC.SaleSet.AddObject(newSale); } if (NTC.DeleteSearch) { _dataDC.ProductsSet.DeleteObject(_dataDC.ProductsSet.First(S => S.Id == NTC.SearchID)); } if (NTC.DeleteSearch || NTC.RequestProduct) { _dataDC.NotificationSet.DeleteObject(_dataDC.NotificationSet.First(S => S.ProductID == _product.Id && S.SearchID == NTC.SearchID)); } _dataDC.SaveChanges(); } Close(); }
private void Accept_Click(object sender, RoutedEventArgs e) { foreach (NotificationListItem NTC in addlist.Items) { Boolean EmailSent = false; if (NTC.SendEmail) { EmailSent = Email.SendEmail(NTC.ClientID, _product.Id, NTC.ClientPrice); } if (NTC.RequestProduct) { SaleSet newSale = new SaleSet(); Ramdom r = new Ramdom(); newSale.Id = r.RandomString(32); newSale.Client_ID = NTC.ClientID; newSale.Product_ID = _product.Id; newSale.PriceforClient = Convert.ToInt32(NTC.ClientPrice); newSale.PriceClientOffered = 0; newSale.FinalPrice = 0; if (EmailSent) { newSale.LastEmailDate = DateTime.Now; } else { newSale.LastEmailDate = new DateTime(1900, 1, 1); } _dataDC.SaleSet.AddObject(newSale); } if (NTC.DeleteSearch) { _dataDC.ProductsSet.DeleteObject(_dataDC.ProductsSet.First(S => S.Id == NTC.SearchID)); } if (NTC.DeleteSearch || NTC.RequestProduct) { _dataDC.NotificationSet.DeleteObject(_dataDC.NotificationSet.First(S=>S.ProductID==_product.Id && S.SearchID == NTC.SearchID)); } _dataDC.SaveChanges(); } Close(); }
private void OnDrop(object sender, DragEventArgs e) { var data = e.Data as DataObject; if (data.ContainsFileDropList()) { var files = data.GetFileDropList(); foreach (string file in files) { string filename = System.IO.Path.GetFileName(file); if (imagelist.Where(S => S.Name == filename).Count() == 0) { ProductImageSet newImage = new ProductImageSet(); newImage.ProducID = _productID; newImage.Path = file; newImage.Name = filename; Ramdom r = new Ramdom(); newImage.ImageID = r.RandomString(32); newImage.Order = 0; imagelist.Add(newImage); _dataDC.ProductImageSet.AddObject(newImage); _dataDC.SaveChanges(); string destinationFile = Properties.Settings.Default.ImagePath + "\\" + ProductID + "\\" + filename; if (!System.IO.Directory.Exists(Properties.Settings.Default.ImagePath + "\\" + ProductID)) { System.IO.Directory.CreateDirectory(Properties.Settings.Default.ImagePath + "\\" + ProductID); } System.IO.File.Copy(file, destinationFile); imageViewer.Source = LoadImageFromFile(destinationFile); ImageList.ItemsSource = imagelist.Where(S => S.ProducID == _productID).ToList(); } else { MessageBox.Show("La imagen" + filename + " ya ha sido añadida anteriormente"); } } } }
private void save_Click(object sender, RoutedEventArgs e) { foreach (SaleListItem item in addlist.Items) { SaleSet newSale = new SaleSet(); Ramdom r = new Ramdom(); newSale.Id = r.RandomString(32); newSale.Client_ID = ClientID; newSale.Product_ID = item.ProductID; newSale.PriceforClient = Convert.ToInt32(item.ClientPrice); newSale.PriceClientOffered = 0; newSale.FinalPrice = 0; newSale.LastEmailDate = new DateTime(1900, 1,1); if (item.SendEmail) { if (Email.SendEmail(ClientID, item.ProductID, item.ClientPrice)) { newSale.LastEmailDate = DateTime.Now; } else { MessageBox.Show("El mensaje con informacion sobre el producto " + item.Name + " no pudo ser enviado"); } } _dataDC.SaleSet.AddObject(newSale); } _dataDC.SaveChanges(); Close(); }
private void OnDrop(object sender, DragEventArgs e) { var data = e.Data as DataObject; if (data.ContainsFileDropList()) { var files = data.GetFileDropList(); foreach (string file in files) { string filename = System.IO.Path.GetFileName(file); if (imagelist.Where(S => S.Name == filename).Count() == 0) { ProductImageSet newImage = new ProductImageSet(); newImage.ProducID = _productID; newImage.Path = file; newImage.Name = filename; Ramdom r = new Ramdom(); newImage.ImageID = r.RandomString(32); newImage.Order = 0; imagelist.Add(newImage); _dataDC.ProductImageSet.AddObject(newImage); _dataDC.SaveChanges(); string destinationFile = Properties.Settings.Default.ImagePath + "\\" + ProductID + "\\" + filename; if(!System.IO.Directory.Exists(Properties.Settings.Default.ImagePath + "\\" + ProductID )) { System.IO.Directory.CreateDirectory(Properties.Settings.Default.ImagePath + "\\" + ProductID); } System.IO.File.Copy(file, destinationFile); imageViewer.Source = LoadImageFromFile(destinationFile); ImageList.ItemsSource = imagelist.Where(S => S.ProducID == _productID).ToList(); } else { MessageBox.Show("La imagen" + filename + " ya ha sido añadida anteriormente"); } } } }
public static void checkNotifications(ProductsSet p) { Model1Container _dataDC = ModelSingleton.getDataDC; Boolean newinserted = false; foreach (ProductsSet Product in _dataDC.ProductsSet.Where(S=>S.Enbusca == "True" && p.Producto.ToLower().Contains(S.Producto.ToLower()) && (p.Marca.ToLower().Contains(S.Marca) || S.Marca == "") && (p.Modelo.ToLower().Contains(S.Modelo.ToLower()) || S.Modelo == "") && p.Precio <= S.Precio && p.Año >= S.Año ) ) { if (_dataDC.SaleSet.Where(S => S.Client_ID == Product.Proveedor_ID && S.Product_ID == p.Id).Count() == 0) { if (_dataDC.NotificationSet.Where(S => S.ProductID == p.Id && S.SearchID == Product.Id).Count() == 0) { NotificationSet newNotification = new NotificationSet(); Ramdom r = new Ramdom(); newNotification.ID = r.RandomString(32); newNotification.ProductID = p.Id; newNotification.SearchID = Product.Id; _dataDC.AddToNotificationSet(newNotification); newinserted = true; } } } if (newinserted) _dataDC.SaveChanges(); }