/// <summary>
    /// 上传excel
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btn_excel_Click(object sender, EventArgs e)
    {
        if (upExcelFile.PostedFile.FileName.Length < 1)
        {
            this.lbl_result.Text = "请选择要上传的Excel文件!";
            return;
        }
        else
        {
            this.initvalidate();
        }
        string filename = upExcelFile.PostedFile.FileName;
        string subfile  = filename.Substring(filename.LastIndexOf(".") + 1);

        if (subfile.ToUpper() != "XLS" && subfile.ToUpper() != "XLSX")
        {
            this.lbl_result.Text = "导入文件格式错误,必须为XLS,XLSX格式!";
            ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_result.Text);
        }
        else
        {
            try
            {
                //获取企业上传文件路径
                string upfilepath = ProductInfoBus.GetCompanyUpFilePath(userinfo.CompanyCD);//得到格式如:"D:\zhou"
                //获取企业并构造企业上传文件名称
                Session["newfile"] = DateTime.Now.ToString("yyyyMMddhhmmss") + filename.Substring(filename.LastIndexOf("\\") + 1);
                //Session["newfile"] = "product1111.xls";
                upExcelFile.PostedFile.SaveAs(upfilepath + @"\" + Session["newfile"].ToString());
                this.lbl_result.Text = "Excel文件上传成功!";
                this.setup1.Enabled  = true;
                //将excel中的数据读取到ds中
                //ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, "", 0, "文件上传成功");
                try
                {
                    ds = ProductInfoBus.ReadEexcel(upfilepath + @"\" + Session["newfile"].ToString(), userinfo.CompanyCD);
                    if (ds.Tables[0].Rows.Count < 1)
                    {
                        initvalidate();
                        this.lbl_result.Text = "您导入的Excel表没有数据!";
                    }
                }
                catch (Exception ex)
                {
                    //ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, "", 0, "数据读取失败");
                    initvalidate();
                    this.lbl_result.Text = "数据读取失败,原因:" + ex.Message.ToString();
                    ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_result.Text);
                }
            }
            catch (Exception ex)
            {
                this.setup1.Enabled  = false;
                this.lbl_result.Text = "数据读取失败,原因:" + ex.Message;
                ProductInfoBus.LogInsert(userinfo.CompanyCD, userinfo.DeptID, userinfo.UserID, Request.QueryString["ModuleID"].ToString(), 0, 0, this.lbl_result.Text);
            }
        }
    }