public void startImporting()
        {
            #region To Import Debit Note
            DataSet dsPath = new DataSet();
            dsPath = getPathDetail("FlexDownload");
            string ImportPath = dsPath.Tables[0].Rows[0]["KeyValue"].ToString();
            if (!Directory.Exists(ImportPath))
            {
                try
                {
                    CreateNewFolder(ImportPath);
                }
                catch { throw; }
            }

            ds = new DataSet();
            ds = getDebitNoteDetailToCsv();
            if (ds.Tables["TM_FlexDebitNote_BSToFlex"].Rows.Count > 0)
            {
                GenerateCsvFile objCSv  = new GenerateCsvFile();
                string          strFile = "DBN" + ".csv";

                string FilePath = ImportPath + strFile + "";
                objCSv.exportToCSVfile(ds, ",", "\n", FilePath);

                objBstoCsv                     = new FlexBsToCsv();
                objBstoCsv.csvId               = 0;
                objBstoCsv.InternalFileName    = strFile;
                objBstoCsv.ImportFor           = "DBN";
                objBstoCsv.Total_No_of_Records = ds.Tables["TM_FlexDebitNote_BSToFlex"].Rows.Count;
                SaveDebitNoteDetailToCsv(objBstoCsv);
            }
            #endregion
        }
        public void makeCsvForInValidRecords(DataSet dsRecord)
        {
            GenerateCsvFile objCSv      = new GenerateCsvFile();
            string          strDestPath = mstrSourceFilePath + "ExceptionFiles";

            if (!Directory.Exists(strDestPath))
            {
                try
                {
                    CreateNewFolder(strDestPath);
                }
                catch { throw; }
            }
            //string FilePath = strCurrFileName.Substring(0, strCurrFileName.LastIndexOf(@"\")) + @"\ExceptionFiles\" + strCurrFileName.Substring(strCurrFileName.LastIndexOf(@"\") + 1);
            string FilePath = strDestPath + "\\" + strFileName;

            objCSv.exportToCSVfile(dsRecord, ",", "\n", FilePath);
        }
        public void startIPDNImporting()
        {
            #region To Import ICAM
            DataSet dsPath = new DataSet();
            dsPath = getPathDetail("IPDNDownload");
            string ImportPath = dsPath.Tables[0].Rows[0]["KeyValue"].ToString();

            if (!Directory.Exists(ImportPath))
            {
                try
                {
                    CreateNewFolder(ImportPath);
                }
                catch { throw; }
            }

            ds = new DataSet();
            ds = getIPDNDetailToCsv();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                GenerateCsvFile objCSv = new GenerateCsvFile();
                //string strFile = "IPDN" + System.DateTime.Now.ToString("yyyyMMdd").Trim().Replace(" ", "").Replace("/", "_").Replace(":", "_") + ".csv";
                string strFile  = "IPDN" + ".csv";
                string FilePath = ImportPath + strFile + "";

                //EventLog.WriteEntry("NWI_IRMFlexProcess", "Importing Started Successfully", System.Diagnostics.EventLogEntryType.Error);
                objCSv.exportToCSVfile(ds, ",", "\n", FilePath);
                objBstoCsv                     = new FlexBsToCsv();
                objBstoCsv.csvId               = 0;
                objBstoCsv.InternalFileName    = strFile;
                objBstoCsv.ImportFor           = "IPDN";
                objBstoCsv.Total_No_of_Records = ds.Tables[0].Rows.Count;
                SaveDebitNoteDetailToCsv(objBstoCsv);
            }
            #endregion
        }