/// <summary>
        /// Retrieves list of Invoice objects from SqlCommand, after database query
        /// number of rows retrieved and returned depends upon the rows field value
        /// </summary>
        /// <param name="cmd">The command object to use for query</param>
        /// <param name="rows">Number of rows to process</param>
        /// <returns>A list of Invoice objects</returns>
        private InvoiceList GetList(SqlCommand cmd, long rows)
        {
            // Select multiple records
            SqlDataReader reader;
            long          result = SelectRecords(cmd, out reader);

            //Invoice list
            InvoiceList list = new InvoiceList();

            using ( reader )
            {
                // Read rows until end of result or number of rows specified is reached
                while (reader.Read() && rows-- != 0)
                {
                    Invoice invoiceObject = new Invoice();
                    FillObject(invoiceObject, reader);

                    list.Add(invoiceObject);
                }

                // Close the reader in order to receive output parameters
                // Output parameters are not available until reader is closed.
                reader.Close();
            }

            return(list);
        }
예제 #2
0
 public Processor()
 {
     InvoiceNoValue             = new InvoiceList();
     InvoiceUpToSixPages        = new InvoiceList();
     InvoiceUpToTwelvePages     = new InvoiceList();
     InvoiceMoreThanTwelvePages = new InvoiceList();
 }
예제 #3
0
        public void EPT_BatchImport()
        {
            int size = EntityTest.BATCH_IMPORT_DATA_SIZE;

            var repo = RF.ResolveInstance <InvoiceRepository>();

            using (RF.TransactionScope(repo))
            {
                var list = new InvoiceList();
                for (int i = 0; i < size; i++)
                {
                    var item = new Invoice();
                    list.Add(item);
                }
                repo.CreateImporter().Save(list);

                list.Clear();
                repo.CreateImporter().Save(list);

                Assert.AreEqual(repo.CountAll(), 0, "幽灵状态的实体,应该无法通过正常的 API 查出。");

                using (PhantomContext.DontFilterPhantoms())
                {
                    Assert.AreEqual(repo.CountAll(), size, "幽灵状态的实体,可以使用特定 API 查出。");
                    var all2 = repo.GetAll();
                    Assert.AreEqual(all2.Count, size, "幽灵状态的实体,应该无法通过正常的 API 查出。");
                    Assert.AreEqual(EntityPhantomExtension.GetIsPhantom(all2[0]), true, "幽灵状态的实体,IsPhantom 值为 true。");
                }
            }
        }
