protected void egvQualify_RowEditing(object sender, GridViewEditEventArgs e)
    {
        btnEdit.Visible = true;
        int id = int.Parse(egvQualify.DataKeys[e.NewEditIndex].Value.ToString());

        hfCurID.Value = id.ToString();
        CompanyQualification cq = CompanyQualifications.GetCompanyQualification(id);

        txtName.Text = cq.QualificationName;
        txtDesc.Text = cq.QualificationDesc;

        ltUpload.Text = "<div>当前附件:<a style='color:#0000ff' href='" + cq.Url + "' target='_blank'>" + cq.File.FileName + "</a></div>";
    }
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        int id = 0;

        if (!string.IsNullOrEmpty(hfCurID.Value))
        {
            id = int.Parse(hfCurID.Value);
        }
        if (id == 0)
        {
            mbMsg.ShowMsg("没有可编辑的对象!", System.Drawing.Color.Red);
        }
        else
        {
            HttpPostedFile files = fuQualify.PostedFile;
            if (files.ContentLength > 0 && !files.FileName.EndsWith(".rar"))
            {
                mbMsg.ShowMsg("必须上传相关附件且只能是.rar文件!", System.Drawing.Color.Red);
                return;
            }

            CompanyQualification cq = CompanyQualifications.GetCompanyQualification(id);
            if (files.ContentLength == 0)
            {
                cq.QualificationFile = cq.QualificationName;
            }
            cq.QualificationName = txtName.Text.Trim();
            cq.QualificationDesc = txtDesc.Text.Trim();
            CompanyQualifications.EditFile(cq, files.ContentLength == 0 ? null : files.InputStream);

            mbMsg.ShowMsg("成功编辑当前资质文件!", System.Drawing.Color.Navy);
            BindQualify();
            txtName.Text  = string.Empty;
            txtDesc.Text  = string.Empty;
            ltUpload.Text = string.Empty;
        }
    }
示例#3
0
    protected void Button14_Click(object sender, EventArgs e)
    {
        CompanyQualification qualification = CompanyQualifications.GetCompanyQualification(6);

        HyperLink1.NavigateUrl = qualification.Url;
    }