Пример #1
0
        private void tileView_ItemDrop(object sender, DevExpress.XtraGrid.Views.Tile.ItemDropEventArgs e)
        {
            var dc = new ClassSRMDataContext(Config.connection);

            var newStatus  = e.GroupColumnValue;
            var prevStatus = e.PrevGroupColumnValue;

            if (!prevStatus.Equals(newStatus))
            {
                var id  = tileView.GetRowCellValue(e.RowHandle, "Id");
                int lbl = (int)tileView.GetRowCellValue(e.RowHandle, "Label");
                if (newStatus.ToString().Equals("انجام شده"))
                {
                    lbl = 2;
                }
                else if (newStatus.ToString().Equals("درحال انجام"))
                {
                    lbl = 1;
                }
                else if (newStatus.ToString().Equals("برای انجام"))
                {
                    lbl = 0;
                }
                else
                {
                    lbl = (int)tileView.GetRowCellValue(e.RowHandle, "Label");
                }

                dc.UpdateTaskLabel((int)id, newStatus.ToString(), lbl);
                dc.SubmitChanges();
                dc = new ClassSRMDataContext(Config.connection);
                InitData();
            }
        }