Advertisement
Guest User

Untitled

a guest
Apr 10th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.29 KB | None | 0 0
  1. private void SelectAccounts(string AccountUsername) //Findet Nutzer und Account ID und gibt alle Accounts des Nutzers aus //// neu machen jede reihe einzeln zurückgeben!!!!!!!
  2. {
  3. MId=database.GetID(this.MasterUsername,"MasterUser","MId"); //for database request
  4. AccId = database.GetID(AccountUsername, "Accounts","AccId"); //for database request
  5. AccountsList.Children.Clear(); //My Grid where i safe it
  6.  
  7. int rows = database.GetRows("Accounts", "AccID"); //How many Rows i have in my table
  8. for (int i = 1; i <= rows; i++)
  9. {
  10. stringusername=database.GetUsernameById("Accounts","Username", i, MId); //getting the username back as string
  11.  
  12.  
  13. if(username!="") // not evry username has the right condition so somtimes the function returns me only ""
  14. {
  15. Label l = new Label();
  16. RowDefinition newRow = new RowDefinition();
  17. newRow.Height = new GridLength(40);
  18.  
  19. AccountsList.RowDefinitions.Add(newRow);
  20. l.Content = username;
  21.  
  22. AccountsList.Children.Add(l);
  23. l.SetValue(Grid.RowProperty, i);
  24. }
  25. }
  26. }
  27.  
  28. for (int i = 1; i <= rows; i++)
  29. {
  30.  
  31. Label l = new Label();
  32. RowDefinition newRow = new RowDefinition();
  33. newRow.Height = new GridLength(40);
  34. AccountsList.RowDefinitions.Add(newRow);
  35.  
  36.  
  37. string username= database.GetUsernameById("Accounts", "Username", i, MId);
  38.  
  39.  
  40. if(username!="")
  41. {
  42.  
  43.  
  44.  
  45. l.Content = username;
  46.  
  47. AccountsList.Children.Add(l);
  48. l.SetValue(Grid.RowProperty, i);
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. }
  57.  
  58. <UserControl x:Class="AccountManager.Login"
  59. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  60. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  61. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  62. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  63. mc:Ignorable="d"
  64. d:DesignHeight="500" d:DesignWidth="750">
  65. <Grid Background="White">
  66. <Grid.RowDefinitions>
  67. <RowDefinition Height="100"/>
  68. <RowDefinition Height="400"/>
  69. </Grid.RowDefinitions>
  70. <Grid.ColumnDefinitions>
  71. <ColumnDefinition Width="13*"/>
  72. <ColumnDefinition Width="37*"/>
  73. </Grid.ColumnDefinitions>
  74. <Grid Grid.Row="0" Grid.Column="0">
  75. <Label Content="Your Accounts" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="21.333" FontFamily="Tekton Pro" FontWeight="Bold"></Label>
  76. <Border BorderBrush="LightBlue" BorderThickness="1.5" HorizontalAlignment="Right"/>
  77. <Border BorderBrush="LightBlue" BorderThickness="1.5" VerticalAlignment="Bottom"/>
  78. <Border BorderBrush="Blue" BorderThickness="1.5" VerticalAlignment="Bottom" Opacity="0.2"/>
  79. <Border BorderBrush="Blue" BorderThickness="1.5" HorizontalAlignment="Right" Opacity="0.2"/>
  80. </Grid>
  81. <Grid Grid.Row="1" Grid.Column="1">
  82. <Grid.ColumnDefinitions>
  83. <ColumnDefinition Width="146*"/>
  84. <ColumnDefinition Width="348*"/>
  85. <ColumnDefinition Width="91*"/>
  86. </Grid.ColumnDefinitions>
  87. <Grid Grid.Row="0" Grid.Column="0">
  88. <Border BorderBrush="LightBlue" BorderThickness="1.5" HorizontalAlignment="Right"/>
  89. <Border BorderBrush="Blue" BorderThickness="1.5" Opacity="0.2" HorizontalAlignment="Right"/>
  90. </Grid>
  91. <Grid Grid.Column="1">
  92.  
  93. <Grid.ColumnDefinitions>
  94. <ColumnDefinition Width="110*"/>
  95. <ColumnDefinition Width="191*"/>
  96. </Grid.ColumnDefinitions>
  97. <Grid.RowDefinitions>
  98. <RowDefinition></RowDefinition>
  99. <RowDefinition></RowDefinition>
  100. <RowDefinition></RowDefinition>
  101. <RowDefinition></RowDefinition>
  102. <RowDefinition></RowDefinition>
  103. </Grid.RowDefinitions>
  104. <Label Content="Benutzername:" VerticalAlignment="Center" HorizontalAlignment="Right" Height="26" Width="90"/>
  105. <TextBox x:Name="addBenutzername" Grid.Row="0" Grid.Column="1" Width="185" Height="30" HorizontalAlignment="Right" VerticalAlignment="Center" BorderBrush="Black" BorderThickness="1" />
  106. <PasswordBox x:Name="addPw" Grid.Row="1" Grid.Column="1" Width="185" Height="30" HorizontalAlignment="Right" VerticalAlignment="Center" BorderBrush="Black" BorderThickness="1" ></PasswordBox>
  107. <Label Grid.Row="1" Grid.Column="0" Content="Password:" VerticalAlignment="Center" HorizontalAlignment="Right" Height="26" Width="62"/>
  108. <Label x:Name="repeatPasswordLabel" Grid.Row="2" Grid.Column="0" Content="Repeat Password:" HorizontalAlignment="Right" VerticalAlignment="Center" Height="26" Width="102" />
  109. <PasswordBox x:Name="addReapeatPw" Grid.Row="2" Grid.Column="1" Width="185" Height="30" HorizontalAlignment="Right" VerticalAlignment="Center" BorderBrush="Black" BorderThickness="1" />
  110. <Label Content="Email:" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Height="26" Width="41"/>
  111. <TextBox x:Name="addEmail" Grid.Row="3" Grid.Column="1" Width="185" Height="30" HorizontalAlignment="Right" VerticalAlignment="Center" BorderBrush="Black" BorderThickness="1"/>
  112. <Button Grid.Row=" 5" Grid.Column="1" Content="ADD" Height="36" HorizontalAlignment="Center" VerticalAlignment="Center" Width="80" Click="AddAccount"></Button>
  113. </Grid>
  114. <Grid Grid.Column="2">
  115. <Grid.RowDefinitions>
  116. <RowDefinition></RowDefinition>
  117. <RowDefinition></RowDefinition>
  118. <RowDefinition></RowDefinition>
  119. <RowDefinition></RowDefinition>
  120. <RowDefinition></RowDefinition>
  121. <RowDefinition></RowDefinition>
  122. <RowDefinition></RowDefinition>
  123. <RowDefinition></RowDefinition>
  124. </Grid.RowDefinitions>
  125. <RadioButton x:Name="r1" Grid.Row="0" Width="70" Height="30">
  126. <Image Source="Bilder/Facebook.png"></Image>
  127.  
  128. </RadioButton>
  129. <RadioButton x:Name="r2" Grid.Row="1" Width="70" Height="30">
  130. <Image Source="Bilder/Skype.png"></Image>
  131. </RadioButton>
  132. <RadioButton x:Name="r3" Grid.Row="2" Width="70" Height="30">
  133. <Image Source="Bilder/Youtube.png"></Image>
  134. </RadioButton>
  135. <RadioButton x:Name="r4" Grid.Row="3" Width="70" Height="30">
  136. <Image Source="Bilder/Twitter.png"></Image>
  137. </RadioButton>
  138. <RadioButton x:Name="r5" Grid.Row="4" Width="70" Height="30">
  139. <Image Source="Bilder/Microsoft.png"></Image>
  140. </RadioButton>
  141. <RadioButton x:Name="r6" Grid.Row="5" Width="70" Height="30">
  142. <Image Source="Bilder/reddit.png"></Image>
  143. </RadioButton>
  144. <RadioButton x:Name="r7" Grid.Row="6" Width="70" Height="30">
  145. <Image Source="Bilder/Origin.png"></Image>
  146. </RadioButton>
  147. <RadioButton x:Name="r8" Grid.Row="8" Width="70" Height="30">
  148. <Image Source="Bilder/Steam.png"></Image>
  149. </RadioButton>
  150. </Grid>
  151. </Grid>
  152. <Grid VerticalAlignment="Top" x:Name="AccountsList" Grid.Row="1" Grid.Column="0">
  153. <Border BorderBrush="LightBlue" BorderThickness="1.5" HorizontalAlignment="Right"/>
  154. <Border BorderBrush="Blue" BorderThickness="1.5" HorizontalAlignment="Right" Opacity="0.2"/>
  155.  
  156.  
  157.  
  158. </Grid>
  159. <Grid Grid.Row="0" Grid.Column="1">
  160. <Border BorderBrush="LightBlue" BorderThickness="1.5" VerticalAlignment="Bottom"/>
  161. <Border BorderBrush="Blue" BorderThickness="1.5" VerticalAlignment="Bottom" Opacity="0.2"/>
  162. <Button x:Name="delete" Content="Delete" HorizontalAlignment="Left" Width="80" Height="36" Margin="85,19,0,19"/>
  163. <Button x:Name="change" Content="Change" HorizontalAlignment="Center" VerticalAlignment="Center" Width="80" Height="36"></Button>
  164.  
  165.  
  166.  
  167.  
  168. </Grid>
  169. </Grid>
  170.  
  171. <Window x:Class="AccountManager.MainWindow"
  172. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  173. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  174. Title="MainWindow" Height="500" Width="750" MaxWidth="750" MinWidth="750" MinHeight="500" MaxHeight="500">
  175. <Grid x:Name="Main">
  176. <Grid>
  177. <Grid.ColumnDefinitions>
  178. <ColumnDefinition Width="371"></ColumnDefinition>
  179. <ColumnDefinition Width="371"></ColumnDefinition>
  180. </Grid.ColumnDefinitions>
  181. <Grid.RowDefinitions>
  182. <RowDefinition Height="80"></RowDefinition>
  183. <RowDefinition Height="190"></RowDefinition>
  184.  
  185. </Grid.RowDefinitions>
  186. <Label Grid.Row="0" Content="Accountmanager" HorizontalAlignment="Center" VerticalAlignment="Center" Background="White" FontSize="24" FontFamily="Snap ITC"/>
  187. <Grid Grid.Row="0" Grid.Column="1">
  188. <Grid.ColumnDefinitions>
  189. <ColumnDefinition Width="150"></ColumnDefinition>
  190. <ColumnDefinition></ColumnDefinition>
  191. </Grid.ColumnDefinitions>
  192.  
  193. </Grid>
  194. <Grid Grid.Row="1" x:Name="bilder">
  195. <Grid.RowDefinitions>
  196. <RowDefinition></RowDefinition>
  197. <RowDefinition></RowDefinition>
  198. </Grid.RowDefinitions>
  199. <Grid.ColumnDefinitions>
  200. <ColumnDefinition></ColumnDefinition>
  201. <ColumnDefinition></ColumnDefinition>
  202. <ColumnDefinition></ColumnDefinition>
  203. <ColumnDefinition></ColumnDefinition>
  204. </Grid.ColumnDefinitions>
  205.  
  206. <Image Grid.Row="0" Source="Bilder/Facebook.png" Height="70" HorizontalAlignment="Center" VerticalAlignment="Center" Width="70"/>
  207. <Image Grid.Row="0" Grid.Column="1" Source="Bilder/Skype.png" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  208. <Image Grid.Row="0" Grid.Column="2" Source="Bilder/Youtube.png" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  209. <Image Grid.Row="0" Grid.Column="3" Source="Bilder/Twitter.png" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  210. <Image Grid.Row="1" Grid.Column="0" Source="Bilder/Microsoft.png" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  211. <Image Grid.Row="1" Grid.Column="1" Source="Bilder/reddit.png" HorizontalAlignment="Center" VerticalAlignment="Center"></Image>
  212. <Image Grid.Row="1" Grid.Column="2" Source="Bilder/Origin.png" VerticalAlignment="Center" HorizontalAlignment="Center"></Image>
  213. <Image Grid.Row="1" Grid.Column="3" Source="Bilder/Steam.png" VerticalAlignment="Center" HorizontalAlignment="Center"></Image>
  214.  
  215. </Grid>
  216. <Grid Grid.Row="1" Grid.Column="1">
  217. <Grid.RowDefinitions>
  218. <RowDefinition></RowDefinition>
  219. <RowDefinition></RowDefinition>
  220. </Grid.RowDefinitions>
  221. <Grid.ColumnDefinitions>
  222. <ColumnDefinition Width="150"></ColumnDefinition>
  223. <ColumnDefinition></ColumnDefinition>
  224. </Grid.ColumnDefinitions>
  225. <Label Content="Benutzername:" VerticalAlignment="Top" HorizontalAlignment="Right"/>
  226. <TextBox x:Name="benutzername" Grid.Row="0" Grid.Column="1" Width="185" Height="30" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="Black" BorderThickness="1"></TextBox>
  227. <PasswordBox x:Name="pw" Grid.Row="0" Grid.Column="1" Width="185" Height="30" HorizontalAlignment="Left" BorderBrush="Black" BorderThickness="1" VerticalAlignment="Bottom"/>
  228. <Label Grid.Row="0" Grid.Column="0" Content="Password:" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
  229. <Button Grid.Column="0" Grid.Row="1" Content="Add" Width="80" Height="40" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="47,0,23,0" Click="ClickAddAccount"/>
  230. <Button Grid.Column="1" Grid.Row="1" Content="Login" Width="80" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,23,0" Click="Login" />
  231. <Button Grid.Column="1" Grid.Row="1" Content="Forgot Password" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="40" Width="95" Click="ForgotPw" />
  232.  
  233. </Grid>
  234.  
  235.  
  236.  
  237.  
  238.  
  239. </Grid>
  240. </Grid>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement