Commit 3d9f56da authored by Sandeep Sagar Panjala's avatar Sandeep Sagar Panjala

initial commit

parent 9fb3d669
namespace Hims.Shared.Dapper.Attributes
{
using System;
/// <inheritdoc />
public sealed class IdentityAttribute : Attribute
{
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes
{
using System;
/// <inheritdoc />
/// <summary>
/// Ignore property attribute
/// </summary>
public sealed class IgnoreUpdateAttribute : Attribute
{
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes.Joins
{
/// <inheritdoc />
/// <summary>
/// Generate INNER JOIN
/// </summary>
public sealed class InnerJoinAttribute : JoinAttributeBase
{
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:Hims.Shared.Dapper.Attributes.Joins.InnerJoinAttribute" /> class.
/// </summary>
public InnerJoinAttribute()
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of external table</param>
/// <param name="key">ForeignKey of this table</param>
/// <param name="externalKey">Key of external table</param>
public InnerJoinAttribute(string tableName, string key, string externalKey)
: base(tableName, key, externalKey, string.Empty, string.Empty)
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of external table</param>
/// <param name="key">ForeignKey of this table</param>
/// <param name="externalKey">Key of external table</param>
/// <param name="tableSchema">Name of external table schema</param>
public InnerJoinAttribute(string tableName, string key, string externalKey, string tableSchema)
: base(tableName, key, externalKey, tableSchema, string.Empty)
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of external table</param>
/// <param name="key">ForeignKey of this table</param>
/// <param name="externalKey">Key of external table</param>
/// <param name="tableSchema">Name of external table schema</param>
/// <param name="tableAbbreviation">External table alias</param>
public InnerJoinAttribute(string tableName, string key, string externalKey, string tableSchema, string tableAbbreviation)
: base(tableName, key, externalKey, tableSchema, tableAbbreviation)
{
}
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes.Joins
{
using System;
/// <inheritdoc />
/// <summary>
/// Base JOIN for LEFT/INNER/RIGHT
/// </summary>
public abstract class JoinAttributeBase : Attribute
{
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:Hims.Shared.Dapper.Attributes.Joins.JoinAttributeBase" /> class.
/// Constructor
/// </summary>
protected JoinAttributeBase()
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
protected JoinAttributeBase(string tableName, string key, string externalKey, string tableSchema, string tableAlias)
{
this.TableName = tableName;
this.Key = key;
this.ExternalKey = externalKey;
this.TableSchema = tableSchema;
this.TableAlias = tableAlias == string.Empty ? this.GetAlias() : tableAlias;
}
/// <summary>
/// Gets or sets the table name.
/// </summary>
public string TableName { get; set; }
/// <summary>
/// Gets or sets the table schema.
/// </summary>
public string TableSchema { get; set; }
/// <summary>
/// Gets or sets the key.
/// </summary>
public string Key { get; set; }
/// <summary>
/// Gets or sets the external key.
/// </summary>
public string ExternalKey { get; set; }
/// <summary>
/// Gets or sets the table alias.
/// </summary>
public string TableAlias { get; set; }
/// <summary>
/// The get alias.
/// </summary>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
private string GetAlias() => $"{this.TableName}_{this.Key}";
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes.Joins
{
/// <inheritdoc />
/// <summary>
/// Generate LEFT JOIN
/// </summary>
public sealed class LeftJoinAttribute : JoinAttributeBase
{
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:Hims.Shared.Dapper.Attributes.Joins.LeftJoinAttribute" /> class.
/// Constructor
/// </summary>
public LeftJoinAttribute()
{
}
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:Hims.Shared.Dapper.Attributes.Joins.LeftJoinAttribute" /> class.
/// Constructor
/// </summary>
/// <param name="tableName">
/// Name of external table
/// </param>
/// <param name="key">
/// ForeignKey of this table
/// </param>
/// <param name="externalKey">
/// Key of external table
/// </param>
public LeftJoinAttribute(string tableName, string key, string externalKey)
: base(tableName, key, externalKey, string.Empty, string.Empty)
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of external table</param>
/// <param name="key">ForeignKey of this table</param>
/// <param name="externalKey">Key of external table</param>
/// <param name="tableSchema">Name of external table schema</param>
public LeftJoinAttribute(string tableName, string key, string externalKey, string tableSchema)
: base(tableName, key, externalKey, tableSchema, string.Empty)
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of external table</param>
/// <param name="key">ForeignKey of this table</param>
/// <param name="externalKey">Key of external table</param>
/// <param name="tableSchema">Name of external table schema</param>
/// <param name="tableAbbreviation">External table alias</param>
public LeftJoinAttribute(string tableName, string key, string externalKey, string tableSchema, string tableAbbreviation)
: base(tableName, key, externalKey, tableSchema, tableAbbreviation)
{
}
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes.Joins
{
/// <inheritdoc />
/// <summary>
/// Generate RIGHT JOIN
/// </summary>
public sealed class RightJoinAttribute : JoinAttributeBase
{
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:Hims.Shared.Dapper.Attributes.Joins.RightJoinAttribute" /> class.
/// </summary>
public RightJoinAttribute()
{
}
/// <inheritdoc />
/// <summary>
/// Initializes a new instance of the <see cref="T:Hims.Shared.Dapper.Attributes.Joins.RightJoinAttribute" /> class.
/// Constructor
/// </summary>
/// <param name="tableName">
/// Name of external table
/// </param>
/// <param name="key">
/// ForeignKey of this table
/// </param>
/// <param name="externalKey">
/// Key of external table
/// </param>
public RightJoinAttribute(string tableName, string key, string externalKey) : base(tableName, key, externalKey, string.Empty, string.Empty)
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of external table</param>
/// <param name="key">ForeignKey of this table</param>
/// <param name="externalKey">Key of external table</param>
/// <param name="tableSchema">Name of external table schema</param>
public RightJoinAttribute(string tableName, string key, string externalKey, string tableSchema)
: base(tableName, key, externalKey, tableSchema, string.Empty)
{
}
/// <inheritdoc />
/// <summary>
/// Constructor
/// </summary>
/// <param name="tableName">Name of external table</param>
/// <param name="key">ForeignKey of this table</param>
/// <param name="externalKey">Key of external table</param>
/// <param name="tableSchema">Name of external table schema</param>
/// <param name="tableAbbreviation">External table alias</param>
public RightJoinAttribute(string tableName, string key, string externalKey, string tableSchema, string tableAbbreviation)
: base(tableName, key, externalKey, tableSchema, tableAbbreviation)
{
}
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes.LogicalDelete
{
using System;
/// <inheritdoc />
/// <summary>
/// Use with "Status" for logical delete
/// </summary>
public sealed class DeletedAttribute : Attribute
{
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes.LogicalDelete
{
using System;
/// <inheritdoc />
/// <summary>
/// Use with "Deleted" for logical delete
/// </summary>
public sealed class StatusAttribute : Attribute
{
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Attributes
{
using System;
/// <inheritdoc />
/// <summary>
/// UpdatedAt. Warning!!! Changes the property during SQL generation
/// </summary>
public sealed class UpdatedAtAttribute : Attribute
{
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.Extensions
{
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Reflection;
/// <summary>
/// The type extensions.
/// </summary>
public static class TypeExtensions
{
/// <summary>
/// The _reflection property cache.
/// </summary>
private static readonly ConcurrentDictionary<Type, PropertyInfo[]> ReflectionPropertyCache = new ConcurrentDictionary<Type, PropertyInfo[]>();
/// <summary>
/// The find class properties.
/// </summary>
/// <param name="objectType">
/// The object type.
/// </param>
/// <returns>
/// The <see cref="PropertyInfo"/>.
/// </returns>
public static PropertyInfo[] FindClassProperties(this Type objectType)
{
if (ReflectionPropertyCache.ContainsKey(objectType))
{
return ReflectionPropertyCache[objectType];
}
var result = objectType.GetProperties().ToArray();
ReflectionPropertyCache.TryAdd(objectType, result);
return result;
}
/// <summary>
/// The is generic type.
/// </summary>
/// <param name="type">
/// The type.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public static bool IsGenericType(this Type type) => type.IsGenericType;
/// <summary>
/// The is enum.
/// </summary>
/// <param name="type">
/// The type.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public static bool IsEnum(this Type type) => type.IsEnum;
/// <summary>
/// The is value type.
/// </summary>
/// <param name="type">
/// The type.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public static bool IsValueType(this Type type) => type.IsValueType;
/// <summary>
/// The is bool.
/// </summary>
/// <param name="type">
/// The type.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public static bool IsBool(this Type type) => type == typeof(bool);
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.TaskRunnerExplorer.14.0" Version="14.0.0" />
<PackageReference Include="TaskRunner" Version="1.0.0" />
<PackageReference Include="Webpack" Version="4.0.0" />
</ItemGroup>
</Project>
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("MicroOrm.Dapper.Repositories.Tests")]
namespace Hims.Shared.Dapper.SqlGenerator
{
using System;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using Extensions;
/// <summary>
/// The expression helper.
/// </summary>
public static class ExpressionHelper
{
/// <summary>
/// The get property name.
/// </summary>
/// <param name="field">
/// The field.
/// </param>
/// <typeparam name="TSource">
/// the source.
/// </typeparam>
/// <typeparam name="TField">
/// the filed.
/// </typeparam>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public static string GetPropertyName<TSource, TField>(Expression<Func<TSource, TField>> field)
{
if (field == null)
{
throw new ArgumentNullException(nameof(field), "field can't be null");
}
var expr = field.Body switch
{
MemberExpression body => body,
UnaryExpression expression => (MemberExpression) expression.Operand,
_ => throw new ArgumentException("Expression field isn't supported", nameof(field))
};
return expr.Member.Name;
}
/// <summary>
/// The get value.
/// </summary>
/// <param name="member">
/// The member.
/// </param>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
public static object GetValue(Expression member)
{
var objectMember = Expression.Convert(member, typeof(object));
var getterLambda = Expression.Lambda<Func<object>>(objectMember);
var getter = getterLambda.Compile();
return getter();
}
/// <summary>
/// The get sql operator.
/// </summary>
/// <param name="type">
/// The type.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public static string GetSqlOperator(ExpressionType type)
{
switch (type)
{
case ExpressionType.Equal:
case ExpressionType.Not:
case ExpressionType.MemberAccess:
return "=";
case ExpressionType.NotEqual:
return "!=";
case ExpressionType.LessThan:
return "<";
case ExpressionType.LessThanOrEqual:
return "<=";
case ExpressionType.GreaterThan:
return ">";
case ExpressionType.GreaterThanOrEqual:
return ">=";
case ExpressionType.AndAlso:
case ExpressionType.And:
return "AND";
case ExpressionType.Or:
case ExpressionType.OrElse:
return "OR";
case ExpressionType.Default:
return string.Empty;
default:
throw new NotSupportedException(type + " isn't supported");
}
}
/// <summary>
/// The get method call sql operator.
/// </summary>
/// <param name="methodName">
/// The method name.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public static string GetMethodCallSqlOperator(string methodName)
{
switch (methodName)
{
case "Contains":
return "IN";
case "Any":
case "All":
return methodName.ToUpperInvariant();
default:
throw new NotSupportedException(methodName + " isn't supported");
}
}
/// <summary>
/// The get binary expression.
/// </summary>
/// <param name="expression">
/// The expression.
/// </param>
/// <returns>
/// The <see cref="BinaryExpression"/>.
/// </returns>
public static BinaryExpression GetBinaryExpression(Expression expression)
{
var binaryExpression = expression as BinaryExpression;
var body = binaryExpression ?? Expression.MakeBinary(ExpressionType.Equal, expression, expression.NodeType == ExpressionType.Not ? Expression.Constant(false) : Expression.Constant(true));
return body;
}
/// <summary>
/// The get primitive properties predicate.
/// </summary>
/// <returns>
/// The <see cref="Func{TResult}"/>.
/// </returns>
public static Func<PropertyInfo, bool> GetPrimitivePropertiesPredicate()
{
return p => p.CanWrite && (p.PropertyType.IsValueType() || p.PropertyType == typeof(string) || p.PropertyType == typeof(byte[]));
}
/// <summary>
/// The get values from collection.
/// </summary>
/// <param name="callExpr">
/// The call expr.
/// </param>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
public static object GetValuesFromCollection(MethodCallExpression callExpr)
{
var expr = callExpr.Object as MemberExpression;
if (!(expr?.Expression is ConstantExpression))
{
throw new NotSupportedException(callExpr.Method.Name + " isn't supported");
}
var constExpr = (ConstantExpression)expr.Expression;
var constExprType = constExpr.Value.GetType();
return constExprType.GetField(expr.Member.Name)?.GetValue(constExpr.Value);
}
/// <summary>
/// The get member expression.
/// </summary>
/// <param name="expression">
/// The expression.
/// </param>
/// <returns>
/// The <see cref="MemberExpression"/>.
/// </returns>
public static MemberExpression GetMemberExpression(Expression expression)
{
switch (expression)
{
case MethodCallExpression expr:
return (MemberExpression)expr.Arguments[0];
case MemberExpression memberExpression:
return memberExpression;
case UnaryExpression unaryExpression:
return (MemberExpression)unaryExpression.Operand;
case BinaryExpression binaryExpression:
var binaryExpr = binaryExpression;
if (binaryExpr.Left is UnaryExpression left)
{
return (MemberExpression)left.Operand;
}
// should we take care if right operation is memberaccess, not left?
return (MemberExpression)binaryExpr.Left;
case LambdaExpression expression1:
var lambdaExpression = expression1;
switch (lambdaExpression.Body)
{
case MemberExpression body:
return body;
case UnaryExpression expressionBody:
return (MemberExpression)expressionBody.Operand;
}
break;
}
return null;
}
/// <summary>
/// Gets the name of the property.
/// </summary>
/// <param name="expr">The Expression.</param>
/// <param name="nested">Out. Is nested property.</param>
/// <returns>The property name for the property expression.</returns>
public static string GetPropertyNamePath(Expression expr, out bool nested)
{
var path = new StringBuilder();
var memberExpression = GetMemberExpression(expr);
var count = 0;
do
{
count++;
if (path.Length > 0)
{
path.Insert(0, string.Empty);
}
path.Insert(0, memberExpression.Member.Name);
memberExpression = GetMemberExpression(memberExpression.Expression);
}
while (memberExpression != null);
if (count > 2)
{
throw new ArgumentException("Only one degree of nesting is supported");
}
nested = count == 2;
return path.ToString();
}
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.SqlGenerator
{
/// <summary>
/// Class that models the data structure in converting the expression tree into SQL and Params.
/// </summary>
public class QueryParameter
{
/// <summary>
/// Initializes a new instance of the <see cref="QueryParameter" /> class.
/// </summary>
/// <param name="linkingOperator">The linking operator.</param>
/// <param name="propertyName">Name of the property.</param>
/// <param name="propertyValue">The property value.</param>
/// <param name="queryOperator">The query operator.</param>
/// <param name="nestedProperty">Signalize if it is nested property.</param>
public QueryParameter(string linkingOperator, string propertyName, object propertyValue, string queryOperator, bool nestedProperty)
{
this.LinkingOperator = linkingOperator;
this.PropertyName = propertyName;
this.PropertyValue = propertyValue;
this.QueryOperator = queryOperator;
this.NestedProperty = nestedProperty;
}
/// <summary>
/// Gets or sets the linking operator.
/// </summary>
public string LinkingOperator { get; set; }
/// <summary>
/// Gets or sets the property name.
/// </summary>
public string PropertyName { get; set; }
/// <summary>
/// Gets or sets the property value.
/// </summary>
public object PropertyValue { get; set; }
/// <summary>
/// Gets or sets the query operator.
/// </summary>
public string QueryOperator { get; set; }
/// <summary>
/// Gets or sets a value indicating whether nested property.
/// </summary>
public bool NestedProperty { get; set; }
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.SqlGenerator
{
/// <summary>
/// Config for SqlGenerator
/// </summary>
public class SqlGeneratorConfig
{
/// <summary>
/// Gets or sets the sql provider.
/// </summary>
public SqlProvider SqlProvider { get; set; }
/// <summary>
/// Gets or sets a value indicating whether use quotation marks.
/// </summary>
public bool UseQuotationMarks { get; set; }
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.SqlGenerator
{
using System.Reflection;
using Attributes.Joins;
/// <inheritdoc />
public class SqlJoinPropertyMetadata : SqlPropertyMetadata
{
/// <inheritdoc />
public SqlJoinPropertyMetadata(PropertyInfo joinPropertyInfo, PropertyInfo propertyInfo) : base(propertyInfo)
{
var joinAttribute = joinPropertyInfo.GetCustomAttribute<JoinAttributeBase>();
this.JoinPropertyInfo = joinPropertyInfo;
this.TableSchema = joinAttribute?.TableSchema;
this.TableName = joinAttribute?.TableName;
this.TableAlias = joinAttribute?.TableAlias;
}
/// <summary>
/// Gets or sets the table name.
/// </summary>
public string TableName { get; set; }
/// <summary>
/// Gets or sets the table alias.
/// </summary>
public string TableAlias { get; set; }
/// <summary>
/// Gets or sets the table schema.
/// </summary>
public string TableSchema { get; set; }
/// <summary>
/// Gets or sets the join property info.
/// </summary>
public PropertyInfo JoinPropertyInfo { get; set; }
/// <summary>
/// The join property name.
/// </summary>
public string JoinPropertyName => this.JoinPropertyInfo.Name;
/// <inheritdoc />
/// <summary>
/// The property name.
/// </summary>
public override string PropertyName => this.JoinPropertyName + base.PropertyName;
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.SqlGenerator
{
using System.ComponentModel.DataAnnotations.Schema;
using System.Reflection;
using Attributes;
/// <summary>
/// Metadata from PropertyInfo
/// </summary>
public class SqlPropertyMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="SqlPropertyMetadata"/> class.
/// Constructor
/// </summary>
/// <param name="propertyInfo">
/// The property Info.
/// </param>
public SqlPropertyMetadata(PropertyInfo propertyInfo)
{
this.PropertyInfo = propertyInfo;
var alias = this.PropertyInfo.GetCustomAttribute<ColumnAttribute>();
if (!string.IsNullOrEmpty(alias?.Name))
{
this.Alias = alias.Name;
this.ColumnName = this.Alias;
}
else
{
this.ColumnName = this.PropertyInfo.Name;
}
var ignoreUpdate = this.PropertyInfo.GetCustomAttribute<IgnoreUpdateAttribute>();
if (ignoreUpdate != null)
{
this.IgnoreUpdate = true;
}
}
/// <summary>
/// Gets the property info.
/// </summary>
public PropertyInfo PropertyInfo { get; }
/// <summary>
/// Gets or sets the alias.
/// </summary>
public string Alias { get; set; }
/// <summary>
/// Gets or sets the column name.
/// </summary>
public string ColumnName { get; set; }
/// <summary>
/// Gets or sets a value indicating whether ignore update.
/// </summary>
public bool IgnoreUpdate { get; set; }
/// <summary>
/// The property name.
/// </summary>
public virtual string PropertyName => this.PropertyInfo.Name;
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.SqlGenerator
{
/// <summary>
/// SQL Provider
/// </summary>
public enum SqlProvider
{
/// <summary>
/// The mssql.
/// </summary>
MSSQL,
/// <summary>
/// The my sql.
/// </summary>
MySQL,
/// <summary>
/// The postgre sql.
/// </summary>
PostgreSQL
}
}
\ No newline at end of file
namespace Hims.Shared.Dapper.SqlGenerator
{
using System.Text;
/// <summary>
/// A object with the generated sql and dynamic params.
/// </summary>
public class SqlQuery
{
/// <summary>
/// Initializes a new instance of the <see cref="SqlQuery"/> class.
/// Initializes a new instance of the class.
/// </summary>
public SqlQuery() => this.SqlBuilder = new StringBuilder();
/// <summary>
/// Initializes a new instance of the <see cref="SqlQuery"/> class.
/// </summary>
/// <param name="param">
/// The param.
/// </param>
public SqlQuery(object param)
{
this.Param = param;
this.SqlBuilder = new StringBuilder();
}
/// <summary>
/// Gets the sql builder.
/// </summary>
public StringBuilder SqlBuilder { get; }
/// <summary>
/// Gets the param.
/// </summary>
public object Param { get; private set; }
/// <summary>
/// The get sql.
/// </summary>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public string GetSql() => this.SqlBuilder.ToString().Trim();
/// <summary>
/// The set param.
/// </summary>
/// <param name="param">
/// The param.
/// </param>
public void SetParam(object param)
{
this.Param = param;
}
}
}
\ No newline at end of file
This diff is collapsed.
namespace Hims.Shared.DataFilters
{
using System;
using Library.Enums;
/// <summary>
/// The date time filter.
/// </summary>
public class DateTimeFilter
{
/// <summary>
/// The to est.
/// </summary>
/// <param name="dateUtc">
/// The date utc.
/// </param>
/// <param name="timeZone">
/// The time Zone.
/// </param>
/// <returns>
/// The <see cref="DateTime"/>.
/// </returns>
public static DateTime ToLocale(DateTime dateUtc, string timeZone) => TimeZoneInfo.ConvertTimeFromUtc(dateUtc, TimeZoneInfo.FindSystemTimeZoneById(timeZone));
/// <summary>
/// The to date.
/// </summary>
/// <param name="date">
/// The date.
/// </param>
/// <returns>
/// The <see cref="DateTime"/>.
/// </returns>
public static DateTime? ToDate(string date)
{
if (string.IsNullOrEmpty(date))
{
return null;
}
if (!date.Contains("-"))
{
return null;
}
var dt = date.Split('-');
return new DateTime(Convert.ToInt32(dt[0]), Convert.ToInt32(dt[1]), Convert.ToInt32(dt[2]));
}
/// <summary>
/// The to date.
/// </summary>
/// <param name="date">
/// The date.
/// </param>
/// <returns>
/// The <see cref="DateTime"/>.
/// </returns>
public static DateTime ToNotNullDate(string date)
{
var dt = date.Split('-');
return new DateTime(Convert.ToInt32(dt[0]), Convert.ToInt32(dt[1]), Convert.ToInt32(dt[2]));
}
/// <summary>
/// The to date.
/// </summary>
/// <param name="date">
/// The date.
/// </param>
/// <returns>
/// The <see cref="DateTime"/>.
/// </returns>
public static DateTime ToUTCDate(string date)
{
var dt = date.Split('-');
return new DateTime(Convert.ToInt32(dt[0]), Convert.ToInt32(dt[1]), Convert.ToInt32(dt[2])).ToUniversalTime();
}
/// <summary>
/// The to date time.
/// </summary>
/// <param name="dateTime">
/// The date time.
/// </param>
/// <returns>
/// The <see cref="DateTime"/>.
/// </returns>
public static DateTime? ToDateTime(string dateTime)
{
// 2019-04-10 10:50 PM
if (string.IsNullOrEmpty(dateTime))
{
return null;
}
var dtS = dateTime.Split('-');
var dtY = dtS[2].Split(' ');
var dtH = dtY[1].Trim().Split(':');
var hour = int.Parse(dtH[0]);
if (dtY[2].ToUpper() == "PM")
{
hour = (hour % 12) + 12;
}
var convertedDateTime = new DateTime(int.Parse(dtS[0]), int.Parse(dtS[1]), int.Parse(dtY[0]), hour, int.Parse(dtH[1]), 0);
return convertedDateTime;
}
/// <summary>
/// The to date time offset.
/// </summary>
/// <param name="dateTime">
/// The date time.
/// </param>
/// <returns>
/// The <see cref="DateTimeOffset"/>.
/// </returns>
public static DateTimeOffset? ToDateTimeOffset(string dateTime)
{
if (string.IsNullOrEmpty(dateTime))
{
return null;
}
var dtS = dateTime.Split('-');
var dtY = dtS[2].Split(' ');
var dtH = dtY[1].Trim().Split(':');
var hour = int.Parse(dtH[0]);
if (dtY[2].ToUpper() == "PM")
{
hour = (hour % 12) + 12;
}
var convertedDateTime = new DateTimeOffset(int.Parse(dtY[0]), int.Parse(dtS[1]), int.Parse(dtS[0]), hour, int.Parse(dtH[1]), 0, TimeZoneInfo.Local.GetUtcOffset(DateTime.Now));
return convertedDateTime;
}
/// <summary>
/// The difference between two dates.
/// </summary>
/// <param name="startDate">
/// The start date.
/// </param>
/// <param name="endDate">
/// The end date.
/// </param>
/// <param name="calendarType">
/// The calendar Type.
/// </param>
/// <returns>
/// The <see cref="int"/>.
/// </returns>
public static int Difference(DateTime startDate, DateTime endDate, CalendarType calendarType)
{
switch (calendarType)
{
case CalendarType.Years:
var difference = endDate.Year - startDate.Year;
if (startDate > endDate.AddYears(-difference))
{
difference--;
}
return difference;
case CalendarType.Hours:
var timeSpan = endDate - startDate;
return (int)timeSpan.TotalHours;
default:
return 0;
}
}
/// <summary>
/// The difference in minutes.
/// </summary>
/// <param name="startTime">
/// The start time.
/// </param>
/// <param name="endTime">
/// The end time.
/// </param>
/// <returns>
/// The <see cref="int"/>.
/// </returns>
public static int DifferenceInMinutes(TimeSpan startTime, TimeSpan endTime)
{
var totalHours = endTime - startTime;
var midNight = new TimeSpan(24, 0, 0);
if (startTime <= endTime)
{
return (int)totalHours.TotalMinutes;
}
var f1 = midNight - startTime;
totalHours = f1 + endTime;
return (int)totalHours.TotalMinutes;
}
}
}
\ No newline at end of file
namespace Hims.Shared.DataFilters
{
using System.Linq;
/// <summary>
/// The empty filter.
/// </summary>
public static class EmptyFilter
{
/// <summary>
/// The decrypt.
/// </summary>
/// <param name="model">
/// The model.
/// </param>
/// <returns>
/// The model<see />.
/// </returns>
public static object Handler(object model)
{
var properties = model.GetType().GetProperties().Where(m => m.PropertyType == typeof(string));
foreach (var item in properties)
{
var value = (string)item.GetValue(model);
if (value == string.Empty || value == "null")
{
item.SetValue(model, null);
}
}
return model;
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Hims.Shared.DataFilters.xml</DocumentationFile>
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Hims.Shared.DataFilters.xml</DocumentationFile>
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.TaskRunnerExplorer.14.0" Version="14.0.0" />
<PackageReference Include="TaskRunner" Version="1.0.0" />
<PackageReference Include="Webpack" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Hims.Shared.Library\Hims.Shared.Library.csproj" />
</ItemGroup>
</Project>
namespace Hims.Shared.DataFilters
{
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
/// <summary>
/// The list filter.
/// </summary>
public static class ListFilter
{
/// <summary>
/// The to data table.
/// </summary>
/// <param name="items">
/// The items.
/// </param>
/// <typeparam name="T">
/// The entity.
/// </typeparam>
/// <returns>
/// The <see cref="DataTable"/>.
/// </returns>
public static DataTable ToDataTable<T>(IEnumerable<T> items)
{
var dataTable = new DataTable(typeof(T).Name);
var props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (var prop in props)
{
dataTable.Columns.Add(GetParameterValue(prop.Name));
}
foreach (var item in items)
{
var values = new object[props.Length];
for (var i = 0; i < props.Length; i++)
{
values[i] = props[i].GetValue(item, null);
}
dataTable.Rows.Add(values);
}
return dataTable;
}
/// <summary>
/// The to data table.
/// </summary>
/// <param name="items">
/// The items.
/// </param>
/// <param name="name">
/// The name.
/// </param>
/// <typeparam name="T">
/// The entity.
/// </typeparam>
/// <returns>
/// The <see cref="DataTable"/>.
/// </returns>
public static DataTable ToDataTable<T>(List<T> items, string name)
{
var dataTable = new DataTable(name);
var props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (var prop in props)
{
dataTable.Columns.Add(GetParameterValue(prop.Name));
}
foreach (var item in items)
{
var values = new object[props.Length];
for (var i = 0; i < props.Length; i++)
{
values[i] = props[i].GetValue(item, null);
}
dataTable.Rows.Add(values);
}
return dataTable;
}
/// <summary>
/// The get columns.
/// </summary>
/// <typeparam name="T">
/// The entity.
/// </typeparam>
/// <returns>
/// The <see cref="List{T}"/>.
/// </returns>
public static List<string> GetColumns<T>()
{
var props = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
return props.Select(prop => GetParameterValue(prop.Name)).ToList();
}
/// <summary>
/// The distinct by.
/// </summary>
/// <param name="source">
/// The source.
/// </param>
/// <param name="keySelector">
/// The key selector.
/// </param>
/// <typeparam name="TSource">
/// The source model.
/// </typeparam>
/// <typeparam name="TKey">
/// The key.
/// </typeparam>
/// <returns>
/// The <see cref="IEnumerable{TSource}"/>.
/// </returns>
public static IEnumerable<TSource> DistinctBy<TSource, TKey>(IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
{
var seenKeys = new HashSet<TKey>();
foreach (var element in source)
{
if (seenKeys.Add(keySelector(element)))
{
yield return element;
}
}
}
/// <summary>
/// The contains all.
/// </summary>
/// <typeparam name="TSource">
/// The source model.
/// </typeparam>
/// <param name="source">
/// The source.
/// </param>
/// <param name="values">
/// The values.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public static bool ContainsAll<TSource>(List<TSource> source, IEnumerable<TSource> values) => values.All(value => source.Contains(value));
/// <summary>
/// The get parameter value.
/// </summary>
/// <param name="value">
/// The value.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
private static string GetParameterValue(string value) => Regex.Replace(value, "_+", " ");
}
}
\ No newline at end of file
namespace Hims.Shared.DataFilters
{
using System.Text.RegularExpressions;
/// <summary>
/// The replace filter.
/// </summary>
public static class ReplaceFilter
{
/// <summary>
/// The replace.
/// </summary>
/// <param name="replaceWith">
/// The replace with.
/// </param>
/// <param name="value">
/// The value.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public static string Replace(string replaceWith, string value)
{
value = Regex.Replace(value, string.Empty + replaceWith + string.Empty, string.Empty + replaceWith + replaceWith + string.Empty);
return value;
}
/// <summary>
/// The replace.
/// </summary>
/// <param name="value">
/// The value.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
public static string Replace(string value)
{
value = Regex.Replace(value, "'", "''");
value = Regex.Replace(value, "-", "--");
value = Regex.Replace(value, "@", "@@");
return value;
}
}
}
using Hims.Shared.Dapper.Attributes;
using Hims.Shared.Library.Enums;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Hims.Shared.EntityModels
{
/// <summary>
/// The anc card generation model.
/// </summary>
public class ANCCardGenerationModel
{
/// <summary>
/// Gets or sets the anc card generation identifier.
/// </summary>
public int? ANCCardGenerationId { get; set; }
/// <summary>
/// Gets or sets department
/// </summary>
public string? Department { get; set; }
/// <summary>
/// Gets or sets anc no.
/// </summary>
public string? ANCNo { get; set; }
/// <summary>
/// Gets or sets the husband name.
/// </summary>
public string? HusbandName { get; set; }
/// <summary>
/// Gets or sets the remark.
/// </summary>
public string? Remarks { get; set; }
/// <summary>
/// Gets or sets the registration date.
/// </summary>
public string? RegistrationDate { get; set; }
/// <summary>
/// Gets or sets the active.
/// </summary>
public bool? Active { get; set; }
/// <summary>
/// Gets or sets the provider id.
/// </summary>
public int ProviderId { get; set; }
/// <summary>
/// Gets or sets the patient Id.
/// </summary>
public int PatientId { get; set; }
/// <summary>
/// Gets or sets the husband age.
/// </summary>
public int? HusbandAge { get; set; }
/// <summary>
/// Gets or sets anc no exist.
/// </summary>
public string? ANCNoExists { get; set; }
/// <summary>
/// Gets or sets appointment Id.
/// </summary>
public int? AppointmentId { get; set; }
public DateTime? AppointmentDate { get; set; }
public TimeSpan? AppointmentTime { get; set; }
public string? ConsultantDoctor { get; set; }
public bool IsAdmission { get; set; }
public string? JsonString { get; set; }
/// <summary>
/// Gets or sets the encounter type.
/// </summary>
public OBEncounterType Type { get; set; }
/// <summary>
/// Gets or sets the modified by.
/// </summary>
public int? ModifiedBy { get; set; }
public int? ObEncounterId { get; set; }
public string? ProviderName { get; set; }
}
public class OrderPrescriptions
{
public int? AppointmentId { get; set; }
public string? OrderPrescription { get; set; }
public DateTime? AppointmentDate { get; set; }
public TimeSpan? AppointmentTime { get; set; }
public string? ProviderName { get; set; }
public string? EncryptedAppointmentId { get; set; }
public object Labs { get; set; }
public object Medications { get; set; }
}
}
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The account credential.
/// </summary>
public class AccountCredentialModel
{
/// <summary>
/// Gets or sets the account credential id.
/// </summary>
public int AccountCredentialId { get; set; }
/// <summary>
/// Gets or sets the account id.
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// Gets or sets the password hash.
/// </summary>
public string PasswordHash { get; set; }
/// <summary>
/// Gets or sets a value indicating whether active.
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets or sets the created by.
/// </summary>
public int CreatedBy { get; set; }
/// <summary>
/// Gets or sets the created date.
/// </summary>
public DateTime CreatedDate { get; set; }
/// <summary>
/// Gets or sets the modified by.
/// </summary>
public int? ModifiedBy { get; set; }
/// <summary>
/// Gets or sets the modified date.
/// </summary>
public DateTime? ModifiedDate { get; set; }
}
}
#nullable enable
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The account.
/// </summary>
public class AccountModel
{
/// <summary>
/// Gets or sets the account id.
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// Gets or sets the role id.
/// </summary>
public int RoleId { get; set; }
/// <summary>
/// Gets or sets the role name.
/// </summary>
public string? RoleName { get; set; }
/// <summary>
/// Gets or sets the reference id.
/// </summary>
public int ReferenceId { get; set; }
/// <summary>
/// Gets or sets the salt key.
/// </summary>
public string SaltKey { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string FullName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the email.
/// </summary>
public string? Email { get; set; }
/// <summary>
/// Gets or sets the mobile.
/// </summary>
public string Mobile { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the country id.
/// </summary>
public int CountryId { get; set; }
/// <summary>
/// Gets or sets the country code.
/// </summary>
public string? CountryCode { get; set; }
/// <summary>
/// Gets or sets a value indicating whether agreed locked.
/// </summary>
public bool? IsAgreed { get; set; }
/// <summary>
/// Gets or sets the agreed date.
/// </summary>
public DateTime? AgreedDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether is locked.
/// </summary>
public bool IsLocked { get; set; }
/// <summary>
/// Gets or sets a value otp verified.
/// </summary>
public bool? OTPVerified { get; set; }
/// <summary>
/// Gets or sets a value manual verified.
/// </summary>
public bool? ManualVerified { get; set; }
/// <summary>
/// Gets or sets a value manual verified.
/// </summary>
public bool? PasswordExist { get; set; }
/// <summary>
/// Gets or sets the failed login attempts.
/// </summary>
public short FailedLoginAttempts { get; set; }
/// <summary>
/// Gets or sets the last failed login date.
/// </summary>
public DateTime? LastFailedLoginDate { get; set; }
/// <summary>
/// Gets or sets the last login date.
/// </summary>
public DateTime? LastLoginDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether active.
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets or sets the created by.
/// </summary>
public int? CreatedBy { get; set; }
/// <summary>
/// Gets or sets the created date.
/// </summary>
public DateTime CreatedDate { get; set; }
/// <summary>
/// Gets or sets the modified by.
/// </summary>
public int? ModifiedBy { get; set; }
/// <summary>
/// Gets or sets the modified date.
/// </summary>
public DateTime? ModifiedDate { get; set; }
/// <summary>
/// Gets or sets the status.
/// </summary>
public char? Status { get; set; }
/// <summary>
/// Gets or sets the total items.
/// </summary>
public int TotalItems { get; set; }
/// <summary>
/// Gets or sets the Patient Guid.
/// </summary>
public Guid PatientGuid { get; set; }
/// <summary>
/// Gets or sets the Description.
/// </summary>
public string? Description { get; set; }
/// <summary>
/// Gets or sets the location identifiers.
/// </summary>
/// <value>
/// The location identifiers.
/// </value>
public string? LocationIdentifiers { get; set; }
/// <summary>
/// Gets or sets the user name.
/// </summary>
public string? UserName { get; set; }
}
}
\ No newline at end of file
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The account session.
/// </summary>
public class AccountSessionModel
{
/// <summary>
/// Gets or sets the account session id.
/// </summary>
public int AccountSessionId { get; set; }
/// <summary>
/// Gets or sets the account id.
/// </summary>
public int AccountId { get; set; }
/// <summary>
/// Gets or sets the device ID.
/// </summary>
public string DeviceId { get; set; }
/// <summary>
/// Gets or sets the device key.
/// </summary>
public string DeviceToken { get; set; }
/// <summary>
/// Gets or sets the device type.
/// </summary>
public short DeviceType { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
public string Description { get; set; }
/// <summary>
/// Gets or sets a value indicating whether active.
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets or sets the created date.
/// </summary>
public DateTime CreatedDate { get; set; }
}
}
\ No newline at end of file
This diff is collapsed.
using Hims.Shared.Dapper.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Hims.Shared.EntityModels
{
public class AdmissionTransferRequestModel
{
/// <summary>
/// Gets or sets the admission transfer request id.
/// </summary>
public int? AdmissionTransferRequestId { get; set; }
/// <summary>
/// Gets or sets the admission id.
/// </summary>
public int AdmissionId { get; set; }
/// <summary>
/// Gets or sets the doctor unit master id.
/// </summary>
public int? DoctorUnitMasterId { get; set; }
/// <summary>
/// Gets or sets the doctor unit master id.
/// </summary>
public bool? Active { get; set; }
/// <summary>
/// Gets or sets the created by.
/// </summary>
public int? CreatedBy { get; set; }
/// <summary>
/// Gets or sets the created date.
/// </summary>
public DateTime CreatedDate { get; set; }
/// <summary>
/// Gets or sets the modified by.
/// </summary>
public int? ModifiedBy { get; set; }
/// <summary>
/// Gets or sets the modified date.
/// </summary>
public DateTime? ModifiedDate { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? FullName { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? ChargeCategoryName { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? UnitName { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? CreatedByName { get; set; }
/// <summary>
/// Gets or sets the modified by.
/// </summary>
public int? ApprovedBy { get; set; }
/// <summary>
/// Gets or sets the modified date.
/// </summary>
public DateTime? ApprovedDate { get; set; }
/// <summary>
/// Gets or sets the charge categories.
/// </summary>
public string? ChargeCategories { get; set; } = null;
/// <summary>
/// Gets or sets the charge categories.
/// </summary>
public int LocationId { get; set; }
/// <summary>
/// Gets or sets the charge categories.
/// </summary>
public int AdmissionChangeRequestTypeId { get; set; }
/// <summary>
/// Gets or sets the charge categories.
/// </summary>
public string? RequestComments { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? ApprovedByName { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? ChangeRequestType { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public int? BedId { get; set; }
/// <summary>
/// Gets or sets the RejectedBy.
/// </summary>
public int? RejectedBy { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? RejectedByName { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public DateTime? RejectedDate { get; set; }
/// <summary>
/// Gets or sets the total items.
/// </summary>
public int? TotalItems { get; set; }
/// <summary>
/// Gets or sets the page index.
/// </summary>
public int? PageIndex { get; set; }
/// <summary>
/// Gets or sets the page size.
/// </summary>
public int? PageSize { get; set; }
}
}
using Hims.Shared.Dapper.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Hims.Shared.EntityModels
{
public class AmbulanceModel
{
/// <summary>
/// get or set AmbulanceId
/// </summary>
[Key, Identity]
public int AmbulanceId { get; set; }
/// <summary>
/// get or set AmbulanceNo
/// </summary>
public string AmbulanceNo { get; set; }
/// <summary>
/// get or set AssignedNo
/// </summary>
public string AssignedNo { get; set; }
/// <summary>
/// get or set Active
/// </summary>
public bool Active { get; set; }
/// <summary>
/// get or set CreatedDate
/// </summary>
[IgnoreUpdate]
public DateTime CreatedDate { get; set; }
/// <summary>
/// get or set
/// </summary>
[IgnoreUpdate]
public int CreatedBy { get; set; }
/// <summary>
/// get or set ModifiedBy
/// </summary>
public int? ModifiedBy { get; set; }
/// <summary>
/// get or set ModifiedDate
/// </summary>
public DateTime? ModifiedDate { get; set; }
/// <summary>
/// Gets or sets the ambulance created name.
/// </summary>
public string CreatedByName { get; set; }
/// <summary>
/// Gets or sets the ambulance modified name.
/// </summary>
public string ModifiedByName { get; set; }
/// <summary>
/// Gets or sets the location id.
/// </summary>
public int LocationId { get; set; }
}
}
using Hims.Shared.Dapper.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Hims.Shared.EntityModels
{
public class AmbulanceRecieptModel
{
/// <summary>
/// get or set AmbulanceId
/// </summary>
[Key, Identity]
public int AmbulanceRecieptId { get; set; }
/// <summary>
/// get or set AmbulanceNo
/// </summary>
public string RecieptNo { get; set; }
/// <summary>
///
/// </summary>
public string FromLocation { get; set; }
/// <summary>
///
/// </summary>
public string Address { get; set; }
/// <summary>
///
/// </summary>
public string ToLocation { get; set; }
/// <summary>
///
/// </summary>
public string PatientName { get; set; }
/// <summary>
///
/// </summary>
public string PatientMobile { get; set; }
/// <summary>
///
/// </summary>
public int DriverDetailId { get; set; }
/// <summary>
///
/// </summary>
public int AmbulanceId { get; set; }
/// <summary>
///
/// </summary>
public int Amount { get; set; }
/// <summary>
/// get or set CreatedDate
/// </summary>
[IgnoreUpdate]
public DateTime CreatedDate { get; set; }
/// <summary>
/// get or set
/// </summary>
[IgnoreUpdate]
public int CreatedBy { get; set; }
/// <summary>
/// get or set ModifiedBy
/// </summary>
public int? ModifiedBy { get; set; }
/// <summary>
/// get or set ModifiedDate
/// </summary>
public DateTime? ModifiedDate { get; set; }
/// <summary>
/// Gets or sets the ambulance reciept created name.
/// </summary>
public string CreatedByName { get; set; }
/// <summary>
/// Gets or sets the ambulance reciept modified name.
/// </summary>
public string ModifiedByName { get; set; }
/// <summary>
/// get or set ModifiedBy
/// </summary>
public int LocationId { get; set; }
/// <summary>
/// Gets or sets the ambulance reciept created name.
/// </summary>
public string AmbulanceNo { get; set; }
/// <summary>
/// Gets or sets the ambulance reciept modified name.
/// </summary>
public string DriverDetailName { get; set; }
}
}
#nullable enable
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The appointment.
/// </summary>
public class AppointmentDashboardModel
{
/// <summary>
/// Gets or sets the appointment id.
/// </summary>
public int AppointmentId { get; set; }
/// <summary>
/// Gets or sets the appointment no.
/// </summary>
public string AppointmentNo { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the encounter id.
/// </summary>
public int? EncounterId { get; set; }
/// <summary>
/// Gets or sets the encrypted appointment id.
/// </summary>
public string? EncryptedAppointmentId { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the encrypted patient id.
/// </summary>
public string? EncryptedPatientId { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the patient id.
/// </summary>
public int PatientId { get; set; }
/// <summary>
/// Gets or sets the patient account id.
/// </summary>
public int PatientAccountId { get; set; }
/// <summary>
/// Gets or sets the patient name.
/// </summary>
public string? PatientName { get; set; }
/// <summary>
/// Gets or sets the patient gender.
/// </summary>
public char? PatientGender { get; set; }
/// <summary>
/// Gets or sets the patient marital status.
/// </summary>
public char? PatientMaritalStatus { get; set; }
/// <summary>
/// Gets or sets the patient mobile.
/// </summary>
public string? PatientMobile { get; set; }
/// <summary>
/// Gets or sets the patient email.
/// </summary>
public string? PatientEmail { get; set; }
/// <summary>
/// Gets or sets the patient thumbnail url.
/// </summary>
public string? PatientThumbnailUrl { get; set; }
/// <summary>
/// Gets or sets the patient age.
/// </summary>
public short? PatientAge { get; set; }
/// <summary>
/// Gets or sets the patient date of birth.
/// </summary>
public DateTime? PatientDateOfBirth { get; set; }
/// <summary>
/// Gets or sets the patient country code.
/// </summary>
public string? PatientCountryCode { get; set; }
/// <summary>
/// Gets or sets the appointment date.
/// </summary>
public DateTime AppointmentDate { get; set; }
/// <summary>
/// Gets or sets the appointment time.
/// </summary>
public TimeSpan AppointmentTime { get; set; }
/// <summary>
/// Gets or sets the AppointmentTimeString
/// </summary>
public string? AppointmentTimeString { get; set; }
/// <summary>
/// Gets or sets the encounter type.
/// </summary>
public string? EncounterType { get; set; }
/// <summary>
/// Gets or sets a value indicating whether is prescription.
/// </summary>
public bool IsPrescription { get; set; }
/// <summary>
/// Gets or sets a value indicating whether is full transcript.
/// </summary>
public bool IsFullTranscript { get; set; }
/// <summary>
/// Gets or sets the provider identifier.
/// </summary>
/// <value>
/// The provider identifier.
/// </value>
public int ProviderId { get; set; }
/// <summary>
/// Gets or sets the provider location identifier.
/// </summary>
/// <value>
/// The provider location identifier.
/// </value>
public int ProviderLocationId { get; set; }
/// <summary>
/// Gets or sets the name of the provider.
/// </summary>
/// <value>
/// The name of the provider.
/// </value>
public string? ProviderName { get; set; }
/// <summary>
/// Gets or sets the queue status.
/// </summary>
/// <value>
/// The queue status.
/// </value>
public string? QueueStatus { get; set; }
/// <summary>
/// Gets or sets the umrno.
/// </summary>
/// <value>
/// The queue umrno.
/// </value>
public string? UMRNo { get; set; }
/// <summary>
/// Gets or sets the consultationTypeId.
/// </summary>
/// <value>
/// The consultationTypeId.
/// </value>
public int? ConsultationTypeId { get; set; }
/// <summary>
/// Gets or sets the specializationId.
/// </summary>
/// <value>
/// The queue specializationId.
/// </value>
public int? SpecializationId { get; set; }
/// <summary>
/// Gets or sets the providerAvailabilityId.
/// </summary>
/// <value>
/// The queue providerAvailabilityId.
/// </value>
public int? ProviderAvailabilityId { get; set; }
/// <summary>
/// Gets or sets the provider mail id.
/// </summary>
/// <value>
/// The queue provider mail id.
/// </value>
public string? ProviderEmail { get; set; }
/// <summary>
/// Gets or sets the room name.
/// </summary>
/// <value>
/// The room name.
/// </value>
public string? RoomName { get; set; }
}
}
#nullable enable
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The appointment exception log.
/// </summary>
public class AppointmentExceptionLogModel
{
/// <summary>
/// Gets or sets the appointment exception log id.
/// </summary>
public int AppointmentExceptionLogId { get; set; }
/// <summary>
/// Gets or sets the appointment log id.
/// </summary>
public int? AppointmentLogId { get; set; }
/// <summary>
/// Gets or sets the appointment id.
/// </summary>
public int? AppointmentId { get; set; }
/// <summary>
/// Gets or sets a value indicating whether payment status.
/// </summary>
public bool PaymentStatus { get; set; }
/// <summary>
/// Gets or sets the exception date.
/// </summary>
public DateTime ExceptionDate { get; set; }
/// <summary>
/// Gets or sets the exception message.
/// </summary>
public string ExceptionMessage { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the stack trace.
/// </summary>
public string? StackTrace { get; set; }
/// <summary>
/// Gets or sets the payment transaction id.
/// </summary>
public string? PaymentTransactionId { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Hims.Shared.EntityModels
{
public class AppointmentHangfireMapModel
{
public int AHMapId { get; set; }
public int AppointmentId { get; set; }
public DateTime CreatedDate { get; set; }
public string Status { get; set; }
public bool SmsSent { get; set; }
public bool EmailSent { get; set; }
/// <summary>
/// Gets or sets the appointment date.
/// </summary>
public DateTime AppointmentDate { get; set; }
/// <summary>
/// Gets or sets the appointment time.
/// </summary>
public TimeSpan AppointmentTime { get; set; }
}
}
#nullable enable
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The appointment log.
/// </summary>
public class AppointmentLogModel
{
/// <summary>
/// Gets or sets the appointment log id.
/// </summary>
public int AppointmentLogId { get; set; }
/// <summary>
/// Gets or sets the provider location id.
/// </summary>
public int? ProviderLocationId { get; set; }
/// <summary>
/// Gets or sets the provider location id.
/// </summary>
public int ProviderAvailabilityId { get; set; }
/// <summary>
/// Gets or sets the provider location id.
/// </summary>
public int ConsultationTypeId { get; set; }
/// <summary>
/// Gets or sets the provider id.
/// </summary>
public int ProviderId { get; set; }
/// <summary>
/// Gets or sets the provider name.
/// </summary>
public string? ProviderName { get; set; }
/// <summary>
/// Gets or sets the provider thumbnail url.
/// </summary>
public string? ProviderThumbnailUrl { get; set; }
/// <summary>
/// Gets or sets the practice name.
/// </summary>
public string? PracticeName { get; set; }
/// <summary>
/// Gets or sets the provider location.
/// </summary>
public string? ProviderLocation { get; set; }
/// <summary>
/// Gets or sets the currency symbol.
/// </summary>
public char CurrencySymbol { get; set; }
/// <summary>
/// Gets or sets the patient id.
/// </summary>
public int PatientId { get; set; }
/// <summary>
/// Gets or sets the patient first name.
/// </summary>
public string? PatientFirstName { get; set; }
/// <summary>
/// Gets or sets the patient last name.
/// </summary>
public string? PatientLastName { get; set; }
/// <summary>
/// Gets or sets the patient email.
/// </summary>
public string? PatientEmail { get; set; }
/// <summary>
/// Gets or sets the patient mobile.
/// </summary>
public string? PatientMobile { get; set; }
/// <summary>
/// Gets or sets the patient country name.
/// </summary>
public string? PatientCountryName { get; set; }
/// <summary>
/// Gets or sets the visit type.
/// </summary>
public char? VisitType { get; set; }
/// <summary>
/// Gets or sets the patient type.
/// </summary>
public char? PatientType { get; set; }
/// <summary>
/// Gets or sets the charge type.
/// </summary>
public char? ChargeType { get; set; }
/// <summary>
/// Gets or sets the appointment date.
/// </summary>
public DateTime AppointmentDate { get; set; }
/// <summary>
/// Gets or sets the appointment time.
/// </summary>
public TimeSpan AppointmentTime { get; set; }
/// <summary>
/// Gets or sets the appointment end time.
/// </summary>
public TimeSpan AppointmentEndTime { get; set; }
/// <summary>
/// Gets or sets the appointment notes.
/// </summary>
public string? AppointmentNotes { get; set; }
/// <summary>
/// Gets or sets the coupon id.
/// </summary>
public int? CouponId { get; set; }
/// <summary>
/// Gets or sets the amount.
/// </summary>
public decimal Amount { get; set; }
/// <summary>
/// Gets or sets the discount.
/// </summary>
public decimal Discount { get; set; }
/// <summary>
/// Gets or sets the app charges.
/// </summary>
public decimal AppCharges { get; set; }
/// <summary>
/// Gets or sets the wallet amount.
/// </summary>
public decimal? WalletAmount { get; set; }
/// <summary>
/// Gets or sets the total.
/// </summary>
public decimal Total { get; set; }
/// <summary>
/// Gets or sets the created by.
/// </summary>
public int CreatedBy { get; set; }
/// <summary>
/// Gets or sets the created date.
/// </summary>
public DateTime CreatedDate { get; set; }
/// <summary>
/// Gets or sets the patient family id.
/// </summary>
public int? PatientFamilyId { get; set; }
/// <summary>
/// Gets or sets the percentage.
/// </summary>
public double? Percentage { get; set; }
/// <summary>
/// Gets or sets the department id.
/// </summary>
public int? DepartmentId { get; set; }
/// <summary>
/// Gets or sets payment type.
/// </summary>
public string? PaymentType { get; set; }
/// <summary>
/// Gets or sets follow up for AppointmentId.
/// </summary>
public int? FollowUpForAppointmentId { get; set; }
/// <summary>
/// Gets or sets follow up for admission id.
/// </summary>
public int? FollowUpForAdmissionId { get; set; }
/// <summary>
/// Gets or sets the follow up days.
/// </summary>
public short? FollowUpDays { get; set; }
/// <summary>
/// Gets or sets the location identifier.
/// </summary>
/// <value>
/// The location identifier.
/// </value>
public int LocationId { get; set; }
/// <summary>
/// Gets or sets the appointment identifier.
/// </summary>
/// <value>
/// The appointment identifier.
/// </value>
public int? AppointmentTypeId { get; set; }
/// <summary>
/// Gets or sets the visitype identifier.
/// </summary>
/// <value>
/// The visitype identifier.
/// </value>
public int? VisitTypeId { get; set; }
/// <summary>
/// Gets or sets the chargetype identifier.
/// </summary>
/// <value>
/// The chargetype identifier.
/// </value>
public int? ChargeTypesId { get; set; }
/// <summary>
/// Gets or sets the appointment identifier.
/// </summary>
/// <value>
/// The appointment identifier.
/// </value>
public int PayTypeId { get; set; }
/// <summary>
/// Gets or sets the token number.
/// </summary>
/// <value>
/// The token number.
/// </value>
public int TokenNumber { get; set; }
/// <summary>
/// Gets or sets the SpecializationId.
/// </summary>
/// <value>
/// The SpecializationId.
/// </value>
public int? SpecializationId { get; set; }
/// <summary>
/// Gets or sets the registration charges.
/// this value is used to add in Patient table (while inserting new patient either identify or unidentify patient.)
/// </summary>
public decimal? PatientRegistrationCharges { get; set; }
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The AppointmentSymptom.
/// </summary>
public class AppointmentSymptomModel
{
/// <summary>
/// Gets or sets appointment symptom Id.
/// </summary>
public int AppointmentSymptomId { get; set; }
/// <summary>
/// Gets or sets the appointment id.
/// </summary>
public int AppointmentId { get; set; }
/// <summary>
/// Gets or sets symptoms.
/// </summary>
public string Symptoms { get; set; }
/// <summary>
/// Gets or sets a value indicating whether active.
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets or sets the created by.
/// </summary>
public int CreatedBy { get; set; }
/// <summary>
/// Gets or sets the created date.
/// </summary>
public DateTime CreatedDate { get; set; }
/// <summary>
/// Gets or sets the modified by.
/// </summary>
public int? ModifiedBy { get; set; }
/// <summary>
/// Gets or sets the modified date.
/// </summary>
public DateTime? ModifiedDate { get; set; }
}
}
This diff is collapsed.
#nullable enable
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The auditLog.
/// </summary>
public class AuditLogModel
{
/// <summary>
/// Gets or sets the auditLog id.
/// </summary>
public int AuditLogId { get; set; }
/// <summary>
/// Gets or sets the Log type.
/// </summary>
public int LogTypeId { get; set; }
/// <summary>
/// Gets or sets the log type name.
/// </summary>
public string? LogTypeName { get; set; }
/// <summary>
/// Gets or sets the log date.
/// </summary>
public DateTime LogDate { get; set; }
/// <summary>
/// Gets or sets the app type.
/// </summary>
public short LogFrom { get; set; }
/// <summary>
/// Gets or sets the account id.
/// </summary>
public int? AccountId { get; set; }
/// <summary>
/// Gets or sets the full name.
/// </summary>
public string? FullName { get; set; }
/// <summary>
/// Gets or sets the RoleId.
/// </summary>
public int? RoleId { get; set; }
/// <summary>
/// Gets or sets the role name.
/// </summary>
public string? RoleName { get; set; }
/// <summary>
/// Gets or sets the auditLog code.
/// </summary>
public string LogDescription { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the total items.
/// </summary>
public int TotalItems { get; set; }
/// <summary>
/// Gets or sets the location id
/// </summary>
public int? LocationId { get; set; }
}
}
\ No newline at end of file
#nullable enable
namespace Hims.Shared.EntityModels
{
using System;
/// <summary>
/// The account.
/// </summary>
public class BasicAppointmentModel
{
/// <summary>
/// Gets or sets the account id.
/// </summary>
public int ProviderId { get; set; }
/// <summary>
/// Gets or sets the role id.
/// </summary>
public int PatientId { get; set; }
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment