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> | 
Partager