private void Click_Edit(object sender, RoutedEventArgs e) { try { var inMemoryDAL = XpoDefault.GetDataLayer(connectionString, DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema); using (var uow = new UnitOfWork(inMemoryDAL)) { XPQuery <Product_ProductReceive> items = new XPQuery <Product_ProductReceive>(uow); Product_ProductReceive searchItem = items.FirstOrDefault(i => i.ID == Convert.ToInt32(((Windows.UI.Xaml.Controls.ContentControl)sender).Content.ToString())); if (!String.IsNullOrEmpty(searchItem.ContainerNo)) { newContainer.Text = (searchItem.ContainerNo).ToString(); } if (!String.IsNullOrEmpty(searchItem.DriverName)) { newDriver.Text = (searchItem.DriverName).ToString(); } if (!String.IsNullOrEmpty(searchItem.TruckRegistration)) { newTruckReg.Text = (searchItem.TruckRegistration).ToString(); } newWbTicket.Text = (searchItem.WBTicket).ToString(); } } catch (Exception ex) { var msg = ex.Message; } }
public void UpdateRecord(int id) { var inMemoryDAL = XpoDefault.GetDataLayer(connectionString, DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema); using (var uow = new UnitOfWork(inMemoryDAL)) { Product_ProductReceive product = uow.FindObject <Product_ProductReceive>(id); } }
public void saveRecord() { var inMemoryDAL = XpoDefault.GetDataLayer(connectionString, DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema); validateInput(); try { using (var uow = new UnitOfWork(inMemoryDAL)) { string val = OrderLookupEdit.SelectedItem.ToString(); Order_OrderIn searchItem = new XPQuery <Order_OrderIn>(uow).FirstOrDefault(i => i.OrderNo.Equals(cleanString(val))); //ExpectedTrucks searchTruck = new XPQuery<ExpectedTrucks>(uow).FirstOrDefault(i => i.ID.Equals(lblExpTruck.Text)); //Library_Supplier L_SearchItem = new XPQuery<Library_Supplier>(uow).FirstOrDefault(i => i.Name == (SupplierComboBox.SelectedValue.ToString())); // var result = TransComboBox.SelectedItem.Content.ToString(); Library_Transporter LT_SearchItem = new XPQuery <Library_Transporter>(uow).FirstOrDefault(i => i.Name.Equals(Transporter)); Product_ProductReceive pr = new Product_ProductReceive(uow); var item = OrderLookupEdit.SelectedItem; try { tar = Convert.ToDouble(txtTar.Text); gross = Convert.ToDouble(txtGross.Text); txtNett.Text = calcNettWeight(tar, gross).ToString(); pr.NettWeight = calcNettWeight(tar, gross); //pr.SupplierID = L_SearchItem; pr.RecOrderID = searchItem; //pr.ExpectedID = searchTruck; pr.TransporterID = LT_SearchItem; pr.ArrivalDate = DateTime.Now; pr.DriverName = newDriver.Text; pr.NettWeight = calcNettWeight(Convert.ToDouble(txtGross.Text), Convert.ToDouble(txtNett.Text)); //pr.TruckRegistration = searchTruck.TruckRegistration; //pr.ContainerNo = newContainer.Text; pr.WBTicket = Convert.ToInt32(txtWbTicket.Text); pr.Save(); } catch { DisplayDialog("An Input Error Occured"); return; } uow.CommitChanges(); clearInput(); DisplayDialog("Transaction Saved"); } } catch (Exception ex) { var Name = ex.Message; DisplayDialog("An input error occured"); } }
private void commitButton_Click(object sender, RoutedEventArgs e) { var inMemoryDAL = XpoDefault.GetDataLayer(connectionString, DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema); try { using (var uow = new UnitOfWork(inMemoryDAL)) { XPQuery <Order_OrderIn> items = new XPQuery <Order_OrderIn>(uow); Order_OrderIn searchItem = items.FirstOrDefault(i => i.OrderNo == (colorComboBox.SelectedValue.ToString())); XPQuery <Library_Supplier> L_items = new XPQuery <Library_Supplier>(uow); Library_Supplier L_SearchItem = L_items.FirstOrDefault(i => i.Name == (SupplierComboBox.SelectedValue.ToString())); XPQuery <Library_Transporter> Trans_items = new XPQuery <Library_Transporter>(uow); Library_Transporter LT_SearchItem = Trans_items.FirstOrDefault(i => i.Name == (TransComboBox.SelectedValue.ToString())); var pr = new Product_ProductReceive(uow); pr.SupplierID = L_SearchItem; pr.RecOrderID = searchItem; pr.TransporterID = LT_SearchItem; pr.DateModified = DateTime.Now; pr.DriverName = newDriver.Text; pr.TruckRegistration = newTruckReg.Text; pr.ContainerNo = newContainer.Text; pr.WBTicket = Convert.ToInt32(newWbTicket.Text); uow.CommitChanges(); DisplayDialog(); PopulateGridControl(); newContainer.Text = ""; newWbTicket.Text = ""; newTruckReg.Text = ""; newDriver.Text = ""; } } catch (Exception ex) { Name = ex.Message; } }