Exemple #1
0
        /// <summary>
        /// Bind Data to grid
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>
        private void BindGrid(bool addRow, bool deleteRow)
        {
            int    HHID;
            string ProjectID    = "0";
            string DocumentCode = 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";
            }
            if (Session["Project_ID"] != null)
            {
                ProjectID = Convert.ToString(Request.QueryString["ProjectID"]);
            }
            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());
            }
            UploadDocumentBLL  UploadDocumentBLLobj = new UploadDocumentBLL();
            UploadDocumentList uplist = UploadDocumentBLLobj.GetALLUploadDocument(HHID, DocumentCode, ProjectID, 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();
            }
        }
Exemple #2
0
        /// <summary>
        /// Bind Data to Grid
        /// </summary>
        private void BindGrid()
        {
            int    HHID         = 0;
            string DocumentCode = 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";
            }

            string            ProjectCode          = Request.QueryString["ProjectCode"].ToString();
            int               ProjectID            = Convert.ToInt32(Request.QueryString["ProjectID"]);
            UploadDocumentBLL UploadDocumentBLLobj = new UploadDocumentBLL();
            int               DocserviceID         = 0;

            if (txtDocserviceID.Text.Trim().Length > 0)
            {
                DocserviceID = Convert.ToInt32(txtDocserviceID.Text.Trim());
            }
            //grdUploadDocument.DataSource = UploadDocumentBLLobj.GetALLUploadDocument(HHID, DocumentCode, ProjectID.ToString(), DocserviceID);
            //grdUploadDocument.DataBind();
            WIS_BusinessObjects.UploadDocumentList uplist  = UploadDocumentBLLobj.GetALLUploadDocument(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;
        }
Exemple #3
0
        //if the user search the record and other information
        private void BindGrid()
        {
            int HHID = 0;

            if (Session["HH_ID"] != null)
            {
                HHID = Convert.ToInt32(Session["HH_ID"]);
            }
            else
            {
                HHID = 0;
            }
            string projectID    = drpProject.SelectedValue;
            string DocumentCode = string.Empty;

            //if (drpProject.SelectedIndex > 0)
            //{
            //    if (HHIDTextBox.Text.Trim().Length > 0)
            //        HHID = Convert.ToInt32(HHIDTextBox.Text.Trim());
            //}

            DocumentCode = "All";

            UploadDocumentBLL UploadDocumentBLLobj = new UploadDocumentBLL();
            //grdUploadDocument.DataSource = UploadDocumentBLLobj.GetALLUploadDocument(HHID, DocumentCode, projectID, 0);
            //grdUploadDocument.DataBind();
            UploadDocumentList uplist  = UploadDocumentBLLobj.GetALLUploadDocument(HHID, DocumentCode, projectID, 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;
        }