-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,873 changed files
with
1,650,924 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<configSections> | ||
<section name="entityFramework" | ||
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" | ||
requirePermission="false"/> | ||
<section name="oracle.manageddataaccess.client" | ||
type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/> | ||
</configSections> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> | ||
</startup> | ||
<connectionStrings> | ||
<!--<add name="STCConnection" | ||
connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=btsoftvn.com)(PORT=1522)))(CONNECT_DATA=(SERVER=orcl)(SERVICE_NAME=orcl)));USER ID=BTSTC;PASSWORD=BTSTC;" providerName="Oracle.ManagedDataAccess.Client"/>--> | ||
<add name="STCConnection" | ||
connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.4)(PORT=1521)))(CONNECT_DATA=(SERVER=orcl)(SERVICE_NAME=orcl)));USER ID=BTSTC;PASSWORD=BTSTC;" providerName="Oracle.ManagedDataAccess.Client"/> | ||
</connectionStrings> | ||
<entityFramework> | ||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> | ||
<parameters> | ||
<parameter value="mssqllocaldb"/> | ||
</parameters> | ||
</defaultConnectionFactory> | ||
<providers> | ||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/> | ||
<provider invariantName="Oracle.ManagedDataAccess.Client" | ||
type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/> | ||
</providers> | ||
</entityFramework> | ||
<system.data> | ||
<DbProviderFactories> | ||
<remove invariant="Oracle.ManagedDataAccess.Client"/> | ||
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" | ||
type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342"/> | ||
</DbProviderFactories> | ||
</system.data> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<publisherPolicy apply="no"/> | ||
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral"/> | ||
<bindingRedirect oldVersion="4.121.0.0 - 4.65535.65535.65535" newVersion="4.121.2.0"/> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
<oracle.manageddataaccess.client> | ||
<version number="*"> | ||
<dataSources> | ||
<dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=btsoftvn.com)(PORT=1522))(CONNECT_DATA=(SERVICE_NAME=ORCL))) "/> | ||
</dataSources> | ||
</version> | ||
</oracle.manageddataaccess.client> | ||
</configuration> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<ProjectView>ShowAllFiles</ProjectView> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"" | ||
{ | ||
"FILE_VERSION" = "9237" | ||
"ENLISTMENT_CHOICE" = "NEVER" | ||
"PROJECT_FILE_RELATIVE_PATH" = "" | ||
"NUMBER_OF_EXCLUDED_FILES" = "0" | ||
"ORIGINAL_PROJECT_FILE_PATH" = "" | ||
"NUMBER_OF_NESTED_PROJECTS" = "0" | ||
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Data.Entity; | ||
using System.Threading; | ||
|
||
namespace BTS.SP.API.ENTITY | ||
{ | ||
public class DataContext : DbContext, IDataContext | ||
{ | ||
private readonly Guid _instanceId; | ||
|
||
public DataContext(string nameOrConnectionString) | ||
: base(nameOrConnectionString) | ||
{ | ||
_instanceId = Guid.NewGuid(); | ||
Configuration.LazyLoadingEnabled = false; | ||
} | ||
|
||
public Guid InstanceId | ||
{ | ||
get { return _instanceId; } | ||
} | ||
|
||
public new DbSet<T> Set<T>() where T : class | ||
{ | ||
return base.Set<T>(); | ||
} | ||
|
||
public override int SaveChanges() | ||
{ | ||
SyncObjectsStatePreCommit(); | ||
int changes = base.SaveChanges(); | ||
SyncObjectsStatePostCommit(); | ||
return changes; | ||
} | ||
|
||
public override Task<int> SaveChangesAsync() | ||
{ | ||
SyncObjectsStatePreCommit(); | ||
var changesAsync = base.SaveChangesAsync(); | ||
SyncObjectsStatePostCommit(); | ||
return changesAsync; | ||
} | ||
|
||
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken) | ||
{ | ||
SyncObjectsStatePreCommit(); | ||
var changesAsync = base.SaveChangesAsync(cancellationToken); | ||
SyncObjectsStatePostCommit(); | ||
return changesAsync; | ||
} | ||
|
||
public void SyncObjectState(object entity) | ||
{ | ||
Entry(entity).State = StateHelper.ConvertState(((IObjectState)entity).ObjectState); | ||
} | ||
|
||
private void SyncObjectsStatePreCommit() | ||
{ | ||
foreach (var dbEntityEntry in ChangeTracker.Entries()) | ||
dbEntityEntry.State = StateHelper.ConvertState(((IObjectState)dbEntityEntry.Entity).ObjectState); | ||
} | ||
|
||
private void SyncObjectsStatePostCommit() | ||
{ | ||
foreach (var dbEntityEntry in ChangeTracker.Entries()) | ||
((IObjectState)dbEntityEntry.Entity).ObjectState = StateHelper.ConvertState(dbEntityEntry.State); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace BTS.SP.API.ENTITY | ||
{ | ||
public class DataInfoEntity : EntityBase | ||
{ | ||
[Key] | ||
[Column("ID")] | ||
public int ID { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BTS.SP.API.ENTITY | ||
{ | ||
public class DataInfoEntityPHC: EntityBase | ||
{ | ||
[Key] | ||
[Column("ID")] | ||
public int ID { get; set; } | ||
|
||
[Column("CODELOCATION")] | ||
[StringLength(5)] | ||
[Description("Mã địa bàn hành chính, để phân quyền")] | ||
public string CODELOCATION { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace BTS.SP.API.ENTITY | ||
{ | ||
public class DataInfoEntityPHF : EntityBase | ||
{ | ||
[Key] | ||
[Column("ID")] | ||
public int ID { get; set; } | ||
|
||
[Column("I_CREATE_DATE")] | ||
[DataType(DataType.Date), DisplayFormat(DataFormatString = "yyyy/MM/dd", ApplyFormatInEditMode = true)] | ||
public virtual DateTime? ICreateDate { get; set; } | ||
|
||
[Column("I_CREATE_BY")] | ||
[StringLength(50)] | ||
public virtual string ICreateBy { get; set; } | ||
|
||
[Column("I_UPDATE_DATE")] | ||
[DataType(DataType.Date), DisplayFormat(DataFormatString = "yyyy/MM/dd", ApplyFormatInEditMode = true)] | ||
public virtual DateTime? IUpdateDate { get; set; } | ||
|
||
[Column("I_UPDATE_BY")] | ||
[StringLength(50)] | ||
public virtual string IUpdateBy { get; set; } | ||
|
||
[Column("I_STATE")] | ||
[StringLength(50)] | ||
public virtual string IState { get; set; } | ||
[Column("UNITCODE")] | ||
[Description("Mã đơn vị")] | ||
[StringLength(50)] | ||
public string UnitCode { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BTS.SP.API.ENTITY | ||
{ | ||
public class DataInfoState | ||
{ | ||
#region State Base | ||
|
||
protected static readonly Dictionary<string, string> StateData = new Dictionary<string, string>(); | ||
|
||
public static List<StateInfoObj> All | ||
{ | ||
get | ||
{ | ||
List<StateInfoObj> result = StateData.Select(item => new StateInfoObj | ||
{ | ||
Value = item.Key, | ||
Text = item.Value | ||
}).ToList(); | ||
return result; | ||
} | ||
} | ||
|
||
public static bool IsValidState(string state) | ||
{ | ||
bool result = !string.IsNullOrEmpty(state) && StateData.ContainsKey(state); | ||
return result; | ||
} | ||
|
||
protected static void AddStateText(string state, string text, bool visible = true, bool executeable = true) | ||
{ | ||
if (!string.IsNullOrEmpty(state) && !StateData.ContainsKey(state)) | ||
{ | ||
StateData.Add(state, text); | ||
if (visible) | ||
{ | ||
VisibleStates.Add(state); | ||
} | ||
if (executeable) | ||
{ | ||
ExecutableStates.Add(state); | ||
} | ||
} | ||
} | ||
|
||
public static string GetStateLabel(string state) | ||
{ | ||
string result = ""; | ||
if (IsValidState(state)) | ||
{ | ||
result = StateData[state]; | ||
} | ||
return result; | ||
} | ||
|
||
public static List<string> VisibleStates = new List<string>(); | ||
|
||
public static List<string> ExecutableStates = new List<string>(); | ||
|
||
public static bool IsVisibleState(string state) | ||
{ | ||
return VisibleStates.Contains(state); | ||
} | ||
|
||
public static bool IsExecutableState(string state) | ||
{ | ||
return ExecutableStates.Contains(state); | ||
} | ||
|
||
#endregion | ||
|
||
static DataInfoState() | ||
{ | ||
AddStateText(Static, "Static"); | ||
AddStateText(Active, "Active"); | ||
AddStateText(Imported, "Imported"); | ||
AddStateText(Locked, "Locked", true, false); | ||
AddStateText(Inactive, "Inactive", true, false); | ||
AddStateText(Deleted, "Deleted", false, false); | ||
} | ||
|
||
public static string Static = "static"; | ||
public static string Active = "active"; | ||
public static string Imported = "imported"; | ||
|
||
public static string Locked = "locked"; | ||
public static string Inactive = "inactive"; | ||
|
||
public static string Deleted = "deleted"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BTS.SP.API.ENTITY | ||
{ | ||
public class DetailInfoEntity : EntityBase | ||
{ | ||
[Key] | ||
[Column("ID")] | ||
public int ID { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BTS.SP.API.ENTITY | ||
{ | ||
public abstract class EntityBase : IObjectState | ||
{ | ||
[NotMapped] | ||
public ObjectState ObjectState { get; set; } //TODO: Renamed since a possible coflict with State entity column | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BTS.SP.API.ENTITY.Helper | ||
{ | ||
public class ExportExcelAttribute: DescriptionAttribute | ||
{ | ||
public ExportExcelAttribute() | ||
{ | ||
|
||
} | ||
public ExportExcelAttribute(string description) | ||
{ | ||
this.DescriptionValue = description; | ||
} | ||
} | ||
} |
Oops, something went wrong.