Exemple #1
0
    protected void Repeater_DataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView dv = e.Item.DataItem as DataRowView;

        if (dv != null)
        {
            DataRow     dr     = dv.Row;
            U_ZCFilesBU bu1    = new U_ZCFilesBU();
            int         count1 = bu1.GetAttachFileCount(dr["id"].ToString());
            bu1.Close();

            Label lab1 = e.Item.FindControl("filecount") as Label;
            if (lab1 != null)
            {
                lab1.Text = count1 + "";
            }

            LinkButton link1 = e.Item.FindControl("butDel") as LinkButton;
            if (link1 != null)
            {
                if (dr["zeren"].ToString() != Page.User.Identity.Name)
                {
                    link1.Visible = false;
                }
            }
        }
    }
Exemple #2
0
    private void BindData(U_ZCFilesBU file1)
    {
        bool flag = false;

        if (file1 == null)
        {
            file1 = new U_ZCFilesBU();
            flag  = true;
        }
        DataSet ds1 = file1.GetAttachListByBID(Request["id"].ToString());

        this.Repeater1.DataSource = ds1;
        this.Repeater1.DataBind();

        string    id  = Request["id"];
        U_ZCBAOBU zc1 = new U_ZCBAOBU();
        DataSet   ds  = zc1.GetDetailByID(id, "depart,bzeren,bname");

        zc1.Close();
        if (ds.Tables[0].Rows.Count > 0)
        {
            this.Bname.Text  = ds.Tables[0].Rows[0]["bname"].ToString();
            this.depart.Text = ds.Tables[0].Rows[0]["depart"].ToString();
            this.zeren.Text  = ds.Tables[0].Rows[0]["bzeren"].ToString();
        }
        if (flag)
        {
            file1.Close();
        }
    }
Exemple #3
0
 protected void Repeater1_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     if (e.Item.FindControl("fileid") != null)
     {
         Label       lab1  = e.Item.FindControl("fileid") as Label;
         string      id    = lab1.Text;
         U_ZCFilesBU file1 = new U_ZCFilesBU();
         file1.DeleteFile(id);
         this.BindData(file1);
         file1.Close();
     }
 }
Exemple #4
0
    //Bind data
    private void BindData(U_ZCFilesBU file1)
    {
        bool flag = false;

        if (file1 == null)
        {
            file1 = new U_ZCFilesBU();
            flag  = true;
        }
        this.Repeater1.DataSource = file1.GetAttachList(Request["id"].ToString(), Request["bkind"].ToString());
        this.Repeater1.DataBind();
        if (flag)
        {
            file1.Close();
        }
    }
Exemple #5
0
    //上传附件
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (this.FileUpload1.FileName != null && this.FileUpload1.PostedFile.ContentLength > 0)
        {
            Hashtable ht       = new Hashtable();
            string    filename = User.Identity.Name + "_" + Util.GetRandomString(9) + "_" + this.FileUpload1.FileName;
            ht["attachfile"] = filename;
            ht["tcid"]       = Request["id"].ToString();
            ht["zcid"]       = Request["zcid"].ToString();
            ht["bkind"]      = Request["bkind"].ToString();

            string filename1 = Server.MapPath("~/Common/AttachFiles/") + filename;

            //保存文件到系统
            this.FileUpload1.SaveAs(filename1);


            U_ZCFilesBU file1 = new U_ZCFilesBU();
            file1.InsertData(ht);
            file1.Close();
            Response.Redirect(Request.RawUrl, true);
        }
    }