<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation = "false" CodeBehind="SystemParam.aspx.cs" 
Inherits="SmartLogonServer.SystemParam" %>

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <!--必须的css引用-->
    <link href="Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="Content/bootstrap-table/bootstrap-table.min.css"  rel="stylesheet" />
<link href="Content/bootstrap-table/extensions/fixed-column/bootstrap-table-fixed-columns.css"  rel="stylesheet" />
    <link href="Content/toastr/toastr.min.css"  rel="stylesheet" />
</head>
<body>
    <div class="row"  style="padding:10px;"> 
        <div class="col-sm-10"><%=GetString("C0021") %></div>
     </div>   
          <div class="row"  style="padding:10px;"> 
          <div class="col-sm-2"><label for="edtComputerDomain" ><%=GetString("D0021") %></label></div> 
          <div class="col-sm-6"><input type="text" id="edtComputerDomain"  name="edtComputerDomain" class="form-control" placeholder=<%=GetQuoteString("D0021") %> /></div> 
          <div class="col-sm-2"><button type="button"  class="btn btn-primary" onclick="saveparam('advalue','edtComputerDomain')"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button></div> 

         </div>

       
            <div class="row"  style="padding:10px;"> 
                <div class="col-sm-2"><label><%=GetString("D0102") %></label> </div>
                <div class="col-sm-6">
            <img id="imgshow" width="128" height="128"  src=""/>
            <input type="file" class="form-control" accept="image/*"  id="customFile" style="display: none;" />
            
            <button type="button" class="btn btn-primary btn-lg" onclick="$('#customFile').click()" ><%=GetString("D0025") %></button>
                <label><%=GetString("D0033") %></label>
                    </div>
            </div>   
         
          <div class="row"  style="padding:10px;"> 
          <div class="col-sm-2"><label for="edtComputerDomain" ><%=GetString("D0026") %></label></div> 
          <div class="col-sm-6"><input type="text" id="edtLogonUIText1"  name="edtLogonUIText1" class="form-control" placeholder="刷卡登录" /></div> 
          <div class="col-sm-2"><button type="button" onclick="saveparam('line1','edtLogonUIText1')" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button></div> 

         </div>
                    <div class="row"   style="padding:10px;"> 
          <div class="col-sm-2"><label for="edtComputerMemo" ><%=GetString("D0027") %></label></div> 
          <div class="col-sm-6"><input type="text" id="edtLogonUIText2"  name="edtLogonUIText2"   class="form-control" placeholder="友我科技"/></div> 
          <div class="col-sm-2"><button type="button" onclick="saveparam('line2','edtLogonUIText2')" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button></div> 

         </div>
           <div class="row "   style="padding:10px;"> 
             <div class="col-sm-2"><label for="edtComputerDomain" ><%=GetString("D0028") %></label></div> 
          <div class="col-sm-6 form-check">
              <input type="radio" id="showeditauto"  name="showeditauto" value="0"  />
             <label class="form-check-label" for="showeditauto"><%=GetString("D0029") %></label>

              <input type="radio" id="showedityes"  name="showeditauto"   value="1"  />
             <label class="form-check-label" for="showedityes"><%=GetString("D0030") %></label>

              <input type="radio" id="showeditno"  name="showeditauto"   value="2"  />
             <label class="form-check-label" for="showeditno"><%=GetString("D0031") %></label>

              <input type="radio" id="cardkey"  name="showeditauto"   value="3"  />
             <label class="form-check-label" for="cardkey"><%=GetString("D0032") %></label>
          </div> 
               <div class="col-sm-2"><button type="button" onclick="saveparamforcheck('uipwd','showeditauto')" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button></div> 
         </div>                





         <div class="row" style="padding:10px;">         
                                
          <div class="col-sm-2"><label ><%=GetString("D0035") %></label> </div>
          <div class="col-sm-6">
            
              <input type="radio" name="outoftime" class="form-check-input" id="outtime0" value="0" />
              <label class="form-check-label" for="outtime0"><%=GetString("D0036") %></label>
    
              <input type="radio" name="outoftime" class="form-check-input" id="outtime1" value="1" />
              <label class="form-check-label" for="outtime1"><%=GetString("D0037") %></label>

              <input type="radio" name="outoftime" class="form-check-input" id="outtime2" value="2" />
              <label class="form-check-label" for="outtime2"><%=GetString("D0038") %></label>

              <input type="radio" name="outoftime" class="form-check-input" id="outtime3" value="3" />
              <label class="form-check-label" for="outtime3"><%=GetString("D0039") %></label>

              <input type="radio" name="outoftime" class="form-check-input" id="outtime4" value="4" />
              <label class="form-check-label" for="outtime4"><%=GetString("D0040") %></label>
            </div>
            <div class="col-sm-2"><button type="button"  onclick="saveparamforcheck('outoftime','outoftime')"  class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button></div> 

          </div>
        
               
          <div class="row" style="padding:10px;">         
                                
          <div class="col-sm-2"><label><%=GetString("D0041") %></label> </div>
          <div class="col-sm-6">
             
              <input type="radio" name="outofcard" class="form-check-input" id="outcard0" value="0" />
              <label class="form-check-label" for="outcard0"><%=GetString("D0036") %></label>

              <input type="radio" name="outofcard" class="form-check-input" id="outcard1" value="1" />
              <label class="form-check-label" for="outcard1"><%=GetString("D0037") %></label>

              <input type="radio" name="outofcard" class="form-check-input" id="outcard2" value="2" />
              <label class="form-check-label" for="outcard2"><%=GetString("D0038") %></label>

              <input type="radio" name="outofcard" class="form-check-input" id="outcard3" value="3" />
              <label class="form-check-label" for="outcard3"><%=GetString("D0039") %></label>

              <input type="radio" name="outofcard" class="form-check-input" id="outcard4" value="4" />
              <label class="form-check-label" for="outcard4"><%=GetString("D0040") %></label>
            </div>
            <div class="col-sm-2"><button type="button" onclick="saveparamforcheck('outofcard','outofcard')" class="btn btn-primary"><span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span><%=GetString("B0026") %></button></div> 
          </div>
          
                   
        


        <!--必须的js文件-->
        <script src="Content/jquery-1.9.1.min.js"></script>
        <script src="Content/bootstrap/js/bootstrap.min.js"></script>
        <script src="Content/bootstrap-table/bootstrap-table.min.js"></script>
        <script src="Content/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="Content/bootstrap-table/extensions/fixed-column/bootstrap-table-fixed-columns.js"></script>
            <script src="Content/toastr/toastr.min.js"></script>
        <script src="Content/sweetalert/sweetalert.min.js"></script>
        <script type="text/javascript">
        

            $(function () {
                $.ajax({
                    type: "post",
                    url: "getsysparam.ashx",
                    data: {
                        'mode': 'get'
                    },
                    dataType: 'JSON',
                    success: function (data, status) {
                        if (status == "success") {
                            
                            if (data.result == true) {
                                $("input[name='edtComputerDomain']").val(data.advalue);
                                $("input[name='edtLogonUIText1']").val(data.line1);
                                $("input[name='edtLogonUIText2']").val(data.line2);

                                $("input:radio[name='showeditauto'][value='" + data.uipwd + "']").attr("checked", true);
                                $("input:radio[name='outoftime'][value='" + data.outoftime + "']").attr("checked", true);
                                $("input:radio[name='outofcard'][value='" + data.outofcard + "']").attr("checked", true);

                                $("#imgshow").attr("src", data.img);
                            }
                            else {
                                toastr.error(<%=GetQuoteString("D0103") %>);
                            }
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("D0103") %>);
                    },
                    complete: function () {

                    }

                });

            });
            
            
            $("#customFile").change(function (e) {
                //获取目标文件
                var file = e.target.files || e.dataTransfer.files;
                //如果目标文件存在
                if (file) {
                    //定义一个文件阅读器
                    var reader = new FileReader();
                    //文件装载后将其显示在图片预览里
                    reader.onload = function () {
                        $("#imgshow").attr("src", this.result);

                        saveparamimg(this.result);
                    }
                    //装载文件
                    reader.readAsDataURL(file[0]);

                    
                }
            });

            var saveparam = function (key, valueedit) {
                $.ajax({
                    type: "post",
                    url: "savesysparam.ashx",
                    data: {
                        'key': key,
                        'value': $("#" + valueedit).val()
                    },
                    dataType: 'JSON',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data.result == true) {
                                toastr.success(<%=GetQuoteString("C0005") %>);
                            }
                            else {
                                toastr.error(<%=GetQuoteString("C0006") %>);
                            }
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("C0006") %>);
                    },
                    complete: function () {

                    }

                });

            }

            var saveparamforcheck = function (key, valueedit) {

     
                $.ajax({
                    type: "post",
                    url: "savesysparam.ashx",
                    data: {
                        'key': key,
                        'value': $("input:radio[name='" + valueedit + "']:checked").val()
                    },
                    dataType: 'JSON',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data.result == true) {
                                toastr.success(<%=GetQuoteString("C0005") %>);
                            }
                            else {
                                toastr.error(<%=GetQuoteString("C0006") %>);
                            }
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("C0006") %>);
                    },
                    complete: function () {

                    }

                });

            }

            var saveparamimg = function (img) {
                $.ajax({
                    type: "post",
                    url: "savesysparam.ashx",
                    data: {
                        'key': 'img',
                        'value': img
                    },
                    dataType: 'JSON',
                    success: function (data, status) {
                        if (status == "success") {
                            if (data.result == true) {
                                toastr.success(<%=GetQuoteString("C0005") %>);
                            }
                            else {
                                toastr.error(<%=GetQuoteString("C0006") %>);
                            }
                        }
                    },
                    error: function () {
                        toastr.error(<%=GetQuoteString("C0006") %>);
                    },
                    complete: function () {

                    }

                });

            }




       
      

            toastr.options.positionClass = 'toast-top-center';
        </script>
</body>
</html>
