TracingDB : WorkplaceRegistration, etc. added, TrivialLoginDlg removed, ver. 1.5.61 --> 2.0.65

This commit is contained in:
Milan Hanajik 2018-08-28 09:58:58 +02:00
parent 0ef9505af1
commit fa818c5cf8
15 changed files with 421 additions and 340 deletions

View File

@ -71,7 +71,7 @@ namespace TBF.BenchControl.Output.DB.ProductionMonitoring
.Configure()
.Database(FluentNHibernate.Cfg.Db.MySQLConfiguration.Standard.ConnectionString(monitoringCfg.ConnStr))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<TracingDB.Entities.Process>())
.ExposeConfiguration(TracingDB.FluentNH.BuildSchema)
.ExposeConfiguration(TracingDB.DB.BuildSchema)
.BuildSessionFactory();
///
/// Read processes and worksteps from the database (this verifies DB connection as well)

View File

@ -5,16 +5,20 @@ using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using log4net;
namespace TracingDB
{
public static class FluentNH
public static class DB
{
/// <summary>
static readonly ILog log = LogManager.GetLogger(typeof(DB));
/// <summary>
/// Current session factory for the last used connection string or null
/// </summary>
public static ISessionFactory SessionFactory;
public static ISession Session;
/// <summary> Connection string for all sessions </summary>
static string connectionString;
@ -206,5 +210,84 @@ namespace TracingDB
}
}
}
public static bool RegisterWorkplace(ISession session, string workplace, string user, string ipAddress, string processName, string workstepName, DateTime valiUntil)
{
try
{
IList<Entities.WorkplaceRegistration> wpRegs = session
.QueryOver<Entities.WorkplaceRegistration>()
.Where(x => (x.Workplace == workplace))
.List();
if (wpRegs.Count == 0)
{
Entities.WorkplaceRegistration wpReg = new Entities.WorkplaceRegistration(workplace, user, ipAddress, processName, workstepName);
wpRegs.Add(wpReg);
session.SaveOrUpdate(wpReg);
log.InfoFormat("RegisterWorkplace(., {0}, {1}, ...) successful (new)", workplace, user);
return true;
}
else if (wpRegs.Count == 1)
{
Entities.WorkplaceRegistration wpReg = wpRegs[0];
wpReg.Active = true;
wpReg.TimeStamp = DateTime.Now;
wpReg.ValidUntil = DateTime.Now + new TimeSpan(8, 0, 0);
wpReg.UserName = user;
wpReg.IPAddress = ipAddress;
wpReg.ProcessName = processName;
wpReg.WorkstepName = workstepName;
session.SaveOrUpdate(wpReg);
log.InfoFormat("RegisterWorkplace(., {0}, {1}, ...) successful", workplace, user);
return true;
}
else
{
log.ErrorFormat("RegisterWorkplace(., {0}, {1}, ...) failed", workplace, user);
return false;
}
}
catch (Exception e)
{
log.ErrorFormat("RegisterWorkplace(., {0}, {1}, ...) exception: {2}", workplace, user, e.Message);
return false;
}
}
public static bool UnregisterWorkplace(ISession session, string workplace)
{
try
{
IList<Entities.WorkplaceRegistration> wpRegs = session
.QueryOver<Entities.WorkplaceRegistration>()
.Where(x => (x.Workplace == workplace))
.List();
if (wpRegs.Count == 1)
{
Entities.WorkplaceRegistration wpReg = wpRegs[0];
wpReg.Active = false;
wpReg.TimeStamp = DateTime.Now;
session.SaveOrUpdate(wpReg);
log.InfoFormat("UnregisterWorkplace(., {0}) successful", workplace);
return true;
}
else
{
log.ErrorFormat("UnregisterWorkplace(., {0}) failed", workplace);
return false;
}
}
catch (Exception e)
{
log.ErrorFormat("UnregisterWorkplace(., {0}) exception: {1}", workplace, e.Message);
return false;
}
}
}
}

View File

