private void ckbLeftBind()
{
Desktop.SQLServerDAL.EmployePact left = new Desktop.SQLServerDAL.EmployePact();
DataTable dt = left.LeftBind();
for (int j = 0; j < dt.Rows.Count; j++)
{
ckbLeft.Items.Add(dt.Rows[j]["description"]);
}
//ckbLeft.DataBindings.DefaultDataSourceUpdateMode = left.LeftBind();
}
private void ckbRightBind()
{
Desktop.SQLServerDAL.EmployePact left = new Desktop.SQLServerDAL.EmployePact();
DataTable dt = left.RightBind();
for (int j = 0; j < dt.Rows.Count; j++)
{
ckbRight.Items.Add(dt.Rows[j]["description"]);
}
}
//上移
private void btnUp_Click(object sender, EventArgs e)
{
string item = ckbLeft.SelectedItem.ToString();
int i = ckbLeft.SelectedIndex;
int j = ckbLeft.Items.Count;
if (j > 0 && i != 0)
{
ckbLeft.Items.Remove(ckbLeft.SelectedItem.ToString());
ckbLeft.Items.Insert(i - 1, item);
ckbLeft.SelectedIndex = i - 1;
}
}
//下移
private void btnDown_Click(object sender, EventArgs e)
{
string item = ckbLeft.SelectedItem.ToString();
int i = ckbLeft.SelectedIndex;
int j = ckbLeft.Items.Count;
if (i < j - 1 && j > 0)
{
ckbLeft.Items.Remove(ckbLeft.SelectedItem.ToString());
ckbLeft.Items.Insert(i + 1, item);
ckbLeft.SelectedIndex = i + 1;
}
}
//左移
private void btnleft_Click(object sender, EventArgs e)
{
if (ckbRight.Items.Count == 0)
{
btnleft.Enabled = false;
}
else
{
btnleft.Enabled = true;
string strRight = ckbRight.SelectedItem.ToString();
ckbRight.Items.Remove(strRight);
ckbLeft.Items.Add(strRight);
}
}
//右移
private void btnright_Click(object sender, EventArgs e)
{
if (ckbRight.Items.Count == 0)
{
btnright.Enabled = false;
}
else
{
btnright.Enabled = true;
string strRight = ckbLeft.SelectedItem.ToString();
ckbLeft.Items.Remove(strRight);
ckbRight.Items.Add(strRight);
}
}