<%@ Page Title="" Language="C#" MasterPageFile="~/helpdesk/Pc.master" AutoEventWireup="true" CodeBehind="pc_addeditasset.aspx.cs" Inherits="helpdesk.helpdesk.pc_addeditasset" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">











 

 
 
    <div>
    
    
 



          
        






<div id=sm>添加修改资材</div>
  <div   class=content >
 
     
       <asp:Panel runat="server" ID="pnl_detail">
       <table class="table table-hover">
     
           
           <tr >     
     
          <th width="20%"  >  资材名称  </th>
       
          <td width="30%">
             <asp:TextBox ID="txt_assetname"  ClientIDMode="Static"  CssClass="form-control" runat="server"  ></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txt_assetname" runat="server" ErrorMessage="必须输入资材名称" Display="Dynamic"></asp:RequiredFieldValidator>  
           
          </td>
         
              
                
         <th  width="20%">制造商</th>
          <td width="30%"> 
             
               <asp:TextBox ID="txt_manufacturer"  CssClass="form-control"  runat="server"  ></asp:TextBox>
               
             </td>
             </tr>
           
            

              


             
           <tr >     
     
          <th    >  IP  </th>
       
          <td  >
             <asp:TextBox ID="txt_ip"  ClientIDMode="Static" CssClass="form-control" runat="server"  ></asp:TextBox>
              
          </td>
         
              
                
         <th  >MAC</th>
          <td  > 
             
               <asp:TextBox ID="txt_mac" ClientIDMode="Static"  CssClass="form-control"  runat="server"  ></asp:TextBox>
               
             </td>
             </tr>




           
           <tr>
                     
         <th >资材类别</th>
          <td  > 
              <asp:DropDownList ID="ddl_types" CssClass="form-control" runat="server">
            
              </asp:DropDownList>
             
            </td>
           


                 <th >使用状态</th>
          <td  > 
                   <asp:DropDownList ID="ddl_usestatus" CssClass="form-control" runat="server">
              </asp:DropDownList>
             
            </td>
           

           </tr>





                   <tr>      
         <th >所属组织:</th>
          <td > 
             
              <asp:TextBox ID="txt_belongto" runat="server"  CssClass="form-control"    ></asp:TextBox>
              
            </td>
            
     
          <th >使用部门</th>
          <td  >
                <asp:TextBox ID="txt_dept" runat="server"  CssClass="form-control"    ></asp:TextBox>
          
           </td>
          </tr>


           
                   <tr>      
         <th >使用人:</th>
          <td > 
             
              <asp:TextBox ID="txt_enduser" runat="server"  CssClass="form-control"    ></asp:TextBox>
              
            </td>
            
     
          <th >连接类型</th>
          <td  >
                <asp:TextBox ID="txt_connecttype" runat="server"  CssClass="form-control"    ></asp:TextBox>
          
           </td>
          </tr>




           


            <tr>
                 <td colspan="4"  style="border:0px; background-color:#e0e0e0; height:10px;" ></td>


            </tr>





          
          
                   <tr >     
              
              
          <th  >外设序列号</th>
          <td >
                <asp:TextBox ID="txt_serialno" CssClass="form-control" runat="server"></asp:TextBox>
           </td>
           
       
           
             <th  >存储位置:</th>
          <td > 
              <asp:TextBox ID="txt_storeplace" CssClass="form-control" runat="server"></asp:TextBox>
            </td>
            
     
          </tr>
          
          
          
           
          
          
           
           
          
        <tr >     
                
         <th  >购买时间:</th>
          <td > 
             
              <asp:TextBox ID="txt_buydate" runat="server"   CssClass="form-control" onClick="javascript:ShowCalendar(this)"  ></asp:TextBox>
              
            </td>
            
     
          <th   >保修到期日</th>
          <td >
              <asp:TextBox ID="txt_expiredate" runat="server"  CssClass="form-control" onClick="javascript:ShowCalendar(this)" ></asp:TextBox>
		
           </td>
          </tr>
          
           

           <tr>      
         <th >产品供应商:</th>
          <td > 
             
              <asp:TextBox ID="txt_provider" runat="server"  CssClass="form-control"    ></asp:TextBox>
              
            </td>
            
     
          <th >产品价格 </th>
          <td  >
                <asp:TextBox ID="txt_price" runat="server"  CssClass="form-control"    ></asp:TextBox>
          
           </td>
          </tr>



                
         <tr>      
         <th >联系人姓名:</th>
          <td > 
             
              <asp:TextBox ID="txt_contactname" runat="server"  CssClass="form-control"    ></asp:TextBox>
              
            </td>
            
     
          <th >联系人电话</th>
          <td  >
                <asp:TextBox ID="txt_contacttel" runat="server"  CssClass="form-control"    ></asp:TextBox>
          
           </td>
          </tr>





          
          
              <tr >     
                
         <th >预留字段1:</th>
          <td  > 
             
              <asp:TextBox ID="txt_prev1" runat="server"   CssClass="form-control"   ></asp:TextBox>
              
            </td>
            
     
          <th  >预留字段2</th>
          <td >
              <asp:TextBox ID="txt_prev2" runat="server"   CssClass="form-control"    ></asp:TextBox>
		
           </td>
          </tr>
          
        
                <tr>

              <th>备注<br />

                <span style="color:gray">  可填写硬件合同说明，官网，型号等信息

                    </span>
              </th>

              <td colspan="3">

  <asp:TextBox runat="server" Width="700px" CssClass="form-control" Height="60px" TextMode="MultiLine" ID="txt_notes"></asp:TextBox>
      

              </td>

          </tr>
 
 
