コード例 #1
0
        public int Execute_Excel_InitialTracker()
        {
            int         Value  = 0;
            DML_Utility objDML = new DML_Utility();

            try
            {
                string strFilePath = "";
                string strFileName = "";
                // Get HostName //
                Get_Data_Utility        objGet    = new Get_Data_Utility();
                List <tbl_config_value> lstConfig = objGet.Get_Cofig_Details("MISDATA");
                foreach (var ob in lstConfig)
                {
                    strFilePath = ob.configstring;
                    strFileName = ob.FileName;
                }

                string path = strFilePath + strFileName; //
                //FilePath_Container.FilePath + FilePath_Container.FileName_InitationTracker;
                if (File.Exists(path))
                {
                    DataTable dt = Read_Excel("Sheet1", path);
                    if (dt.Rows.Count > 0)
                    {
                        // Add Rows Count into table //
                        long rowcount = dt.Rows.Count;
                        objDML.Add_Rows_Count_Data(path, rowcount);
                        Value = addData(dt);
                    }
                    else
                    {
                        Value = 9; // No data exist
                    }
                }
            }
            catch (Exception ex)
            {
                Value = -1;
                ////// Exception Log ///
                int iException = objDML.Add_Exception_Log(ex.Message, "");
            }
            return(Value);
        }