예제 #4
0
        private ToolStripMenuItem CreateShowActFuelCard()
        {
            ToolStripMenuItem item = CreateItem("Акт передачи топливной карты");

            item.Click += delegate
            {
                Car car = _dgvMain.GetCar();
                if (car == null)
                {
                    MessageBox.Show("Для формирования акта выберите ячейку в таблице", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    InvoiceList invoiceList = InvoiceList.getInstance();
                    Invoice     invoice     = invoiceList.getItem(_dgvMain.GetID());
                    if (invoice == null)
                    {
                        MessageBox.Show("Для формирования акта необходимо перейти на страницу \"Перемещения\"", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    CreateDocument doc = new CreateDocument(car, invoice);
                    doc.ShowActFuelCard();
                }
            };
            return(item);
        }
예제 #5
0
        public void EPT_Clear_Query()
        {
            var repo = RF.ResolveInstance <InvoiceRepository>();

            using (RF.TransactionScope(repo))
            {
                var InvoiceList = new InvoiceList
                {
                    new Invoice(),
                    new Invoice(),
                    new Invoice()
                };
                repo.Save(InvoiceList);
                Assert.AreEqual(repo.CountAll(), 3);

                InvoiceList.Clear();
                repo.Save(InvoiceList);
                Assert.AreEqual(repo.CountAll(), 0, "幽灵状态的实体,应该无法通过正常的 API 查出。");
                var all = repo.GetAll();
                Assert.AreEqual(all.Count, 0, "幽灵状态的实体,应该无法通过正常的 API 查出。");

                using (PhantomContext.DontFilterPhantoms())
                {
                    Assert.AreEqual(repo.CountAll(), 3, "幽灵状态的实体,可以使用特定 API 查出。");
                    var all2 = repo.GetAll();
                    Assert.AreEqual(all2.Count, 3, "幽灵状态的实体,应该无法通过正常的 API 查出。");
                    Assert.AreEqual(EntityPhantomExtension.GetIsPhantom(all2[0]), true, "幽灵状态的实体,IsPhantom 值为 true。");
                    Assert.AreEqual(EntityPhantomExtension.GetIsPhantom(all2[1]), true, "幽灵状态的实体,IsPhantom 值为 true。");
                    Assert.AreEqual(EntityPhantomExtension.GetIsPhantom(all2[2]), true, "幽灵状态的实体,IsPhantom 值为 true。");
                }
            }
        }
예제 #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //Initialize Controller
            m_AppController = new AppController();

            /* Note that the DataProvider class is static, so it doesn't
             * get instantiated. */

            // Get invoices List
            CommandGetInvoices getInvoices = new CommandGetInvoices();

            m_Invoices = (InvoiceList)m_AppController.ExecuteCommand(getInvoices);

            //Get Customer List
            CommandGetCustomer getCustomer = new CommandGetCustomer();

            m_Customer = (CustomerList)m_AppController.ExecuteCommand(getCustomer);

            //Bind Grids
            bindingInvoice.DataSource = m_Invoices;
            bindingItems.DataSource   = bindingInvoice;
            bindingItems.DataMember   = "Items";

            namaInstitusiCmb.DataSource = m_Customer;
            bindingCustomer.DataSource  = m_Customer;
        }
예제 #7
0
        private void NewInvoice()
        {
            if (Validator.ValidateAll().IsValid)
            {
                if (order.Id == 0)
                {
                    order = UnitOfWork.Orders.Add(order);
                }

                var vm = new InvoiceCreationViewModel(new UnitOfWorkFactory());
                vm.Init();
                var windowView = new InvoiceCreationView(vm);

                if (windowView.ShowDialog() ?? false)
                {
                    var    invoiceNumber = vm.InvoiceNumber;
                    var    amount        = double.Parse(vm.Amount);
                    string fileName;
                    try
                    {
                        fileName = FileAccess.CreateDocumentFromTemplate(order.Customer, invoiceNumber, Properties.Settings.Default.InvoiceTemplatePath);
                    }
                    catch (Win32Exception)
                    {
                        MessageBox.Show("Das Dokument konnte nicht erstellt werden. Eventuell haben Sie die Vorlage noch geöffnet.", "Ein Fehler ist aufgetreten");
                        return;
                    }

                    var document = new Document
                    {
                        IssueDate    = DateTime.Now,
                        Name         = invoiceNumber,
                        Tag          = "Rechnung",
                        RelativePath = fileName
                    };

                    document = UnitOfWork.Documents.Add(document);

                    var invoice = new Invoice
                    {
                        Amount        = amount,
                        InvoiceNumber = invoiceNumber,
                        IsPaid        = false,
                        Order         = order,
                        Document      = document
                    };

                    invoice = UnitOfWork.Invoices.Add(invoice);

                    UnitOfWork.Complete();

                    InvoiceList.Add(invoice);

                    if (vm.OpenAfterSave ?? false)
                    {
                        Open(fileName);
                    }
                }
            }
        }
예제 #8
0
        private void dgBindingFrm_Load(object sender, EventArgs e)
        {
            //Initialize Controller
            m_AppController = new AppController();

            /* Note that the DataProvider class is static, so it doesn't
             * get instantiated. */

            //Get Customer List
            CommandGettingOutlet getOutlets = new CommandGettingOutlet();

            m_OutletList = (outletList)m_AppController.ExecuteCommand(getOutlets);

            // Get invoices List
            CommandGetInvoices getInvoices = new CommandGetInvoices();

            m_Invoices = (InvoiceList)m_AppController.ExecuteCommand(getInvoices);

            CommandGetRoti getRoti = new CommandGetRoti();

            m_RotiList = (RotiToChooseList)m_AppController.ExecuteCommand(getRoti);

            //Bind Grids
            outletItemBindingSource.DataSource       = m_OutletList;
            rotiToChooseItemBindingSource.DataSource = m_RotiList;

            bindingInvoice.DataSource = m_Invoices;
            bindingItem.DataSource    = bindingInvoice;
            bindingItem.DataMember    = "Items";
        }
예제 #9
0
        public void DPT_EntityList_Migration()
        {
            //聚合实体
            var repo = RF.ResolveInstance <InvoiceRepository>();

            using (RF.TransactionScope(DataTableMigrationPlugin.BackUpDbSettingName))
            {
                using (RF.TransactionScope(DataTableMigrationPlugin.DbSettingName))
                {
                    var invoiceList = new InvoiceList
                    {
                        new Invoice()
                        {
                            InvoiceItemList =
                            {
                                new InvoiceItem(),
                                new InvoiceItem(),
                            }
                        },
                        new Invoice()
                        {
                            InvoiceItemList =
                            {
                                new InvoiceItem(),
                                new InvoiceItem(),
                            }
                        },
                        new Invoice(),
                        new Invoice()
                    };

                    RF.Save(invoiceList);

                    Assert.AreEqual(repo.GetAll().Count, 4, "新增 Invoice 数目为4");

                    var context = new DataTableMigrationContext(
                        2,
                        DateTime.Now.AddMinutes(2),
                        new List <Type>()
                    {
                        typeof(Invoice)
                    }
                        );

                    var dataTableMigrationService = new DataTableMigrationService(context);

                    dataTableMigrationService.ExecuteArchivingData();

                    Assert.AreEqual(repo.GetAll().Count, 0, "执行数据归档后 Invoice 数目为 0");

                    using (RdbDataProvider.RedirectDbSetting(
                               DataTableMigrationPlugin.DbSettingName,
                               DataTableMigrationPlugin.BackUpDbSettingName
                               ))
                    {
                        Assert.AreEqual(repo.GetAll().Count, 4, "数据归档数据库 Invoice 数目为 4");
                    }
                }
            }
        }
예제 #10
0
        private CreateDocument CreateWayBill(Car car, DateTime date, int idInvoice = 0)
        {
            CreateDocument waybill = new CreateDocument(car);

            Driver driver = null;

            if (idInvoice != 0)
            {
                InvoiceList invoiceList = InvoiceList.getInstance();
                Invoice     invoice     = invoiceList.getItem(idInvoice);
                DriverList  driverList  = DriverList.getInstance();
                driver = driverList.getItem(Convert.ToInt32(invoice.DriverToID));
            }

            waybill.CreateWaybill(date, driver);

            try
            {
                if (_type == WayBillType.Day)
                {
                    waybill.AddRouteInWayBill(date, Fields.All);
                }
            }
            catch (NullReferenceException ex)
            {
                MessageBox.Show(ex.Message, "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
                waybill.Exit();
                throw;
            }

            return(waybill);
        }
예제 #11
0
        private string getNextNumber()
        {
            InvoiceList invoiceList = InvoiceList.getInstance();
            int         number      = invoiceList.GetNextNumber();

            return(number.ToString());
        }
예제 #12
0
        public static InvoiceList ReadInvoiceList()
        {
            string location = Directory.GetCurrentDirectory();
            string fileName = "/../../../invoicelist.txt";

            if (File.Exists(location + fileName))
            {
                using (FileStream fileStream = File.OpenRead(location + fileName))
                {
                    BinaryFormatter f = new BinaryFormatter();

                    while (fileStream.Position < fileStream.Length)
                    {
                        InvoiceList il = f.Deserialize(fileStream) as InvoiceList;
                        return(il);
                    }
                    fileStream.Close();
                }
            }
            else
            {
                return(null);
            }
            return(null);
        }
        // to add total to invoice table
        protected void Button3_Click(object sender, EventArgs e)
        {
            using (DatabaseEntities db = new DatabaseEntities())
            {
                var result = from i in db.invoice_line_item
                             group i by new
                {
                    i.inv_hed_id
                } into g

                    select new
                {
                    g.Key.inv_hed_id,
                    totalcost = (double)g.Sum(x => x.ser_cost)
                };

                foreach (var r in result)
                {
                    foreach (var s in db.invoices)
                    {
                        if (r.inv_hed_id == s.inv_hed_id)
                        {
                            s.total_cost = r.totalcost;
                        }
                    }
                }

                db.SaveChanges();
            }

            var invoices = db.invoices.ToList();

            InvoiceList.DataSource = invoices;
            InvoiceList.DataBind();
        }
예제 #14
0
        internal override object[] getRow()
        {
            MileageList mileageList = MileageList.getInstance();
            Mileage     mileage     = mileageList.getItem(this);
            InvoiceList invoiceList = InvoiceList.getInstance();
            Invoice     invoice     = invoiceList.getItem(this);

            PTSList ptsList = PTSList.getInstance();
            PTS     pts     = ptsList.getItem(this);

            STSList stsList = STSList.getInstance();
            STS     sts     = stsList.getItem(this);

            Regions regions    = Regions.getInstance();
            string  regionName = (invoice == null) ? regions.getItem(_idRegionUsing) : regions.getItem(Convert.ToInt32(invoice.RegionToID));

            int      mileageInt  = 0;
            DateTime mileageDate = DateTime.Today;

            if (mileage != null)
            {
                int.TryParse(mileage.Count, out mileageInt);
                mileageDate = mileage.MonthToString();
            }

            return(new object[] { ID, ID, BBNumber, Grz, Mark.Name, info.Model, vin, regionName,
                                  info.Driver.GetName(NameType.Full), pts.Number, sts.Number, Year, mileageInt,
                                  mileageDate, info.Owner, info.Guarantee, GetStatus() });
        }
예제 #15
0
        private void detailedBindingForm_Load(object sender, EventArgs e)
        {
            m_AppController = new AppController();
            m_Control       = new miscellanacousFunction();

            CommandGetInvoices getInvoices = new CommandGetInvoices();

            m_InvoiceList = (InvoiceList)m_AppController.ExecuteCommand(getInvoices);

            CommandGetOutlet getOutlets = new CommandGetOutlet();

            m_OutletList = (outletList)m_AppController.ExecuteCommand(getOutlets);

            CommandGetRoti getRoti = new CommandGetRoti();

            m_RotiToChooseList = (RotiToChooseList)m_AppController.ExecuteCommand(getRoti);

            outletItemBindingSource.DataSource   = m_OutletList;
            RotiToChooseBindingSource.DataSource = m_RotiToChooseList;

            invoiceItemBindingSource.DataSource = m_InvoiceList;
            itemsBindingSource.DataSource       = invoiceItemBindingSource;
            itemsBindingSource.DataMember       = "Items";

            //invoiceItemBindingSource.Position = 0;
        }
        public void WhenCreatingNewInvoiceList_CountRecordsShouldBeZero()
        {
            // arrange & act
            var invoiceList = new InvoiceList();

            // assert
            invoiceList.CountRecords().Should().Be(0);
        }
예제 #17
0
파일: MainForm.cs 프로젝트: ademaydogdu/msp
        private void btnSatisFaturasi_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            InvoiceList frm = new InvoiceList();

            frm.invoice   = Models.InvoiceType.SatisFaturasi;
            frm.MdiParent = this;
            frm.Show();
        }
        public void WhenCreatingNewInvoiceList_GetRecordsShouldBeEmptyButNotNull()
        {
            // arrange & act
            var invoiceList = new InvoiceList();

            // assert
            invoiceList.GetRecords().Should().NotBeNull();
            invoiceList.GetRecords().Should().BeEmpty();
        }
예제 #19
0
 public ActionResult EditTimesheetSummary(InvoiceList i)
 {
     using (LittleDwarfAgencyEntities1 context = new LittleDwarfAgencyEntities1())
     {
         context.Entry(i).State = EntityState.Modified;
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
 //Invoice Stock Info Load
 public void InvoiceStockInfoLoad(InvoiceList invoiceItems, TextBlock textboxproductID, TextBlock textBoxQuantity, TextBlock textBoxWaitAndAvarageRate, string ProductID)
 {
     StockInfoLoad(textboxproductID, textBoxQuantity, textBoxWaitAndAvarageRate, ProductID);
     IEnumerable<InvoiceItems> ProductChecker = from invoiceItem in invoiceItems where invoiceItem.ProductID.Equals(ProductID) select invoiceItem ;
     if (ProductChecker.Count() > 0)
     {
         InvoiceItems quantity = ProductChecker.First();
         textBoxQuantity.Text = (Convert.ToInt32(textBoxQuantity.Text) - quantity.Quantity).ToString();
     }
 }
예제 #21
0
 public ActionResult delete_conf1(int id)
 {
     using (LittleDwarfAgencyEntities1 context = new LittleDwarfAgencyEntities1())
     {
         InvoiceList inv = context.InvoiceLists.Find(id);
         context.InvoiceLists.Remove(inv);
         context.SaveChanges();
         return(RedirectToAction("Index"));
     }
 }
예제 #22
0
        public void DAT_EntityList_Migration()
        {
            //聚合实体
            var repo = RF.ResolveInstance <InvoiceRepository>();

            using (RF.TransactionScope(BackUpDbSettingName))
                using (RF.TransactionScope(DbSettingName))
                {
                    var invoiceList = new InvoiceList
                    {
                        new Invoice()
                        {
                            InvoiceItemList =
                            {
                                new InvoiceItem(),
                                new InvoiceItem(),
                            }
                        },
                        new Invoice()
                        {
                            InvoiceItemList =
                            {
                                new InvoiceItem(),
                                new InvoiceItem(),
                            }
                        },
                        new Invoice(),
                        new Invoice()
                    };

                    RF.Save(invoiceList);

                    Assert.AreEqual(repo.GetAll().Count, 4, "新增 Invoice 数目为4");

                    var context = new AggregationArchiveContext
                    {
                        OrignalDataDbSettingName = DbSettingName,
                        BackUpDbSettingName      = BackUpDbSettingName,
                        BatchSize             = 2,
                        DateOfArchiving       = DateTime.Now.AddMinutes(2),
                        AggregationsToArchive = new List <Type> {
                            typeof(Invoice)
                        }
                    };
                    var migrationSvc = new AggregationArchiver();
                    migrationSvc.Archive(context);

                    Assert.AreEqual(repo.GetAll().Count, 0, "执行数据归档后 Invoice 数目为 0");

                    using (RdbDataProvider.RedirectDbSetting(DbSettingName, BackUpDbSettingName))
                    {
                        Assert.AreEqual(repo.GetAll().Count, 4, "数据归档数据库 Invoice 数目为 4");
                    }
                }
        }
예제 #23
0
        public void EPT_BatchImport_Aggt()
        {
            if (IsTestDbSQLite())
            {
                return;
            }

            int size = EntityTest.BATCH_IMPORT_DATA_SIZE;

            var repo     = RF.ResolveInstance <InvoiceRepository>();
            var itemRepo = RF.ResolveInstance <InvoiceItemRepository>();

            using (RF.TransactionScope(repo))
            {
                var invoices = new InvoiceList();
                for (int i = 0; i < size; i++)
                {
                    var Invoice = new Invoice
                    {
                        InvoiceItemList =
                        {
                            new InvoiceItem(),
                            new InvoiceItem(),
                        }
                    };
                    invoices.Add(Invoice);
                }

                var importer = repo.CreateImporter();
                importer.Save(invoices);

                Assert.AreEqual(size, repo.CountAll());
                Assert.AreEqual(size * 2, itemRepo.CountAll());

                invoices.Clear();
                importer.Save(invoices);

                Assert.AreEqual(repo.CountAll(), 0, "幽灵状态的实体,应该无法通过正常的 API 查出。");
                Assert.AreEqual(itemRepo.CountAll(), 0, "幽灵状态的实体,应该无法通过正常的 API 查出。");

                using (PhantomContext.DontFilterPhantoms())
                {
                    Assert.AreEqual(repo.CountAll(), size, "幽灵状态的实体,可以使用特定 API 查出。");
                    var roots = repo.GetAll();
                    Assert.AreEqual(roots.Count, size, "幽灵状态的实体,应该无法通过正常的 API 查出。");
                    Assert.AreEqual(EntityPhantomExtension.GetIsPhantom(roots[0]), true, "幽灵状态的实体,IsPhantom 值为 true。");

                    Assert.AreEqual(itemRepo.CountAll(), size * 2, "幽灵状态的实体,可以使用特定 API 查出。");
                    var items = itemRepo.GetAll();
                    Assert.AreEqual(items.Count, size * 2, "幽灵状态的实体,应该无法通过正常的 API 查出。");
                    Assert.AreEqual(EntityPhantomExtension.GetIsPhantom(items[0]), true, "幽灵状态的实体,IsPhantom 值为 true。");
                }
            }
        }
예제 #24
0
 public MainWindow()
 {
     timerLoginCheck.Tick += new EventHandler(WindowPropartyChecker);
     timerLoginCheck.Interval = new TimeSpan(0,0,0,0,5);
     timerLoginCheck.Start();
     GridViewInvoice = new InvoiceList();
     GridViewLoadProductHistory = new LoadProductHistory();
     TotalSummary = new Summary();
     InitializeComponent();
     this.mainwindowTitleBar.CurrentWindow = App.Current.Windows[1];
 }
예제 #25
0
        private void FrmViewInvoice_Load(object sender, EventArgs e)
        {
            //Initialize Controller
            m_AppController = new AppController();

            /* Note that the DataProvider class is static, so it doesn't
             * get instantiated. */

            //Get Customer List
            CommandGettingOutlet getOutlets = new CommandGettingOutlet();

            m_Outlet = (outletList)m_AppController.ExecuteCommand(getOutlets);

            // Get invoices List
            CommandGetInvoices getInvoices = new CommandGetInvoices();

            m_Invoices = (InvoiceList)m_AppController.ExecuteCommand(getInvoices);


            invoiceItemBindingSource.DataSource = m_Invoices;


            #region [ CardView... ]

            //card.CaptionField = "OUTLETCODE";
            //card.CardSpacingWidth = 10;
            //card.CardSpacingHeight = 10;
            //card.MaxCardCols = 5;
            //card.CaptionHeight = 35;
            //card.CardBackColor = Color.Lavender;
            //card.WireGrid(this.gridDataBoundGrid1);

            #endregion

            //Assumes this.dataTable is a DataTable object with at least 2 columns named "id" and "display".



            //Sets the style properties.

            GridStyleInfo style = this.gridDataBoundGrid1.GridBoundColumns[3].StyleInfo;

            style.CellType = "ComboBox";

            style.DataSource = m_Outlet;

            //Displays in the grid cell.
            style.DisplayMember = "OutletName";

            //Values in the grid cell.
            style.ValueMember = "OutletCode";

            style.DropDownStyle = GridDropDownStyle.AutoComplete;
        }
예제 #26
0
        public static InvoiceList GetInvoiceList()
        {
            List <Invoice> invoices = new List <Invoice> {
                TestModels.GetInvoice(), TestModels.GetInvoice()
            };
            InvoiceList invoicesList = new InvoiceList {
                invoices = invoices
            };

            return(invoicesList);
        }
예제 #27
0
 public ActionResult CreateTimesheetSummary(InvoiceList invoiceList)
 {
     using (LittleDwarfAgencyEntities1 context = new LittleDwarfAgencyEntities1())
     {
         if (ModelState.IsValid)
         {
             context.InvoiceLists.Add(invoiceList);
             context.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(invoiceList));
     }
 }
예제 #28
0
        internal override object[] getRow()
        {
            Driver driver = getDriver();

            ViolationTypes violationType = ViolationTypes.getInstance();

            InvoiceList invoiceList = InvoiceList.getInstance();
            Invoice     invoice     = invoiceList.getItem(Car);
            Regions     regions     = Regions.getInstance();
            string      regionName  = (invoice == null) ? regions.getItem(Convert.ToInt32(Car.regionUsingID)) : regions.getItem(Convert.ToInt32(invoice.RegionToID));

            return(new object[] { ID, Car.ID, Car.BBNumber, Car.Grz, regionName, Date, driver.GetName(NameType.Full), Number, DatePay,
                                  violationType.getItem(_idViolationType), _sum });
        }
예제 #29
0
        internal Types.PagedList <Invoice> ApiToDomain(InvoiceList value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new Types.PagedList <Invoice>
            {
                Page = value.Page,
                ItemsPerPage = value.PerPage,
                TotalItems = value.Total,
                List = value.List?.Select(ApiToDomain).ToList()
            });
        }
예제 #30
0
        public static string Generate(InvoiceList invoiceList, bool withHeader = false)
        {
            StringBuilder sb = new StringBuilder();

            if (withHeader)
            {
                sb.AppendLine(HEADER);
            }

            foreach (var record in invoiceList.GetRecords())
            {
                sb.AppendLine(CreateCsvLine(record));
            }

            return(sb.ToString());
        }
        /// <summary>
        /// Retrieves all Invoice objects by PageRequest
        /// </summary>
        /// <returns>A list of Invoice objects</returns>
        public InvoiceList GetPaged(PagedRequest request)
        {
            using (SqlCommand cmd = GetSPCommand(GETPAGEDINVOICE))
            {
                AddParameter(cmd, pInt32Out("TotalRows"));
                AddParameter(cmd, pInt32("PageIndex", request.PageIndex));
                AddParameter(cmd, pInt32("RowPerPage", request.RowPerPage));
                AddParameter(cmd, pNVarChar("WhereClause", 4000, request.WhereClause));
                AddParameter(cmd, pNVarChar("SortColumn", 128, request.SortColumn));
                AddParameter(cmd, pNVarChar("SortOrder", 4, request.SortOrder));

                InvoiceList _InvoiceList = GetList(cmd, ALL_AVAILABLE_RECORDS);
                request.TotalRows = Convert.ToInt32(GetOutParameter(cmd, "TotalRows"));
                return(_InvoiceList);
            }
        }
예제 #32
0
        public static int AtribuirIDFatura(InvoiceList il)
        {
            int id;

            if (il.invoiceListing.Count > 0)
            {
                Invoice lastInvoice = il.invoiceListing[il.invoiceListing.Count - 1];
                id = lastInvoice.InvoiceNumber + 1;
            }
            else
            {
                id = 1;
            }

            return(id);
        }
 public override void Search()
 {
     Proxy proxy = new Proxy();
     Result = proxy.SearchInvoice(DateFrom, DateTo, AmountFrom,AmountTo,SearchContact);
     Items.Clear();
     if (Result.Invoice != null)
     {
         foreach (var obj in Result.Invoice)
         {
             Items.Add(new InvoiceViewModel(obj));
         }
     }
     else
     {
         Invoice obj = new Invoice();
         obj.Nummer = "Keinen Eintrag gefunden!";
         obj.ID = "x";
         Items.Add(new InvoiceViewModel(obj));
     }
 }
        public InvoiceEditViewModel(string ID)
        {
            ID2 = ID;
            Proxy proxy = new Proxy();
            result = proxy.SearchInvoiceID(ID);
            foreach (var obj in result.Invoice)
            {
                InvoiceNum = obj.Nummer;
                string PayDate1 = obj.Faelligkeit;
                string EditDate1 = obj.Datum;
                Name = obj.Vorname + " " + obj.Nachname;
                BillingAdress = obj.Billingadress;
                Comment = obj.Kommentar;
                Note = obj.Nachricht;

                /* Rechungszeile 1 */
                Stk1 = obj.Menge1;
                Article1 = obj.Artikel1;
                Price1 = obj.Stueckpreis1;
                USt1 = obj.Ust1;

                /* Rechungszeile 2 */
                Stk2 = obj.Menge2;
                Article2 = obj.Artikel2;
                Price2 = obj.Stueckpreis2;
                USt2 = obj.Ust2;

                /* Rechungszeile 3 */
                Stk3 = obj.Menge3;
                Article3 = obj.Artikel3;
                Price3 = obj.Stueckpreis3;
                USt3 = obj.Ust3;

                string[] PayDateReg = Regex.Split(PayDate1, "T");
                PayDate = PayDateReg[0];

                string[] EditDateReg = Regex.Split(EditDate1, "T");
                EditDate = EditDateReg[0];

            }
        }
예제 #35
0
        //Grid view Chart Item Add
        public void ChartItemAdd(InvoiceList invoiceItems, string productID,string Description, string stockQuantity, string saleQuanty, string SaleAmount, string saleRate, TextBlock quantity)
        {
            if (Convert.ToInt32(saleQuanty) <= Convert.ToInt32(stockQuantity))
            {
                IEnumerable<InvoiceItems> invoiceitem = from tempInvoiceItem in invoiceItems where tempInvoiceItem.ProductID.Equals(productID) select tempInvoiceItem;
                if (invoiceitem.Count() > 0)
                    {
                        MessageBoxResult errorCodeMessBoxResult = new MessageBoxResult();
                        errorCodeMessBoxResult = Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[1, 7], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.YesNoCancel, MessageBoxImage.Question);

                        switch (errorCodeMessBoxResult)
                        {
                            case MessageBoxResult.Yes:
                                invoiceitem.First().Quantity += Convert.ToInt32(saleQuanty);
                                invoiceitem.First().Amount += Convert.ToDouble(SaleAmount);
                                break;
                            case MessageBoxResult.No:
                                invoiceitem.First().Quantity = Convert.ToInt32(saleQuanty);
                                invoiceitem.First().Amount = Convert.ToDouble(SaleAmount);
                                break;
                            case MessageBoxResult.Cancel:
                                return;
                            default:
                                return;
                        }
                    }
                    else
                    {
                        invoiceItems.Add(new InvoiceItems(productID, Description, Convert.ToInt32(saleQuanty), Convert.ToDouble(saleRate), Convert.ToDouble(SaleAmount)));
                    }
                    quantity.Text = Convert.ToString(Convert.ToDouble(stockQuantity) - Convert.ToDouble(saleQuanty));
                    return;
                }
            else
            {
                Microsoft.Windows.Controls.MessageBox.Show(Variables.ERROR_MESSAGES[1, 0], Variables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Hand);
                return;
            }
        }
 public async Task<InvoiceList.response> InvoiceList(InvoiceList.request request, CancellationToken? token = null)
 {
     return await SendAsync<InvoiceList.response>(request.ToXmlString(), token.GetValueOrDefault(CancellationToken.None));
 }