</table>
        
       
</asp:Panel>

 
              
           
      
      
      
      
      <div style="text-align:center; width:90%">
           <asp:Button ID="btn_add" runat="server"  
               
                 OnClientClick="if(isAddConflict()) return false;"
               
                OnClick="softadd_Click" class="btn btn-flat btn-sm btn-primary"   Text="添加外设" />
           
 
          <asp:Button ID="btn_update" runat="server"  class="btn btn-flat btn-sm btn-primary "  
              
               OnClientClick="if(isEditConflict()) return false;"
              
               onclick="updated_Click" Text="更新" />
           <asp:Button ID="btn_del" runat="server"  class="btn btn-flat btn-sm  btn-danger"  onclick="del_Click" Text="删除" />
          </div>
         


       



    </div>
 </div>










    <script>

        

        function isEditConflict() {
          
            _name = "";
            _assetname = $("#txt_assetname").val();
            _ip = $("#txt_ip").val();
            _mac = $("#txt_mac").val();
            _id=<%=id %>;
            var result = true;
           
            $.ajax({
                url: "ajax/chk_asset_edit.aspx",
                async: false,
                cache: false,
                data: {
                    name: escape(_name),
                    assetname: escape(_assetname),
                    ip: escape(_ip),
                    mac: escape(_mac),
                    id:_id,
                    types:"asset"
                },
                success: function (data) {
                 

                    if (data == "name") {
                        alert("机器名冲突");
                        result = true;
                        return;
                    }

                    if (data == "assetname") {
                        alert("资产名冲突");
                        result = true;
                        return;
                    }


                    if (data == "ip") {
                        alert("IP冲突");
                        result = true;
                        return;
                    }

                    if (data == "mac") {
                        alert("MAC冲突");
                        result = true;
                        return;
                    }

                    result = false;
                }




            });

            return result;
        }





     function isAddConflict()
                  {
                      _name ="";
                      _assetname = $("#txt_assetname").val();
                      _ip = $("#txt_ip").val();
                      _mac = $("#txt_mac").val();
                   
                      var result = true;

                      $.ajax({
                          url: "ajax/chk_asset.aspx",
                          async: false,
                          cache:false,
                          data: {
                              name: escape(_name),
                              assetname: escape(_assetname),
                              ip: escape(_ip),
                              mac: escape(_mac)
                          },
                          success: function (data) {
                            

                              if (data == "name")
                              {
                                  alert("机器名冲突");
                                  result = true;
                                  return;
                              }
                              
                              if (data == "assetname") {
                                  alert("资产名冲突");
                                  result = true;
                                  return;
                              }


                              if (data == "ip") {
                                  alert("IP冲突");
                                  result = true;
                                  return;
                              }

                              if (data == "mac") {
                                  alert("MAC冲突");
                                  result = true;
                                  return;
                              }

                              result = false;
                          }




                      });

                      return result;
                  }


        
    </script>


</asp:Content>
