Aggiunta svecchiamento e svuotamento

This commit is contained in:
Samuele E. Locatelli
2018-11-07 22:37:53 +01:00
parent aa9d3a1e11
commit aacfedd94f
5 changed files with 250 additions and 79 deletions
+50 -16
View File
@@ -4483,7 +4483,7 @@ SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamat
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
private void InitCommandCollection() {
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[4];
this._commandCollection = new global::System.Data.SqlClient.SqlCommand[5];
this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[0].Connection = this.Connection;
this._commandCollection[0].CommandText = "SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamatr" +
@@ -4491,27 +4491,33 @@ SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamat
this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[1].Connection = this.Connection;
this._commandCollection[1].CommandText = "dbo.stp_TabOpr_getLast";
this._commandCollection[1].CommandText = "dbo.stp_TabOpr_deleteAll";
this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@maxNum", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@authKey", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[2].Connection = this.Connection;
this._commandCollection[2].CommandText = "dbo.stp_TabOpr_insertQuery";
this._commandCollection[2].CommandText = "dbo.stp_TabOpr_getLast";
this._commandCollection[2].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Datamatrix", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodArt", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodStazione", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodSottostaz", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodOperaz", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodStato", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[2].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@maxNum", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[3].Connection = this.Connection;
this._commandCollection[3].CommandText = "dbo.stp_TabOpr_purgeOld";
this._commandCollection[3].CommandText = "dbo.stp_TabOpr_insertQuery";
this._commandCollection[3].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@days2keep", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Datamatrix", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodArt", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodStazione", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodSottostaz", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodOperaz", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[3].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@CodStato", global::System.Data.SqlDbType.NVarChar, 50, global::System.Data.ParameterDirection.Input, 0, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[4] = new global::System.Data.SqlClient.SqlCommand();
this._commandCollection[4].Connection = this.Connection;
this._commandCollection[4].CommandText = "dbo.stp_TabOpr_purgeOld";
this._commandCollection[4].CommandType = global::System.Data.CommandType.StoredProcedure;
this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@days2keep", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", ""));
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -4543,7 +4549,7 @@ SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamat
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, false)]
public virtual int FillLastRec(DS_App.TabOperazioniDataTable dataTable, global::System.Nullable<int> maxNum) {
this.Adapter.SelectCommand = this.CommandCollection[1];
this.Adapter.SelectCommand = this.CommandCollection[2];
if ((maxNum.HasValue == true)) {
this.Adapter.SelectCommand.Parameters[1].Value = ((int)(maxNum.Value));
}
@@ -4562,7 +4568,7 @@ SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamat
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)]
public virtual DS_App.TabOperazioniDataTable GetLastRec(global::System.Nullable<int> maxNum) {
this.Adapter.SelectCommand = this.CommandCollection[1];
this.Adapter.SelectCommand = this.CommandCollection[2];
if ((maxNum.HasValue == true)) {
this.Adapter.SelectCommand.Parameters[1].Value = ((int)(maxNum.Value));
}
@@ -4802,11 +4808,39 @@ SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamat
return this.Update(Original_IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamatrix, Original_IdxRec, Original_DtEvento, Original_CodStazione, Original_CodSottostaz, Original_CodOperaz, Original_CodStato, Original_Datamatrix);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int deleteAll(string authKey) {
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[1];
if ((authKey == null)) {
command.Parameters[1].Value = global::System.DBNull.Value;
}
else {
command.Parameters[1].Value = ((string)(authKey));
}
global::System.Data.ConnectionState previousConnectionState = command.Connection.State;
if (((command.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
command.Connection.Open();
}
int returnValue;
try {
returnValue = command.ExecuteNonQuery();
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
command.Connection.Close();
}
}
return returnValue;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int insertQuery(string Datamatrix, string CodArt, string CodStazione, string CodSottostaz, string CodOperaz, string CodStato) {
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[2];
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[3];
if ((Datamatrix == null)) {
command.Parameters[1].Value = global::System.DBNull.Value;
}
@@ -4864,7 +4898,7 @@ SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamat
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")]
[global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
public virtual int purgeOld(global::System.Nullable<int> days2keep) {
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[3];
global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[4];
if ((days2keep.HasValue == true)) {
command.Parameters[1].Value = ((int)(days2keep.Value));
}
+11
View File
@@ -303,6 +303,17 @@ SELECT IdxRec, DtEvento, CodStazione, CodSottostaz, CodOperaz, CodStato, Datamat
<Mapping SourceColumn="Datamatrix" DataSetColumn="Datamatrix" />
</Mappings>
<Sources>
<DbSource ConnectionRef="CMS_OMRConnectionString (Settings)" DbObjectName="[CMS-OMR].dbo.stp_TabOpr_deleteAll" DbObjectType="StoredProcedure" GenerateShortCommands="true" GeneratorSourceName="deleteAll" Modifier="Public" Name="deleteAll" QueryType="NoData" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetDataBy2" UserSourceName="deleteAll">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_TabOpr_deleteAll</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@authKey" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
<DbSource ConnectionRef="CMS_OMRConnectionString (Settings)" DbObjectName="[CMS-OMR].dbo.stp_TabOpr_getLast" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="FillLastRec" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetLastRec" GeneratorSourceName="FillLastRec" GetMethodModifier="Public" GetMethodName="GetLastRec" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetLastRec" UserSourceName="FillLastRec">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
+1 -1
View File
@@ -9,7 +9,7 @@
<Shape ID="DesignTable:StoricoAllarmi" ZOrder="9" X="471" Y="592" Height="158" Width="269" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="99" />
<Shape ID="DesignTable:AnagOperatori" ZOrder="1" X="839" Y="601" Height="250" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="99" />
<Shape ID="DesignTable:AnagAllarmi" ZOrder="8" X="104" Y="535" Height="227" Width="256" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="168" />
<Shape ID="DesignTable:TabOperazioni" ZOrder="6" X="84" Y="124" Height="267" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
<Shape ID="DesignTable:TabOperazioni" ZOrder="6" X="84" Y="124" Height="286" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="159" />
<Shape ID="DesignTable:TabPezzi" ZOrder="5" X="459" Y="133" Height="227" Width="229" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="168" />
<Shape ID="DesignTable:AnagArticoli" ZOrder="3" X="796" Y="156" Height="250" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="99" />
</Shapes>
+107 -56
View File
@@ -52,14 +52,13 @@
this.cbOperazione = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.btnAddOpr = new System.Windows.Forms.Button();
this.TabControls = new System.Windows.Forms.TabControl();
this.Paginatore = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.dgvOpr = new System.Windows.Forms.DataGridView();
this.dS_App = new DemoApp.DS_App();
this.tabOperazioniBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.tabOperazioniTableAdapter = new DemoApp.DS_AppTableAdapters.TabOperazioniTableAdapter();
this.lblOprOutMess = new System.Windows.Forms.Label();
this.btnReloadOpr = new System.Windows.Forms.Button();
this.idxRecDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dtEventoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.codStazioneDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -67,7 +66,13 @@
this.codOperazDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.codStatoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.datamatrixDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lblOprOutMess = new System.Windows.Forms.Label();
this.tabOperazioniBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dS_App = new DemoApp.DS_App();
this.tabOperazioniTableAdapter = new DemoApp.DS_AppTableAdapters.TabOperazioniTableAdapter();
this.btnEmptyTabOpr = new System.Windows.Forms.Button();
this.txtDay2keep = new System.Windows.Forms.TextBox();
this.btnPurgeOld = new System.Windows.Forms.Button();
this.label7 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@@ -79,11 +84,12 @@
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.TabControls.SuspendLayout();
this.Paginatore.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvOpr)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dS_App)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tabOperazioniBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dS_App)).BeginInit();
this.SuspendLayout();
//
// txtBCode
@@ -260,6 +266,7 @@
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.btnReloadOpr);
this.groupBox3.Controls.Add(this.lblOprOutMess);
this.groupBox3.Controls.Add(this.cbStato);
this.groupBox3.Controls.Add(this.label6);
@@ -282,11 +289,6 @@
// cbStato
//
this.cbStato.FormattingEnabled = true;
this.cbStato.Items.AddRange(new object[] {
"1-Inizio Lavoro",
"2-Concluso OK",
"3-Interrotto",
"4-Concluso con interruzione"});
this.cbStato.Location = new System.Drawing.Point(294, 41);
this.cbStato.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cbStato.Name = "cbStato";
@@ -306,9 +308,6 @@
// cbSottostazione
//
this.cbSottostazione.FormattingEnabled = true;
this.cbSottostazione.Items.AddRange(new object[] {
"TAV01",
"TAV02"});
this.cbSottostazione.Location = new System.Drawing.Point(64, 41);
this.cbSottostazione.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cbSottostazione.Name = "cbSottostazione";
@@ -328,8 +327,6 @@
// cbStazione
//
this.cbStazione.FormattingEnabled = true;
this.cbStazione.Items.AddRange(new object[] {
"F164"});
this.cbStazione.Location = new System.Drawing.Point(64, 17);
this.cbStazione.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cbStazione.Name = "cbStazione";
@@ -349,11 +346,6 @@
// cbOperazione
//
this.cbOperazione.FormattingEnabled = true;
this.cbOperazione.Items.AddRange(new object[] {
"1-carico",
"2-attesa",
"3-lavoro",
"4-scarico"});
this.cbOperazione.Location = new System.Drawing.Point(294, 17);
this.cbOperazione.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.cbOperazione.Name = "cbOperazione";
@@ -375,26 +367,26 @@
this.btnAddOpr.Location = new System.Drawing.Point(491, 15);
this.btnAddOpr.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnAddOpr.Name = "btnAddOpr";
this.btnAddOpr.Size = new System.Drawing.Size(147, 47);
this.btnAddOpr.Size = new System.Drawing.Size(147, 39);
this.btnAddOpr.TabIndex = 2;
this.btnAddOpr.Text = "Aggiungi Record";
this.btnAddOpr.UseVisualStyleBackColor = true;
this.btnAddOpr.Click += new System.EventHandler(this.btnAddOpr_Click);
//
// TabControls
// Paginatore
//
this.TabControls.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
this.Paginatore.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TabControls.Controls.Add(this.tabPage1);
this.TabControls.Controls.Add(this.tabPage2);
this.TabControls.Controls.Add(this.tabPage3);
this.TabControls.Location = new System.Drawing.Point(9, 162);
this.TabControls.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.TabControls.Name = "TabControls";
this.TabControls.SelectedIndex = 0;
this.TabControls.Size = new System.Drawing.Size(653, 317);
this.TabControls.TabIndex = 6;
this.Paginatore.Controls.Add(this.tabPage1);
this.Paginatore.Controls.Add(this.tabPage2);
this.Paginatore.Controls.Add(this.tabPage3);
this.Paginatore.Location = new System.Drawing.Point(9, 162);
this.Paginatore.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Paginatore.Name = "Paginatore";
this.Paginatore.SelectedIndex = 0;
this.Paginatore.Size = new System.Drawing.Size(653, 317);
this.Paginatore.TabIndex = 6;
//
// tabPage1
//
@@ -422,6 +414,10 @@
//
// tabPage3
//
this.tabPage3.Controls.Add(this.label7);
this.tabPage3.Controls.Add(this.btnPurgeOld);
this.tabPage3.Controls.Add(this.txtDay2keep);
this.tabPage3.Controls.Add(this.btnEmptyTabOpr);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(645, 291);
@@ -450,19 +446,26 @@
this.dgvOpr.Size = new System.Drawing.Size(636, 197);
this.dgvOpr.TabIndex = 6;
//
// dS_App
// lblOprOutMess
//
this.dS_App.DataSetName = "DS_App";
this.dS_App.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
this.lblOprOutMess.AutoSize = true;
this.lblOprOutMess.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblOprOutMess.ForeColor = System.Drawing.Color.Red;
this.lblOprOutMess.Location = new System.Drawing.Point(16, 63);
this.lblOprOutMess.Name = "lblOprOutMess";
this.lblOprOutMess.Size = new System.Drawing.Size(10, 13);
this.lblOprOutMess.TabIndex = 11;
this.lblOprOutMess.Text = "-";
//
// tabOperazioniBindingSource
// btnReloadOpr
//
this.tabOperazioniBindingSource.DataMember = "TabOperazioni";
this.tabOperazioniBindingSource.DataSource = this.dS_App;
//
// tabOperazioniTableAdapter
//
this.tabOperazioniTableAdapter.ClearBeforeFill = true;
this.btnReloadOpr.Location = new System.Drawing.Point(491, 52);
this.btnReloadOpr.Name = "btnReloadOpr";
this.btnReloadOpr.Size = new System.Drawing.Size(147, 23);
this.btnReloadOpr.TabIndex = 12;
this.btnReloadOpr.Text = "Reload";
this.btnReloadOpr.UseVisualStyleBackColor = true;
this.btnReloadOpr.Click += new System.EventHandler(this.btnReloadOpr_Click);
//
// idxRecDataGridViewTextBoxColumn
//
@@ -506,15 +509,56 @@
this.datamatrixDataGridViewTextBoxColumn.HeaderText = "Datamatrix";
this.datamatrixDataGridViewTextBoxColumn.Name = "datamatrixDataGridViewTextBoxColumn";
//
// lblOprOutMess
// tabOperazioniBindingSource
//
this.lblOprOutMess.AutoSize = true;
this.lblOprOutMess.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblOprOutMess.Location = new System.Drawing.Point(16, 63);
this.lblOprOutMess.Name = "lblOprOutMess";
this.lblOprOutMess.Size = new System.Drawing.Size(10, 13);
this.lblOprOutMess.TabIndex = 11;
this.lblOprOutMess.Text = "-";
this.tabOperazioniBindingSource.DataMember = "TabOperazioni";
this.tabOperazioniBindingSource.DataSource = this.dS_App;
//
// dS_App
//
this.dS_App.DataSetName = "DS_App";
this.dS_App.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// tabOperazioniTableAdapter
//
this.tabOperazioniTableAdapter.ClearBeforeFill = true;
//
// btnEmptyTabOpr
//
this.btnEmptyTabOpr.Location = new System.Drawing.Point(10, 15);
this.btnEmptyTabOpr.Name = "btnEmptyTabOpr";
this.btnEmptyTabOpr.Size = new System.Drawing.Size(172, 52);
this.btnEmptyTabOpr.TabIndex = 0;
this.btnEmptyTabOpr.Text = "ELIMINA TabOperazioni";
this.btnEmptyTabOpr.UseVisualStyleBackColor = true;
this.btnEmptyTabOpr.Click += new System.EventHandler(this.btnEmptyTabOpr_Click);
//
// txtDay2keep
//
this.txtDay2keep.Location = new System.Drawing.Point(364, 32);
this.txtDay2keep.Name = "txtDay2keep";
this.txtDay2keep.Size = new System.Drawing.Size(100, 20);
this.txtDay2keep.TabIndex = 1;
this.txtDay2keep.Text = "365";
//
// btnPurgeOld
//
this.btnPurgeOld.Location = new System.Drawing.Point(470, 15);
this.btnPurgeOld.Name = "btnPurgeOld";
this.btnPurgeOld.Size = new System.Drawing.Size(172, 52);
this.btnPurgeOld.TabIndex = 2;
this.btnPurgeOld.Text = "SVECCHIAMENTO DataBase";
this.btnPurgeOld.UseVisualStyleBackColor = true;
this.btnPurgeOld.Click += new System.EventHandler(this.btnPurgeOld_Click);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(367, 15);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(97, 13);
this.label7.TabIndex = 3;
this.label7.Text = "# gg da mantenere";
//
// MainForm
//
@@ -522,7 +566,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(667, 489);
this.Controls.Add(this.TabControls);
this.Controls.Add(this.Paginatore);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
@@ -545,11 +589,13 @@
this.splitContainer2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.TabControls.ResumeLayout(false);
this.Paginatore.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvOpr)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dS_App)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tabOperazioniBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dS_App)).EndInit();
this.ResumeLayout(false);
}
@@ -579,7 +625,7 @@
private System.Windows.Forms.ComboBox cbStazione;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox cbOperazione;
private System.Windows.Forms.TabControl TabControls;
private System.Windows.Forms.TabControl Paginatore;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
@@ -595,6 +641,11 @@
private System.Windows.Forms.DataGridViewTextBoxColumn codStatoDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn datamatrixDataGridViewTextBoxColumn;
private System.Windows.Forms.Label lblOprOutMess;
private System.Windows.Forms.Button btnReloadOpr;
private System.Windows.Forms.Button btnEmptyTabOpr;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Button btnPurgeOld;
private System.Windows.Forms.TextBox txtDay2keep;
}
}
+81 -6
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace DemoApp
@@ -36,11 +37,43 @@ namespace DemoApp
/// </summary>
private void dataInit()
{
// predisporre tavole, operazioni, stati...
#if false
Dictionary cmbStazioni = new Dictionary();
cmbStazioni.Add("F164", "F164");
#endif
// predisposizione dati: stazioni/sottostazioni//operazioni/stati...
// STAZIONI
Dictionary<string, string> cmbStazioni = new Dictionary<string, string>();
cmbStazioni.Add("CMS-F164", "CMS-F164");
cbStazione.DataSource = new BindingSource(cmbStazioni, null);
cbStazione.DisplayMember = "Value";
cbStazione.ValueMember = "Key";
// SOTTOSTAZIONI
Dictionary<string, string> cmbSottoStazioni = new Dictionary<string, string>();
cmbSottoStazioni.Add("TAV01", "Tavola 1");
cmbSottoStazioni.Add("TAV02", "Tavola 2");
cbSottostazione.DataSource = new BindingSource(cmbSottoStazioni, null);
cbSottostazione.DisplayMember = "Value";
cbSottostazione.ValueMember = "Key";
// OPERAZIONI
Dictionary<string, string> cmbOpr = new Dictionary<string, string>();
cmbOpr.Add("OPR01", "Carico");
cmbOpr.Add("OPR02", "Attesa");
cmbOpr.Add("OPR03", "Lavoro");
cmbOpr.Add("OPR04", "Scarico");
cbOperazione.DataSource = new BindingSource(cmbOpr, null);
cbOperazione.DisplayMember = "Value";
cbOperazione.ValueMember = "Key";
// STATI
Dictionary<string, string> cmbStati = new Dictionary<string, string>();
cmbStati.Add("ST01", "Inizio Lavoro");
cmbStati.Add("ST02", "Concluso OK");
cmbStati.Add("ST03", "Interrotto");
cmbStati.Add("ST04", "Concluso con Interruzione");
cbStato.DataSource = new BindingSource(cmbStati, null);
cbStato.DisplayMember = "Value";
cbStato.ValueMember = "Key";
}
/// <summary>
/// Aggiorna controlli dati
@@ -148,7 +181,7 @@ namespace DemoApp
// ora verifico selezioni...
if (cbStato.SelectedIndex >= 0)
{
DataLayer.man.taTO.insertQuery(CurrDatamatrix, CurrCodArt, cbStazione.SelectedItem.ToString(), cbSottostazione.SelectedItem.ToString(), cbOperazione.SelectedItem.ToString(), cbStato.SelectedItem.ToString());
DataLayer.man.taTO.insertQuery(CurrDatamatrix, CurrCodArt, cbStazione.SelectedValue.ToString(), cbSottostazione.SelectedValue.ToString(), cbOperazione.SelectedValue.ToString(), cbStato.SelectedValue.ToString());
messaggio = "OK: creato record OPERAZIONE";
updCtrl();
}
@@ -178,5 +211,47 @@ namespace DemoApp
}
lblOprOutMess.Text = messaggio;
}
private void btnReloadOpr_Click(object sender, EventArgs e)
{
updCtrl();
}
/// <summary>
/// Eliminazione completa TabOpr
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnEmptyTabOpr_Click(object sender, EventArgs e)
{
// init var x msgBox
string message = "Sicuro di voler ELIMINARE COMPLETAMENTE i dati della tabella TabOperazioni?";
string caption = "Richiesta FULL RESET TabOpr";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(message, caption, buttons);
if (result == System.Windows.Forms.DialogResult.Yes)
{
// eseguo delete
DataLayer.man.taTO.deleteAll("digheDelBu");
// update
updCtrl();
lblOprOutMess.Text = "Effettuato SVUOTAMENTO COMPLETO TabOpr";
Paginatore.SelectedIndex = 0;
}
}
private void btnPurgeOld_Click(object sender, EventArgs e)
{
// controllo ci siano giorni sennò uso 365...
int numGG = 365;
int.TryParse(txtDay2keep.Text.Trim(), out numGG);
DataLayer.man.taTO.purgeOld(numGG);
updCtrl();
lblOprOutMess.Text = "Effettuato svecchiamento TabOpr";
Paginatore.SelectedIndex = 0;
}
}
}