73 lines
2.4 KiB
C#
73 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using GZTW.AyaNova.BLL;
|
|
using GZTW.Data;
|
|
using GZTW.Data.Sql;
|
|
using GZTW.Data.FireBird;
|
|
|
|
namespace AyaNova.PlugIn.Merger
|
|
{
|
|
public partial class MergeClients : Form
|
|
{
|
|
public MergeClients()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void MergeClients_Load(object sender, EventArgs e)
|
|
{
|
|
if (MessageBox.Show(
|
|
"Warning: Merging data is a serious change!\r\n\r\n" +
|
|
"- Do not proceed unless you have read and understood the documentation for this merge plugin\r\n" +
|
|
"- Do not proceed unless you are certain you have a recent and *restoreable* backup of the AyaNova database\r\n" +
|
|
"- Do not proceed unless you are certain there are no other users or utilities using the AyaNova database", "Proceed with caution", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning,
|
|
MessageBoxDefaultButton.Button2)
|
|
== DialogResult.Cancel)
|
|
this.Close();
|
|
|
|
|
|
ClientPickList source = ClientPickList.GetList();
|
|
cbSource.DataSource = source;
|
|
cbSource.DisplayMember = "Name";
|
|
cbSource.ValueMember = "ID";
|
|
|
|
ClientPickList dest = ClientPickList.GetList();
|
|
cbDest.DataSource = dest;
|
|
cbDest.DisplayMember = "Name";
|
|
cbDest.ValueMember = "ID";
|
|
|
|
}
|
|
|
|
private void btnMerge_Click(object sender, EventArgs e)
|
|
{
|
|
Guid srcID = ((ClientPickList.ClientPickListInfo)cbSource.SelectedItem).ID;
|
|
Guid destID = ((ClientPickList.ClientPickListInfo)cbDest.SelectedItem).ID;
|
|
|
|
if (srcID == destID) return;
|
|
|
|
if (MessageBox.Show(
|
|
"Merge data from " + cbSource.Text + " to " + cbDest.Text + "\r\n\r\nAre you sure?", "Are you sure?",
|
|
MessageBoxButtons.OKCancel, MessageBoxIcon.Warning,
|
|
MessageBoxDefaultButton.Button2)
|
|
== DialogResult.Cancel)
|
|
this.Close();
|
|
|
|
DBManager.MergeClients.Merge(srcID, destID);
|
|
|
|
MessageBox.Show("Done!");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|