protected void UploadButton_Click(object sender, EventArgs e) { string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url); using (Utils utility = new Utils()) { utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod()); } if (this.ReportUpload.HasFile) { for (int i = 0; i < this.grddocumnetmanager.VisibleRowCount; i++) { GridViewDataColumn gridViewDataColumn = (GridViewDataColumn)this.grddocumnetmanager.Columns[0]; CheckBox box = (CheckBox)this.grddocumnetmanager.FindRowCellTemplateControl(i, gridViewDataColumn, "chkall"); if (box.Checked) { string str = this.grddocumnetmanager.GetRowValues(i, new string[] { "NodeID" }).ToString(); Bill_Sys_Document_Manager manager = new Bill_Sys_Document_Manager(); string pathFromNodeId = manager.GetPathFromNodeId(str); if (((pathFromNodeId == "0") || (pathFromNodeId == "")) || ((pathFromNodeId.ToUpper() == "NULL") || (pathFromNodeId == null))) { this.MessageControl1.PutMessage("Folder NodeType not Found Contact to admin"); this.MessageControl1.SetMessageType(0); this.MessageControl1.Show(); log.Debug(" NodeType not Found "); return; } log.Debug("szPath " + pathFromNodeId); string str3 = ((Bill_Sys_BillingCompanyObject)this.Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_NAME + @"\" + pathFromNodeId + @"\"; log.Debug("szPath " + pathFromNodeId); string str4 = ApplicationSettings.GetParameterValue("PhysicalBasePath"); log.Debug("szBasePath " + str4); string fileName = this.ReportUpload.FileName; log.Debug("szFileName " + fileName); if (!Directory.Exists(str4 + str3)) { log.Debug("File not Exists "); Directory.CreateDirectory(str4 + str3); } if (File.Exists(str4 + str3 + fileName)) { this.MessageControl1.PutMessage("File already Exists"); this.MessageControl1.SetMessageType(0); this.MessageControl1.Show(); log.Debug("File already Exists"); return; } try { this.ReportUpload.SaveAs(str4 + str3 + fileName); log.Debug("File Saved "); string str6 = manager.SaveFileInDOc(str, fileName, str3, ((Bill_Sys_UserObject)this.Session["USER_OBJECT"]).SZ_USER_NAME); if (((str6 != "0") && (str6 != "")) && ((str6.ToUpper() != "NULL") && (str6 != null))) { DataSet documentmanagerInfo = new DataSet(); documentmanagerInfo = new Bill_Sys_Document_Manager().GetDocumentmanagerInfo(this.txtcaseid.Text, this.txtCompanyID.Text); this.grddocumnetmanager.DataSource = documentmanagerInfo; this.grddocumnetmanager.DataBind(); this.MessageControl1.PutMessage("File uploaded Successfully..! "); this.MessageControl1.SetMessageType(UserControl_ErrorMessageControl.DisplayType.Type_UserMessage); this.MessageControl1.Show(); log.Debug("File uploaded Successfully"); } else { this.MessageControl1.PutMessage(" DB error to add File "); this.MessageControl1.SetMessageType(0); this.MessageControl1.Show(); log.Debug("DB error to ADD File"); } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } string str2 = "Error Request=" + id + ".Please share with Technical support."; base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2); } return; } } } else { this.MessageControl1.PutMessage("File was not selected for upload"); this.MessageControl1.SetMessageType(0); this.MessageControl1.Show(); } //Method End using (Utils utility = new Utils()) { utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod()); } }