parent
							
								
									db3c94b36e
								
							
						
					
					
						commit
						8c280213e9
					
				@ -1,13 +0,0 @@
 | 
				
			|||||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <PropertyGroup>
 | 
					 | 
				
			||||||
    <TargetFramework>net5.0</TargetFramework>
 | 
					 | 
				
			||||||
    <RootNamespace>OSI_API.Business</RootNamespace>
 | 
					 | 
				
			||||||
  </PropertyGroup>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  <ItemGroup>
 | 
					 | 
				
			||||||
    <PackageReference Include="Restsharp" Version="106.11.7" />
 | 
					 | 
				
			||||||
    <PackageReference Include="System.Text.Json" Version="5.0.2" />
 | 
					 | 
				
			||||||
  </ItemGroup>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
</Project>
 | 
					 | 
				
			||||||
@ -1,9 +0,0 @@
 | 
				
			|||||||
namespace OSI.API.Business.Objects
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    public class InvoiceObject
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        public int InvoiceNumber { get; set; }
 | 
					 | 
				
			||||||
        public float InvoiceAmount { get; set; }
 | 
					 | 
				
			||||||
        public float Discount { get; set; }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -0,0 +1,100 @@
 | 
				
			|||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace OSI.API.Business.Database.Base
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public abstract class SQLBase : IDisposable
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        protected DBConnectionInformation DBConnectionInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public enum DBType
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            MSSQL,
 | 
				
			||||||
 | 
					            MYSQL
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public struct DBConnectionInformation
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            public string DBHost { get; set; }
 | 
				
			||||||
 | 
					            public string DBName { get; set; }
 | 
				
			||||||
 | 
					            public string DBUserName { get; set; }
 | 
				
			||||||
 | 
					            public string DBPassword { get; set; }
 | 
				
			||||||
 | 
					            public DBType DBType { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            public string GetConnectionString()
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                string rv = string.Empty;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                switch (DBType)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    case DBType.MSSQL:
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                    case DBType.MYSQL:
 | 
				
			||||||
 | 
					                        rv = string.Format("Server={0};Database={1};Uid={2};Pwd={3}", DBHost, DBName, DBUserName, DBPassword);
 | 
				
			||||||
 | 
					                        break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return rv;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public void Dispose()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Dispose(true);
 | 
				
			||||||
 | 
					            GC.SuppressFinalize(this);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected virtual void Dispose(bool disposing)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if (disposing)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                // free managed resources
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            // free native resources if there are any.
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected string FormatNewLineForHTML(string input)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return input.Replace("\\r\\n", "<br/>");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected string FormatNewLineForHTML(string input, int numberOfBreaksToAdd)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            StringBuilder breaks = new();
 | 
				
			||||||
 | 
					            for (int x = 0; x < numberOfBreaksToAdd; x++)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                breaks.Append("<br/>");
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return input.Replace("\\r\\n", breaks.ToString());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected string FormatBoldForHTML(string input)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            return input.Replace("[b]", "<strong>").Replace("[/b]", "</strong>");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected abstract void InitConnection();
 | 
				
			||||||
 | 
					        protected abstract void DisposeConnection();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        protected abstract int GetOrdinal(string columnName);
 | 
				
			||||||
 | 
					        protected abstract int? GetInt(int columnID);
 | 
				
			||||||
 | 
					        protected abstract int? GetInt(string columnName);
 | 
				
			||||||
 | 
					        protected abstract byte? GetByte(int columnID);
 | 
				
			||||||
 | 
					        protected abstract byte? GetByte(string columnName);
 | 
				
			||||||
 | 
					        protected abstract byte[] GetBytes(int columnID);
 | 
				
			||||||
 | 
					        protected abstract byte[] GetBytes(string columnName);
 | 
				
			||||||
 | 
					        protected abstract decimal? GetDecimal(int columnID);
 | 
				
			||||||
 | 
					        protected abstract decimal? GetDecimal(string columnName);
 | 
				
			||||||
 | 
					        protected abstract long? GetLong(int columnID);
 | 
				
			||||||
 | 
					        protected abstract long? GetLong(string columnName);
 | 
				
			||||||
 | 
					        protected abstract short? GetShort(int columnID);
 | 
				
			||||||
 | 
					        protected abstract short? GetShort(string columnName);
 | 
				
			||||||
 | 
					        protected abstract string GetString(int columnID);
 | 
				
			||||||
 | 
					        protected abstract string GetString(string columnName);
 | 
				
			||||||
 | 
					        protected abstract bool? GetBool(int columnID);
 | 
				
			||||||
 | 
					        protected abstract bool? GetBool(string columnName);
 | 
				
			||||||
 | 
					        protected abstract DateTime? GetDateTime(int columnID);
 | 
				
			||||||
 | 
					        protected abstract DateTime? GetDateTime(string columnName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					namespace OSI.API.Business.Objects
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class ClientObject
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public int ClientID { get; set; }
 | 
				
			||||||
 | 
					        public string ClientName { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace OSI.API.Business.Objects
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class InvoiceObject
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public int InvoiceNumber { get; set; }
 | 
				
			||||||
 | 
					        public float InvoiceAmount { get; set; }
 | 
				
			||||||
 | 
					        public float Discount { get; set; }
 | 
				
			||||||
 | 
					        public float Tax { get; set; }
 | 
				
			||||||
 | 
					        public List<InvoiceObjectLineItems> InvoiceLineItems { get; set; }
 | 
				
			||||||
 | 
					        public Notes Notes { get; set; }
 | 
				
			||||||
 | 
					        public DateTime InvoiceDate { get; set; }
 | 
				
			||||||
 | 
					        public DateTime DueDate { get; set; }
 | 
				
			||||||
 | 
					        public ClientObject Client { get; set; }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public class InvoiceObjectLineItems
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public string Item { get; set; }
 | 
				
			||||||
 | 
					        public string Description { get; set; }
 | 
				
			||||||
 | 
					        public float Cost { get; set; }
 | 
				
			||||||
 | 
					        public float Quantity { get; set; }
 | 
				
			||||||
 | 
					        public float Tax { get; set; }
 | 
				
			||||||
 | 
					        //public float Total => ((Cost * Quantity) + ((Cost * Quantity) * (Tax / 100)));
 | 
				
			||||||
 | 
					        public float Total { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public class Notes
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public string PublicNotes { get; set; }
 | 
				
			||||||
 | 
					        public string PrivateNotes { get; set; }
 | 
				
			||||||
 | 
					        public string Terms { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue