<%@ page language="C#" autoeventwireup="true" inherits="general_SystemManage_ProductTypeList, CrmCommand" %>

<%@ Register TagPrefix="C1WebGrid" Namespace="C1.Web.C1WebGrid" Assembly="C1.Web.C1WebGrid.2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>产品信息</title>
    <script src="../../Javascript/CheckALL.js" type="text/javascript"></script>
    <script language=javascript type="text/javascript">
   function OpenWin(str)
   {
      var id=document.getElementById("Hidden1").value;
      var url=str+"&Product_id="+id;
      if(str.indexOf("edit")>-1)
      {
         if(id=="0" || id=="")
         {
           alert('请您选择需要修改的产品类型！');
         }
         else
         {
              var R=  window.showModalDialog(url,"水平","dialogWidth=460px;dialogHeight=260px");
              if(R != null)
              {
                  var keys = R.split('|');
                  if(keys[0] == "ok")
                  {
                    parent.proleft.location.reload();
                     location.href = 'ProductInfo.aspx?Type_Id='+keys[1];
                   
                  }
              }
         }
     }
    else
    {
       var R=window.showModalDialog(url,"水平","dialogWidth=460px;dialogHeight=260px");
        if(R != null)
              {
           var keys = R.split('|');
            if(keys[0] == "ok")
                  {
                     
                     parent.proleft.location.reload();
                     location.href = 'ProductInfo.aspx?Type_Id='+keys[1];
                  }
              }
     }
   }
  
function ok()
{
 var id=document.getElementById("Hidden1").value;
 if(id=="0" || id=="")
 {
   
   alert('请您选择要删除的产品类型！');
   return false;
 }
 else
 {
     if(confirm('真的要删除此产品类型吗!'))
     {
       
       return true;
     }
     else
     {
      return false;
     }
 }
}

function OpenPro(str)
   {
      var id=document.getElementById("Hidden1").value;
    
       var url=str+"&Product_id="+id;
     
      if(id != "0")
      {
       var R=window.showModalDialog(url,"水平","dialogWidth=500px;dialogHeight=260px");
     
       if(R == "ok")
       {
            location.reload();
       }
       
       else if(R != null)
       {
          alert('你必须选择一个类别!');
        
       }
      }
  
   }
function CheckPro(formName,chkName,str)
{
    var i=0;
    var pronameid;
    var objForm = document.forms[formName];
    var objLen = objForm.length;
    for (var iCount = 0; iCount < objLen; iCount++)
    {
		if (objForm.elements[iCount].type == "checkbox")
		{
		     
		     if((objForm.elements[iCount].name.indexOf(chkName)>-1))
		     {
		          if( objForm.elements[iCount].checked )
		          {
		             i=i+1;
		             pronameid=objForm.elements[iCount].value;
		          }

			 }
		}
		
    }
    if(i>0)
    {
        if(i>1)
        {
          alert('只允许选择一条产品信息来进行编辑！');
        }
        else
        {
          
          var url=str+"&Product_id="+pronameid;
          var R=window.showModalDialog(url,"水平","dialogWidth=460px;dialogHeight=260px");
            if(R == "ok")
           {
                parent.proleft.location.reload();
                location.reload();
           }
        }
    }
    else
    {
     alert('必须选择一条数据进行编辑！');
    }
}
function ChkOk(formName,chkName)
{
    var i=0;
    var objForm = document.forms[formName];
    var objLen = objForm.length;
    for (var iCount = 0; iCount < objLen; iCount++)
    {
		if (objForm.elements[iCount].type == "checkbox")
		{
		     
		     if((objForm.elements[iCount].name.indexOf(chkName)>-1))
		     {
		          if( objForm.elements[iCount].checked )
		          {
		             i=i+1;
		            
		          }

			 }
		}
		
    }
    if(i>0)
    {
       return confirm('确定删除选定的产品类型吗？');
      
    }
    else
    {
      alert('必须选择一条数据删除！');
      return false;
    }
}
function Valion()
{
  var pro=document.getElementById("TxtName").value;
  if(pro=="")
  {
  
    alert('产品名称不能为空');
    return false;
  }
  else
  {
   return true;
  }
}
function OpenOther(url)
{
  var R=window.showModalDialog(url,"水平","dialogWidth=500px;dialogHeight=320px");
    if(R == "ok")
           {
                location.reload();
           }
}
    </script>
    
</head>
<body class="bodycolor" leftmargin="0" topmargin="0">
    <form id="form1" runat="server">
    <div>
    	<TABLE class="small" cellSpacing="1" cellPadding="1" width="550" align="center" bgColor="#000000"
					border="0">
            <tr>
                <td class="TableHeader" colspan="3"><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                </td>
            </tr>
					
        
				   <tr>
				   <td align=center noWrap class="TableData" valign=top colspan=3> <C1WebGrid:C1WebGrid ID="C1WebGrid1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CallbackOptions="Selection, Sorting" 
            DataKeyField="ProductType_Id"  OnItemCreated="C1WebGrid1_ItemCreated"
            OnPageIndexChanging="C1WebGrid1_PageIndexChanging" OnSortingCommand="C1WebGrid1_SortingCommand" SkinID="gridviewSkin" Width="500px" >
            <Columns>
                <C1WebGrid:C1TemplateColumn ><HeaderTemplate>
                    <input id="all" type="checkbox"  value="全选" onclick="CheckAll('form1','item','all')" /></HeaderTemplate> <ItemTemplate > <input id="item" type="checkbox" runat=server value='<%#Eval("ProductType_Id") %>'  /></ItemTemplate>
                    <ItemStyle Width="40px" />
                </C1WebGrid:C1TemplateColumn>
               
                <C1WebGrid:C1BoundColumn DataField="ProducTypet_Name"  HeaderText="产品类型名称" SortExpression="Exp1">
                </C1WebGrid:C1BoundColumn>

                        <C1WebGrid:C1TemplateColumn HeaderText="产品类型说明">
                <ItemStyle Width="250px" />
                <ItemTemplate>
                    <asp:Label     ID="Lkb" Text='<%# Server.HtmlDecode(Eval

("ProductType_Remark").ToString()).Length > 20 ? Server.HtmlDecode(Eval

("ProductType_Remark").ToString()).Substring(0, 19) + "..." : Server.HtmlDecode

(Eval("ProductType_Remark").ToString())%>'  ToolTip='<%# Server.HtmlDecode(Eval

("ProductType_Remark").ToString())%>' runat="server"></asp:Label>
 
                </ItemTemplate>
            </C1WebGrid:C1TemplateColumn>
             
               

            		</Columns>
        </C1WebGrid:C1WebGrid>
                      </td>
				   </tr>
			    <tr>
                <td  class="TableData" colspan="3" align="center">
                            <input id="Button1" class="BigButton"  type="button" value="新建产品类型" onclick="OpenWin('TypeAdd.aspx?Method=add')" />
                            <input id="Button2" class="BigButton"  type="button" value="修改产品类型" onclick="CheckPro('form1','item','TypeAdd.aspx?Method=edit')"  />
                            <asp:Button ID="Button6" CssClass ="BigButton" OnClientClick="return ChkOk('form1','item')" runat="server" Text="删除产品类型" OnClick="Button6_Click" /></td>
            </tr>
				</TABLE>
        <input id="Hidden1" type="hidden" runat=server />
 
       
    </div>
        
    
    </form>
</body>
</html>