SubmanagerStatus iSubmanager.Init(ManagerContext context) { // Set the Initial Major State this._majorState = SubmanagerMajorState.INIT; // Return success return SubmanagerStatus.ERROR_NONE; }
SubmanagerStatus iSubmanager.Enable(ManagerContext context) { // Transition to ACTIVE this._majorState = SubmanagerMajorState.ACTIVE; // Report the state change this._stateCallbacks(this._majorState); // Return success return SubmanagerStatus.ERROR_NONE; }
SubmanagerStatus iSubmanager.Shutdown(ManagerContext context) { // Transition to SHUTDOWN this._majorState = SubmanagerMajorState.SHUTDOWN; // Report the state change this._stateCallbacks(this._majorState); // Return success return SubmanagerStatus.ERROR_NONE; }
private void rendreButtonTest_Click(object sender, RoutedEventArgs e) { Dispatcher.BeginInvoke(DispatcherPriority.Render, (SendOrPostCallback) delegate { _context = (ManagerContext)DataContext; if (_context.EditorImage != null) { _context.EditorImage.ReRender(true); _context.EditorImage = _context.EditorImage; } }, null); }
private void AddOriginalSeriesCast(ManagerContext aContext) { List <Person> vPersonList = new List <Person> { new Person { FirstName = "Leonard", LastName = "Nimoy", BirthDate = new DateTime(1932, 4, 26) }, new Person { FirstName = "William", LastName = "Shatner", BirthDate = new DateTime(1931, 3, 22) }, new Person { FirstName = "DeForest", LastName = "Kelley", BirthDate = new DateTime(1920, 1, 20) }, new Person { FirstName = "Nichelle", LastName = "Nichols", BirthDate = new DateTime(1932, 12, 28) }, new Person { FirstName = "James", LastName = "Doohan", BirthDate = new DateTime(1920, 3, 3) }, new Person { FirstName = "George", LastName = "Takei", BirthDate = new DateTime(1937, 4, 20) }, new Person { FirstName = "Walter", LastName = "Koenig", BirthDate = new DateTime(1936, 9, 14) }, }; List <Employee> vEmployeeList = new List <Employee>(); foreach (Person vPerson in vPersonList) { aContext.Persons.AddOrUpdate( person => person.LastName, vPerson ); vEmployeeList.Add( new Employee { EmployeeNum = (vPersonList.IndexOf(vPerson) + 1).ToString(), EmployedDate = new DateTime(1966, 1, 1), TerminatedDate = new DateTime(1969, 1, 1), Person = vPerson } ); } foreach (Employee vEmployee in vEmployeeList) { aContext.Employees.AddOrUpdate( emp => emp.PersonId, vEmployee ); } aContext.SaveChanges(); }
public MainWindow() { //Global Exception Handling var currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += GlobalExceptionHandler; InitializeComponent(); // Window Title var currentAssembly = Assembly.GetExecutingAssembly(); string versionNumber = currentAssembly.GetName().Version.ToString(); Title = Title + " (" + versionNumber + ")"; _context = (ManagerContext)DataContext; //Enable the cross acces to this collection elsewhere BindingOperations.EnableCollectionSynchronization(_context.Carts, _synLock); // Start Processes _running = true; var t1 = new Thread(AutoProcessing); t1.Start(); // Standalone no DataItemConfigurations Settings if (_context?.Config?.DataConfiguration?.DataItemConfigurations.Count == 0) { // Column 4 is the data column - would be changed back if any layout stored HorizontalSystemGrid.ColumnDefinitions[4].Width = new GridLength(0.0); // Also hide Data Buttons and Bar autoDataButton.Visibility = Visibility.Hidden; dataOverrideInterval.Visibility = Visibility.Hidden; dataOverrideProgress.Visibility = Visibility.Hidden; // Start Watchfolder if incoming picture defined if (!string.IsNullOrEmpty(_context.Config.DataConfiguration.IncomingPictureFolder)) { _imageWatchFolder = new SystemWatchfolder(_context.Config.DataConfiguration.IncomingPictureFolder, "*.jpg|*.png|*.gif", false, _context); _imageWatchFolder.Start(); } } // Restore RestoreLayout(); }
public bool IsUniqueStudentICardNumber(string _ICNumber) { using (var db = new ManagerContext()) { if (db.Students.FirstOrDefault(q => q.Person.ICNumber == _ICNumber) == null) { return(true); } else { return(false); } } }
public bool IsUniqueParentPassport(string _Passport) { using (var db = new ManagerContext()) { if (db.Parents.FirstOrDefault(q => q.Person.PassportNumber == _Passport) == null) { return(true); } else { return(false); } } }
public bool IsUniqueParentIIN(string _IIN) { using (var db = new ManagerContext()) { if (db.Parents.FirstOrDefault(q => q.Person.IIN == _IIN) == null) { return(true); } else { return(false); } } }
public MainViewModel() { _facilityService = new FacilityService(); _rootPasswordService = new RootPasswordService(); _fileDialogService = new FileDialogService(); _docxFileService = new DocFileService(); _migrationService = new DatabaseMigrationService(); _context = ManagerContext.Instance; Facilitys = new ObservableCollection <Facility>(); Initialization(); }
public bool IsUniquePlaceName(string _PlaceName) { using (var db = new ManagerContext()) { if (db.Places.FirstOrDefault(q => q.PlaceName == _PlaceName) == null) { return(true); } else { return(false); } } }
public bool IsUniqueManagerLogin(string _ManagerLogin) { using (var db = new ManagerContext()) { if (db.Credentials.FirstOrDefault(q => q.Login == _ManagerLogin) == null) { return(true); } else { return(false); } } }
static void Main(string[] args) { Database.SetInitializer(new ServiceInitializer()); var db = new ManagerContext(); db.Database.Initialize(false); Console.WriteLine("Complete"); Console.WriteLine("Complete"); Console.ReadLine(); }
private void TemplateListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Selected other Slide to be pushed ! Dispatcher.BeginInvoke(DispatcherPriority.Render, (SendOrPostCallback) delegate { _context = (ManagerContext)DataContext; if (e.AddedItems.Count > 0 && e.AddedItems[0] is ManagerImageReference) { _lastSelectedEditorImageRef = (ManagerImageReference)e.AddedItems[0]; //_context.EditorImage = _lastSelectedEditorImageRef.Clone(); } }, null); }
private async void LoadData() { using (ManagerContext context = new ManagerContext()) { var query = await(from c in context.AccessOptions select c.AccessName).ToListAsync(); comboBoxAccessList.DataSource = query; //Есть режим редактирования: использовать предыдущие права if (mode == WindowsMode.EDIT) { comboBoxAccessList.SelectedItem = currentCredential.AccessList.AccessName; } } }
private void textBoxSrc_TextChanged(object sender, EventArgs e) { string textSearch = textBoxSrc.Text; ManagerContext db = new ManagerContext(); var category = (from cat in db.ItemCategories where cat.Name.StartsWith(textSearch) && cat.IsDelete == false || cat.Code.StartsWith(textSearch) && cat.IsDelete == false select new { cat.Name, cat.Code, cat.Description, }).ToList(); dgvCategoryList.DataSource = category; }
private void ListBox_KeyDown(object sender, KeyEventArgs e) { // Remove the last selected Cart from the list if (e.Key == Key.Delete) { _context = (ManagerContext)DataContext; if (_lastSelectedCart != null) { if (_context.Carts.Contains(_lastSelectedCart)) { _context.Carts.Remove(_lastSelectedCart); } } } }
private void Window_Closing(object sender, CancelEventArgs e) { // Stop Watchfolder _imageWatchFolder.Start(); _context = (ManagerContext)DataContext; _running = false; lock (_synLock) { Monitor.PulseAll(_synLock); } _context.Dispose(); _context.SerializeToFile(); }
private void LoadDataGridView() { ManagerContext db = new ManagerContext(); var purchases = (from p in db.Purchases.Where(a => a.IsDelete == false) join outlet in db.Outlets on p.OutletId equals outlet.Id join emp in db.Employees on p.EmployeeId equals emp.Id join s in db.CustomerAndSuppliers on p.SupplierId equals s.Id where s.Type != "Customr" select new { p.Id, p.InvoiceNo, p.PurchaseDate, Outlet = p.Outlet.Name, EmployeeName = p.Employee.Name, Supplier = p.Supplier.Name, ListOfProduct = p.ListOfPurchase, p.TotalAmount }).ToList(); dgvPurchaseReport.DataSource = purchases; var dataGridViewColumn = dgvPurchaseReport.Columns["Id"]; if (dataGridViewColumn != null) { dataGridViewColumn.Visible = false; } DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); btn.HeaderText = "Action"; btn.Name = "btnDelete"; btn.Text = "Delete"; btn.UseColumnTextForButtonValue = true; dgvPurchaseReport.Columns.Add(btn); itemListView.View = View.Details; itemListView.GridLines = true; itemListView.FullRowSelect = true; //Add column header itemListView.Columns.Add("Product", 200); itemListView.Columns.Add("Quantity", 100); itemListView.Columns.Add("CostPrice", 100); itemListView.Columns.Add("TotalPrice", 100); }
SubmanagerStatus iSubmanager.Init(ManagerContext context) { // Set the Initial Major State this._majorState = SubmanagerMajorState.INIT; // Initialize any sub managers // Init the Parallax Manager // Init the Environment Event Manager // Process any Children Environment Layers // Configure the Parallax Manager with data from the Environment Layers // Configure the Environment Event Manager with data from the Environment Layers // Return success return SubmanagerStatus.ERROR_NONE; }
private void textBoxSrc_TextChanged(object sender, EventArgs e) { string textSearch = textBoxSrc.Text; ManagerContext db = new ManagerContext(); var item = (from exp in db.ExpenseCategories where exp.Name.StartsWith(textSearch) && exp.IsDelete == false || exp.Code.StartsWith(textSearch) && exp.IsDelete == false select new { exp.Name, exp.Code, exp.Description, exp.RootCategoryName }).ToList(); dgvCategoryList.DataSource = item; }
private void SalesReportForm_Load(object sender, EventArgs e) { try { ManagerContext db = new ManagerContext(); var salesList = (from s in db.Sales join o in db.Outlets on s.OutletId equals o.Id join emp in db.Employees on s.EmployeeId equals emp.Id join cus in db.CustomerAndSuppliers on s.CustomerId equals cus.Id select new { s.Id, Invoice = s.InvoiceNo, Employee = s.Employee.Name, Outlet = s.Outlet.Name, Customer = s.Customer.Name, Contact = s.Customer.ContactNo, Vat = s.Vat, Discount = s.Discount, TotalAmount = s.TotalAmount, LineTotal = s.SubTotal, Date = s.SalesDate, }).ToList(); dgvSalesList.DataSource = salesList; var dataGridViewColumn = dgvSalesList.Columns["Id"]; if (dataGridViewColumn != null) { dataGridViewColumn.Visible = false; } itemListView.View = View.Details; itemListView.GridLines = true; itemListView.FullRowSelect = true; //Add column header itemListView.Columns.Add("Product Name", 110); itemListView.Columns.Add("Quantity", 100); itemListView.Columns.Add("CostPrice", 100); itemListView.Columns.Add("TotalPrice", 100); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
SubmanagerStatus iSubmanager.Init(ManagerContext context) { // Set the Initial Major State this._majorState = SubmanagerMajorState.INIT; // Setting up the reference shortcut. this._cam = Camera.main.transform; // Create a list for stored ParallaxControllers this._parallaxControllers = new List<ParallaxController>(); // The 'previous frame' had the current frame's camera position. this._previousCamPos = this._cam.position; // Return success return SubmanagerStatus.ERROR_NONE; }
private void addPreviewCartButton_Click(object sender, RoutedEventArgs e) { _context = (ManagerContext)DataContext; if (_context.PreviewCart.Slides.Count > 0) { foreach (var s in _context.PreviewCart.Slides) { _context.ActiveCart.Slides.Add(s); } _context.PreviewCart = _context.ActiveCart; _context.ReloadPreview(); } else { // TODO Error } }
private void newCartButton_Click(object sender, RoutedEventArgs e) { _context = (ManagerContext)DataContext; var name = NewCartWindow.Show(this); if (!string.IsNullOrEmpty(name)) { var c = new ManagerCart(name) { CanBeDeleted = true, ShowInCartList = true }; _context.Carts.Add(c); _context.PreviewCart = c; } }
private void editorAddButtonAndMain_Click(object sender, RoutedEventArgs e) { // Add the image to the current Active Cart and set it active Dispatcher.BeginInvoke(DispatcherPriority.Render, (SendOrPostCallback) delegate { if (_context.EditorImage != null) { _context = (ManagerContext)DataContext; var newImg = _context.EditorImage.Clone(); _context.PreviewCart.Slides.Add(newImg); _context.ReloadPreview(); _lastAutomationChange = DateTime.Now; _context.SwitchToSlide(newImg); } }, null); }
private void btnSalesAdd_Click_1(object sender, EventArgs e) { try { SalesItem item = new SalesItem(); item.ItemId = (int)cmbSalesItem.SelectedValue; item.Quantity = Convert.ToInt32(txtSalesQty.Text); if (txtSalePrice.Text == "") { item.SalePrice = Convert.ToDecimal(txtSalePriceRO.Text); } else { item.SalePrice = Convert.ToDecimal(txtSalePrice.Text); } using (ManagerContext db = new ManagerContext()) { var name = db.Items.Where(a => a.Id == item.ItemId).ToList(); if (name.Count == 0) { MessageBox.Show("Item Does Not Found", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { item.LineTotal = item.Quantity * item.SalePrice; table.Rows.Add(cmbSalesItem.Text, item.Quantity, item.SalePrice, item.LineTotal); listOfSalesItem.Add(item); totalAmount.Add(item.LineTotal); dgvSalesList.DataSource = table; ClearTextBox(); txtTotalAmount.Text = totalAmount.Sum().ToString(); txtSubTotal.Text = txtTotalAmount.Text; StockUpdate(item.ItemId, item.Quantity, item.SalePrice, cmbSalesItem.Text); } } txtDiscount.Text = 0.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void UpdateStock() { try { Stock stock = new Stock(); stock.ItemId = (int)listOfSalesItem[0].ItemId; stock.AvailableQuantity = listOfSalesItem[0].Quantity; using (ManagerContext db = new ManagerContext()) { db.Stocks.Attach(stock); db.Entry(stock).Property(X => X.AvailableQuantity).IsModified = true; db.SaveChanges(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void CartListBox_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 2 && e.LeftButton == MouseButtonState.Pressed) { // Selected other Slide to be pushed ! Dispatcher.BeginInvoke(DispatcherPriority.Render, (SendOrPostCallback) delegate { _context = (ManagerContext)DataContext; if (_lastSelectedCart != null) { _context.PreviewCart = _lastSelectedCart; _context.ReloadPreview(); } }, null); e.Handled = true; } }
private void ImageFlowList_Drop(object sender, DragEventArgs e) { Dispatcher.BeginInvoke(DispatcherPriority.Render, (SendOrPostCallback) delegate { _context = (ManagerContext)DataContext; if (e.Data.GetDataPresent(DataFormats.FileDrop, true)) { string[] droppedFilePaths = e.Data.GetData(DataFormats.FileDrop, true) as string[]; if (droppedFilePaths != null) { foreach (var path in droppedFilePaths) { _context.IngestImage(path); } } } }, null); }
public static List <Employee> GetEmployeeList( ManagerContext aDbContext, string aFilterQuery ) { var vEmployees = aDbContext.Employees .Include(emp => emp.Person); if (!String.IsNullOrEmpty(aFilterQuery)) { aFilterQuery = aFilterQuery.ToLower(); vEmployees = vEmployees.Where(emp => emp.Person.FirstName.ToLower().Contains(aFilterQuery) || emp.Person.LastName.ToLower().Contains(aFilterQuery)); } vEmployees = vEmployees.OrderBy(emp => emp.Person.LastName); return(vEmployees.ToList()); }
private void EditorListBox_KeyDown(object sender, KeyEventArgs e) { // Remove the last selected Slide from the active Cart if (e.Key == Key.Delete) { Dispatcher.BeginInvoke(DispatcherPriority.Render, (SendOrPostCallback) delegate { _context = (ManagerContext)DataContext; if (_lastSelectedEditorImageRef != null) { if (_context.EditorCart.Slides.Contains(_lastSelectedEditorImageRef) && _context.EditorCart.Slides.Count > 1) { _context.EditorCart.Slides.Remove(_lastSelectedEditorImageRef); _context.ReloadPreview(); } } }, null); } }
public async Task <Result <ManagerContext> > GetManagerContext() { var manager = GetManager(); if (manager.Result.IsFailure) { return(Result.Failure <ManagerContext>(manager.Result.Error)); } var serviceSupplier = GetServiceSupplier(); if (serviceSupplier.Result.IsFailure) { return(Result.Failure <ManagerContext>(serviceSupplier.Result.Error)); } var managerRelation = await _dbContext.ManagerServiceSupplierRelations .SingleOrDefaultAsync(relation => relation.ManagerId == manager.Result.Value.Id && relation.ServiceSupplierId == serviceSupplier.Result.Value.Id); if (managerRelation is null) { return(Result.Failure <ManagerContext>("Manager has no relation with service supplier")); } var managerContext = new ManagerContext { Id = manager.Result.Value.Id, FirstName = manager.Result.Value.FirstName, LastName = manager.Result.Value.LastName, Title = manager.Result.Value.Title, Position = manager.Result.Value.Position, Email = manager.Result.Value.Email, Phone = manager.Result.Value.Phone, Fax = manager.Result.Value.Fax, ServiceSupplierId = managerRelation.ServiceSupplierId, ManagerPermissions = managerRelation.ManagerPermissions, IsMaster = managerRelation.IsMaster }; return(Result.Success(managerContext)); }
private void btnSearch_Click(object sender, EventArgs e) { using (ManagerContext db = new ManagerContext()) { var stockitem = (from s in db.Stocks join i in db.Items on s.ItemId equals i.Id join sales in db.SalesItem on s.ItemId equals sales.ItemId where i.Code.StartsWith(txtSearch.Text) select new { i.Name, i.Code, Category = i.ItemCategory.Name, s.ItemId, s.ItemName, AvailbleQuantity = s.AvailableQuantity - sales.Quantity, s.AveragePrice }).ToList(); dgvStock.DataSource = stockitem; } }
public static List <Person> GetPersonList( ManagerContext aDbContext, string aFilterQuery ) { List <Person> vPersonList = new List <Person>(); if (!String.IsNullOrEmpty(aFilterQuery)) { aFilterQuery = aFilterQuery.ToLower(); vPersonList = aDbContext.Persons .Where(person => person.FirstName.ToLower().Contains(aFilterQuery) || person.LastName.ToLower().Contains(aFilterQuery)) .ToList(); } else { vPersonList = aDbContext.Persons.ToList(); } return(vPersonList); }
public ReportEmailModel() { ManagerContext db = new ManagerContext(); NumberOfEmails = db.Clients.Count(m => m.Email != null); }