public virtual IHttpActionResult Get([FromUri] GridArgs args)
        {
            var entities = GetEntities(args.Filtering);

            if (entities == null)
            {
                var empty = new GridResult <ReportMaterialModel, int>
                {
                    total = 0,
                    data  = new List <ReportMaterialModel>()
                };

                return(Ok(empty));
            }

            var total = entities.Count();

            entities = Page(entities, args.Paging);

            var result = new GridResult <ReportMaterialModel, int>
            {
                total = total,
                data  = entities.ToList()
            };

            return(Ok(result));
        }
Пример #2
0
    internal void Create(GridArgs BoardSize)
    {
        List <Tile> tiles = new List <Tile>();

        float boardWidth = Board.GetComponent <RectTransform>().rect.width;
        float boardHight = Board.GetComponent <RectTransform>().rect.height;

        float squareWidth = boardWidth / BoardSize.xSize;
        float squareHight = boardHight / BoardSize.ySize;

        Board.GetComponent <GridLayoutGroup>().cellSize = new Vector2(squareWidth, squareHight);

        for (int y = 0; y < BoardSize.ySize; y++)
        {
            for (int x = 0; x < BoardSize.xSize; x++)
            {
                GameObject newTile = Instantiate(SquarePrefab, Board.GetComponent <Transform>());
                newTile.name = "Tile: (" + x.ToString() + ", " + y.ToString() + ")";
                newTile.GetComponent <Coord>().SetValue(x, y);

                tiles.Add(newTile.GetComponent <Tile>());
            }
        }

        GetComponent <GameManager>().SetTiles(tiles);
    }
Пример #3
0
 public override IScreen OpenAnnotationInterface(GridArgs args)
 {
     return(DisplayMessage(new MessageArgs()
     {
         Persist = true,
         Block = true,
         Text = "Annotation available in VR.",
         BackEnabled = true
     }));
 }
Пример #4
0
 public override IScreen OpenInventory(GridArgs args)
 {
     return(DisplayMessage(new MessageArgs()
     {
         Persist = true,
         Block = true,
         Text = "Object inventory available in VR.",
         BackEnabled = true
     }));
 }
Пример #5
0
        public virtual void OpenGridMenu(IUserInterface userInterface, GridArgs args)
        {
            m_userInterface = userInterface;
            if (m_backButton != null)
            {
                m_backButton.gameObject.SetActive(args.BackEnabled);
            }
            m_refreshCategory = args.RefreshCategory;
            if (m_refreshCategory != null && m_refreshButton != null)
            {
                m_refreshButton.SetActive(true);
            }

            if (m_title != null)
            {
                m_title.text = args.Title;
            }
            OpenMenu(userInterface, args);
        }
Пример #6
0
        public IHttpActionResult Get([FromUri] GridArgs args, int id, int printTypeId)
        {
            string path          = String.Empty;
            var    dataDirectory = Path.Combine(HttpRuntime.AppDomainAppPath, "App_Data");
            var    report        = (PrintTypes)printTypeId;
            Stream stream        = null;

            switch (report)
            {
            case PrintTypes.Order:
                path   = Path.Combine(dataDirectory, Contracts.Configuration.OrderFileName);
                stream = printerManager.PrepareOrderPrintData(id, path, taxesManager, Manager);
                break;

            case PrintTypes.Offer:
                path   = Path.Combine(dataDirectory, Contracts.Configuration.OfferFileName);
                stream = printerManager.PrepareOfferPrintData(id, path, taxesManager, Manager);
                break;

            case PrintTypes.Invoice:
                path   = Path.Combine(dataDirectory, Contracts.Configuration.InvoiceFileName);
                stream = printerManager.PrepareInvoicePrintData(id, path, invoicesManager, Manager);
                break;

            case PrintTypes.ReminderMail:
                path = Path.Combine(dataDirectory, Contracts.Configuration.ReminderFileName);

                var invoices = invoicesManager.GetEntities(o => !o.PayDate.HasValue && o.ReminderCount < 3 &&
                                                           ((!o.LastReminderDate.HasValue && o.CreateDate.AddDays(o.PayInDays) < DateTime.Now) ||
                                                            (o.LastReminderDate.HasValue && o.LastReminderDate.Value.AddDays(8) < DateTime.Now)
                                                           )).ToList();

                foreach (var invoice in invoices)
                {
                    invoice.LastReminderDate = DateTime.Now;
                    invoice.ReminderCount++;
                }

                invoicesManager.SaveChanges();

                var newIds = invoices.Select(o => o.Id).ToList();

                var allInvoicesToReminder = new List <Contracts.Entities.Invoices>(invoices);
                allInvoicesToReminder.AddRange(invoicesManager.GetEntities(o => !o.PayDate.HasValue && o.ReminderCount != 0 &&
                                                                           !newIds.Contains(o.Id)).ToList());

                stream = printerManager.PrepareReminderPrintData(allInvoicesToReminder, path, invoicesManager, taxesManager, Manager);
                break;

            case PrintTypes.InvoiceStorno:
                path   = Path.Combine(dataDirectory, Contracts.Configuration.InvoiceStornoFileName);
                stream = printerManager.PrepareInvoiceStornoPrintData(id, path, invoiceStornosManager, Manager);
                break;

            case PrintTypes.DeliveryNote:

                var term = termsManager.GetById(id);

                if (!String.IsNullOrEmpty(term.DeliveryNoteFileName))
                {
                    var directory = Path.Combine(HttpRuntime.AppDomainAppPath, "Lieferscheine");
                    var filePath  = Path.Combine(directory, term.DeliveryNoteFileName);

                    if (File.Exists(filePath))
                    {
                        stream = File.OpenRead(filePath);
                    }
                    else
                    {
                        path   = Path.Combine(dataDirectory, Contracts.Configuration.DeliveryNoteFileName);
                        stream = printerManager.PrepareDeliveryNotePrintData(id, path, termsManager);
                    }
                }
                else
                {
                    path   = Path.Combine(dataDirectory, Contracts.Configuration.DeliveryNoteFileName);
                    stream = printerManager.PrepareDeliveryNotePrintData(id, path, termsManager);
                }
                break;

            default:
                throw new NotImplementedException();
            }

            stream.Position = 0;
            var result = new StreamActionResult(stream);

            if (report == PrintTypes.DeliveryNote)
            {
                result.ContentType = "application/pdf";
                path = "DeliveryNote.pdf";
            }
            else if (report == PrintTypes.Invoice)
            {
                result.ContentType = "application/pdf";
                path = "Invoice.pdf";
            }
            else
            {
                result.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            }

            result.ContentDisposition = new ContentDispositionHeaderValue("attachment")
            {
                FileName = Path.GetFileName(path)
            };

            return(result);
        }