- teamvision_rel.zip
- teamvision.3.0_src.zip
- Framework.Dll
- TeamVision.App
- app.config
- app.ico
- bin
- Common
- Data
- dbTeam.mdf
- FrmMain.de.resx
- FrmMain.Designer.vb
- FrmMain.resx
- FrmMain.vb
- Gui
- Components
- Controls
- Lists
- Shared
- Designers
- Dialogs
- Forms
- Categories
- CostTypes
- Persons
- Projects
- Tasks
- Teams
- Users
- Grids
- Interfaces
- Mods
- My Project
- Reports
- res
- Embedded Images
- Calendar.ico
- Exclaimation.ico
- StatusConnected.ico
- StatusDisconnected.ico
- TeamVision.gif
- ToolNewTask.ico
- ToolSearch.ico
- ToolWorkOffline.ico
- ToolWorkOnline.ico
- TrayOffline.ico
- TrayOnline.ico
- Images
- Major.gif
- Medium.gif
- Minor.gif
- Resources
- Calendar24.bmp
- Collapse.jpg
- Collapse_h.jpg
- Contacts24.bmp
- Expand.jpg
- Expand_h.jpg
- Folder24.bmp
- Mail24.bmp
- Notes32.bmp
- Shortcut24.bmp
- Tasks24.bmp
- Servers
- TeamVision.vbproj
- TeamVision.vbproj.user
- TeamVision.sln
- TeamVision.suo
|
Namespace Forms.Tasks
Public Class FrmAdd
Private m_ActiveTask As New Business.Task
Private m_ImageList As New ImageList()
Private m_TextList As New ArrayList()
Private m_ProgressList As ArrayList
Private Const c_PriorityImagesPath As String = "Images\"
Private m_ResourceManager As New Resources.ResourceManager("TeamVision.Localize", System.Reflection.Assembly.GetExecutingAssembly())
Private Sub TaskForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'bind the datatables to their respective dropdowns
cbStatus.DataSource = MyCache.AllStates
cbStatus.DisplayMember = Columns.State.Name
cbStatus.ValueMember = Columns.State.StateID
cbPriority.DataSource = MyCache.AllPriorities
cbPriority.DisplayMember = Columns.Priority.Name
cbPriority.ValueMember = Columns.Priority.PriorityID
cbAssignedTo.DataSource = MyCache.AllUsers
cbAssignedTo.DisplayMember = Columns.User.Name
cbAssignedTo.ValueMember = Columns.User.UserID
'grab the priority images
Try
m_ImageList.Images.Add(My.Resources.Major)
m_ImageList.Images.Add(My.Resources.Medium)
m_ImageList.Images.Add(My.Resources.Minor)
m_TextList.Add("Major")
m_TextList.Add("Medium")
m_TextList.Add("Minor")
Catch
MessageBox.Show(m_ResourceManager.GetString("gif_was_not_found"), m_ResourceManager.GetString("File_Not_Found"))
LogError.Write(m_ResourceManager.GetString("gif_was_not_found"))
Me.Close()
Return
End Try
'add the value from a drag and drop task
If m_ActiveTask.Description Is DBNull.Value Then
txtDescription.Text = String.Empty
Else
txtDescription.Text = m_ActiveTask.Description
End If
'enable the update button if data is changed by the user
AddHandler txtSummary.TextChanged, AddressOf EnableUpdate
AddHandler txtDescription.TextChanged, AddressOf EnableUpdate
AddHandler cbPriority.SelectedValueChanged, AddressOf EnableUpdate
AddHandler barProgress.ValueChanged, AddressOf EnableUpdate
AddHandler cbAssignedTo.SelectedValueChanged, AddressOf EnableUpdate
AddHandler cbStatus.SelectedValueChanged, AddressOf EnableUpdate
AddHandler dtDueDate.ValueChanged, AddressOf EnableUpdate
lblHeader.Text = m_ResourceManager.GetString("Add_new_task_to") & " " & m_ActiveTask.Project.Name
End Sub
Public Sub Databind(ByVal e As EventArgs.TaskEventArgs)
m_ActiveTask = e.Task
End Sub
Private Sub EnableUpdate(ByVal sender As Object, ByVal e As System.EventArgs)
btnOK.Enabled = True
End Sub
Private Function SaveTask() As Boolean
If txtSummary.Text.Trim().Length > 0 Then
'copy the information from the form fields back to the DataRow
With m_ActiveTask
.Summary = txtSummary.Text.Trim()
.Description = txtDescription.Text.Trim()
.PriorityID = CInt(cbPriority.SelectedValue)
.StateID = CInt(cbStatus.SelectedValue)
.UserID = CInt(cbAssignedTo.SelectedValue)
.UserID = MyCache.CurrentUser.UserID
.Progress = CDbl(barProgress.Value)
.IsDeleted = False
.DueDate = dtDueDate.Value
.DateModified = DateTime.Now
If .Progress >= 100 Then .DateCompleted = Now
.Datestamp = Now
End With
Return True
Else
MessageBox.Show(m_ResourceManager.GetString("Please_enter_a_Summary"))
txtSummary.Focus()
Return False
End If
End Function
Private Sub cbPriority_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles cbPriority.DrawItem
e.DrawBackground()
e.DrawFocusRectangle()
e.Graphics.DrawImage(m_ImageList.Images(e.Index), New Point(e.Bounds.X, e.Bounds.Y))
e.Graphics.DrawString(CType(m_TextList(e.Index), String), e.Font, New SolidBrush(Color.Black), _
m_ImageList.Images(e.Index).Width + 4, e.Bounds.Top + 1)
End Sub
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
If SaveTask() Then
Me.Close()
Else
Me.DialogResult = System.Windows.Forms.DialogResult.None
End If
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Private Sub txtDescription_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDescription.Enter
Me.AcceptButton = Nothing
End Sub
Private Sub txtDescription_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtDescription.Leave
Me.AcceptButton = Me.btnOK
End Sub
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
MS, BBA, software developer, consultant, and trainer. Specializing in building data-centric applications designed for business, university, community & faith based organizations. Started developing Excel VBA macros and never looked back. Freelance developer utilizing VB.Net, SQL Server, Microsoft Access, and ASP.Net.