Exemple #1
0
        public static void MarkInvoiceAsPaid(Invoice invoice)
        {
            invoice.IsPaid = true;
            invoice.DatePayment = DateTime.Now;
            invoice.InvoiceStatus = DictionaryManager.GetDictionaryByEnumAndType((int)InvoiceStatusEnum.Zaplacona, DictionaryTypeNames.Invoice);

            InvoiceDB.UpdateInvoice(invoice);
        }
Exemple #2
0
        public static void UpdateInvoice(Invoice invoice)
        {
            if (invoice.Invoiceid == Guid.Empty)
                return;
            string sqlQuery = "UPDATE Invoice SET DatePayment=@DatePayment, IsPaid=@IsPaid, InvoiceStatus=@InvoiceStatus WHERE InvoiceID='" + invoice.Invoiceid + "'";

            DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery);
            if(invoice.DatePayment.HasValue)
                DBHelper.AddInParameter(dbCommand, "DatePayment", DbType.DateTime, invoice.DatePayment.Value);
            else
                DBHelper.AddInParameter(dbCommand, "DatePayment", DbType.DateTime,DBNull.Value);
            DBHelper.AddInParameter(dbCommand, "IsPaid", DbType.Boolean, invoice.IsPaid);
            DBHelper.AddInParameter(dbCommand, "InvoiceStatus", DbType.Guid, invoice.InvoiceStatusID);
            DBHelper.ExecuteNonQuery(dbCommand);
        }
Exemple #3
0
        private static Invoice GetInvoiceFromReader(IDataReader dataReader)
        {
            Invoice invoice = new Invoice();
            invoice.Invoiceid = DBHelper.GetGuid(dataReader, "InvoiceID");
            invoice.OrderID = DBHelper.GetGuid(dataReader, "OrderID");
            invoice.InvoiceStatusID = DBHelper.GetGuid(dataReader, "InvoiceStatus");
            invoice.Number = DBHelper.GetString(dataReader, "Number");
            invoice.Date = DBHelper.GetDateTime(dataReader, "Date");
            invoice.DatePayment = DBHelper.GetNullableDateTime(dataReader, "DatePayment");
            invoice.IsPaid = DBHelper.GetBoolean(dataReader, "IsPaid");

            return invoice;
        }