Skip to content

Commit

Permalink
migrate version 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Dag Robole committed Jan 9, 2020
1 parent ebaaaaa commit 781fb0a
Show file tree
Hide file tree
Showing 43 changed files with 7,539 additions and 3,715 deletions.
18 changes: 13 additions & 5 deletions App.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DSA_lims.Properties.Settings.dsa_limsConnectionString"
Expand Down Expand Up @@ -46,6 +46,14 @@
<assemblyIdentity name="System.Configuration" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.111.0" newVersion="1.0.111.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
Expand All @@ -59,10 +67,10 @@
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>

<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data>
</configuration>
</system.data></configuration>
25 changes: 25 additions & 0 deletions DBAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,31 @@ public static bool IdExists(SqlConnection conn, SqlTransaction trans, Guid analI
return cnt > 0;
}

public static bool IsSpectrumReferenceAvailable(SqlConnection conn, SqlTransaction trans, Guid analId, string specRef, out int sampleNum)
{
sampleNum = -1;
string query = @"
select s.number
from analysis a
inner join preparation p on a.preparation_id = p.id
inner join sample s on p.sample_id = s.id
where a.instance_status_id = 1 and a.specter_reference = @specref and a.id not in(@exId)
";
SqlCommand cmd = new SqlCommand(query, conn, trans);
cmd.Parameters.AddWithValue("@specref", specRef);
cmd.Parameters.AddWithValue("@exId", analId);

object o = cmd.ExecuteScalar();
if (o != null && o != DBNull.Value)
{
sampleNum = Convert.ToInt32(o);
//MessageBox.Show("The spectrum reference " + tbPrepAnalAnalSpecRef.Text.Trim() + " is already used by sample " + snum);
return false;
}

return true;
}

public void LoadFromDB(SqlConnection conn, SqlTransaction trans, Guid analId)
{
using (SqlDataReader reader = DB.GetDataReader(conn, trans, "csp_select_analysis", CommandType.StoredProcedure,
Expand Down
6 changes: 6 additions & 0 deletions DBAssignment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ public string LaboratoryName(SqlConnection conn, SqlTransaction trans)
return !DB.IsValidField(o) ? "" : o.ToString();
}

public string ResponsibleName(SqlConnection conn, SqlTransaction trans)
{
object o = DB.GetScalar(conn, trans, "select name from cv_account where id = @aid", CommandType.Text, new SqlParameter("@aid", AccountId));
return !DB.IsValidField(o) ? "" : o.ToString();
}

public static bool IdExists(SqlConnection conn, SqlTransaction trans, Guid assId)
{
int cnt = (int)DB.GetScalar(conn, trans, "select count(*) from assignment where id = @id", CommandType.Text, new SqlParameter("@id", assId));
Expand Down
9 changes: 9 additions & 0 deletions DBPreparation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public Preparation()
public Guid CreateId { get; set; }
public DateTime UpdateDate { get; set; }
public Guid UpdateId { get; set; }
public double? Volume_l { get; set; }
public double? PreprocessingVolume_l { get; set; }


public List<Analysis> Analyses { get; set; }

Expand Down Expand Up @@ -111,6 +114,8 @@ public void LoadFromDB(SqlConnection conn, SqlTransaction trans, Guid prepId)
Quantity = reader.GetDoubleNullable("quantity");
QuantityUnitId = reader.GetInt32("quantity_unit_id");
FillHeightMM = reader.GetDoubleNullable("fill_height_mm");
Volume_l = reader.GetDoubleNullable("volume_l");
PreprocessingVolume_l = reader.GetDoubleNullable("preprocessing_volume_l");
InstanceStatusId = reader.GetInt32("instance_status_id");
Comment = reader.GetString("comment");
CreateDate = reader.GetDateTime("create_date");
Expand Down Expand Up @@ -169,6 +174,8 @@ public void StoreToDB(SqlConnection conn, SqlTransaction trans)
cmd.Parameters.AddWithValue("@create_id", Common.UserId, Guid.Empty);
cmd.Parameters.AddWithValue("@update_date", DateTime.Now);
cmd.Parameters.AddWithValue("@update_id", Common.UserId, Guid.Empty);
cmd.Parameters.AddWithValue("@volume_l", Volume_l, null);
cmd.Parameters.AddWithValue("@preprocessing_volume_l", PreprocessingVolume_l, null);

cmd.ExecuteNonQuery();

Expand All @@ -193,6 +200,8 @@ public void StoreToDB(SqlConnection conn, SqlTransaction trans)
cmd.Parameters.AddWithValue("@comment", Comment, String.Empty);
cmd.Parameters.AddWithValue("@update_date", DateTime.Now);
cmd.Parameters.AddWithValue("@update_id", Common.UserId, Guid.Empty);
cmd.Parameters.AddWithValue("@volume_l", Volume_l, null);
cmd.Parameters.AddWithValue("@preprocessing_volume_l", PreprocessingVolume_l, null);

cmd.ExecuteNonQuery();

Expand Down
Binary file modified DSA-LIMS_MANUAL.pdf
Binary file not shown.
Loading

0 comments on commit 781fb0a

Please sign in to comment.