Exemple #1
0
    protected void SaveFBMAttachment(int fbmid, bool SyncAttachment)
    {
        string sourchfilepath  = "";
        string destinationpath = "";

        DataTable dt = new DataTable();


        if (Request.QueryString["FBMID"] != null)
        {
            dt = BLL_FBM_Report.FBMAttachmentSearch(Convert.ToInt32(Request.QueryString["FBMID"].ToString()));
        }


        DataTable vdtFile = (DataTable)ViewState["vdtFile"];

        foreach (DataRow dr in vdtFile.Rows)
        {
            sourchfilepath  = Server.MapPath(@"~/QMS\\TempUpload\\");
            sourchfilepath += dr["FileGuid"].ToString() + dr["FileExtn"].ToString();

            destinationpath  = Server.MapPath(@"~/Uploads\\FBM\\");
            destinationpath += dr["FileGuid"].ToString() + dr["FileExtn"].ToString();


            BLL_FBM_Report.FBMAttachmentSave(Convert.ToInt32(Session["userid"].ToString()), fbmid, dr["FileName"].ToString(), dr["FileGuid"].ToString() + dr["FileExtn"].ToString());

            if (!File.Exists(destinationpath))
            {
                File.Copy(sourchfilepath, destinationpath);
            }
        }
    }