Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Login, Registration and Location pages added.(TODO Location page)
- Loading branch information
1 parent
0f8eb0d
commit a399229
Showing
7 changed files
with
214 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Page x:Class="IoT1.Location" | ||
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:IoT1" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800" | ||
Title="Location"> | ||
|
||
<Grid> | ||
|
||
</Grid> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace IoT1 | ||
{ | ||
/// <summary> | ||
/// Interaction logic for Location.xaml | ||
/// </summary> | ||
public partial class Location : Page | ||
{ | ||
public Location() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<Page x:Class="IoT1.RegisterPage" | ||
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:IoT1" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800" | ||
Title="RegisterPage" Background="AliceBlue"> | ||
|
||
<StackPanel Margin="20"> | ||
|
||
|
||
|
||
<Label Content="Register" Foreground="Black" HorizontalAlignment="Center" FontSize="24" | ||
FontWeight="Bold"/> | ||
|
||
|
||
|
||
<Label Content="Username" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center"/> | ||
<TextBox x:Name="txt_Username" Background="White" Width="592" Height="31" FontSize="18"/> | ||
|
||
<Label Content="Password" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center"/> | ||
<PasswordBox x:Name="txt_Password" Background="White" Width="585" Height="31" FontSize="18"/> | ||
|
||
|
||
<Button Content="Register" Width="213" Margin="30" Click="Button_Click"/> | ||
|
||
</StackPanel> | ||
|
||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data.SqlClient; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace IoT1 | ||
{ | ||
/// <summary> | ||
/// Interaction logic for RegisterPage.xaml | ||
/// </summary> | ||
public partial class RegisterPage : Page | ||
{ | ||
public RegisterPage() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
SqlConnection conn = new SqlConnection(@"Data Source=(localdb)\Local;Initial Catalog=LoginDB;Integrated Security=True"); | ||
|
||
private void Button_Click(object sender, RoutedEventArgs e) | ||
{ | ||
try | ||
{ | ||
SqlCommand cmd = new SqlCommand("INSERT INTO tblUser VALUES (@Username, @Password)", conn); | ||
cmd.CommandType = System.Data.CommandType.Text; | ||
cmd.Parameters.AddWithValue("@Username", txt_Username.Text); | ||
cmd.Parameters.AddWithValue("@Password", txt_Password.Password); | ||
conn.Open(); | ||
cmd.ExecuteNonQuery(); | ||
conn.Close(); | ||
MessageBox.Show("Registration Completed "); | ||
|
||
} | ||
|
||
catch (SqlException Ex) | ||
{ | ||
|
||
MessageBox.Show(Ex.Message); | ||
|
||
} | ||
|
||
} | ||
} | ||
} |