Ejemplo n.º 1
0
        private ArrayList LoadPath(ArrayList objarr)
        {
            ArrayList objpatharr = new ArrayList();
            DataTable dt         = new DataTable();
            string    _ischeck   = "";
            string    _NodeName  = "";

            try
            {
                // here call the store proc and get all doucment id , name and path . this information store in object and per object store in one array list
                // and that arraylist sent back to method
                dt = GetAllReceiveDocument(objarr);
                foreach (DataRow dr in dt.Rows)
                {
                    if (_ischeck == "")
                    {
                        _reqDocumentEO = new REQUIREDDOCUMENT_EO();
                        _NodeName      = dr["NodeName"].ToString();
                        _reqDocumentEO.SZ_DOCUMENT_ID   = dr["NodeID"].ToString();
                        _reqDocumentEO.SZ_DOCUMENT_NAME = dr["NodeName"].ToString();
                        _reqDocumentEO.SZ_DOCUMENT_PATH = dr["PhysicalBasePath"] + dr["FilePath"].ToString();
                        objpatharr.Add(_reqDocumentEO);
                        _ischeck = "1";
                    }

                    if (_NodeName != dr["NodeName"].ToString())
                    {
                        _reqDocumentEO = new REQUIREDDOCUMENT_EO();
                        _reqDocumentEO.SZ_DOCUMENT_ID   = dr["NodeID"].ToString();
                        _reqDocumentEO.SZ_DOCUMENT_NAME = dr["NodeName"].ToString();
                        _reqDocumentEO.SZ_DOCUMENT_PATH = dr["PhysicalBasePath"] + dr["FilePath"].ToString();
                        objpatharr.Add(_reqDocumentEO);
                        _NodeName = dr["NodeName"].ToString();
                    }
                }
            }
            catch (Exception ex)
            { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); }
            return(objpatharr);
        }
Ejemplo n.º 2
0
        public REQUIREDDOCUMENT_EO CheckExists(ArrayList objarr)
        {
            _reqDocumentEO = new REQUIREDDOCUMENT_EO();
            try
            {
                ArrayList             objlist  = new ArrayList();
                Bill_Sys_NF3_Template _objTemp = new Bill_Sys_NF3_Template();
                objlist = LoadPath(objarr);
                string _doucumentPath         = "";
                bool   _ischeck               = false;
                String szSourceFile1          = "";
                String szSourceFile1_FullPath = "";
                String szSourceFile2          = "";
                String szSourceFile2_FullPath = "";
                String szOpenFilePath         = "";
                String szBasePhysicalPath     = _objTemp.getPhysicalPath();
                string szerrmsg               = "";


                // this objlist arraylist store all information of document and check every document path is correct or not
                // suppose file not found on specific path that time show the error msg otherwise merge document and sent back the openfile path
                for (int i = 0; i < objlist.Count; i++)
                {
                    //if check file is exist or not
                    if (!System.IO.File.Exists(((REQUIREDDOCUMENT_EO)(objlist[i])).SZ_DOCUMENT_PATH.ToString()))
                    {
                        _ischeck = true;

                        szerrmsg = szerrmsg + ((REQUIREDDOCUMENT_EO)(objlist[i])).SZ_DOCUMENT_NAME.ToString() + ",";
                    }
                }
                if (szerrmsg != "")
                {
                    _reqDocumentEO.SZ_ERROR_MSG = szerrmsg + " does not exists. Do you want to proceed?";
                }
            }
            catch (Exception ex)
            { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); }
            return(_reqDocumentEO);
        }
Ejemplo n.º 3
0
        public REQUIREDDOCUMENT_EO MergeDocument(ArrayList objarr)
        {
            _reqDocumentEO = new REQUIREDDOCUMENT_EO();
            try
            {
                ArrayList             objlist     = new ArrayList();
                ArrayList             objFilelist = new ArrayList();
                Bill_Sys_NF3_Template _objTemp    = new Bill_Sys_NF3_Template();
                objFilelist = LoadPath(objarr);
                string _doucumentPath         = "";
                bool   _ischeck               = false;
                String szSourceFile1          = "";
                String szSourceFile1_FullPath = "";
                String szSourceFile2          = "";
                String szSourceFile2_FullPath = "";
                String szOpenFilePath         = "";
                String szBasePhysicalPath     = _objTemp.getPhysicalPath();
                string szerrmsg               = "";

                for (int i = 0; i < objFilelist.Count; i++)
                {
                    //if check file is exist or not
                    if (System.IO.File.Exists(((REQUIREDDOCUMENT_EO)(objFilelist[i])).SZ_DOCUMENT_PATH.ToString()))
                    {
                        objlist.Add(objFilelist[i]);
                    }
                }


                //                        CompanyName                       caseID
                String szDefaultPath = objarr[3].ToString() + "/" + objarr[0].ToString() + "/Packet Document/";
                string _fullPath     = szBasePhysicalPath + szDefaultPath;
                if (!Directory.Exists(_fullPath))
                {
                    Directory.CreateDirectory(_fullPath);
                }
                if (objlist.Count > 1)
                {
                    for (int j = 0; j < objlist.Count; j++)
                    {
                        if (szSourceFile1 == "")
                        {
                            szSourceFile1          = getFileName("Packet") + ".pdf";
                            szSourceFile1_FullPath = Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[j])).SZ_DOCUMENT_PATH);
                            szOpenFilePath         = szDefaultPath + szSourceFile1;
                        }
                        else
                        {
                            szSourceFile2_FullPath = Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[j])).SZ_DOCUMENT_PATH);
                            MergePDF.MergePDFFiles(szSourceFile1_FullPath, szSourceFile2_FullPath, szBasePhysicalPath + szDefaultPath + szSourceFile1);

                            szSourceFile1_FullPath = szBasePhysicalPath + szDefaultPath + szSourceFile1;
                            szOpenFilePath         = szDefaultPath + szSourceFile1;
                        }
                    }
                }
                else
                {
                    szSourceFile1          = getFileName("Packet") + ".pdf";
                    szSourceFile1_FullPath = Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[0])).SZ_DOCUMENT_PATH);
                    szOpenFilePath         = szDefaultPath + szSourceFile1;
                    File.Copy(Convert.ToString(((REQUIREDDOCUMENT_EO)(objlist[0])).SZ_DOCUMENT_PATH), szBasePhysicalPath + szDefaultPath + szSourceFile1);
                }
                _reqDocumentEO.SZ_OPEN_FILE_PATH = szOpenFilePath;
            }
            catch (Exception ex)
            { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); }
            return(_reqDocumentEO);
        }