Just Code‎ > ‎

Can i has Task Management System?

posted Nov 2, 2009, 5:15 AM by Peter Henell   [ updated Nov 3, 2009, 3:55 AM ]
CREATE DATABASE TMS
GO USE TMS

CREATE TABLE Roles ( RoleID INT IDENTITY(1, 1) NOT NULL, RoleName VARCHAR(50) NOT NULL ); CREATE TABLE Person
( PersonID INT IDENTITY(1, 1) NOT NULL, FirstName VARCHAR(50) NOT NULL, LastName VARCHAR(50) NOT NULL, RoleID INT NOT NULL, LogonID VARCHAR(50) NOT NULL, ManagerID INT NULL, PRIMARY KEY(PersonID), FOREIGN KEY(ManagerID) REFERENCES Person(PersonID), FOREIGN KEY(RoleID) REFERENCES Roles(RoleID) ); CREATE TABLE Task
( TaskID INT IDENTITY(1, 1) NOT NULL, TaskName VARCHAR(100) NOT NULL, TaskDescription VARCHAR(500), PRIMARY KEY(TaskID) ); CREATE TABLE Assignment
( TaskID INT NOT NULL, PersonID INT NOT NULL, AssignmentPercent INT NOT NULL, StateID INT NOT NULL, Comment VARCHAR(255) PRIMARY KEY(TaskID, PersonID), FOREIGN KEY(TaskID) REFERENCES Task(TaskID), FOREIGN KEY(PersonID) REFERENCES Person(PersonID), FOREIGN KEY(StateID) REFERENCES States(StateID) ); --CREATE TABLE AssignmentLog --( -- TaskID INT, -- PersonID INT, -- --); CREATE TABLE States
( StateID INT IDENTITY(1, 1), StateName VARCHAR(50), PRIMARY KEY(StateID) );
<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:Silverlight_TMS_Web="clr-namespace:Silverlight.TMS.Web"
    x:Class="Silverlight.TMS.Person"
    >

    <UserControl.Resources>
        <DataTemplate x:Key="TaskDataTemplate">
            <Grid Height="32" Background="AntiqueWhite" Width="400">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.3*"/>
                    <ColumnDefinition Width="0.5*"/>
                </Grid.ColumnDefinitions>
                
                <Slider Value="{Binding AssignmentPercent}" LargeChange="20" Maximum="100" Grid.Column="1" />
                <TextBlock Margin="5,0,0,0" Text="{Binding Task.TaskName}" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" TextWrapping="Wrap" Grid.ColumnSpan="2"/>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">        
        <ListBox HorizontalAlignment="Left" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ItemTemplate="{StaticResource TaskDataTemplate}">
            <Silverlight_TMS_Web:Assignment AssignmentPercent="75" Comment="Jobba hårdare" PersonID="1" StateID="1" TaskID="2">
                <Silverlight_TMS_Web:Assignment.Task >
                    <Silverlight_TMS_Web:Task TaskName="FTP överföring"></Silverlight_TMS_Web:Task>
                </Silverlight_TMS_Web:Assignment.Task>
            </Silverlight_TMS_Web:Assignment>
            <Silverlight_TMS_Web:Assignment AssignmentPercent="25" Comment="Jobba hårdare" PersonID="1" StateID="1" TaskID="1">
                <Silverlight_TMS_Web:Assignment.Task >
                    <Silverlight_TMS_Web:Task TaskName="Delicard XML"></Silverlight_TMS_Web:Task>
                </Silverlight_TMS_Web:Assignment.Task>
            </Silverlight_TMS_Web:Assignment>
        </ListBox>
    </Grid>
</UserControl>
<navigation:Page 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           xmlns:local="clr-namespace:Silverlight.TMS" x:Class="Silverlight.TMS.ManageTasks"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="ManageTasks Page">
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FF1F3DFF" Offset="0.55"/>
                <GradientStop Color="#FF3E58FF" Offset="1"/>
            </LinearGradientBrush>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="0.01*"/>
            <RowDefinition Height="0.49*"/>
            <RowDefinition Height="0.412*"/>
            <RowDefinition Height="0.077*"/>
            <RowDefinition Height="0.01*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.009*"/>
            <ColumnDefinition Width="0.178*"/>
            <ColumnDefinition Width="0.164*"/>
            <ColumnDefinition Width="0.148*"/>
            <ColumnDefinition Width="0.492*"/>
            <ColumnDefinition Width="0.008*"/>
        </Grid.ColumnDefinitions>
        <ListBox x:Name="TaskListBox" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="3" />
        <Canvas Grid.Column="4" Grid.Row="1">
            
            <local:Person Canvas.Left="1" Canvas.Top="1"/>
            
        </Canvas>
        <Canvas Grid.Column="4" Grid.Row="2" Grid.RowSpan="2">
            <local:Person Canvas.Left="1" Canvas.Top="1"/>
        </Canvas>
        <Button Content="New Task..." Grid.Column="3" Grid.Row="3"/>
        <Button Content="Edit Task..." Grid.Column="2" Grid.Row="3"/>
    </Grid>
</navigation:Page>
Comments