<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ResultatEdit.aspx.cs" Inherits="QW2021C.Resultate.ResultatEdit" %>


<%@ Register Assembly="Syncfusion.EJ.Web, Version=18.3460.0.35, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Web" TagPrefix="ej" %>
<%@ Register Assembly="Syncfusion.EJ, Version=18.3460.0.35, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Models" TagPrefix="ej" %>
<%@ Register Assembly="Syncfusion.EJ" Namespace="Syncfusion.JavaScript.Models" TagPrefix="ej" %>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:HiddenField ID="hiddensql" runat="server" />
        <asp:Label runat="server"><h4>Resultate bearbeiten</h4></asp:Label>

    <asp:Label ID="lblselect" runat="server" Text="Selektion:"></asp:Label>
    <asp:Panel ID="PnlDatenselektion" runat="server">
        <table>
            <tr>
                <td style="width: 100px">
                    <asp:Label ID="lblort" runat="server" Text="Ort"></asp:Label>

                </td>
                <td style="width: 200px">

                    <ej:ComboBox ID="cbboxOrt" runat="server" Width="200px" Text=""
                        DataSourceID="SqlDataSource1" DataSourceCachingMode="Session" DataTextField="Ort" DataValueField="OrtNr" Locale="de-DE" NoRecordsTemplate="No Records Found"
                        SortOrder="None">
                    </ej:ComboBox>

                </td>
          </tr>

            <tr>
                <td style="width: 100px">
                    <asp:Label ID="lblKategorie" runat="server" Text="Kategorie"></asp:Label>
                </td>
                <td style="width: 200px">
                    <asp:TextBox ID="txtkategorie" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="width: 100px">
                    <asp:Label ID="lbldisziplin" runat="server" Text="Disziplin"></asp:Label>
                </td>
                <td style="width: 200px">
                    <asp:TextBox ID="txtdisziplin" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td style="width: 100px">
                    <asp:Label ID="Label1" runat="server" Text="Name"></asp:Label>
                </td>
                <td style="width: 200px">
                    <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                </td>
                               <td style="width=200px">
                      <ej:Button ID="btndataselect" runat="server" Text="Selektieren" Type="Button" OnClick="btndataselect_Click" ></ej:Button>
                </td>
   
            </tr>
        </table>


        <hr />
    </asp:Panel>
    <ej:Grid ID="GridEditor" runat="server" AllowFiltering="True" CssClass="" DataSourceCachingMode="None" DataSourceID="Resultatdaten" 
         OnServerBatchEditRow="GridEditor_ServerBatchEditRow" EnableLoadOnDemand="False" Locale="de-DE" MinWidth="0" AllowResizing="True" AllowSorting="True">
        <Columns>
            <ej:Column AllowEditing="False" DataType="number" Field="EintragNr" IsIdentity="True" IsPrimaryKey="True" Visible="false">
            </ej:Column>
            <ej:Column DataType="number" Field="OrtNr">
            </ej:Column>
            <ej:Column DataType="string" Field="Rang">
            </ej:Column>
            <ej:Column DataType="string" Field="Nachname">
            </ej:Column>
            <ej:Column DataType="string" Field="Vorname">
            </ej:Column>
            <ej:Column DataType="string" Field="Jahrgang" Visible="false">
            </ej:Column>
            <ej:Column DataType="string" Field="Land" Visible="false">
            </ej:Column>
            <ej:Column DataType="string" Field="Verein" Visible="false">
            </ej:Column>
            <ej:Column DataType="string" Field="Lizenz">
            </ej:Column>
            <ej:Column DataType="string" Field="Kategorie_kurzname" Visible="false">
            </ej:Column>
            <ej:Column DataType="string" Field="Kategorie">
            </ej:Column>
            <ej:Column DataType="string" Field="Position">
            </ej:Column>
            <ej:Column DataType="string" Field="Bahn">
            </ej:Column>
            <ej:Column DataType="string" Field="Qualifikation">
            </ej:Column>
            <ej:Column DataType="string" Field="Serie">
            </ej:Column>
            <ej:Column DataType="string" Field="Disziplin">
            </ej:Column>
            <ej:Column DataType="string" Field="Leistung">
            </ej:Column>
            <ej:Column DataType="string" Field="Info">
            </ej:Column>
            <ej:Column DataType="number" Field="Punkte">
            </ej:Column>
            <ej:Column DataType="string" Field="Wind" Visible="false">
            </ej:Column>
            <ej:Column DataType="boolean" Field="Nicht_Beruecksichtigen" EditType="BooleanEdit">
            </ej:Column>
            <ej:Column DataType="boolean" Field="Nur_Erdgas" EditType="BooleanEdit">
            </ej:Column>
            <ej:Column DataType="string" Field="Team">
            </ej:Column>
        </Columns>
        <EditSettings AllowEditing="True" AllowDeleting="True" EditMode="Batch" />
        <ToolbarSettings ShowToolbar="true" ToolbarItems="update" />
    </ej:Grid>

    <asp:SqlDataSource ID="Resultatdaten" runat="server" ConnectionString="<%$ ConnectionStrings:QWToolConnectionstring %>" 
        DeleteCommand="DELETE FROM [Res_Resultate] WHERE [EintragNr] = @EintragNr" 
        InsertCommand="INSERT INTO [Res_Resultate] ([OrtNr], [Rang], [Nachname], [Vorname], [Jahrgang], [Land], [Verein], [Lizenz], [Kategorie_kurzname], [Kategorie], [Position], [Bahn], [Qualifikation], [Serie], [Disziplin], [Leistung], [Info], [Punkte], [Wind], [Nicht_Beruecksichtigen], [Nur_Erdgas], [Team]) VALUES (@OrtNr, @Rang, @Nachname, @Vorname, @Jahrgang, @Land, @Verein, @Lizenz, @Kategorie_kurzname, @Kategorie, @Position, @Bahn, @Qualifikation, @Serie, @Disziplin, @Leistung, @Info, @Punkte, @Wind, @Nicht_Beruecksichtigen, @Nur_Erdgas, @Team)" 
        SelectCommand="SELECT [EintragNr], [OrtNr], [Rang], [Nachname], [Vorname], [Jahrgang], [Land], [Verein], [Lizenz], [Kategorie_kurzname], [Kategorie], [Position], [Bahn], [Qualifikation], [Serie], [Disziplin], [Leistung], [Info], [Punkte], [Wind], [Nicht_Beruecksichtigen], [Nur_Erdgas], [Team] FROM [Res_Resultate] where eintragnr=-1" 
        UpdateCommand="UPDATE [Res_Resultate] SET [OrtNr] = @OrtNr, [Rang] = @Rang, [Nachname] = @Nachname, [Vorname] = @Vorname, [Jahrgang] = @Jahrgang, [Land] = @Land, [Verein] = @Verein, [Lizenz] = @Lizenz, [Kategorie_kurzname] = @Kategorie_kurzname, [Kategorie] = @Kategorie, [Position] = @Position, [Bahn] = @Bahn, [Qualifikation] = @Qualifikation, [Serie] = @Serie, [Disziplin] = @Disziplin, [Leistung] = @Leistung, [Info] = @Info, [Punkte] = @Punkte, [Wind] = @Wind, [Nicht_Beruecksichtigen] = @Nicht_Beruecksichtigen, [Nur_Erdgas] = @Nur_Erdgas, [Team] = @Team WHERE [EintragNr] = @EintragNr">
        <DeleteParameters>
            <asp:Parameter Name="EintragNr" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="OrtNr" Type="Int32" />
            <asp:Parameter Name="Rang" Type="String" />
            <asp:Parameter Name="Nachname" Type="String" />
            <asp:Parameter Name="Vorname" Type="String" />
            <asp:Parameter Name="Jahrgang" Type="String" />
            <asp:Parameter Name="Land" Type="String" />
            <asp:Parameter Name="Verein" Type="String" />
            <asp:Parameter Name="Lizenz" Type="String" />
            <asp:Parameter Name="Kategorie_kurzname" Type="String" />
            <asp:Parameter Name="Kategorie" Type="String" />
            <asp:Parameter Name="Position" Type="String" />
            <asp:Parameter Name="Bahn" Type="String" />
            <asp:Parameter Name="Qualifikation" Type="String" />
            <asp:Parameter Name="Serie" Type="String" />
            <asp:Parameter Name="Disziplin" Type="String" />
            <asp:Parameter Name="Leistung" Type="String" />
            <asp:Parameter Name="Info" Type="String" />
            <asp:Parameter Name="Punkte" Type="Double" />
            <asp:Parameter Name="Wind" Type="String" />
            <asp:Parameter Name="Nicht_Beruecksichtigen" Type="Boolean" />
            <asp:Parameter Name="Nur_Erdgas" Type="Boolean" />
            <asp:Parameter Name="Team" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="OrtNr" Type="Int32" />
            <asp:Parameter Name="Rang" Type="String" />
            <asp:Parameter Name="Nachname" Type="String" />
            <asp:Parameter Name="Vorname" Type="String" />
            <asp:Parameter Name="Jahrgang" Type="String" />
            <asp:Parameter Name="Land" Type="String" />
            <asp:Parameter Name="Verein" Type="String" />
            <asp:Parameter Name="Lizenz" Type="String" />
            <asp:Parameter Name="Kategorie_kurzname" Type="String" />
            <asp:Parameter Name="Kategorie" Type="String" />
            <asp:Parameter Name="Position" Type="String" />
            <asp:Parameter Name="Bahn" Type="String" />
            <asp:Parameter Name="Qualifikation" Type="String" />
            <asp:Parameter Name="Serie" Type="String" />
            <asp:Parameter Name="Disziplin" Type="String" />
            <asp:Parameter Name="Leistung" Type="String" />
            <asp:Parameter Name="Info" Type="String" />
            <asp:Parameter Name="Punkte" Type="Double" />
            <asp:Parameter Name="Wind" Type="String" />
            <asp:Parameter Name="Nicht_Beruecksichtigen" Type="Boolean" />
            <asp:Parameter Name="Nur_Erdgas" Type="Boolean" />
            <asp:Parameter Name="Team" Type="String" />
            <asp:Parameter Name="EintragNr" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:QWToolConnectionstring %>"
        SelectCommand="SELECT [OrtNr], [Ort] FROM [Res_Ort]"></asp:SqlDataSource>

</asp:Content>
