public Item( Game game, string id, ActionHandlers actionHandlers, ItemDependency?dependency, string displayName, RelativePosition interactPosition, string interactStatus, bool isTouchable, int scrollFactor, int depthOffset, string status, bool canBeUsedWithOtherObject) : base( game, id, actionHandlers, displayName, interactPosition, interactStatus, isTouchable, scrollFactor, depthOffset, status) { _dependency = dependency; CanBeUsedWithOtherObject = canBeUsedWithOtherObject; }
internal Actor( Game game, string id, ActionHandlers actionHandlers, string displayName, RelativePosition interactPosition, string interactStatus, bool isTouchable, int scrollFactor, int depthOffset, string status, string textColor) : base( game, id, actionHandlers, displayName, interactPosition, interactStatus, isTouchable, scrollFactor, depthOffset, status) { _inventory = new(); TextColor = textColor; }
private void FillControlsItems() { //_prefillItems = RestQueryApi.QueryPostJsonRaw("systemconfig", "prefill", "getfillitems", null, null).ToDynamicList(); _prefillItems = new dynamic[] {}; ComplexPrefillEditor.Properties.Items.Clear(); ComplexPrefillEditor.Properties.Items.AddRange(ActionHandlers.BuildImageComboBoxItems().ToList()); ComplexValidationErrorEditor.Properties.Items.Clear(); ComplexValidationErrorEditor.Properties.Items.AddRange(ValidationHandlers.BuildImageComboBoxItems().ToList()); ComplexValidationWarningEditor.Properties.Items.Clear(); ComplexValidationWarningEditor.Properties.Items.AddRange(ValidationHandlers.BuildImageComboBoxItems().ToList()); SimpleValidationWarningEditor.Properties.Items.Clear(); SimpleValidationWarningEditor.Properties.Items.AddRange(ValidationWarnings.BuildImageComboBoxItemsString().ToList()); SimpleValidationErrorEditor.Properties.Items.Clear(); SimpleValidationErrorEditor.Properties.Items.AddRange(ValidationErrors.BuildImageComboBoxItemsString().ToList()); DeletingDocumentValidationErrorEditor.Properties.Items.Clear(); DeletingDocumentValidationErrorEditor.Properties.Items.AddRange(ValidationHandlers.BuildImageComboBoxItems().ToList()); SuccessSaveEditor.Properties.Items.Clear(); SuccessSaveEditor.Properties.Items.AddRange(ActionHandlers.BuildImageComboBoxItems().ToList()); FailSaveEditor.Properties.Items.Clear(); FailSaveEditor.Properties.Items.AddRange(ActionHandlers.BuildImageComboBoxItems().ToList()); DeleteDocumentEditor.Properties.Items.Clear(); DeleteDocumentEditor.Properties.Items.AddRange(ActionHandlers.BuildImageComboBoxItems().ToList()); DefaultProcessCredentialsAction.Properties.Items.Clear(); DefaultProcessCredentialsAction.Properties.Items.AddRange(ActionHandlers.BuildImageComboBoxItems().ToList()); }
public void AppendStringShorthand() { IScanner scanner = Provider.NewScanner; ArrayList list = NewList; Parser parser = new StringParser(Provider.Text)[ActionHandlers.Append(list)]; parser.Parse(scanner); Assert.AreEqual(list.Count, 1); Assert.AreEqual(list[0], Provider.Text); }
public void AppendString() { IScanner scanner = Provider.NewScanner; StringParser parser = new StringParser(Provider.Text); IList list = NewList; parser.Act += ActionHandlers.Append(list); parser.Parse(scanner); Assert.AreEqual(list.Count, 1); Assert.AreEqual(list[0], Provider.Text); }
protected GameObject( Game game, string id, ActionHandlers actionHandlers, string displayName, RelativePosition interactPosition, string interactStatus, bool isTouchable, int scrollFactor, int depthOffset, string status) { Game = game; Id = id; ActionHandlers = actionHandlers; DisplayName = displayName; InteractPosition = interactPosition; InteractStatus = interactStatus; IsTouchable = isTouchable; ScrollFactor = scrollFactor; DepthOffset = depthOffset; Position = new Point(-1, -1); Status = status; }
private async Task <IActionResult> CreateSellDocFromRecTrans(SellDocCreateAjaxDto data, RecurringTransDoc recurringTransDoc) { const string sectionCode = "SYS-SELL-COMBINED-SCN"; bool noWarehouseTrans = false; SellDocCreateAjaxNoLinesDto transToAttachNoLines; SellDocument transToAttach; DateTime dateOfTrans; if (data == null) { return(BadRequest(new { error = "Empty request data" })); } try { transToAttachNoLines = _mapper.Map <SellDocCreateAjaxNoLinesDto>(data); transToAttach = _mapper.Map <SellDocument>(transToAttachNoLines); transToAttach.SalesChannelId = 1; dateOfTrans = data.TransDate; } catch (Exception e) { return(BadRequest(new { error = e.Message })); } using (var transaction = _context.Database.BeginTransaction()) { #region Fiscal Period var fiscalPeriod = await _context.FiscalPeriods.FirstOrDefaultAsync(p => dateOfTrans >= p.StartDate && dateOfTrans <= p.EndDate); if (fiscalPeriod == null) { transaction.Rollback(); ModelState.AddModelError(string.Empty, "No Fiscal Period covers Transaction Date"); return(NotFound(new { error = "No Fiscal Period covers Transaction Date" })); } #endregion var docSeries = await _context.SellDocSeriesDefs.SingleOrDefaultAsync(m => m.Id == data.SellDocSeriesId); if (docSeries is null) { transaction.Rollback(); ModelState.AddModelError(string.Empty, "Δεν βρέθηκε η σειρά παραστατικού"); return(NotFound(new { error = "Buy Doc Series not found" })); } await _context.Entry(docSeries).Reference(t => t.SellDocTypeDef).LoadAsync(); var docTypeDef = docSeries.SellDocTypeDef; await _context.Entry(docTypeDef) .Reference(t => t.TransTransactorDef) .LoadAsync(); await _context.Entry(docTypeDef).Reference(t => t.TransWarehouseDef) .LoadAsync(); #region Section Management int sectionId = 0; if (docTypeDef.SectionId == 0) { var sectn = await _context.Sections.SingleOrDefaultAsync(s => s.SystemName == sectionCode); if (sectn == null) { transaction.Rollback(); ModelState.AddModelError(string.Empty, "Δεν υπάρχει το Section"); return(NotFound(new { error = "Could not locate section " })); } sectionId = sectn.Id; } else { sectionId = docTypeDef.SectionId; } #endregion var transTransactorDef = docTypeDef.TransTransactorDef; var transWarehouseDef = docTypeDef.TransWarehouseDef; transToAttach.SectionId = sectionId; transToAttach.FiscalPeriodId = fiscalPeriod.Id; transToAttach.SellDocTypeId = docSeries.SellDocTypeDefId; _context.SellDocuments.Add(transToAttach); try { await _context.SaveChangesAsync(); } catch (Exception e) { Console.WriteLine(e); transaction.Rollback(); string msg = e.InnerException.Message; return(BadRequest(new { error = e.Message + " " + msg })); } var docId = _context.Entry(transToAttach).Entity.Id; if (transTransactorDef.DefaultDocSeriesId > 0) { var transTransactorDefaultSeries = await _context.TransTransactorDocSeriesDefs.FirstOrDefaultAsync(p => p.Id == transTransactorDef.DefaultDocSeriesId); if (transTransactorDefaultSeries == null) { transaction.Rollback(); ModelState.AddModelError(string.Empty, "Default series for transactor transaction not found"); return(NotFound(new { error = "Default series for transactor transaction not found" })); } var sTransactorTransaction = _mapper.Map <TransactorTransaction>(data); sTransactorTransaction.TransactorId = data.TransactorId; sTransactorTransaction.SectionId = sectionId; sTransactorTransaction.TransTransactorDocTypeId = transTransactorDefaultSeries.TransTransactorDocTypeDefId; sTransactorTransaction.TransTransactorDocSeriesId = transTransactorDefaultSeries.Id; sTransactorTransaction.FiscalPeriodId = fiscalPeriod.Id; sTransactorTransaction.CreatorId = docId; ActionHandlers.TransactorFinAction(transTransactorDef.FinancialTransAction, sTransactorTransaction); _context.TransactorTransactions.Add(sTransactorTransaction); try { await _context.SaveChangesAsync(); } catch (Exception e) { transaction.Rollback(); string msg = e.InnerException.Message; return(BadRequest(new { error = e.Message + " " + msg })); } } #region Αυτόματη Εξόφληση //Αυτόματη εξόφληση var paymentMethod = await _context.PaymentMethods.FirstOrDefaultAsync(p => p.Id == transToAttach.PaymentMethodId); if (paymentMethod is null) { transaction.Rollback(); ModelState.AddModelError(string.Empty, "Δεν βρέθηκε ο τρόπος πληρωμής"); return(NotFound(new { error = "Δεν βρέθηκε ο τρόπος πληρωμής" })); } if (paymentMethod.AutoPayoffWay == SeriesAutoPayoffEnum.SeriesAutoPayoffEnumAuto) { var autoPaySeriesId = transToAttach.SellDocSeries.PayoffSeriesId; if (autoPaySeriesId > 0) { var transTransactorPayOffSeries = await _context.TransTransactorDocSeriesDefs.FirstOrDefaultAsync(p => p.Id == autoPaySeriesId); if (transTransactorPayOffSeries == null) { transaction.Rollback(); ModelState.AddModelError(string.Empty, "AutoPayOff series not found"); return(NotFound(new { error = "AutoPayOff series not found" })); } var sTransactorTransaction = _mapper.Map <TransactorTransaction>(data); sTransactorTransaction.TransactorId = data.TransactorId; sTransactorTransaction.SectionId = sectionId; sTransactorTransaction.TransTransactorDocTypeId = transTransactorPayOffSeries.TransTransactorDocTypeDefId; sTransactorTransaction.TransTransactorDocSeriesId = transTransactorPayOffSeries.Id; sTransactorTransaction.FiscalPeriodId = fiscalPeriod.Id; sTransactorTransaction.Etiology = "AutoPayOff"; sTransactorTransaction.CreatorId = docId; await _context.Entry(transTransactorPayOffSeries) .Reference(t => t.TransTransactorDocTypeDef) .LoadAsync(); var transTransactorDocTypeDef = transTransactorPayOffSeries.TransTransactorDocTypeDef; await _context.Entry(transTransactorDocTypeDef) .Reference(t => t.TransTransactorDef) .LoadAsync(); var transPaymentTransactorDef = transTransactorDocTypeDef.TransTransactorDef; ActionHandlers.TransactorFinAction(transPaymentTransactorDef.FinancialTransAction, sTransactorTransaction); _context.TransactorTransactions.Add(sTransactorTransaction); try { await _context.SaveChangesAsync(); } catch (Exception e) { transaction.Rollback(); string msg = e.InnerException.Message; return(BadRequest(new { error = e.Message + " " + msg })); } } } #endregion int warehouseSeriesId = 0; int warehouseTypeId = 0; if (transWarehouseDef.DefaultDocSeriesId > 0) { var transWarehouseDefaultSeries = await _context.TransWarehouseDocSeriesDefs.FirstOrDefaultAsync(p => p.Id == transWarehouseDef.DefaultDocSeriesId); if (transWarehouseDefaultSeries == null) { transaction.Rollback(); ModelState.AddModelError(string.Empty, "Default series for warehouse transaction not found"); return(NotFound(new { error = "Default series for warehouse transaction not found" })); } noWarehouseTrans = false; warehouseSeriesId = transWarehouseDef.DefaultDocSeriesId; warehouseTypeId = transWarehouseDefaultSeries.TransWarehouseDocTypeDefId; } else { noWarehouseTrans = true; } foreach (var docLine in data.SellDocLines) { var warehouseItemId = docLine.WarehouseItemId; var material = await _context.WarehouseItems.SingleOrDefaultAsync(p => p.Id == warehouseItemId); if (material is null) { //Handle error transaction.Rollback(); ModelState.AddModelError(string.Empty, "Doc Line error null WarehouseItem"); return(NotFound(new { error = "Could not locate material in Doc Line " })); } #region MaterialLine var sellDocLine = new SellDocLine(); decimal unitPrice = docLine.Price; decimal units = (decimal)docLine.Q1; decimal fpaRate = (decimal)docLine.FpaRate; decimal discountRate = (decimal)docLine.DiscountRate; decimal lineNetAmount = unitPrice * units; decimal lineDiscountAmount = lineNetAmount * discountRate; decimal lineFpaAmount = (lineNetAmount - lineDiscountAmount) * fpaRate; sellDocLine.UnitPrice = unitPrice; sellDocLine.AmountFpa = lineFpaAmount; sellDocLine.AmountNet = lineNetAmount; sellDocLine.AmountDiscount = lineDiscountAmount; sellDocLine.DiscountRate = discountRate; sellDocLine.FpaRate = fpaRate; sellDocLine.WarehouseItemId = docLine.WarehouseItemId; sellDocLine.Quontity1 = docLine.Q1; sellDocLine.Quontity2 = docLine.Q2; sellDocLine.PrimaryUnitId = docLine.MainUnitId; sellDocLine.SecondaryUnitId = docLine.SecUnitId; sellDocLine.Factor = docLine.Factor; sellDocLine.SellDocumentId = docId; sellDocLine.Etiology = transToAttach.Etiology; //_context.Entry(transToAttach).Entity transToAttach.SellDocLines.Add(sellDocLine); #endregion if (!noWarehouseTrans) { #region Warehouse transaction var warehouseTrans = new WarehouseTransaction(); warehouseTrans.FpaRate = fpaRate; warehouseTrans.DiscountRate = discountRate; warehouseTrans.UnitPrice = unitPrice; warehouseTrans.AmountDiscount = lineDiscountAmount; warehouseTrans.AmountNet = lineNetAmount; warehouseTrans.AmountFpa = lineFpaAmount; warehouseTrans.CompanyId = transToAttach.CompanyId; warehouseTrans.Etiology = transToAttach.Etiology; warehouseTrans.FiscalPeriodId = transToAttach.FiscalPeriodId; warehouseTrans.WarehouseItemId = warehouseItemId; warehouseTrans.PrimaryUnitId = docLine.MainUnitId; warehouseTrans.SecondaryUnitId = docLine.SecUnitId; warehouseTrans.SectionId = sectionId; warehouseTrans.CreatorId = transToAttach.Id; warehouseTrans.TransDate = transToAttach.TransDate; warehouseTrans.TransRefCode = transToAttach.TransRefCode; warehouseTrans.UnitFactor = (decimal)docLine.Factor; warehouseTrans.TransWarehouseDocSeriesId = warehouseSeriesId; warehouseTrans.TransWarehouseDocTypeId = warehouseTypeId; ActionHandlers.ItemNatureHandler(material.WarehouseItemNature, warehouseTrans, transWarehouseDef); ActionHandlers.ItemInventoryActionHandler(warehouseTrans.InventoryAction, docLine.Q1, docLine.Q2, warehouseTrans); ActionHandlers.ItemInventoryValueActionHandler(warehouseTrans.InventoryValueAction, warehouseTrans); _context.WarehouseTransactions.Add(warehouseTrans); #endregion } } try { await _context.SaveChangesAsync(); } catch (Exception e) { transaction.Rollback(); string msg = e.InnerException.Message; return(BadRequest(new { error = e.Message + " " + msg })); } var curDate = recurringTransDoc.NextTransDate; var nextDate = GetNextTransactionDate(curDate, recurringTransDoc.RecurringFrequency); recurringTransDoc.NextTransDate = nextDate; _context.Entry(recurringTransDoc).State = EntityState.Modified; try { await _context.SaveChangesAsync(); transaction.Commit(); } catch (Exception e) { transaction.Rollback(); string msg = e.InnerException.Message; return(BadRequest(new { error = e.Message + " " + msg })); } } return(Ok()); }
public override Action?GetHandler(ActionHandlers actionHandlers) => actionHandlers.HandleTalkTo;
public abstract Action?GetHandler(ActionHandlers actionHandlers);
public override Action?GetHandler(ActionHandlers actionHandlers) => actionHandlers.HandleClose;
public override Action?GetHandler(ActionHandlers actionHandlers) => actionHandlers.HandlePickUp;
public override Action?GetHandler(ActionHandlers actionHandlers) => actionHandlers.HandleLookAt;
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { LoadCombos(); return(Page()); } #region Fiscal Period var fiscalPeriod = await HelperFunctions.GetFiscalPeriod(_context, ItemVm.TransDate); if (fiscalPeriod == null) { ModelState.AddModelError(string.Empty, "No Fiscal Period covers Transaction Date"); return(Page()); } #endregion await using (var transaction = await _context.Database.BeginTransactionAsync()) { #region transaction 1 var docSeries1 = await _context.TransTransactorDocSeriesDefs.SingleOrDefaultAsync(m => m.Id == ItemVm.DocSeries1Id); if (docSeries1 is null) { ModelState.AddModelError(string.Empty, "Δεν βρέθηκε η σειρά παραστατικού"); LoadCombos(); return(Page()); } await _context.Entry(docSeries1).Reference(t => t.TransTransactorDocTypeDef).LoadAsync(); var docTypeDef1 = docSeries1.TransTransactorDocTypeDef; await _context.Entry(docTypeDef1) .Reference(t => t.TransTransactorDef) .LoadAsync(); var transTransactorDef1 = docTypeDef1.TransTransactorDef; #region Section Management int sectionId1 = 0; if (docTypeDef1.SectionId == 0) { var sectn = await _context.Sections.SingleOrDefaultAsync(s => s.SystemName == _sectionCode); if (sectn == null) { ModelState.AddModelError(string.Empty, "Δεν υπάρχει το Section"); LoadCombos(); return(Page()); } sectionId1 = sectn.Id; } else { sectionId1 = docTypeDef1.SectionId; } #endregion TransactorTransaction spTransaction1 = new TransactorTransaction { TransDate = ItemVm.TransDate, TransactorId = ItemVm.Transactor1Id, SectionId = sectionId1, TransTransactorDocSeriesId = docSeries1.Id, TransTransactorDocTypeId = docSeries1.TransTransactorDocTypeDefId, FiscalPeriodId = fiscalPeriod.Id, CompanyId = ItemVm.CompanyId, Etiology = ItemVm.Etiology, AmountNet = ItemVm.Amount, TransRefCode = ItemVm.RefCode, FinancialAction = transTransactorDef1.FinancialTransAction }; ActionHandlers.TransactorFinAction(transTransactorDef1.FinancialTransAction, spTransaction1); #endregion #region transaction 2 var docSeries2 = await _context.TransTransactorDocSeriesDefs.SingleOrDefaultAsync(m => m.Id == ItemVm.DocSeries2Id); if (docSeries2 is null) { ModelState.AddModelError(string.Empty, "Δεν βρέθηκε η σειρά παραστατικού"); LoadCombos(); return(Page()); } await _context.Entry(docSeries2).Reference(t => t.TransTransactorDocTypeDef).LoadAsync(); var docTypeDef2 = docSeries2.TransTransactorDocTypeDef; await _context.Entry(docTypeDef2) .Reference(t => t.TransTransactorDef) .LoadAsync(); var transTransactorDef2 = docTypeDef2.TransTransactorDef; #region Section Management int sectionId2 = 0; if (docTypeDef2.SectionId == 0) { var sectn = await _context.Sections.SingleOrDefaultAsync(s => s.SystemName == _sectionCode); if (sectn == null) { ModelState.AddModelError(string.Empty, "Δεν υπάρχει το Section"); LoadCombos(); return(Page()); } sectionId2 = sectn.Id; } else { sectionId2 = docTypeDef2.SectionId; } #endregion TransactorTransaction spTransaction2 = new TransactorTransaction { TransDate = ItemVm.TransDate, TransactorId = ItemVm.Transactor2Id, SectionId = sectionId2, TransTransactorDocSeriesId = docSeries2.Id, TransTransactorDocTypeId = docSeries2.TransTransactorDocTypeDefId, FiscalPeriodId = fiscalPeriod.Id, CompanyId = ItemVm.CompanyId, Etiology = ItemVm.Etiology, AmountNet = ItemVm.Amount, TransRefCode = ItemVm.RefCode, FinancialAction = transTransactorDef2.FinancialTransAction }; ActionHandlers.TransactorFinAction(transTransactorDef2.FinancialTransAction, spTransaction2); #endregion try { await _context.TransactorTransactions.AddAsync(spTransaction1); await _context.TransactorTransactions.AddAsync(spTransaction2); await _context.SaveChangesAsync(); await transaction.CommitAsync(); } catch (Exception e) { await transaction.RollbackAsync(); string msg = e.InnerException?.Message; ModelState.AddModelError(string.Empty, msg); LoadCombos(); return(Page()); } } return(RedirectToPage("./Index")); }