Beispiel #1
0
 private void btn_Keyword_Remove_Click(object sender, EventArgs e)
 {
     try
     {
         ComboBoxItem cb = cbo_Keyword_LstKeyword.SelectedItem as ComboBoxItem;
         if (cb != null && cb.Value is DataRow)
         {
             DataRow R = cb.Value as DataRow;
             if (sqlite.DeleteEntry("CfgData", "ID", R["ID"].ToString()))
             {
                 MessageBox.Show("Remove data successful", "Remove data", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 cbo_Keyword_Typelog_SelectedIndexChanged(sender, e);
                 return;
             }
         }
         else
         {
             MessageBox.Show("Please, select Map Contens", "Remove data", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
         }
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
     if (MessageBox.Show("Remove data fail", "Remove data", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Retry)
     {
         btn_Keyword_Remove_Click(sender, e);
     }
 }
Beispiel #2
0
 private void btn_RunTest2_Click(object sender, EventArgs e)
 {
     try
     {
         UC_Info uc = new UC_Info();
         uc.Dock = DockStyle.Fill;
         Frm_TemplateDefault frm = new Frm_TemplateDefault(uc);
         frm.titleCustom.Text = "Test map";
         DateTime timeStart = DateTime.Now;
         if (fctxt_Pattern.Text.Trim() == string.Empty || fctxt_Test.Text.Trim() == string.Empty)
         {
             MessageBox.Show("Please, input data Pattern string and Test string", "Run test", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         else
         {
             Style  fontTitle = new TextStyle(Brushes.Wheat, null, FontStyle.Bold);
             Style  fontBody  = new TextStyle(Brushes.Green, null, FontStyle.Bold);
             string sReg      = fctxt_Pattern.SelectedText;
             string sString   = fctxt_Test.Text;
             if (string.IsNullOrEmpty(sReg))
             {
                 sReg = fctxt_Pattern.Text;
             }
             Dictionary <int, RegesValueWithPatternOfGroup> listResult2 = new Dictionary <int, RegesValueWithPatternOfGroup>();
             uc.TextCustom.AppendText("Pattern: ", fontTitle);
             uc.TextCustom.AppendText(sReg + Environment.NewLine, new TextStyle(Brushes.White, null, FontStyle.Bold));
             if (Regexs.RunPatternRegular(sString, sReg, out listResult2))
             {
                 uc.TextCustom.AppendText("Time: " + (DateTime.Now - timeStart).TotalMilliseconds + " milliseconds ~ " + (DateTime.Now - timeStart).TotalSeconds + " seconds\n", fontTitle);
                 int k = 0;
                 foreach (KeyValuePair <int, RegesValueWithPatternOfGroup> group in listResult2)
                 {
                     k++;
                     uc.TextCustom.AppendText(Environment.NewLine + "Found map: " + k.ToString() + "/" + listResult2.Count.ToString() + Environment.NewLine + "-----------Group var map-----------" + Environment.NewLine, fontTitle);
                     foreach (KeyValuePair <string, Dictionary <int, string> > var in group.Value.value)
                     {
                         uc.TextCustom.AppendText(var.Key + " : " + string.Join(" | ", var.Value.Values.ToArray()) + Environment.NewLine, fontTitle);
                     }
                     uc.TextCustom.AppendText("-----------Map string--------------" + Environment.NewLine, fontTitle);
                     uc.TextCustom.AppendText(group.Value.stringfind + Environment.NewLine, fontBody);
                 }
             }
             else
             {
                 uc.TextCustom.AppendText("Time: " + (DateTime.Now - timeStart).TotalMilliseconds + " milliseconds ~ " + (DateTime.Now - timeStart).TotalSeconds + " seconds\n", fontTitle);
                 uc.TextCustom.AppendText("Not math :(", new TextStyle(Brushes.Red, null, FontStyle.Italic));
             }
             frm.Show();
         }
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #3
0
 private void btn_Export_Click(object sender, EventArgs e)
 {
     try
     {
         readtran.Export();
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #4
0
 private void btn_Apply_Click(object sender, EventArgs e)
 {
     try
     {
         ComboBoxItem cb_tmp = cbo_LstTemplate.SelectedItem as ComboBoxItem;
         InitParametar.TemplateTransactionID = cb_tmp.Value.ToString();
         InitParametar.LoadTemplateInfo();
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #5
0
 private void btn_Edit_Click(object sender, EventArgs e)
 {
     try
     {
         ComboBoxItem   cb_tmp        = cbo_LstTemplate.SelectedItem as ComboBoxItem;
         UC_CfgTemplate ucCfgTemplate = new UC_CfgTemplate(cb_tmp.Value.ToString());
         ucCfgTemplate.Dock = DockStyle.Fill;
         Frm_TemplateDefault frm = new Frm_TemplateDefault(ucCfgTemplate);
         frm.Show();
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #6
0
 static void Main(string[] args)
 {
     InitParametar.Init();
     if (args.Length == 0)
     {
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         //  Application.Run(new Frm_LoadingApp());
         Application.Run(new Frm_Main());
     }
     else
     {
         //Auto start - not GUI
     }
 }
Beispiel #7
0
 private void btn_Transaction_Refresh_Click(object sender, EventArgs e)
 {
     try
     {
         cbo_Transactions.Items.Clear();
         cbo_Transactions.Text = string.Empty;
         DataTable tb_trans = sqlite.GetTableDataWithColumnName("Transactions", "TemplateID", template_ID);
         foreach (DataRow r in tb_trans.Rows)
         {
             ComboBoxItem cb = new ComboBoxItem();
             cb.Text  = r["Name"].ToString();
             cb.Value = r["ID"].ToString();
             cbo_Transactions.Items.Add(cb);
         }
     }
     catch (Exception ex) { InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name); }
 }
Beispiel #8
0
 private void cbo_Keyword_LstKeyword_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         fctxt_Pattern.Clear();
         ComboBoxItem cb = cbo_Keyword_LstKeyword.SelectedItem as ComboBoxItem;
         if (cb != null && cb.Value is DataRow)
         {
             DataRow R = cb.Value as DataRow;
             fctxt_Pattern.Text = R["Data"].ToString();
         }
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #9
0
 private void btn_Keyword_Add_Click(object sender, EventArgs e)
 {
     try
     {
         ComboBoxItem cb = cbo_Keyword_LstKeyword.SelectedItem as ComboBoxItem;
         if (cb != null && cb.Value is DataRow)
         {
             MessageBox.Show("Data existed !!", "Add data", MessageBoxButtons.OK, MessageBoxIcon.Warning); return;
         }
         if (cbo_Keyword_LstKeyword.Text == string.Empty)
         {
             MessageBox.Show("Map Contents not empty !!", "Add data", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
         }
         if (fctxt_Pattern.Text == string.Empty)
         {
             MessageBox.Show("Pattern string not empty !!", "Add data", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
         }
         ComboBoxItem item  = cbo_Keyword_Typelog.SelectedItem as ComboBoxItem;
         EntryList    entry = new EntryList();
         entry.ColumnName.Add("Field");
         entry.Content.Add(cbo_Keyword_LstKeyword.Text);
         entry.ColumnName.Add("Data");
         entry.Content.Add(fctxt_Pattern.Text);
         entry.ColumnName.Add("Type_ID");
         entry.Content.Add(item.Value.ToString());
         entry.ColumnName.Add("Parent_ID");
         entry.Content.Add(template_ID);
         if (sqlite.CreateEntry("CfgData", entry))
         {
             MessageBox.Show("Add data successful", "Add data", MessageBoxButtons.OK, MessageBoxIcon.Information);
             cbo_Keyword_Typelog_SelectedIndexChanged(sender, e);
             return;
         }
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
     if (MessageBox.Show("Add data fail", "Add data", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Retry)
     {
         btn_Keyword_Add_Click(sender, e);
     }
 }
Beispiel #10
0
 public void LoadInfo()
 {
     try
     {
         DataTable cfg_vendor = InitParametar.sqlite.GetTableDataWith2ColumnName("CfgData", "Type_ID", "60", "Parent_ID", "54");
         foreach (DataRow R in cfg_vendor.Rows)
         {
             ComboBoxItem cb = new ComboBoxItem();
             cb.Text  = R["Field"].ToString();
             cb.Value = R["ID"].ToString();
             cbo_LstTemplate.Items.Add(cb);
             if (cb.Value.Equals(InitParametar.TemplateTransactionID.ToString()))
             {
                 cbo_LstTemplate.SelectedItem = cb;
             }
         }
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #11
0
 private void btn_Keyword_Save_Click(object sender, EventArgs e)
 {
     try
     {
         ComboBoxItem cb = cbo_Keyword_LstKeyword.SelectedItem as ComboBoxItem;
         if (cb != null && cb.Value is DataRow)
         {
             DataRow R = cb.Value as DataRow;
             if (sqlite.Update1Entry("CfgData", "Data", fctxt_Pattern.Text, "ID", R["ID"].ToString()))
             {
                 MessageBox.Show("Save successful", "Save data", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
             }
         }
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
     if (MessageBox.Show("Save fail", "Save data", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry)
     {
         btn_Keyword_Save_Click(sender, e);
     }
 }
Beispiel #12
0
 private void tre_LstTrans_AfterSelect(object sender, TreeViewEventArgs e)
 {
     try
     {
         if (e.Node != null && e.Node.Tag != null && e.Node.Tag is Transaction)
         {
             propertyGrid1.SelectedObject = (Transaction)e.Node.Tag;
             fctxt_FullLog.Text           = (e.Node.Tag as Transaction).TraceJournalFull;
         }
         else if (e.Node != null && e.Node.Tag != null && e.Node.Tag is TransactionEvent)
         {
             propertyGrid1.SelectedObject = (TransactionEvent)e.Node.Tag;
             fctxt_FullLog.Text           = (e.Node.Tag as TransactionEvent).TContent;
         }
         else if (e.Node != null && e.Node.Tag != null && e.Node.Tag is Cycle)
         {
             var cycle = (Cycle)e.Node.Tag;
             fctxt_FullLog.Text = (e.Node.Tag as Cycle).LogTxt;
             AddLayoutEventCycle(cycle, panel4);
         }
         else if (e.Node != null && e.Node.Tag != null && e.Node.Tag is List <KeyValuePair <DateTime, Cycle> > )
         {
             var     tagValue = ((List <KeyValuePair <DateTime, Cycle> >)e.Node.Tag).ToList();
             ListBox listBox  = new ListBox();
             listBox.Dock = DockStyle.Fill;
             tagValue.ForEach(x =>
             {
                 listBox.Items.Add(x.Value.ToString());
             });
             panel4.Controls.Add(listBox);
         }
     }
     catch (Exception ex)
     {
         InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #13
0
        private void JournalAnalyze(List <string> lsFile_Journal)
        {
            try
            {
                readtran = new ReadTransaction();
                tre_LstTrans.Nodes.Clear();
                propertyGrid1.SelectedObject = null;
                fctxt_FullLog.Text           = string.Empty;
                if (!cb_FullTime.Checked)
                {
                    readtran.StartDate = dateTimePicker_Start.Value;
                    readtran.EndDate   = dateTimePicker_End.Value;
                }
                if (readtran.Reads(lsFile_Journal))
                {
                    string day;
                    foreach (KeyValuePair <string, Dictionary <DateTime, object> > kTerminal in readtran.ListTransaction)
                    {
                        int      countCycle            = kTerminal.Value.Where(x => (x.Value is Cycle)).ToList().Count;
                        int      countTransaction      = kTerminal.Value.Where(x => (x.Value is Transaction)).ToList().Count;
                        int      countTransactionEvent = kTerminal.Value.Where(x => (x.Value is TransactionEvent)).ToList().Count;
                        TreeNode ndTerminal            = tre_LstTrans.Nodes.Add(kTerminal.Key, String.Format("Terminal ID: {0} - Total: {1} transactions", kTerminal.Key, kTerminal.Value.Count), "Terminal", "Terminal");

                        foreach (KeyValuePair <DateTime, object> kTransaction in kTerminal.Value.OrderBy(x => x.Key))
                        {
                            day = String.Format("{0:" + readtran.FormatDate + "}", kTransaction.Key);
                            TreeNode ndDay = new TreeNode(day);
                            if (ndTerminal.Nodes.ContainsKey(day))
                            {
                                ndDay = ndTerminal.Nodes[day];
                            }
                            else
                            {
                                ndDay = ndTerminal.Nodes.Add(day, day, "Date", "DateOpen");
                            }
                            string   textDisplay   = kTransaction.Value.ToString();
                            TreeNode ndTransaction = ndDay.Nodes.Add(textDisplay, textDisplay);
                            ndTransaction.Tag = kTransaction.Value;
                            if (ndTransaction.Tag is Transaction)
                            {
                                ndTransaction.ImageKey         = "Flag";
                                ndTransaction.SelectedImageKey = "Flag_Success";
                            }
                            else if (ndTransaction.Tag is TransactionEvent)
                            {
                                ndTransaction.ImageKey         = "Device";
                                ndTransaction.SelectedImageKey = "Device";
                            }
                            else
                            {
                                ndTransaction.ImageKey         = "Cycle";
                                ndTransaction.SelectedImageKey = "Cycle";
                            }
                            ndDay.Text = day + " Total: " + ndDay.Nodes.Count + " transactions";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                InitParametar.Send_Error(ex.ToString(), MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name);
            }
        }