@ -8,14 +8,24 @@ namespace TracingDB.Entities
public virtual int Id { get; protected set; }
public virtual int ItemNr { get; set; }
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual ReleaseStatus ReleaseStatus { get; set; }
public virtual DateTime TimeStamp { get; set; }
public virtual string UserName { get; set; }
public virtual int SubClass { get; set; } /// Main process: 1, Sub processes: 2, 4, 8, ...
public virtual string Description { get; set; }
public virtual string CreatedBy { get; set; }
public virtual DateTime TimeStamp { get; set; }
public virtual string ApprovedBy { get; set; }
public virtual DateTime TimeStamp2 { get; set; }
public virtual string ReleaseNotes { get; set; }
public virtual ReleaseStatus ReleaseStatus { get; set; }
public virtual IList<Part> Parts { get; set; }
public virtual IList<Workstep> Worksteps { get; set; }
/// Wrappers
public virtual SubClass GetSubClass() { return (SubClass)SubClass; }
public virtual void SetSubClass(SubClass subClass) { SubClass = (int)subClass; }
/// <summary>
/// Default (private) constructor inicializing lists
/// </summary>
@ -33,11 +43,15 @@ namespace TracingDB.Entities
: this()
{
Name = name;
SubClass = 0;
Description = string.Empty;
ReleaseStatus = ReleaseStatus.In_preparation;
TimeStamp = DateTime.Now;
UserName = "admin";
}
ReleaseNotes = string.Empty;
CreatedBy = "admin";
TimeStamp = DateTime.Now;
ApprovedBy = string.Empty;
TimeStamp2 = DateTime.Now;
ReleaseStatus = ReleaseStatus.In_preparation;
}
/// <summary>
/// Create a copy of a process with a new name
@ -47,7 +61,14 @@ namespace TracingDB.Entities
public virtual Process Clone(string name)
{
Process rslt = new Process(name);
rslt.Description = Description;
rslt.SubClass = SubClass;
rslt.Description = Description;
rslt.ReleaseNotes = ReleaseNotes;
CreatedBy = "admin";
TimeStamp = DateTime.Now;
ApprovedBy = string.Empty;
TimeStamp2 = DateTime.Now;
ReleaseStatus = ReleaseStatus.In_preparation;
foreach (var part in Parts) rslt.Parts.Add(part.Clone(rslt));
foreach (var workstep in Worksteps) rslt.Worksteps.Add(workstep.Clone(rslt));
@ -57,12 +78,7 @@ namespace TracingDB.Entities
public override string ToString()
{
return string.Format("{0} '{1}' ({2}) {3} {4}",
ItemNr,
Name,
TimeStamp.Date.ToShortDateString(),
(Description == null) ? string.Empty : Description,
ReleaseStatus);
return string.IsNullOrEmpty(Name) ? string.Empty : Name;
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TracingDB.Entities
{
public class WorkplaceRegistration
{
public virtual int Id { get; protected set; }
public virtual string Workplace { get; set; }
public virtual bool Active { get; set; }
public virtual DateTime TimeStamp { get; set; }
public virtual DateTime ValidUntil { get; set; }
public virtual string UserName { get; set; }
public virtual string IPAddress { get; set; }
public virtual string ProcessName { get; set; }
public virtual string WorkstepName { get; set; }
public virtual int Count { get; set; } /// Count of produced parts, not mapped to the database
/// <summary>
/// Default (private) constructor inicializing lists
/// </summary>
protected WorkplaceRegistration()
{
}
/// <summary>
/// Public constructor
/// </summary>
/// <param name="workplace">Workplace name</param>
/// <param name="user">User name</param>
/// <param name="ipAddress">IP address</param>
/// <param name="processName">Process name</param>
/// <param name="workstepName">Workstep name</param>
public WorkplaceRegistration(string workplace, string user, string ipAddress, string processName, string workstepName)
{
this.Workplace = workplace;
this.Active = true;
this.TimeStamp = DateTime.Now;
this.ValidUntil = DateTime.Now + new TimeSpan(8, 0, 0);
this.UserName = user;
this.IPAddress = ipAddress;
this.ProcessName = processName;
this.WorkstepName = workstepName;
}
}
}

View File

@ -1,23 +1,73 @@
namespace TracingDB
using System;
using System.Reflection;
namespace TracingDB
{
/// <summary>
/// Helper class to assign descriptions to enum values
/// </summary>
public class Description : Attribute
{
public string Text;
public Description(string t)
{
Text = t;
}
}
public static class GetDescription
{
/// Extension method for enum-s
public static string ToDescription(this Enum enm)
{
Type type = enm.GetType();
MemberInfo[] memInfo = type.GetMember(enm.ToString());
if (memInfo != null && memInfo.Length > 0)
{
object[] attrs = memInfo[0].GetCustomAttributes(typeof(Description), false);
if (attrs != null && attrs.Length > 0)
return ((Description)attrs[0]).Text;
}
return enm.ToString(); /// Return ToString() value in case there is no description
}
}
public enum CodeType
{
[Description("-")]
UniqueNr,
[Description("PCB")]
FlowtubeNr, /// prvé 3 znaky sa zhodujú s poslednými 3 znakmi názvu
[Description("Flowt.")]
FlowtubeNrLU, /// začiatok kódu sa zhoduje s názvom
[Description("1")]
BatchNr,
[Description("2")]
BatchNrContainingPartName,
[Description("3")]
DateMMYY,
QualityCheck,
[Description("4")]
QualityCheck,
Count
}
public enum CodeForm
{
Barcode,
QRCode,
Keyboard,
OkNok,
Barcode, /// Barcode
QRCode, /// QR code
Keyboard, /// Data entered by a keyboard
OkNok, /// OK/NOK or Yes/No data entered by a keyboard or a mouse
Count
}
@ -35,12 +85,35 @@
Count,
}
public enum SubClass
{
[Description("invalid")]
Invalid = 0,
[Description("vodomery")]
Normal = 1, /// Original process type
[Description("vodomery bez PCB")]
NormalWithoutPCB = 2, ///
[Description("flowtuby")]
FlowTube = 4, /// FlowTube
[Description("vodomery odvodene z flowtuby")]
InheritsFlowTube = 8, ///
[Description("vodomery z flowtuby bez PCB")]
InheritsFlowTubeWithoutPCB = 16, ///
}
public enum ReleaseStatus
{
In_preparation,
Released,
ReleasedActive,
Deactivated,
In_preparation, /// Process definition is not completed, cannot be used in production
ToBeApproved, /// Process is completed, protected against changes and waits for an approval
Released, /// Process is ready for production (completed, protected, approved), but it is inactive
ReleasedActive, /// Process is ready for production, it is active = enabled
Deactivated, /// Process was used in production but it was de-activated (should never be deleted as there are references to the process)
Separator, /// 'Process' is only a named separator between other process items
Count,
}

View File

@ -45,10 +45,12 @@
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.usersDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.timeGroupBox = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.timePicker3 = new System.Windows.Forms.DateTimePicker();
this.timePicker2 = new System.Windows.Forms.DateTimePicker();
this.timePicker1 = new System.Windows.Forms.DateTimePicker();
this.label1 = new System.Windows.Forms.Label();
this.processFilterGroupBox = new System.Windows.Forms.GroupBox();
this.processFilterComboBox = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@ -56,6 +58,7 @@
this.oracleGroupBox.SuspendLayout();
this.groupBox5.SuspendLayout();
this.timeGroupBox.SuspendLayout();
this.processFilterGroupBox.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
@ -113,7 +116,7 @@
this.groupBox3.Controls.Add(this.workplaceNameTextBox);
this.groupBox3.Location = new System.Drawing.Point(12, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(622, 50);
this.groupBox3.Size = new System.Drawing.Size(300, 50);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Meno pracoviska";
@ -122,7 +125,7 @@
//
this.workplaceNameTextBox.Location = new System.Drawing.Point(17, 18);
this.workplaceNameTextBox.Name = "workplaceNameTextBox";
this.workplaceNameTextBox.Size = new System.Drawing.Size(586, 20);
this.workplaceNameTextBox.Size = new System.Drawing.Size(265, 20);
this.workplaceNameTextBox.TabIndex = 0;
//
// saveButton
@ -227,6 +230,15 @@
this.timeGroupBox.Text = "Čas odlogovania";
this.timeGroupBox.Visible = false;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(17, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(106, 13);
this.label1.TabIndex = 3;
this.label1.Text = "00:00 = neodlogovať";
//
// timePicker3
//
this.timePicker3.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
@ -252,20 +264,31 @@
this.timePicker1.Size = new System.Drawing.Size(98, 20);
this.timePicker1.TabIndex = 0;
//
// label1
// processFilterGroupBox
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(17, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(106, 13);
this.label1.TabIndex = 3;
this.label1.Text = "00:00 = neodlogovať";
this.processFilterGroupBox.Controls.Add(this.processFilterComboBox);
this.processFilterGroupBox.Location = new System.Drawing.Point(334, 12);
this.processFilterGroupBox.Name = "processFilterGroupBox";
this.processFilterGroupBox.Size = new System.Drawing.Size(300, 50);
this.processFilterGroupBox.TabIndex = 9;
this.processFilterGroupBox.TabStop = false;
this.processFilterGroupBox.Text = "Filter procesov";
this.processFilterGroupBox.Visible = false;
//
// processFilterComboBox
//
this.processFilterComboBox.FormattingEnabled = true;
this.processFilterComboBox.Location = new System.Drawing.Point(20, 17);
this.processFilterComboBox.Name = "processFilterComboBox";
this.processFilterComboBox.Size = new System.Drawing.Size(261, 21);
this.processFilterComboBox.TabIndex = 0;
//
// SettingsDlg
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(648, 333);
this.Controls.Add(this.processFilterGroupBox);
this.Controls.Add(this.timeGroupBox);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.oracleGroupBox);
@ -294,6 +317,7 @@
this.groupBox5.PerformLayout();
this.timeGroupBox.ResumeLayout(false);
this.timeGroupBox.PerformLayout();
this.processFilterGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -321,5 +345,7 @@
private System.Windows.Forms.DateTimePicker timePicker2;
private System.Windows.Forms.DateTimePicker timePicker1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox processFilterGroupBox;
private System.Windows.Forms.ComboBox processFilterComboBox;
}
}

View File

@ -8,12 +8,62 @@ namespace TracingDB.Forms
static readonly DateTime MinTime = new DateTime(1753, 1, 1, 0, 0, 0);
public string WorkplaceName
{
set { workplaceNameTextBox.Text = value; }
get { return workplaceNameTextBox.Text; }
}
public int ProcessFilter
{
set
{
if ((value & (int)SubClass.Normal) != 0 &&
(value & (int)SubClass.FlowTube) != 0 &&
(value & (int)SubClass.InheritsFlowTube) != 0)
{
processFilterComboBox.Text = "všetky";
}
else if ((value & (int)SubClass.FlowTube) != 0)
{
processFilterComboBox.Text = "flowtuby";
}
else if ((value & (int)SubClass.InheritsFlowTube) != 0)
{
processFilterComboBox.Text = "vodomery odvodene z flowtuby";
}
else /// if ((value & (int)SubClass.Normal) != 0)
{
processFilterComboBox.Text = "vodomery";
}
}
get
{
if (processFilterComboBox.Text == "všetky")
{
return (int)SubClass.Normal +
(int)SubClass.NormalWithoutPCB +
(int)SubClass.FlowTube +
(int)SubClass.InheritsFlowTube +
(int)SubClass.InheritsFlowTubeWithoutPCB;
}
else if (processFilterComboBox.Text == "flowtuby")
{
return (int)SubClass.FlowTube;
}
else if (processFilterComboBox.Text == "vodomery odvodene z flowtuby")
{
return (int)SubClass.InheritsFlowTube;
}
else /// if (processFilterComboBox.Text == "vodomery")
{
return (int)SubClass.Normal;
}
}
}
public string ConnectionString
{
set { connectionStringTextBox.Text = value; }
@ -87,11 +137,19 @@ namespace TracingDB.Forms
public SettingsDlg(bool isWorkplace)
{
InitializeComponent();
if (isWorkplace)
{
oracleGroupBox.Visible = true;
timeGroupBox.Visible = true;
processFilterGroupBox.Visible = true;
processFilterComboBox.Items.Add("všetky");
processFilterComboBox.Items.Add("vodomery");
processFilterComboBox.Items.Add("vodomery odvodene z flowtuby");
processFilterComboBox.Items.Add("flowtuby");
}
extraBatteryLifetimeTextBox.Text = "0";
timePicker1.Format = DateTimePickerFormat.Custom;

View File

@ -1,49 +0,0 @@
using System;
using System.Windows.Forms;
namespace TracingDB.Forms
{
public partial class TrivialLoginDlg : Form
{
public LoginLevel LoginLevel;
public TrivialLoginDlg()
{
InitializeComponent();
LoginLevel = LoginLevel.None;
}
private void okButton_Click(object sender, EventArgs e)
{
if (passwordTextBox.Text.ToLower().Equals("barcode"))
{
LoginLevel = LoginLevel.Administrator;
DialogResult = DialogResult.OK;
Close();
}
else if (passwordTextBox.Text.ToLower().Equals("teamleader"))
{
LoginLevel = LoginLevel.TeamLeader;
DialogResult = DialogResult.OK;
Close();
}
else if (passwordTextBox.Text.ToLower().Equals("kremik"))
{
LoginLevel = LoginLevel.MH;
DialogResult = DialogResult.OK;
Close();
}
else
{
DialogResult = DialogResult.Cancel;
Close();
}
}
private void cancelButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
}
}

View File

@ -1,105 +0,0 @@
namespace TracingDB.Forms
{
partial class TrivialLoginDlg
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.passwordGroupBox = new System.Windows.Forms.GroupBox();
this.passwordTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.passwordGroupBox.SuspendLayout();
this.SuspendLayout();
//
// passwordGroupBox
//
this.passwordGroupBox.Controls.Add(this.passwordTextBox);
this.passwordGroupBox.Location = new System.Drawing.Point(12, 10);
this.passwordGroupBox.Name = "passwordGroupBox";
this.passwordGroupBox.Size = new System.Drawing.Size(200, 49);
this.passwordGroupBox.TabIndex = 0;
this.passwordGroupBox.TabStop = false;
this.passwordGroupBox.Text = "Heslo";
//
// passwordTextBox
//
this.passwordTextBox.Location = new System.Drawing.Point(51, 18);
this.passwordTextBox.Name = "passwordTextBox";
this.passwordTextBox.PasswordChar = '*';
this.passwordTextBox.Size = new System.Drawing.Size(100, 20);
this.passwordTextBox.TabIndex = 0;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(237, 18);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 39);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(330, 18);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 39);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// LoginDlg
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(426, 73);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.passwordGroupBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LoginDlg";
this.Text = "LoginDlg";
this.passwordGroupBox.ResumeLayout(false);
this.passwordGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox passwordGroupBox;
private System.Windows.Forms.TextBox passwordTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -97,25 +97,51 @@ namespace TracingDB
AllItems.Add(new ItemSpec(ItemSpecID.RefRecordID, Strings.RefRecordID, (x, f, p, w) => ((int)x).ToString(), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp, Strings.Time_stamp, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Workstep)x).Name : string.Format(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Barcode, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep, Strings.Workstep, (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace, Strings.Workplace, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName, Strings.User_name, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode, Strings.Barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode, Strings.Part_barcode, (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.TimeStamp2, Strings.Time_stamp+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((DateTime)x).ToString() : string.Format(f, (DateTime)x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Workstep)x).Name : string.Format(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode+"2", (x, f, p, w) => string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode+"2",(x, f, p, w)=> string.IsNullOrEmpty(f) ? (string)x : string.Format(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workstep2, Strings.Workstep + "2", (x, f, p, w) => FormatStr(f, ((Workstep)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Workplace2, Strings.Workplace + "2",(x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.UserName2, Strings.User_name + "2",(x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Barcode2, Strings.Barcode + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.PartBarcode2, Strings.Part_barcode + "2", (x, f, p, w) => FormatStr(f, x), ItemSpecCaps.ReferenceRecord | ItemSpecCaps.AssociatedRecord));
AllItems.Add(new ItemSpec(ItemSpecID.SerialNr, Strings.Serial_nr, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.PurchaseOrder, Strings.Purchase_order, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.TestResult, Strings.Test_result, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.MaxPruefindex, Strings.Max_pruefindex, (x, f, p, w) => x as string, ItemSpecCaps.ReferenceRecord | ItemSpecCaps.OracleQuery));
AllItems.Add(new ItemSpec(ItemSpecID.Process, Strings.Process, (x, f, p, w) => string.IsNullOrEmpty(f) ? ((Process)x).Name : string.Format(f, ((Process)x).Name), ItemSpecCaps.ReferenceRecord));
AllItems.Add(new ItemSpec(ItemSpecID.Process, Strings.Process, (x, f, p, w) => FormatStr(f, ((Process)x).Name), ItemSpecCaps.ReferenceRecord));
}
public static string FormatStr(string format, object value)
{
int len;
if (string.IsNullOrEmpty(format))
{
return (string)value;
}
else if (int.TryParse(format, out len) && len > 0)
{
if (((string)value).Length >= len)
{
return ((string)value).Substring(0, len);
}
else
{
return (string)value;
}
}
else
{
return string.Format(format, value);
}
}
public PropertyProjection GetProperty(ReferenceRecord refRecord, Record record)

View File

@ -7,16 +7,25 @@ namespace TracingDB.Mappings
public ProcessMap()
{
Id(x => x.Id);
Map(x => x.ItemNr);
Map(x => x.Name);
Map(x => x.Description);
Map(x => x.ReleaseStatus);
Map(x => x.TimeStamp);
Map(x => x.UserName);
Map(x => x.SubClass);
Map(x => x.Description);
Map(x => x.ReleaseNotes)
.CustomType("StringClob")
.CustomSqlType("varchar(8000)");
Map(x => x.CreatedBy)
.Column("UserName");
Map(x => x.TimeStamp);
Map(x => x.ApprovedBy);
Map(x => x.TimeStamp2);
Map(x => x.ReleaseStatus);
HasMany(x => x.Parts)
.OrderBy("Name")
.Cascade.All();
HasMany(x => x.Worksteps)
.OrderBy("WorkstepNr")
.Cascade.All();

View File

@ -0,0 +1,20 @@
using FluentNHibernate.Mapping;
namespace TracingDB.Mappings
{
class WorkplaceRegistrationMap : ClassMap<Entities.WorkplaceRegistration>
{
public WorkplaceRegistrationMap()
{
Id(x => x.Id);
Map(x => x.Workplace);
Map(x => x.Active);
Map(x => x.TimeStamp);
Map(x => x.ValidUntil);
Map(x => x.UserName);
Map(x => x.IPAddress);
Map(x => x.ProcessName);
Map(x => x.WorkstepName);
}
}
}

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 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("1.5.61.0")]
[assembly: AssemblyFileVersion("1.5.61.0")]
[assembly: AssemblyVersion("2.0.65.0")]
[assembly: AssemblyFileVersion("2.0.65.0")]

View File

@ -64,15 +64,10 @@
<Compile Include="BatteryInfo.cs" />
<Compile Include="Entities\Option1.cs" />
<Compile Include="Entities\Option2.cs" />
<Compile Include="Entities\WorkplaceRegistration.cs" />
<Compile Include="Forms\ListViewEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Forms\TrivialLoginDlg.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\TrivialLoginDlg.designer.cs">
<DependentUpon>TrivialLoginDlg.cs</DependentUpon>
</Compile>
<Compile Include="Forms\ModelessForm.cs">
<SubType>Form</SubType>
</Compile>
@ -95,6 +90,7 @@
<Compile Include="ItemSpec.cs" />
<Compile Include="Mappings\Option1Map.cs" />
<Compile Include="Mappings\Option2Map.cs" />
<Compile Include="Mappings\WorkplaceRegistrationMap.cs" />
<Compile Include="QuitAppException.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
@ -110,7 +106,7 @@
<Compile Include="Entities\ReferenceRecord.cs" />
<Compile Include="Entities\Workstep.cs" />
<Compile Include="Enums.cs" />
<Compile Include="FluentNH.cs" />
<Compile Include="DB.cs" />
<Compile Include="Mappings\PartMap.cs" />
<Compile Include="Mappings\ProcessMap.cs" />
<Compile Include="Mappings\RecordMap.cs" />
@ -127,9 +123,6 @@
<EmbeddedResource Include="Forms\ListViewEx.resx">
<DependentUpon>ListViewEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\TrivialLoginDlg.resx">
<DependentUpon>TrivialLoginDlg.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\ModelessForm.resx">
<DependentUpon>ModelessForm.cs</DependentUpon>
</EmbeddedResource>