示例#1
0
        protected void SaveAttachment(string filName, string extension, string docKind, string callRefNo, string AttachedBLOB)
        {
            var usNo    = nav.myConsultants.ToList().Where(usr => usr.Organization_Username == Session["username"].ToString()).Select(nu => nu.No).SingleOrDefault();
            var usaname = Session["username"].ToString();
            var prjct   = ddlProjectApp.SelectedItem.Text;

            // string fullFPath = Request.PhysicalApplicationPath + "All Uploads\\" + Grantees.No + @"\" + filName;

            string navfilePath = @"D:\All_Portal_Uploaded\" + filName;

            var    credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
            int    granttype   = 2;
            string docType     = "";

            if ((extension == ".jpg") || (extension == ".jpeg") || (extension == ".png"))
            {
                docType = "Picture";
            }
            else
            if ((extension == ".pdf"))
            {
                docType = "PDF";
            }
            if ((extension == ".doc") || (extension == ".docx"))
            {
                docType = "Word Document";
            }
            if (extension == ".xlsx")
            {
                docType = "Excel Document";
            }
            try
            {
                Portals sup = new Portals();
                sup.Credentials     = credentials;
                sup.PreAuthenticate = true;
                if (sup.FnAttachmentConsultant(usNo, docType, navfilePath, filName, granttype, docKind, usaname, prjct, callRefNo, AttachedBLOB) == true)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "itsABitch", "alert('Document: " + filName + " uploaded and Saved successfully!');", true);
                    GetProjects();
                }
            }
            catch (Exception r)
            {
                // KCDFAlert.ShowAlert(r.Message);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "itsABitch", "alert('" + r.Message + " ');", true);
            }
        }