1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
string strTempIndex = string.Empty;
if (SaveRow != e.RowIndex)// && SaveRow!=9999)
{
if (BTColReIns.Text == "-")
{
SaveRow = e.RowIndex;
SaveIndex = DGVList.Rows[e.RowIndex].Cells[CaseNrIndex].Value.ToString();
BTColReIns.Text = "+";
}
else
{
if (
MessageBox.Show("Voulez vous insérer l'article " + art[SaveRow].Name + " avant l'article " + art[e.RowIndex].Name + " ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes
)
{
if (SaveRow > e.RowIndex)
{
strTempIndex = dsList.Tables["Listing"].Rows[e.RowIndex]["Index"].ToString();
int i = e.RowIndex;
for (; i < SaveRow; i++)
{
dsList.Tables["Listing"].Rows[i]["Index"] = dsList.Tables["Listing"].Rows[i + 1]["Index"].ToString();
}
dsList.Tables["Listing"].Rows[i]["Index"] = strTempIndex;
DGVList.Sort(DGVList.Columns["Index"], ListSortDirection.Ascending);
FnSaveDataFull();
}
else
{
strTempIndex = DGVList.Rows[e.RowIndex - 1].Cells["Index"].Value.ToString();
for (int i = e.RowIndex - 1; i > SaveRow ; i--)
{
DGVList.Rows[i].Cells["Index"].Value = DGVList.Rows[i - 1].Cells["Index"].Value;
}
DGVList.Rows[SaveRow].Cells["Index"].Value = strTempIndex;
DGVList.Sort(DGVList.Columns["Index"], ListSortDirection.Ascending);
FnSaveDataFull();
}
}
BTColReIns.Text = "-";
SaveRow = 9999;
SaveIndex = "9999";
}
}
else
{
SaveRow = 9999;
SaveIndex = "9999";
BTColReIns.Text = "-";
} |
Partager