Skip to content

Commit

Permalink
Added version information to client + database
Browse files Browse the repository at this point in the history
  • Loading branch information
Dag Robole committed Apr 25, 2019
1 parent d236ec7 commit 3508ef0
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 14 deletions.
25 changes: 13 additions & 12 deletions AboutBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions AboutBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,10 @@ public string AssemblyCompany
}
}
#endregion

private void okButton_Click(object sender, EventArgs e)
{

}
}
}
Binary file modified DSA-LIMS_MANUAL.pdf
Binary file not shown.
19 changes: 19 additions & 0 deletions FormLogin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License
using System.DirectoryServices.ActiveDirectory;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Security.Principal;
using System.Text;
using System.Windows.Forms;
Expand Down Expand Up @@ -71,6 +72,16 @@ private void btnOk_Click(object sender, EventArgs e)

trans = conn.BeginTransaction();

int client_version, database_version;

GetVersionInfo(conn, trans, out client_version, out database_version);

if (client_version != database_version)
{
MessageBox.Show("Incompatible database. Client expects version " + client_version + " but database has version " + database_version);
return;
}

if (cboxAction.SelectedIndex == 0)
{
string username = tbUsername.Text.ToLower().Trim();
Expand Down Expand Up @@ -130,6 +141,14 @@ private void btnOk_Click(object sender, EventArgs e)
}
}

private void GetVersionInfo(SqlConnection conn, SqlTransaction trans, out int client_version, out int database_version)
{
client_version = Assembly.GetExecutingAssembly().GetName().Version.Major;

SqlCommand cmd = new SqlCommand("select value from counters where name = 'database_version'", conn, trans);
database_version = (int)cmd.ExecuteScalar();
}

private bool CreateLIMSAdministrator(SqlConnection conn, SqlTransaction trans)
{
FormCreateLIMSAdministrator form = new FormCreateLIMSAdministrator();
Expand Down
2 changes: 1 addition & 1 deletion FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.*")]
[assembly: AssemblyVersion("1.1.*")]
[assembly: AssemblyFileVersion("0.0.0.0")]
1 change: 1 addition & 0 deletions database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ create table counters (
)
go

insert into counters (name) values('database_version')
insert into counters (name) values('sample_counter')
go

Expand Down

0 comments on commit 3508ef0

Please sign in to comment.