<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LimitiViolati.aspx.cs" Inherits="OlympiaIntranet.LimitiViolati" %>

<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Limiti Violati</title>
</head>
<body>
    <form id="form1" runat="server">
        <table>
            <tr>
                <td>
                    <div>
                        <dx:ASPxFormLayout ID="ASPxFormLayout1" runat="server" ColCount="2" EnableTheming="True" Theme="Aqua" ColumnCount="2">
                            <Items>
                                <dx:LayoutGroup Caption="Controllo Limiti Violati" ColCount="5" ColSpan="1" ColumnCount="5">
                                    <Items>
                                        <dx:LayoutItem Caption="Gestore" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxGridLookup ID="gridLookupGestore" runat="server" 
                                                        Theme="Aqua" 
                                                        DataSourceID="SqlDSGestori" 
                                                        DropDownStyle="DropDownList" 
                                                        EnableTheming="True" 
                                                        KeyFieldName="Gestore" 
                                                        TextFormatString="{0}" 
                                                        AutoPostBack="true"
                                                        OnValueChanged="gridLookupGestore_ValueChanged">
                                                        <GridViewProperties>
                                                            <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" EnableRowHotTrack="True" />
                                                            <SettingsPager Mode="ShowAllRecords" />
                                                        </GridViewProperties>
                                                        <Columns>
                                                            <dx:GridViewDataTextColumn FieldName="Gestore" Caption="Gestore" />
                                                        </Columns>
                                                    </dx:ASPxGridLookup>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                        <dx:LayoutItem Caption="" ColSpan="1" ShowCaption="False">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxLabel ID="lblMeseRiferimento" runat="server" Text="" Theme="Aqua" Font-Bold="True" Font-Size="Medium" />
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                    </Items>
                                </dx:LayoutGroup>
                            </Items>
                        </dx:ASPxFormLayout>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div>
                        <dx:ASPxGridView ID="gvLimitiViolati" runat="server" 
                            EnableTheming="True" 
                            Theme="Office2010Blue" 
                            AutoGenerateColumns="False"                             
                            KeyFieldName="Id"
                            OnRowUpdating="gvLimitiViolati_RowUpdating"
                            OnCellEditorInitialize="gvLimitiViolati_CellEditorInitialize"
                            OnDataBound="gvLimitiViolati_DataBound"
                            OnCancelRowEditing="gvLimitiViolati_CancelRowEditing"
                            OnHtmlDataCellPrepared="gvLimitiViolati_HtmlDataCellPrepared"
                            OnDataBinding="gvLimitiViolati_DataBinding">
                            <SettingsPager Mode="ShowAllRecords" />
                            <Settings  ShowFilterRow="True" ShowHeaderFilterButton="True" ShowFilterBar="Visible" VerticalScrollBarMode="Visible" VerticalScrollableHeight="750" />
                            <SettingsBehavior FilterRowMode="Auto" AllowFocusedRow="True" />
                            <SettingsEditing Mode="Inline" />

                            <SettingsPopup>
                                <FilterControl AutoUpdatePosition="False" />
                            </SettingsPopup>

                            <SettingsFilterControl ViewMode="VisualAndText" />
                            
                            <Columns>
                                <dx:GridViewCommandColumn ShowEditButton="True" VisibleIndex="0" Width="70px" Caption=" " />
                                <dx:GridViewDataTextColumn FieldName="Id" VisibleIndex="1" Visible="false" ReadOnly="true" />
                                <dx:GridViewDataTextColumn FieldName="Portafoglio" Caption="Portafoglio" VisibleIndex="2" ReadOnly="true" Width="100px" />
                                <dx:GridViewDataTextColumn FieldName="Intestazione" Caption="Intestazione" VisibleIndex="3" ReadOnly="true" Width="200px" />
                                <dx:GridViewDataTextColumn FieldName="Gestore" Caption="Gestore" VisibleIndex="4" ReadOnly="true" Width="100px" />
                                <dx:GridViewDataTextColumn FieldName="Limite" Caption="Limite" VisibleIndex="5" ReadOnly="true" Width="100px" />
                                <dx:GridViewDataTextColumn FieldName="Descrizione" Caption="Descrizione" VisibleIndex="6" ReadOnly="true" Width="200px" />
                                <dx:GridViewDataTextColumn FieldName="PesoMinimo" Caption="Peso Min" VisibleIndex="7" ReadOnly="true" Width="80px">
                                    <PropertiesTextEdit DisplayFormatString="N2" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="PesoMassimo" Caption="Peso Max" VisibleIndex="8" ReadOnly="true" Width="80px">
                                    <PropertiesTextEdit DisplayFormatString="N2" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="PesoInPortafoglio" Caption="Peso Ptf" VisibleIndex="9" ReadOnly="true" Width="80px">
                                    <PropertiesTextEdit DisplayFormatString="N2" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="Note" Caption="Note" VisibleIndex="10" ReadOnly="true" Width="150px" />
                                <dx:GridViewDataMemoColumn FieldName="Commento" Caption="Commento" VisibleIndex="11" Width="250px">
                                    <PropertiesMemoEdit Rows="3" />
                                </dx:GridViewDataMemoColumn>
                                <dx:GridViewDataCheckColumn FieldName="BloccoCommento" Caption="Bloccato" VisibleIndex="12" Width="70px" />
                                <dx:GridViewDataTextColumn FieldName="DataRiferimento" Caption="Data Rif." VisibleIndex="13" ReadOnly="true" Visible="false" />
                                <dx:GridViewDataTextColumn FieldName="MeseRiferimento" Caption="Mese" VisibleIndex="14" ReadOnly="true" Visible="false" />
                            </Columns>
                        </dx:ASPxGridView>
                    </div>
                </td>
            </tr>
        </table>
        
        <asp:SqlDataSource ID="SqlDSGestori" runat="server" 
            ConnectionString="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection %>"  
            SelectCommand="GDN_ElencoGestoriLimitiViolati" 
            SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:SessionParameter Name="IsRiskManager" SessionField="is_risk" DbType="Boolean" />
            </SelectParameters>
        </asp:SqlDataSource>

    </form>
</body>
</html>
