/// /// Drag/Drop Logic /// private void ultraExplorerBar1_GroupDropped(object sender, GroupDroppedEventArgs e) { int grouprankcnt = 0; // Reorder Groups foreach (UltraExplorerBarGroup aGroup in ultraExplorerBar1.Groups) { mGroupItemTag atag = (mGroupItemTag)aGroup.Tag; atag.Rank = grouprankcnt++; string sql = "UPDATE TaskItems SET Rank =" + atag.Rank.ToString() + " WHERE ID=" + atag.ID + ";"; VWA4Common.DB.Update(sql); } /// Update the Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); }
private void ultraExplorerBar1_ItemDropped(object sender, ItemDroppedEventArgs e) { // Iterate through Groups foreach (UltraExplorerBarGroup aGroup in ultraExplorerBar1.Groups) { mGroupItemTag agtag = (mGroupItemTag)aGroup.Tag; int itemrankcnt = 0; // Reorder Items in the Group foreach (UltraExplorerBarItem anItem in aGroup.Items) { mGroupItemTag atag = (mGroupItemTag)anItem.Tag; atag.Rank = itemrankcnt++; string sql = "UPDATE TaskItems SET Rank =" + atag.Rank.ToString() + ", ParentID = " + agtag.ID + " WHERE ID=" + atag.ID + ";"; VWA4Common.DB.Update(sql); } } /// Update the Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); }
private void ultraExplorerBar1_ItemClick(object sender, ItemEventArgs e) { UltraExplorerBarItem anItem = e.Item; mGroupItemTag tag = (mGroupItemTag)anItem.Tag; string sql = ""; try { // First need to make sure the user can change this Task // First, check whether the image or the text was clicked if (VWA4Common.AppContext.TaskItemImageClicked) { /// IMAGE was clicked - change the image // First need to make sure the user can change it if (VWA4Common.GlobalSettings.IsSuper || VWA4Common.GlobalSettings.IsLogged) { /// allow the current user to check or uncheck this task anItem.Settings.AppearancesSmall.Appearance.Image = ((int)anItem.Settings.AppearancesSmall.Appearance.Image == 0) ? 1 : 0; if ((int)anItem.Settings.AppearancesSmall.Appearance.Image == 0) { // Change Item to Not Enabled anItem.Checked = false; sql = "UPDATE TaskItems SET Enabled = false WHERE UniqueName = '" + anItem.Key + "';"; } else { // Change Item to Enabled anItem.Checked = true; sql = "UPDATE TaskItems SET Enabled = true WHERE UniqueName = '" + anItem.Key + "';"; } // Update Database VWA4Common.DB.Update(sql); commonEvents.UpdateProductUI = true; /// Update the Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); } else { /// disallow the current user from checking or unchecking this task } } else { /// Text was clicked, so change the name // First need to make sure the user can change it if (VWA4Common.GlobalSettings.IsSuper || VWA4Common.GlobalSettings.IsLogged) { if (!anItem.Checked) { if (MessageBox.Show("This Task is currently disabled - Remove this Task permanently from the Task Bar?", "Disabled Task Removal", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // Delete the Task sql = "DELETE FROM TaskItems WHERE ID=" + tag.ID + ";"; VWA4Common.DB.Delete(sql); /// Update the real Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); return; } } // If we get here, user just wants to rename the Group /// allow the current user to rename this task VWA4Common.DialogGet1LineofText dtb = new VWA4Common.DialogGet1LineofText( "Please type in the new Task Name below:", e.Item.Text, "Change Task Name"); if (dtb.ShowDialog() == DialogResult.OK) { e.Item.Text = dtb.sNewText; dtb.Dispose(); // Update database with new name sql = "UPDATE TaskItems SET DisplayName = '" + e.Item.Text + "' WHERE UniqueName = '" + anItem.Key + "';"; VWA4Common.DB.Update(sql); /// Update the Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); } } else { /// disallow the current user from checking or unchecking this task } } } finally { LoadTaskBarData(); } }
private void ultraExplorerBar1_GroupClick(object sender, GroupEventArgs e) { UltraExplorerBarGroup anGroup = e.Group; mGroupItemTag tag = (mGroupItemTag)anGroup.Tag; string sql = ""; try { // First need to make sure the user can change this Group if (VWA4Common.GlobalSettings.IsSuper || VWA4Common.GlobalSettings.IsLogged) { if (anGroup.Items.Count == 0) { if (MessageBox.Show("No Tasks under this Group - Remove this Group permanently from the Task Bar?", "No Tasks in Group", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // Delete the Group sql = "DELETE FROM TaskItems WHERE ID=" + tag.ID + ";"; VWA4Common.DB.Delete(sql); /// Update the local Taskbar LoadTaskBarData(); /// Update the real Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); return; } } // If we get here, user just wants to rename the Group /// allow the current user to rename this Group /// Get current enabled setting sql = "SELECT * FROM TaskItems WHERE (ParentID = 0) AND UniqueName = '" + e.Group.Key + "';"; DataTable dtGroups = VWA4Common.DB.Retrieve(sql); DataRow irow = dtGroups.Rows[0]; bool enablesetting = bool.Parse(irow["Enabled"].ToString()); int grpID = int.Parse(irow["ID"].ToString()); /// Text was clicked, so change the name VWA4Common.DialogGet1LineofText dtb = new VWA4Common.DialogGet1LineofText( "Please type in the new Task Group Name below:", e.Group.Text, "Change Task Group Name", enablesetting, "Show Group in Task Bar"); if (dtb.ShowDialog() == DialogResult.OK) { e.Group.Text = dtb.sNewText; bool grpenabled = dtb.bNewEnabled; dtb.Dispose(); if (grpenabled) { e.Group.Settings.AppearancesSmall.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.False; } else { e.Group.Settings.AppearancesSmall.Appearance.FontData.Strikeout = Infragistics.Win.DefaultableBoolean.True; } // Update database with new name sql = "UPDATE TaskItems SET DisplayName = '" + e.Group.Text + "', Uniquename = '" + e.Group.Text.ToLower() + "', Enabled = " + grpenabled.ToString() + " WHERE ID = " + grpID.ToString() + ";"; VWA4Common.DB.Update(sql); if (!grpenabled) { sql = "UPDATE TaskItems SET Enabled = false WHERE ParentID = " + grpID.ToString() + ";"; VWA4Common.DB.Update(sql); } /// Update the local Taskbar LoadTaskBarData(); /// Update the real Taskbar // UCTaskList is listening to week start event, so cause it to fire & reload trackerDetector.FireWeekStart(); } } else { /// disallow the current user from checking or unchecking this Group } } finally { LoadTaskBarData(); } }