IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP.NET Discussion :

probleme de lien


Sujet :

ASP.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    49
    Détails du profil
    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 49
    Par défaut probleme de lien
    bonjour,
    je realise une application web sous visual studio en asp.net vb

    dans un module appelé PDP, j'integre un autre module appelé "document" ce dernier est inclu dans différents autres module

    j'ai créer une procédure pour avoir un lien personnalisé dans chaque modules, exemple si je suis dans PDP le lien sera "ajouter un exemplaire du pdp" ou si je suis dans le module "avenant" le lien sera ajouter un exmplaire a l'avenant.

    le probleme est que je n'arrive pas a afficher ce lien personnalisé, alors que ce matin tout fonctionné parfaitemenent

    voici mon code :

    celui de la page document.ascx :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
     
    <%@ Control
        Language="VB"
        AutoEventWireup="false"
        CodeFile="Document.ascx.vb"
        Inherits="Modules_Document" %>
     
    <script
        language="VBscript"
        type="text/vbscript">
     
      Sub ouvrir(lien)
        Set objShell = CreateObject("Wscript.Shell")
        objShell.run "" & lien & ""
      end sub
     
    </script>
     
    <asp:Label
        ID="LabelType"
        runat="server"
        Visible="False" />
    <asp:Label
        ID="LabelPrefixe"
        runat="server"
        Visible="False" />
    <asp:Label
        ID="ParamidDocument"
        runat="server"
        Visible="False" />
    <asp:Label
        ID="LabelTypeText"
        runat="server"
        Visible="False" />
    <asp:Panel
        ID="PanelLangueReadOnly"
        runat="server"
        GroupingText=""
        Width="100%">
        <div class="panelcontent">
            <asp:GridView
                ID="GridView2"
                runat="server"
                AllowSorting="True"
                AutoGenerateColumns="False"
                DataSourceID="SqlDataSourceDocument"
                EmptyDataText="(Aucun document associé)"
                Width="100%" >
                <Columns>
                    <asp:TemplateField
                        headerText="langue"
                        ShowHeader="false" 
                        sortExpression="langue">
                        <ItemTemplate>
                            <asp:HyperLink 
                                ID="HyperLinkURL"
                                runat="server"
                                NavigateUrl='<%# variable ("filePathClt") & Eval ("Fichier").toString %>'
                                Text='<%# Eval ("langue") %>'>
                            </asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
        <asp:SqlDataSource
            ID="SqlDataSourceDocumentReadOnly"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:PDP %>"
            SelectCommand="SELECT DocumentLangue.idDocument, DocumentLangue.idLangue, Langue.Langue, Langue.CodeLangue, DocumentLangue.Fichier FROM DocumentLangue INNER JOIN Langue ON DocumentLangue.idLangue = Langue.idLangue WHERE (DocumentLangue.idDocument = @idDocument)">
            <SelectParameters>
                <asp:ControlParameter
                    ControlID="ParamidDocument"
                    Name="idDocument"
                    PropertyName="Text"
                    Type="int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </asp:Panel>
    <asp:LinkButton
                ID="LinkButtonAjouter"
                runat="server"
                CssClass="textcenter"
                OnClick="LinkButtonAjouter_Click"
                Text= "Ajouter un exemplaire"
                Width="100%">
            </asp:LinkButton>
    <asp:Panel
        ID="PanelLangue"
        runat="server"
        GroupingText=""
        visible="False"
        Width="100%">
        <div class="panelcontent">
            <asp:GridView
                ID="GridView1"
                runat="server"
                AllowSorting="True"
                AutoGenerateColumns="False"
                DataKeyNames="idDocument,idLangue"
                DataSourceID="SqlDataSourceDocument"
                EmptyDataText="(Aucun document associé)"
                Width="100%">
                <Columns>
                    <asp:TemplateField 
                           headerText="Langue"
                           Showheader="false" 
                           SortExpression="Langue">
                           <ItemTemplate>
                                <asp:HyperLink
                                    ID="HyperLinkURL"
                                    runat="server"
                                    NavigateURL='<%# variable ("FilePathClt") & Eval ("Fichier").tostring %>'
                                    Text='<%# Eval ("langue") %>'>
                                </asp:HyperLink>
                           </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField 
                            showheader="false">
                            <ItemStyle
                                Width="20px" />
                            <ItemTemplate>
                                <asp:ImageButton
                                    ID="ImageButton1"
                                    Runat="server"
                                    OnClientClick='<%# DoubleBackslash ("ouvrir(""" & variable("FilePathClt") & Eval ("Fichier").tostring & """)") %>'
                                    SkinId="Edit" />        
                            </ItemTemplate>           
                    </asp:TemplateField>
                    <asp:TemplateField 
                         ShowHeader="false">
                         <ItemStyle  
                                Width="20px" />
                         <ItemTemplate>
                            <asp:ImageButton 
                                ID="ImageButtonde1"
                                runat="server"
                                CommandName="Delete"
                                OnClientClick='<%# "return confirm (""Etes-vous sur de vouloir supprimer la version en " & Eval("Langue").ToString & " de ce document ?"");" %>'
                                SkinID="Delete" />
                         </ItemTemplate> 
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <br />
     
        </div>
        <asp:SqlDataSource
            ID="SqlDataSourceDocument"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:PDP %>"
            DeleteCommand="DELETE FROM [DocumentLangue] WHERE [idDocument] = @idDocument AND [idLangue] = @idLangue"
            InsertCommand="INSERT INTO DocumentLangue(idLangue, idDocument, Fichier) VALUES (@idLangue, @idDocument, @Fichier)"
            SelectCommand="SELECT DocumentLangue.idDocument, DocumentLangue.idLangue, Langue.Langue, Langue.CodeLangue, DocumentLangue.Fichier FROM DocumentLangue INNER JOIN Langue ON DocumentLangue.idLangue = Langue.idLangue WHERE (DocumentLangue.idDocument = @idDocument)">
            <DeleteParameters>
                <asp:ControlParameter
                    ControlID="ParamidDocument"
                    Name="idDocument"
                    PropertyName="Text"
                    Type="int32" />
                <asp:Parameter
                    Name="idLangue"
                    Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:ControlParameter
                    ControlID="ParamidDocument"
                    Name="idDocument"
                    PropertyName="Text"
                    Type="int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter
                    Name="idLangue"
                    Type="Int32" />
                <asp:ControlParameter
                    ControlID="ParamidDocument"
                    Name="idDocument"
                    PropertyName="Text"
                    Type="int32" />
                <asp:Parameter
                    Name="Fichier" />
            </InsertParameters>
        </asp:SqlDataSource>
     
        <asp:SqlDataSource
            ID="SqlDataSourceLangueNew"
            runat="server"
            ConnectionString="<%$ ConnectionStrings:PDP %>"
            SelectCommand="SELECT idLangue, CodeLangue, Langue FROM Langue WHERE (idLangue NOT IN (SELECT idLangue FROM DocumentLangue WHERE (idDocument = @idDocument)))">
            <SelectParameters>
                <asp:ControlParameter
                    ControlID="ParamidDocument"
                    Name="idDocument"
                    PropertyName="Text"
                    Type="int32" />
            </SelectParameters>
        </asp:SqlDataSource>
    </asp:Panel>
     
    <asp:Panel
        ID="PanelNouveau"
        runat="server"
        GroupingText="Nouveau"
        visible="false"
        Width="100%">
        <div class="panelcontent">
            <table
                width="100%" cellspacing="5">
                <tr>
                    <td style="width: 120px">
                        Langue
                        du<br />
                        nouveau
                        document</td>
                    <td>
                        <asp:DropDownList
                            ID="DropDownListLangueNew"
                            runat="server"
                            DataSourceID="SqlDataSourceLangueNew"
                            DataTextField="Langue"
                            DataValueField="CodeLangue"
                            Width="150px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td valign="top" colspan="2">
                        Source :
                        <asp:RadioButtonList
                            ID="RadioButtonList1"
                            runat="server"
                            AutoPostBack="True"
                            Width="100%" CellSpacing="10" RepeatDirection="Horizontal">
                            <asp:ListItem
                                Selected="True" Value="Vierge">Modèle</asp:ListItem>
                            <asp:ListItem
                                Value="Copie">Copie</asp:ListItem>
                        </asp:RadioButtonList>
                        </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Panel
                            ID="PanelVierge"
                            runat="server"
                            GroupingText="Documents modèles"
                            Visible="true"
                            Width="100%">
                            <div class="panelcontent">
                                <asp:GridView
                                    ID="GridViewDocVierge"
                                    runat="server"
                                    AllowSorting="True"
                                    AutoGenerateColumns="False"
                                    DataKeyNames="Fichier"
                                    DataSourceID="SqlDataSourceDocVierge"
                                    EmptyDataText="(Aucun document trouvé)"
                                    OnSelectedIndexChanged="GridViewDoc_SelectedIndexChanged"
                                    Width="100%">
                                    <Columns>
                                        <asp:BoundField
                                            DataField="Langue"
                                            HeaderText="Langue"
                                            SortExpression="Langue" />
                                        <asp:CommandField
                                            ButtonType="Button"
                                            ShowSelectButton="True"
                                            SelectText="Copier">
                                            <ItemStyle
                                                Width="50px" />
                                        </asp:CommandField>
                                    </Columns>
                                </asp:GridView>
                                <asp:SqlDataSource
                                    ID="SqlDataSourceDocVierge"
                                    runat="server"
                                    ConnectionString="<%$ ConnectionStrings:PDP %>"
                                    SelectCommand="SELECT Document.idDocument, DocumentLangue.Fichier, Langue.idLangue, Langue.CodeLangue, Langue.Langue FROM Document INNER JOIN DocumentLangue ON Document.idDocument = DocumentLangue.idDocument INNER JOIN Langue ON DocumentLangue.idLangue = Langue.idLangue WHERE (Document.Type LIKE '%' + 'ADMIN\' + @Type + '%')">
                                    <SelectParameters>
                                        <asp:ControlParameter
                                            ControlID="LabelType"
                                            Name="Type"
                                            PropertyName="Text"
                                            Type="string" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
                            </div>
                        </asp:Panel>
                        <asp:Panel
                            ID="PanelCopie"
                            runat="server"
                            GroupingText="Copier à partir de"
                            Visible="False"
                            Width="100%">
                            <div class="panelcontent">
                                <asp:Panel
                                    ID="Panel3"
                                    runat="server"
                                    GroupingText="Rechercher"
                                    Width="100%">
                                    <table style="width: 100%">
                                        <tr>
                                            <td>
                                                Entreprise</td>
                                            <td>
                                                <asp:DropDownList
                                                    ID="DropDownListEntreprise"
                                                    runat="server"
                                                    AppendDataBoundItems="True"
                                                    AutoPostBack="True"
                                                    DataSourceID="SqlDataSourceEntreprise"
                                                    DataTextField="Nom"
                                                    DataValueField="idEntreprise"
                                                    OnDataBinding="DropDownListClear_DataBinding"
                                                    Width="200px">
                                                </asp:DropDownList>
                                                <asp:SqlDataSource
                                                    ID="SqlDataSourceEntreprise"
                                                    runat="server"
                                                    ConnectionString="<%$ ConnectionStrings:PDP %>"
                                                    SelectCommand="SELECT [idEntreprise], [Nom] FROM [Entreprise] ORDER BY [Nom]">
                                                </asp:SqlDataSource>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="height: 21px">
                                                Commanditaire</td>
                                            <td style="height: 21px">
                                                <asp:DropDownList
                                                    ID="DropDownListCommanditaire"
                                                    runat="server"
                                                    AppendDataBoundItems="True"
                                                    AutoPostBack="True"
                                                    DataSourceID="SqlDataSourceDonneurOrdre"
                                                    DataTextField="NomPrenom"
                                                    DataValueField="idDonneurOrdre"
                                                    OnDataBinding="DropDownListClear_DataBinding">
                                                </asp:DropDownList>
                                                <asp:SqlDataSource
                                                    ID="SqlDataSourceDonneurOrdre"
                                                    runat="server"
                                                    ConnectionString="<%$ ConnectionStrings:PDP %>"
                                                    SelectCommand="SELECT idDonneurOrdre, Nom + ISNULL(' ' + Prenom, '') AS NomPrenom FROM DonneurOrdre">
                                                </asp:SqlDataSource>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Langue</td>
                                            <td>
                                                <asp:DropDownList
                                                    ID="DropDownListLangue"
                                                    runat="server"
                                                    AppendDataBoundItems="True"
                                                    AutoPostBack="True"
                                                    DataSourceID="SqlDataSourceLangue"
                                                    DataTextField="Langue"
                                                    DataValueField="idLangue"
                                                    OnDataBinding="DropDownListClear_DataBinding">
                                                </asp:DropDownList>
                                                <asp:SqlDataSource
                                                    ID="SqlDataSourceLangue"
                                                    runat="server"
                                                    ConnectionString="<%$ ConnectionStrings:PDP %>"
                                                    SelectCommand="SELECT [idLangue], [Langue], [CodeLangue] FROM [Langue]">
                                                </asp:SqlDataSource>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                                <br />
                                <asp:GridView
                                    ID="GridViewDoc"
                                    runat="server"
                                    AutoGenerateColumns="False"
                                    DataKeyNames="Fichier"
                                    DataSourceID="SqlDataSourceDoc"
                                    EmptyDataText="(Aucun document trouvé)"
                                    OnSelectedIndexChanged="GridViewDoc_SelectedIndexChanged"
                                    Width="100%">
                                    <Columns>
                                        <asp:TemplateField
                                            HeaderText="Nom"
                                            SortExpression="Nom">
                                            <ItemTemplate>
                                                <asp:HyperLink
                                                    ID="HyperLink1"
                                                    runat="server"
                                                    NavigateUrl='<%# variable("FilePathClt") & Eval("Fichier").toString %>'>
                                                    <asp:Label
                                                        ID="Label1"
                                                        runat="server"
                                                        Text='<%# Bind("Nom") %>' />
                                                </asp:HyperLink>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField
                                            DataField="Langue"
                                            HeaderText="Langue"
                                            SortExpression="Langue" />
                                        <asp:CommandField
                                            ButtonType="Button"
                                            SelectText="Copier"
                                            ShowSelectButton="True">
                                            <ItemStyle
                                                Width="50px" />
                                        </asp:CommandField>
                                    </Columns>
                                </asp:GridView>
                                <br />
                            </div>
                        </asp:Panel>
                    </td>
                </tr>
                <tr>
                    <td align="center"
                        colspan="2">
                        <br />
                        <asp:LinkButton
                            ID="LinkButtonAnnuler"
                            runat="server">Annuler</asp:LinkButton>
                    </td>
                </tr>
            </table>
        </div>
    </asp:Panel>
    <asp:SqlDataSource
        ID="SqlDataSourceDoc"
        runat="server"
        ConnectionString="<%$ ConnectionStrings:PDP %>"
        SelectCommand="SELECT Document.idDocument, Document.Type, CONVERT (varchar, CGS.DateCreation, 103) AS Nom, DocumentLangue.Fichier, Langue.Langue, DocumentLangue.idLangue FROM Document INNER JOIN DocumentLangue ON Document.idDocument = DocumentLangue.idDocument INNER JOIN Langue ON DocumentLangue.idLangue = Langue.idLangue INNER JOIN CGS ON Document.idDocument = CGS.idDocument WHERE (Document.Type LIKE '%' + @Type + '%') UNION SELECT Document_2.idDocument, Document_2.Type, Avenant.Nom AS nom, DocumentLangue_2.Fichier, Langue_2.Langue, DocumentLangue_2.idLangue FROM DocumentLangue AS DocumentLangue_2 INNER JOIN Document AS Document_2 INNER JOIN Avenant ON Document_2.idDocument = Avenant.idDocument ON DocumentLangue_2.idDocument = Document_2.idDocument INNER JOIN Langue AS Langue_2 ON DocumentLangue_2.idLangue = Langue_2.idLangue LEFT OUTER JOIN AvenantPDP LEFT OUTER JOIN Entreprise INNER JOIN PDP ON Entreprise.idEntreprise = PDP.idEntreprise INNER JOIN DonneurOrdreCommande INNER JOIN DonneurOrdre ON DonneurOrdreCommande.idDonneurOrdre = DonneurOrdre.idDonneurOrdre INNER JOIN Commande ON DonneurOrdreCommande.idCommande = Commande.idCommande ON PDP.idPDP = Commande.idPDP ON AvenantPDP.idPDP = PDP.idPDP ON Avenant.idAvenant = AvenantPDP.idAvenant WHERE (ISNULL(CAST(PDP.idEntreprise AS varchar), '') LIKE '%' + @idEntreprise + '%') AND (ISNULL(CAST(DocumentLangue_2.idLangue AS varchar), '') LIKE '%' + @idLangue + '%') AND (ISNULL(DonneurOrdre.Nom, '') LIKE '%' + @DonneurOrdre + '%') AND (Document_2.Type LIKE '%' + @Type + '%') UNION SELECT Document_1.idDocument, Document_1.Type, PDP_1.Intitule AS nom, DocumentLangue_1.Fichier, Langue_1.Langue, DocumentLangue_1.idLangue FROM Entreprise AS Entreprise_1 INNER JOIN Document AS Document_1 INNER JOIN DocumentLangue AS DocumentLangue_1 ON Document_1.idDocument = DocumentLangue_1.idDocument INNER JOIN Langue AS Langue_1 ON DocumentLangue_1.idLangue = Langue_1.idLangue INNER JOIN PDP AS PDP_1 ON Document_1.idDocument = PDP_1.idDocument ON Entreprise_1.idEntreprise = PDP_1.idEntreprise LEFT OUTER JOIN DonneurOrdre AS DonneurOrdre_1 INNER JOIN DonneurOrdreCommande AS DonneurOrdreCommande_1 ON DonneurOrdre_1.idDonneurOrdre = DonneurOrdreCommande_1.idDonneurOrdre INNER JOIN Commande AS Commande_1 ON DonneurOrdreCommande_1.idCommande = Commande_1.idCommande ON PDP_1.idPDP = Commande_1.idPDP WHERE (ISNULL(CAST(PDP_1.idEntreprise AS varchar), '') LIKE '%' + @idEntreprise + '%') AND (ISNULL(CAST(DocumentLangue_1.idLangue AS varchar), '') LIKE '%' + @idLangue + '%') AND (ISNULL(DonneurOrdre_1.Nom, '') LIKE '%' + @DonneurOrdre + '%') AND (Document_1.Type LIKE '%' + @Type + '%')">
        <SelectParameters>
            <asp:ControlParameter
                ControlID="LabelType"
                Name="Type"
                PropertyName="Text"
                Type="string" />
            <asp:ControlParameter
                ControlID="DropDownListEntreprise"
                DefaultValue="%"
                Name="idEntreprise"
                PropertyName="SelectedValue"
                Type="String" />
            <asp:ControlParameter
                ControlID="DropDownListLangue"
                DefaultValue="%"
                Name="idLangue"
                Type="String"
                PropertyName="SelectedValue" />
            <asp:ControlParameter
                ControlID="DropDownListCommanditaire"
                DefaultValue="%"
                Name="DonneurOrdre"
                Type="string"
                PropertyName="SelectedValue" />
        </SelectParameters>
    </asp:SqlDataSource>

    et voici le code behond de la page documennt.ascx

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
     
    mports System.IO
    Partial Class Modules_Document
        Inherits System.Web.UI.UserControl
     
     
        Public Function InitMode(ByVal Mode As FormViewMode, ByVal idDocument As String) As Boolean
            ViewState.Clear()
     
            InitMode = IsNumeric(idDocument) 'S'il y'a un document
     
            If InitMode Then
                ParamidDocument.Text = idDocument
                'On récupère son type (AVE, PDP, CGS)
                LabelPrefixe.Text = ExecuteSQL("Select Type From Document Where idDocument = " & ParamidDocument.Text.ToString).ToString
     
                Select Case LabelPrefixe.Text
                    Case "AVE"
                        LabelTypeText.Text = "de l'avenant"
                    Case "PDP"
                        LabelTypeText.Text = "du plan de prévention"
     
                    Case "CGS"
                        LabelTypeText.Text = "des consignes générales de sécurité"
                    Case "ADMIN\AVE"
                        LabelTypeText.Text = "modèle(s) de l'avenant"
                    Case "ADMIN\PDP"
                        LabelTypeText.Text = "modèle(s) du plan de prévention"
                    Case "ADMIN\CGS"
                        LabelTypeText.Text = "modèle(s) des consignes générales de sécurité"
                End Select
     
                LabelType.Text = LabelPrefixe.Text.Replace("ADMIN\", "")
                PanelLangueReadOnly.GroupingText = "Exemplaire(s) " & LabelTypeText.Text
                PanelLangue.GroupingText = "Exemplaire(s) " & LabelTypeText.Text
                LinkButtonAjouter.Text = "Ajouter un exemplaire " & LabelTypeText.Text
                'On affiche les bons panels suivant le mode de visualisation
                PanelLangueReadOnly.Visible = (Mode = FormViewMode.ReadOnly)
                PanelLangue.Visible = (Mode <> FormViewMode.ReadOnly)
            End If
     
        End Function
     
        Public Function SaveAndGetID() As Integer
            Try
                SaveAndGetID = CInt(ParamidDocument.Text)
            Catch ex As Exception
                SaveAndGetID = -1
            End Try
        End Function
     
        Public Shared Sub DeleteID(ByVal idDocument As String)
            If IsNumeric(idDocument) Then
                Dim idDocLng As Object
                idDocLng = ExecuteSQL("Select idLangue From DocumentLangue Where idDocument = " & idDocument)
                While IsNumeric(idDocLng)
                    DeleteLangueID(idDocument, idDocLng.ToString)
                    idDocLng = ExecuteSQL("Select idLangue From DocumentLangue Where idDocument = " & idDocument)
                End While
                ExecuteSQL("Delete From Document Where idDocument = " & idDocument)
            End If
        End Sub
     
        Public Shared Sub DeleteLangueID(ByVal idDocument As String, ByVal idLangue As String)
            If IsNumeric(idDocument) And IsNumeric(idLangue) Then
                Dim File As Object
                File = ExecuteSQL("Select Fichier From DocumentLangue Where idDocument = " & idDocument & " and idLangue = " & idLangue).ToString()
                If Not IsNothing(File) And File.ToString.Trim <> "" Then
                    If System.IO.File.Exists(Variable("FilePathSrv") & File) Then
                        System.IO.File.Delete(Variable("FilePathSrv") & File)
                    End If
                    ExecuteSQL("Delete From DocumentLangue Where idDocument = " & idDocument & " and idLangue = " & idLangue)
                End If
            End If
        End Sub
     
     
        'Bouton Ajouter un élément
        Protected Sub LinkButtonAjouter_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            PanelNouveau.Visible = True
            PanelLangue.Visible = False
            GridViewDoc.DataBind()
            GridViewDocVierge.DataBind()
            DropDownListLangueNew.DataBind()
            RadioButtonList1_SelectedIndexChanged(RadioButtonList1, Nothing)
        End Sub
     
        ' Affiche le bouton "ajouter" s'il existe une langue
        ' pour laquel il n'y a pas d'exemplaire du document
        Protected Sub SqlDataSourceLangueNew_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSourceLangueNew.Selected
            LinkButtonAjouter.Visible = (e.AffectedRows <> 0)
        End Sub
     
        'Bouton Annuler
        Protected Sub LinkButtonAnnuler_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButtonAnnuler.Click
            PanelNouveau.Visible = False
            PanelLangue.Visible = True
        End Sub
     
        'Procédure de création d'un nouveau document
        Protected Sub SaveDocument(ByVal Fichier As String)
     
            'Enregistrement dans la base de données
            With CType(FindControl("SqlDataSourceDocument"), SqlDataSource)
                With .InsertParameters
                    .Clear()
                    .Add("idDocument", ParamidDocument.Text.ToString)
                    .Add("Fichier", Fichier)
                    .Add("idLangue", ExecuteSQL("Select idLangue From Langue where CodeLangue = '" & DropDownListLangueNew.SelectedValue & "'").ToString)
                End With
                .Insert()
            End With
     
     
        End Sub
     
        Function FindNewDocumentLocation(ByVal Extension As String) As String
            'Création du nom du nouveau fichier
            FindNewDocumentLocation = LabelPrefixe.Text.ToString + "-"
            If Not LabelPrefixe.Text Like "*ADMIN\*" Then
                FindNewDocumentLocation = FindNewDocumentLocation + ParamidDocument.Text.ToString + "-"
            End If
            FindNewDocumentLocation = FindNewDocumentLocation + DropDownListLangueNew.SelectedValue
            FindNewDocumentLocation = FindNewDocumentLocation + Extension
        End Function
     
        ' Affichage suivant le choix de la source de copie
        Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged
            Select Case RadioButtonList1.SelectedValue
                Case "Copie"
                    PanelCopie.Visible = True
                    PanelVierge.Visible = False
                    'PanelVide.visible = False
                    'panelUpload.visivle=False 
     
     
                Case "Vierge"
                    PanelVierge.Visible = True
                    PanelCopie.Visible = False
                    'PanelVide.visible = False
                    'panelUpload.visivle=False 
     
                    'Case "Vide"
                    'PanelVierge.Visible = False
                    'PanelCopie.Visible = False
                    'PanelVide.Visible = True
                    'PanelUpload.Visible = False
                    'Case "Fichier"
                    'PanelVierge.Visible = False
                    ' PanelCopie.Visible = False
                    'PanelVide.Visible = False
                    'PanelUpload.Visible = True
            End Select
        End Sub
     
     
        'Selection du document à copier
        Protected Sub GridViewDoc_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim GV As GridView = CType(sender, GridView)
            Dim FichierSource As String
            Dim FichierDestination As String
            'Dim AppWord As New Microsoft.Office.Interop.Word.Application
     
            FichierSource = GV.DataKeys(GV.SelectedRow.RowIndex)("Fichier").ToString
            FichierDestination = FindNewDocumentLocation(FichierSource.Substring(FichierSource.LastIndexOf(".")))
     
            'Création du nouveau document
     
            System.IO.File.Copy(Variable("FilePathSrv") & FichierSource, _
                    Variable("FilePathSrv") & FichierDestination, True)
     
            'INSERTION DES données du pdp
            'Dim w As Microsoft.Office.Interop.Word.Document = AppWord.Documents.Add("S:\PDP\Admin\PDP-FR.docx")
            'w.Bookmarks("IDPDP").Range.Text = "4"
            SaveDocument(FichierDestination)
     
            GV.SelectedIndex = -1 'Déselection
            'Actualisation et retour à l'affichage normal
            DropDownListLangueNew.DataBind()
            PanelNouveau.Visible = False
            PanelLangue.Visible = True
        End Sub
     
        ' Protected Sub LinkButtonAjouterVide_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButtonAjouterVide.Click
        'Dim FichierDestination As String
        '
        '   With Variable("EmptyFile")
        '      FichierDestination = FindNewDocumentLocation(.Substring(.LastIndexOf(".")))
        ' End With
        '
        '   If System.IO.File.Exists(Variable("FilePathSrv") & Variable("EmptyFile")) Then
        '      System.IO.File.Copy(Variable("FilePathSrv") & Variable("EmptyFile"), _
        '         Variable("FilePathSrv") & FichierDestination, True)
        '
        '   SaveDocument(FichierDestination)
        '  DropDownListLangueNew.DataBind()
        ' PanelNouveau.Visible = False
        ' PanelLangue.Visible = True
        'End If
        '
        'End Sub
     
        'Initialisation des DropDownList de recherche
        Protected Sub DropDownListClear_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim DDL As DropDownList = CType(sender, DropDownList)
            'On efface tout
            DDL.ClearSelection()
            DDL.Items.Clear()
            'Ajout de l'élément vide
            DDL.Items.Add("")
        End Sub
     
        Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
            e.Cancel = True
            DeleteLangueID(e.Keys("idDocument"), e.Keys("idLangue"))
            GridView1.DataBind()
        End Sub

    y a t'il une personne qui peut m'aider, s'il vous plait ?

    merci d'avance,

    cordialement

  2. #2
    Membre Expert
    Avatar de Nicolas Esprit
    Homme Profil pro
    Consultant en technologies
    Inscrit en
    Février 2010
    Messages
    1 467
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France

    Informations professionnelles :
    Activité : Consultant en technologies
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Février 2010
    Messages : 1 467
    Par défaut
    Bonjour,

    Citation Envoyé par yassin-59 Voir le message
    alors que ce matin tout fonctionné parfaitemenent
    et tu as modifié quoi depuis ce matin ?

  3. #3
    Membre averti
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    49
    Détails du profil
    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2010
    Messages : 49
    Par défaut
    bonjour,
    je n'ai rien modifié, je pense que l'iddocument n'est plus pris en compte car c'est avec cette valeur que cette page peut fonctionner.

Discussions similaires

  1. Probleme de lien
    Par coaster dans le forum Bases de données
    Réponses: 1
    Dernier message: 22/05/2005, 12h03
  2. [xHTML]Probleme pour liens ht
    Par ThitoO dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 17/01/2005, 11h52
  3. [JSP][Struts][Debutant]Probleme de liens dans pages JSP
    Par bluefox_du_974 dans le forum Servlets/JSP
    Réponses: 5
    Dernier message: 08/12/2004, 16h17
  4. [débutante]Probleme de liens image dans JSP/Servlet
    Par celine31 dans le forum Servlets/JSP
    Réponses: 2
    Dernier message: 24/11/2004, 15h51
  5. [Win'Design] Probleme de lien
    Par Machjaghjolu dans le forum Autres
    Réponses: 8
    Dernier message: 08/11/2004, 11h50

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo