<Page x:Class="WSP_USA_Admin_Dashboard.Pages.GiftCodeGenerator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WSP_USA_Admin_Dashboard.Pages"
mc:Ignorable="d"
Height="Auto" Width="600"
Title="GiftCodeGenerator">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.ColumnSpan="5" TextWrapping="Wrap" Padding="10">
Use the below form to generate new gift codes for use on the WSP USA Gift Store. The Begin and End dates are optional and indicate the dates that the code is valid. If you leave the begin date empty, it will be valid immediately. If you leave the end date empty, it will never expire.
</TextBlock>
<Label Grid.Column="0" Grid.Row="1" Content="Number of codes*" VerticalAlignment="Center" Margin="5" />
<TextBox x:Name="CodeQty" Grid.Column="1" Grid.Row="1" Height="25" Margin="5" Width="100" VerticalContentAlignment="Center" />
<Label Grid.Column="0" Grid.Row="2" Content="PO Number*" VerticalAlignment="Center" Margin="5" />
<TextBox x:Name="PONumber" Grid.Column="1" Grid.Row="2" Height="25" Margin="5" Width="100" VerticalContentAlignment="Center" />
<Rectangle Grid.Column="2" Grid.Row="1" Grid.RowSpan="2" VerticalAlignment="Stretch" Fill="LightSlateGray" Width="1" />
<Label Grid.Column="3" Grid.Row="1" Content="Begin Date" VerticalAlignment="Center" Margin="5" />
<DatePicker x:Name="BeginDate" Grid.Column="4" Grid.Row="1" Margin="5" Width="100" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center" />
<Label Grid.Column="3" Grid.Row="2" Content="End Date" VerticalAlignment="Center" Margin="5" />
<DatePicker x:Name="EndDate" Grid.Column="4" Grid.Row="2" Margin="5" Width="100" Height="25" HorizontalAlignment="Left" VerticalAlignment="Center" />
<Button x:Name="GenerateCodes" Content="Generate Gift Codes" Grid.ColumnSpan="5" Grid.Row="3" Height="Auto" HorizontalAlignment="Center" Padding="5" Background="DarkRed" Foreground="White" Width="Auto" VerticalAlignment="Center" VerticalContentAlignment="Center" Click="GenerateCodes_Click" />
</Grid>
</Page>
private void GenerateCodes_Click(object sender, RoutedEventArgs e)
{
if (CodeQty.Text == "" || PONumber.Text == "")
{
MessageBox.Show("The quantity and PO Number fields are required!");
return;
}
else
{
int numCodes = Convert.ToInt32(CodeQty.Text);
string poNumber = PONumber.Text;
string ValidFrom = BeginDate.Text;
string ValidTo = EndDate.Text;
MessageBox.Show("The values entered include:\n# codes: " + numCodes.ToString() + "\nPO #: " + poNumber + "\nValid From: " + ValidFrom + "\nValid To: " + ValidTo);
}
}
var datestring = datePicker.Value.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE