/// <summary> /// Bind Search Data /// </summary> private void BindGridForSearch() { int HHID; string DocumentCode = string.Empty; string KeyWord = string.Empty; if ((Request.QueryString["HHID"]) != null) { HHID = Convert.ToInt32(Request.QueryString["HHID"]); } else { HHID = 0; DocumentCode = "All"; } if ((Request.QueryString["DOCUMENT_CODE"]) != null) { DocumentCode = Request.QueryString["DOCUMENT_CODE"].ToString(); } else { DocumentCode = "All"; } string ProjectCode = Request.QueryString["ProjectCode"].ToString(); //Convert.ToInt32(Session["HHID"].ToString()); int DocserviceID = 0; if (txtDocserviceID.Text.Trim().Length > 0) { DocserviceID = Convert.ToInt32(txtDocserviceID.Text.Trim()); } if (txtSearchKeyword.Text.ToString().Trim() == string.Empty) { KeyWord = "ALL"; } else { KeyWord = txtSearchKeyword.Text.ToString().Trim(); } // = txtSearchKeyword.Text.ToString().Trim(); UploadDocumentBLL UploadDocumentBLLobj = new UploadDocumentBLL(); //grdUploadDocument.DataSource = UploadDocumentBLLobj.GetSearchDocument(KeyWord, HHID, DocumentCode, upProjectIDTextBox.Text, DocserviceID); //grdUploadDocument.DataBind(); UploadDocumentList uplist = UploadDocumentBLLobj.GetSearchDocument(KeyWord, HHID, DocumentCode, upProjectIDTextBox.Text, DocserviceID, Convert.ToInt32(Session["USER_ID"])); System.Web.HttpBrowserCapabilities browser = Request.Browser; if (browser.Type.ToUpper().Contains("IE") || true) { UploadDocumentList uplist1 = new UploadDocumentList(); foreach (UploadDocumentBO upbo in uplist) { string FilePath = upbo.DocumentPath; if (FilePath != null) { if (upbo.HHID <= 0) { string sTempPath = ConfigurationManager.AppSettings["TempDirectory"].ToString(); if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\"); } string sFileName = Path.GetFileName(FilePath); if (File.Exists(FilePath)) { File.Copy(FilePath, sTempPath + upbo.Projectcode + @"\" + sFileName, true); string path = ConfigurationManager.AppSettings["TempFolder"].ToString() + upbo.Projectcode + "/" + sFileName; upbo.DocumentPath = path; } } else { string sTempPath = ConfigurationManager.AppSettings["TempDirectory"].ToString(); if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\"); } if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\"); } string sFileName = Path.GetFileName(FilePath); if (File.Exists(FilePath)) { File.Copy(FilePath, sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\" + sFileName, true); string path = ConfigurationManager.AppSettings["TempFolder"].ToString() + upbo.Projectcode + "/" + upbo.HHID.ToString() + "/" + sFileName; upbo.DocumentPath = path; } } } uplist1.Add(upbo); } grdUploadDocument.DataSource = uplist1; grdUploadDocument.DataBind(); grdUploadDocument.Columns[grdUploadDocument.Columns.Count - 3].Visible = false; } else { grdUploadDocument.Columns[grdUploadDocument.Columns.Count - 2].Visible = false; grdUploadDocument.DataSource = uplist; grdUploadDocument.DataBind(); } }
/// <summary> /// To Search Documents and bind it to grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BindGridForSearch() { int HHID = 0; string DocumentCode = string.Empty; string KeyWord = string.Empty; if ((Request.QueryString["HHID"]) != null) { HHID = Convert.ToInt32(Request.QueryString["HHID"]); } if (Request.QueryString["DOCUMENT_CODE"] != null) { DocumentCode = Request.QueryString["DOCUMENT_CODE"].ToString(); } else { DocumentCode = "All"; } int DocserviceID = 0; if (txtDocserviceID.Text.Trim().Length > 0) { DocserviceID = Convert.ToInt32(txtDocserviceID.Text.Trim()); } string ProjectCode = Request.QueryString["ProjectCode"].ToString(); int ProjectID = Convert.ToInt32(Request.QueryString["ProjectID"]); if (txtSearchKeyword.Text.ToString().Trim() == string.Empty) { KeyWord = "ALL"; } else { KeyWord = txtSearchKeyword.Text.ToString().Trim(); } UploadDocumentBLL UploadDocumentBLLobj = new UploadDocumentBLL(); //grdUploadDocument.DataSource = UploadDocumentBLLobj.GetSearchDocument(KeyWord, HHID, DocumentCode, ProjectID.ToString(), DocserviceID); //grdUploadDocument.DataBind(); WIS_BusinessObjects.UploadDocumentList uplist = UploadDocumentBLLobj.GetSearchDocument(KeyWord, HHID, DocumentCode, ProjectID.ToString(), DocserviceID, Convert.ToInt32(Session["USER_ID"])); WIS_BusinessObjects.UploadDocumentList uplist1 = new WIS_BusinessObjects.UploadDocumentList(); foreach (UploadDocumentBO upbo in uplist) { string FilePath = upbo.DocumentPath; if (FilePath != null) { if (upbo.HHID <= 0) { string sTempPath = ConfigurationManager.AppSettings["TempDirectory"].ToString(); if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\"); } string sFileName = Path.GetFileName(FilePath); if (File.Exists(FilePath)) { File.Copy(FilePath, sTempPath + upbo.Projectcode + @"\" + sFileName, true); string path = ConfigurationManager.AppSettings["TempFolder"].ToString() + upbo.Projectcode + "/" + sFileName; upbo.DocumentPath = path; } } else { string sTempPath = ConfigurationManager.AppSettings["TempDirectory"].ToString(); if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\"); } if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\"); } string sFileName = Path.GetFileName(FilePath); if (File.Exists(FilePath)) { File.Copy(FilePath, sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\" + sFileName, true); string path = ConfigurationManager.AppSettings["TempFolder"].ToString() + upbo.Projectcode + "/" + upbo.HHID.ToString() + "/" + sFileName; upbo.DocumentPath = path; } } } uplist1.Add(upbo); } grdUploadDocument.DataSource = uplist1; grdUploadDocument.DataBind(); grdUploadDocument.AllowPaging = true; }
/// <summary> /// bind grid data for search /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BindGridForSearch() { Int32 HHID = 0; if (txtHHID.Text.Trim().Length > 0) { HHID = Convert.ToInt32(txtHHID.Text); } string DocumentCode = string.Empty; string KeyWord = string.Empty; DocumentCode = "All"; if (txtSearchKeyword.Text.ToString().Trim() == string.Empty) { KeyWord = "ALL"; } else { KeyWord = txtSearchKeyword.Text.ToString().Trim(); } UploadDocumentBLL UploadDocumentBLLobj = new UploadDocumentBLL(); //grdUploadDocument.DataSource = UploadDocumentBLLobj.GetSearchDocument(KeyWord, HHID, DocumentCode, drpProjectsearch.SelectedValue, 0); //grdUploadDocument.DataBind(); UploadDocumentList uplist = UploadDocumentBLLobj.GetSearchDocument(KeyWord, HHID, DocumentCode, drpProjectsearch.SelectedValue, 0, Convert.ToInt32(Session["USER_ID"])); UploadDocumentList uplist1 = new UploadDocumentList(); foreach (UploadDocumentBO upbo in uplist) { string FilePath = upbo.DocumentPath; if (FilePath != null) { if (upbo.HHID <= 0) { string sTempPath = ConfigurationManager.AppSettings["TempDirectory"].ToString(); if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\"); } string sFileName = Path.GetFileName(FilePath); if (File.Exists(FilePath)) { File.Copy(FilePath, sTempPath + upbo.Projectcode + @"\" + sFileName, true); string path = "../" + ConfigurationManager.AppSettings["TempFolder"].ToString() + upbo.Projectcode + "/" + sFileName; upbo.DocumentPath = path; } } else { string sTempPath = ConfigurationManager.AppSettings["TempDirectory"].ToString(); if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\"); } if (!Directory.Exists(sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\")) { System.IO.Directory.CreateDirectory(sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\"); } string sFileName = Path.GetFileName(FilePath); if (File.Exists(FilePath)) { File.Copy(FilePath, sTempPath + upbo.Projectcode + @"\" + upbo.HHID.ToString() + @"\" + sFileName, true); string path = "../" + ConfigurationManager.AppSettings["TempFolder"].ToString() + upbo.Projectcode + "/" + upbo.HHID.ToString() + "/" + sFileName; upbo.DocumentPath = path; } } } uplist1.Add(upbo); } grdUploadDocument.DataSource = uplist1; grdUploadDocument.DataBind(); grdUploadDocument.AllowPaging = true; }