Compare commits

...

5 Commits

2 changed files with 34 additions and 5 deletions

View File

@@ -63,18 +63,21 @@ namespace VEPROMS
lstFrom.Items.Remove(item); lstFrom.Items.Remove(item);
} }
SetButtonsEditable(); SetButtonsEditable();
btnUpdate.Enabled = true;
} }
// Move all items to lstSelected. // Move all items to lstSelected.
private void btnSelectAll_Click(object sender, EventArgs e) private void btnSelectAll_Click(object sender, EventArgs e)
{ {
MoveAllItems(lstUnselected, lstSelected); MoveAllItems(lstUnselected, lstSelected);
btnUpdate.Enabled = true;
} }
// Move all items to lstUnselected. // Move all items to lstUnselected.
private void btnDeselectAll_Click(object sender, EventArgs e) private void btnDeselectAll_Click(object sender, EventArgs e)
{ {
MoveAllItems(lstSelected, lstUnselected); MoveAllItems(lstSelected, lstUnselected);
btnUpdate.Enabled = true;
} }
// Move all items from one ListBox to another. // Move all items from one ListBox to another.
@@ -83,6 +86,7 @@ namespace VEPROMS
lstTo.Items.AddRange(lstFrom.Items); lstTo.Items.AddRange(lstFrom.Items);
lstFrom.Items.Clear(); lstFrom.Items.Clear();
SetButtonsEditable(); SetButtonsEditable();
btnUpdate.Enabled = true;
} }
// Enable and disable buttons. // Enable and disable buttons.
@@ -93,8 +97,7 @@ namespace VEPROMS
// Save selected list to DB. // Save selected list to DB.
private void btnUpdate_Click(object sender, EventArgs e) private void btnUpdate_Click(object sender, EventArgs e)
{ {
DataTable dt2 = coverToTable(); saveChanges();
VEPROMS.CSLA.Library.AnnotationstypeSelections.Update(dt2, UserID);
} }
public class AnnotataionItem public class AnnotataionItem
{ {
@@ -150,12 +153,32 @@ namespace VEPROMS
{ {
lstSelected.Items.Add(new AnnotataionItem(lstSelectedRow["Name"].ToString(), (int)lstSelectedRow["TypeID"])); lstSelected.Items.Add(new AnnotataionItem(lstSelectedRow["Name"].ToString(), (int)lstSelectedRow["TypeID"]));
} }
btnUpdate.Enabled = false;
} }
private void btnCancel_Click_1(object sender, EventArgs e) private void btnCancel_Click_1(object sender, EventArgs e)
{ {
if (btnUpdate.Enabled == true)
{
string message = "Changes have not yet been saved. Do you want to save the changes prior to closing?";
string title = "Save Annotation Selections";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result = MessageBox.Show(message, title, buttons);
if (result == DialogResult.Yes)
{
saveChanges();
this.Close(); this.Close();
} }
else
{
this.Close();
}
}
else
{
this.Close();
}
}
private DataTable coverToTable() private DataTable coverToTable()
{ {
@@ -169,6 +192,12 @@ namespace VEPROMS
} }
return dt; return dt;
} }
private void saveChanges()
{
DataTable dt2 = coverToTable();
VEPROMS.CSLA.Library.AnnotationstypeSelections.Update(dt2, UserID);
btnUpdate.Enabled = false;
}
} }
} }

View File

@@ -158,7 +158,7 @@ namespace VEPROMS
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(100, 35); this.btnCancel.Size = new System.Drawing.Size(100, 35);
this.btnCancel.TabIndex = 9; this.btnCancel.TabIndex = 9;
this.btnCancel.Text = "Cancel"; this.btnCancel.Text = "Close";
this.btnCancel.UseVisualStyleBackColor = true; this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click_1); this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click_1);
// //
@@ -203,7 +203,7 @@ namespace VEPROMS
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "dlgAnnotationsSelect"; this.Name = "dlgAnnotationsSelect";
this.Text = "Select Annotation Types"; this.Text = "Filter Annotation Types";
this.Load += new System.EventHandler(this.DlgAnnotationsSelect_Load); this.Load += new System.EventHandler(this.DlgAnnotationsSelect_Load);
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);