Beispiel #1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        DataTable dt = MySQL.ExecProc("usp_Car_EmployeePassInfo_GetWithImage", new string[] { }, out sqlexec, out sqlresult).Tables[0];

        BFService.BigFileService bs = new BFService.BigFileService(CarEnum.BigServiceSysID);

        foreach (DataRow dr in dt.Rows)
        {
            try
            {
                string bfidstring = dr["CarImg"].ToString();
                string bfid       = bfidstring.Substring(bfidstring.LastIndexOf("/") + 1);

                if (string.IsNullOrEmpty(bs.Delete(bfid)))
                {
                    MySQL.ExecProc("usp_Car_EmployeePassInfo_ClearImg",
                                   new string[] { dr["id"].ToString() },
                                   out sqlexec, out sqlresult);
                }
            }
            catch
            {
            }
        }
    }
Beispiel #2
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        DataSet ds = MySQL.ExecProc("usp_Car_PassInfo_GetByDeviceID_ForClear", new string[] { deviceid }, out sqlexec, out sqlresult);

        BFService.BigFileService bs = new BFService.BigFileService(CarEnum.BigServiceSysID);

        foreach (DataTable dt in ds.Tables)
        {
            foreach (DataRow dr in dt.Rows)
            {
                try
                {
                    string bfidstring = dr["CarImg"].ToString();
                    string bfid       = bfidstring.Substring(bfidstring.LastIndexOf("/") + 1);

                    if (string.IsNullOrEmpty(bs.Delete(bfid)))
                    {
                        MySQL.ExecProc("usp_Car_PassInfo_ClearImg",
                                       new string[] { dr["id"].ToString(), dr["TableName"].ToString() },
                                       out sqlexec, out sqlresult);
                    }
                }
                catch
                {
                }
            }
        }

        Session[WebHint.Web_Hint] = new WebHint("清除成功." + sqlresult, Request.Url.ToString(), HintFlag.跳转);
        Response.Redirect(WebHint.HintURL);
    }
Beispiel #3
0
    protected void btnUpLoad_Click(object sender, EventArgs e)
    {
        if (!fp.HasFile)
        {
            lb.Text = "请先选择文件";
            return;
        }

        string fileurl = "";

        if (IsSaveToOSS)
        {
            BFService.BFResult bfresult;

            BFService.BigFileService bs = new BFService.BigFileService(CarEnum.BigServiceSysID);
            if (ImgWidth == 0 || ImgHeight == 0)
            {
                bfresult = bs.UpLoadALL(HFID.Value, fp.FileName, fp.PostedFile.ContentType.ToString(), fp.FileBytes);
            }
            else
            {
                bfresult = bs.UpLoadALL(HFID.Value, fp.FileName, fp.PostedFile.ContentType.ToString(), fp.FileBytes, ImgWidth.ToString(), ImgHeight.ToString());
            }

            if (bfresult.code == 0)
            {
                //失败!
                lb.ForeColor = Color.Red;
                lb.Text      = bfresult.message;
                return;
            }
            else
            {
                fileurl              = "http://big.tourzj.com/bfinfo/GetFile/" + bfresult.message;
                HFID.Value           = fileurl;
                FileView.NavigateUrl = fileurl;
            }
        }
        else
        {
            string date    = DateTime.Now.ToString("yyMMdd");
            string newPath = Server.MapPath(upLoadPath + date + "/");

            if (!Directory.Exists(newPath))
            {
                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(newPath);
                di.Create();
            }

            string fnOrg = date + "/" + Guid.NewGuid().ToString() + fp.FileName.Substring(fp.FileName.LastIndexOf("."));


            fp.SaveAs(Server.MapPath(upLoadPath) + fnOrg);

            HFID.Value           = fnOrg;
            fileurl              = upLoadPath + fnOrg;
            FileView.NavigateUrl = fileurl;
        }

        lb.Text      = "上传成功";
        lb.ForeColor = Color.Black;



        if (ShowImage)
        {
            ImgShow.ImageUrl = FileView.NavigateUrl;
            ImgShow.Visible  = true;
        }
        else
        {
            ImgShow.Visible = false;
        }
        divView.Visible = true;
        //获得文件名,并且传递给调用的窗口
        if (OnAfterUpLoad != null)
        {
            OnAfterUpLoad(fileurl, fp.FileName);
        }
    }