private void btnSaveChanges_Click(object sender, RoutedEventArgs e)
        {
            DataTable_Processing dataTable_Processing = new DataTable_Processing();
            DataTable            dt      = (DataTable)dgLoadMappingTable.DataContext;
            string mappingDataJsonString = dataTable_Processing.DataTableToJSONWithJSONNet(dt);
            string allInfo           = (string)lblColumnName.Content;
            string folderName        = allInfo.Split('|')[0] + datetimeString;
            string fileName          = allInfo.Split('|')[1];
            string mappingInfoFolder = "";
            string dirPath           = mappingInfoFolder != ""? mappingInfoFolder + "//" + folderName:folderName;

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            string filePath = dirPath != ""? dirPath + "//" + fileName : fileName;

            if (File.Exists(filePath + ".json"))
            {
                File.Delete(filePath + ".json");
            }
            using (StreamWriter sw = new StreamWriter((filePath + ".json")))
            {
                sw.Write(mappingDataJsonString);
            }
        }
        private void btnSaveAllExpressions_Click(object sender, RoutedEventArgs e)
        {
            DataTable            dt = DictToDT();
            DataTable_Processing dataTable_Processing = new DataTable_Processing();
            string      jsonString  = dataTable_Processing.DataTableToJSONWithJSONNet(dt);
            ChildWindow childWindow = new ChildWindow();

            childWindow.saveFile(dataTable.TableName + ChildWindow.datetimeString, "ExpressionsList", "", jsonString);
        }
        public Dictionary <string, string> ReadMappingFile(string filePath)
        {
            Dictionary <string, string> mappingDataDict = new Dictionary <string, string>();
            string jsonData = ReadFileDataContent(filePath);

            if (jsonData != "")
            {
                DataTable_Processing dataTable_Processing = new DataTable_Processing();
                mappingDataDict = dataTable_Processing.GetDictinaryFromJson(jsonData);
            }
            return(mappingDataDict);
        }
        public void btnProcessMapping_Click(object sender, RoutedEventArgs e)
        {
            backupTable = dataTable.Copy();
            foreach (string f in allfiles)
            {
                Dictionary <string, string> mappingDataDic = ReadMappingFile(f);
                if (mappingDataDic.Count > 0)
                {
                    DataTable_Processing dataTable_Processing = new DataTable_Processing();

                    dataTable_Processing.MappingOnDataTableColumn(ref dataTable, System.IO.Path.GetFileNameWithoutExtension(f), mappingDataDic);
                }
            }
        }
        public void MyButton_DoubleClick(object sender, RoutedEventArgs e)
        {
            Label l = (Label)sender;
            //MessageBox.Show(l.Content.ToString());
            string jsonData = ReadFileDataContent(txtboxMappingFolderPath.Text + "//" + l.Content.ToString());

            if (jsonData != "")
            {
                DataTable_Processing dataTable_Processing = new DataTable_Processing();
                DataTable            dt         = dataTable_Processing.ConvertJsonStrToDT(jsonData);
                ChildWindow          chldWindow = new ChildWindow(dt);
                chldWindow.Show();
            }
        }
        private void btnApplyExpression_Click(object sender, RoutedEventArgs e)
        {
            DataTable_Processing dataTable_Processing = new DataTable_Processing();

            dt_backUpDataTable = dt_OriginalDataTable.Copy();

            foreach (DataRow dr in dt_expsInfoTable.Rows)
            {
                if ((bool)dr["Status"])
                {
                    dataTable_Processing.AddNewColumn(ref dt_OriginalDataTable, dr[0].ToString(), dr[1].ToString());
                }
            }
            MessageBox.Show("All Expression executed successfully", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
        }
        public ExpressionManager(DataTable dt, string jsonExpsData)
        {
            InitializeComponent();
            dt_OriginalDataTable = dt;
            DataTable_Processing dataTable_Processing = new DataTable_Processing();

            dt_expsInfoTable = dataTable_Processing.ConvertJsonStrToDT(jsonExpsData);
            if (dt_expsInfoTable.Rows.Count > 0)
            {
                DataColumn newColumn = new System.Data.DataColumn("Status", typeof(System.Boolean));
                newColumn.DefaultValue = true;
                dt_expsInfoTable.Columns.Add(newColumn);
                dgLoadExpressionTable.DataContext = dt_expsInfoTable;
            }
        }
Esempio n. 8
0
        public void OpenColumnMapping(string seletedCol)
        {
            List <string> uniqueValue = new List <string>();

            if (seletedCol != "")
            {
                DataTable_Processing dataTable_Processing = new DataTable_Processing();
                uniqueValue = dataTable_Processing.GetColUniqueValues(currentProcessingTable, seletedCol);

                if (uniqueValue.Count > 0)
                {
                    DataTable dt = CreateColumnMapperTable(uniqueValue, seletedCol);
                    //ChildWindow chldWindow = new ChildWindow(dt);
                    //chldWindow.Show();
                    ThreadStartingPoint(dt);
                    mIemExecuteCurrentDir.IsEnabled = true;
                    // return dt;
                }
            }
            //return new DataTable("");
        }