示例#1
0
        /// <summary>
        /// Actual currency conversion occurs when the user selects new currency from the drop-down menu.
        /// Although we have loaded the data in the drop-down for the user to view, and we need to load then again to compare with the user selected data.
        /// </summary>

        private void CmbNewCurrency_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            TxtResult.Clear(); // All previous result are clear before loading new result.

            string jason;

            using (StreamReader sr = new StreamReader(JCurrencyList))  // loading currecy from local CurrencyList.json file
            {
                jason = sr.ReadToEnd();
            }
            CurrencyList cl = new CurrencyList();

            JsonConvert.PopulateObject(jason, cl);

            foreach (var item in cl.Currency)
            {
                if (item.Key == CmbCurrentCurrency.SelectedItem.ToString())
                {
                    currentCurrency = item.Value; // based on user selected currency, values are selected . e.g Key: Pound Sterling (GBP), Value: GBP
                }
                if (item.Key == CmbNewCurrency.SelectedItem.ToString())
                {
                    newCurrency = item.Value; // based on user selected currency, values are selected . e.g Key: Swiss Franc (CHF), Value: CHF
                }
            }

            if (CmbCurrentCurrency.Text != "") // This will ensure that current currency are not empty before it start conversion processing
            {
                ProcessCurrencyConversion();
            }
        }
示例#2
0
        /// <summary>
        /// 预处理程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnPreProcess_Click(object sender, RoutedEventArgs e)
        {
            string filePath = this._preProcessFilePath;
            string strCon   = "Provider=Microsoft.Ace.OLEDB.12.0;" + "Data Source=" + filePath + ";" + "Extended Properties=Excel 12.0;";

            TxtResult.AppendText("开始预处理,请稍后" + Environment.NewLine);

            StringBuilder result = PreProcess(strCon);

            SaveFileDialog save = new SaveFileDialog
            {
                DefaultExt = ".txt",
                Filter     = "文本文件 (.txt)|*.txt"
            };


            if (save.ShowDialog() == true)
            {
                FileStream   output = new FileStream(save.FileName, FileMode.Create);
                StreamWriter writer = new StreamWriter(output, Encoding.UTF8);
                writer.Write(result);
                writer.Close();
                output.Close();
            }

            TxtResult.AppendText("预处理完成,结果为:" + save.FileName + Environment.NewLine);
        }
示例#3
0
 private void WriteMessageToTxt(string message)
 {
     TxtResult.Invoke(new Action(() =>
     {
         TxtResult.AppendText(message + Environment.NewLine);
     }));
 }
示例#4
0
 private void dialog_outBuffer_Loaded(object sender, RoutedEventArgs e)
 {
     foreach (string s in resultText)
     {
         TxtResult.AppendText(s + "\r\n");
     }
 }
示例#5
0
        private void Equals_Click(object sender, RoutedEventArgs e)
        {
            second = Int32.Parse(TxtResult.Text);
            int result = 0;

            if (op == '+')
            {
                result = first + second;
            }
            else if (op == '-')
            {
                result = first - second;
            }
            else if (op == '*')
            {
                result = first * second;
            }
            else if (op == '/')
            {
                result = first / second;
            }
            if (TxtResult.Text == "0")
            {
                ;
            }
            {
                TxtResult.Clear();
            }
            TxtResult.Text = result.ToString();
        }
示例#6
0
        //BOTON DE RESTA
        public void button10_Click(object sender, EventArgs e)
        {
            opciones = 2;
            using (ServiceReference1.Service1Client cliente = new ServiceReference1.Service1Client())
            {
                a = Convert.ToInt32(TxtResult.Text);

                TxtResult.Clear();
            }
        }
        private void BtnClick(object sender, EventArgs e)
        {
            if ((TxtResult.Text == "0") || (ismethodExecuted))
            {
                TxtResult.Clear();
            }
            ismethodExecuted = false;
            Button button = (Button)sender;

            TxtResult.Text = TxtResult.Text + button.Text;
        }
示例#8
0
        /// <summary>
        ///  生成自定义主键
        /// </summary>
        /// Author  : Napoleon
        /// Created : 2015-06-25 15:07:01
        private void PicSubmitCustomId_Click(object sender, EventArgs e)
        {
            var guid1 = TxtGuid1.Text.ConvertToInt();
            var guid2 = TxtGuid2.Text.ConvertToInt();

            if (string.IsNullOrWhiteSpace(TxtDateTime.Text))
            {
                MessageBox.Show("请填写日期样式!");
                return;
            }
            if (guid1 == -2 || guid2 == -2 || guid1 > 32 || guid2 > 32)
            {
                MessageBox.Show("请填写Guid起始位置(0-32)!");
                return;
            }
            if (guid1 > guid2)
            {
                MessageBox.Show("Guid开始位置不能大于结束位置!");
                return;
            }
            if (cobSelectOrderBy.SelectedIndex == -1)
            {
                MessageBox.Show("请选择生成顺序!");
                return;
            }
            var datetime = DateTime.Now.ToString(TxtDateTime.Text);
            var guid     = Guid.NewGuid().ToString().Replace("-", "").Substring(guid1, guid2 - guid1);

            switch (cobSelectOrderBy.SelectedIndex)
            {
            case 0:     //日期+Guid
                TxtResult.Text = datetime + guid;
                break;

            case 1:     //Guid+日期
                TxtResult.Text = guid + datetime;
                break;

            default:
                TxtResult.Text = datetime + guid;
                break;
            }
            if (chkFocus.Checked)//选中并复制
            {
                TxtResult.Focus();
                TxtResult.SelectAll();
                Clipboard.SetDataObject(TxtResult.Text, true);
            }
        }
示例#9
0
        private void BuscarDatos(ContactoModel filter)
        {
            TxtResult.Clear();
            List <ContactoModel> lista = clientSoap.GetContacts(filter);

            foreach (ContactoModel contacto in lista)
            {
                TxtResult.AppendText(contacto.Id.ToString());
                TxtResult.AppendText("\t\t");
                TxtResult.AppendText(contacto.Nombre);
                TxtResult.AppendText("\r\n");
            }

            if (string.Empty.Equals(TxtResult.Text))
            {
                TxtResult.AppendText("Sin Resultados encontrados");
                TxtResult.AppendText("\r\n");
            }
        }
示例#10
0
        private void BtnDecompse_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(TxtQueryBox.Text))
                {
                    throw new Exception("No query entered in query box.");
                }

                var query      = TxtQueryBox.Text;
                var parameters = Utility.DecomposeQueryParameters(query, true);
                TxtResult.Clear();
                var sb = new StringBuilder();
                parameters.Select(kv => $"{kv.Key}: {kv.Value}").ToList().ForEach(p => sb.AppendLine(p).AppendLine());
                TxtResult.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#11
0
 /// <summary>
 ///  显示记录
 /// </summary>
 /// <param name="pIndex"></param>
 private void ShowRecord(int pIndex)
 {
     TxtResult.Clear();
     TxtRecordHtml.Clear();
     if (pIndex >= 0)
     {
         if (mRecordHtmls != null && mRecordHtmls.Length > pIndex)
         {
             TxtCurrent.Text    = pIndex.ToString();
             TxtRecordHtml.Text = mRecordHtmls[pIndex];
             RegScriptTransactor sSe = new RegScriptTransactor(TxtRecordHtml.Text);
             if (mDrillRule.Feilds != null)
             {
                 for (int i = 0; i < mDrillRule.Feilds.Count; i++)
                 {
                     RegularMetaFeild sFeild = mDrillRule.Feilds[i];
                     if (sFeild.Rule != null)
                     {
                         try
                         {
                             TxtResult.AppendText(sFeild.Name);
                             TxtResult.AppendText(" : ");
                             TxtResult.AppendText(sSe.Exe(sFeild.Rule));
                             TxtResult.AppendText("\n");
                         }
                         catch (Exception E)
                         {
                             MessageBox.Show(E.Message);
                         }
                     }
                 }
             }
         }
     }
     else
     {
         TxtCurrent.Text = "0";
     }
 }
示例#12
0
 private void BtnClear_Click(object sender, EventArgs e)
 {
     TxtResult.Clear();
 }
示例#13
0
        //TODO: 逆序、合并、去重、输出

        /// <summary>
        /// 再处理程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnReProcess_Click(object sender, RoutedEventArgs e)
        {
            TxtResult.AppendText("开始再处理,请稍后" + Environment.NewLine);

            //去除 FP-Growth 所得结果中的出现次数
            List <List <string> > reverse = RemovePrefix();

            //使用删减版流通记录制作图书名称字典
            OpenFileDialog open = new OpenFileDialog();

            open.DefaultExt = ".xlsx";
            open.Filter     = "Excel 工作簿 (.xlsx)|*.xlsx";

            string filePath = open.FileName;
            string strCon   = "";

            Nullable <bool> openedFile = open.ShowDialog();

            if (openedFile == true)
            {
                //this._preProcessFilePath = open.FileName;
                //this.TxtPreProcess.Text = open.FileName;
                this.TxtResult.AppendText("已选择图书集文件:" + open.FileName + Environment.NewLine);
                strCon = "Provider=Microsoft.Ace.OLEDB.12.0;" + "Data Source=" + open.FileName + ";" + "Extended Properties=Excel 12.0;";
            }

            OleDbConnection connection = new OleDbConnection(strCon);

            connection.Open();
            string           strExcel = "";
            OleDbDataAdapter adapter  = null;
            DataSet          ds       = null;

            strExcel = "select * from [Sheet1$]";
            adapter  = new OleDbDataAdapter(strExcel, strCon);
            ds       = new DataSet();
            adapter.Fill(ds, "table1");
            DataTable table = ds.Tables[0];

            //HashSet<string> bookName = new HashSet<string>();

            Dictionary <string, string> bookName = new Dictionary <string, string>();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                try
                {
                    bookName.Add(table.Rows[i][0].ToString(), table.Rows[i][1].ToString());
                }
                catch (Exception exception)
                {
                }
            }

            //逆序
            for (int i = 0; i < reverse.Count; i++)
            {
                reverse[i].Reverse();
            }

            //合并与去重
            //每一行
            List <string>         row    = new List <string>();
            List <List <string> > result = new List <List <string> >();
            //List<HashSet<string>> hashList = new List<HashSet<string>>();
            HashSet <string> hashSet = new HashSet <string>();

            /*
             * for (int i = 0; i < reverse.Count; i++)
             * {
             *  for (int j = i; j < reverse.Count; j++)
             *  {
             *      if (reverse[i][0] == reverse[j][0])
             *      {
             *          row.AddRange(reverse[j]);
             *      }
             *      else
             *      {
             *          i = j;
             *          hashSet = new HashSet<string>(row);
             *          result.Add(hashSet.ToList());
             *          row.Clear();
             *          hashSet.Clear();
             *          break;
             *      }
             *  }
             * }
             */

            for (int i = 0; i < reverse.Count; i++)
            {
                row.AddRange(reverse[i]);
                for (int j = i + 1; j < reverse.Count; j++)
                {
                    if (reverse[i][0] == reverse[j][0])
                    {
                        row.AddRange(reverse[j]);
                    }
                    else
                    {
                        i       = j - 1;
                        hashSet = new HashSet <string>(row);
                        result.Add(hashSet.ToList());
                        row.Clear();
                        hashSet.Clear();
                        break;
                    }
                }
            }

            //替换结果中的图书种类号

            for (int i = 0; i < result.Count; i++)
            {
                for (int j = 0; j < result[i].Count; j++)
                {
                    result[i][j] = bookName[result[i][j]];
                }
                //result[i].Add(Environment.NewLine);
            }

            /*
             * for (int i = 0; i < result.Count; i++)
             * {
             *  result[i].Add(Environment.NewLine);
             * }
             */

            //图书名称保存本次分析结果
            SaveFileDialog save = new SaveFileDialog
            {
                DefaultExt = ".txt",
                Filter     = "文本文件 (.txt)|*.txt"
            };


            if (save.ShowDialog() == true)
            {
                FileStream   output = new FileStream(save.FileName, FileMode.Create);
                StreamWriter writer = new StreamWriter(output, Encoding.UTF8);
                for (int i = 0; i < result.Count; i++)
                {
                    for (int j = 0; j < result[i].Count; j++)
                    {
                        writer.Write(result[i][j] + ",");
                    }
                    writer.Write(Environment.NewLine + Environment.NewLine);
                }
                //writer.Write(result);
                writer.Close();
                output.Close();
            }

            TxtResult.AppendText("再处理完成,结果为:" + save.FileName + Environment.NewLine);
        }
示例#14
0
 private void Divide_Click(object sender, RoutedEventArgs e)
 {
     first = Int32.Parse(TxtResult.Text);
     op    = '/';
     TxtResult.Clear();
 }
示例#15
0
 private void AddButton_Click(object sender, RoutedEventArgs e)
 {
     first = Int32.Parse(TxtResult.Text);
     op    = '+';
     TxtResult.Clear();
 }
示例#16
0
 private void button17_Click(object sender, EventArgs e)
 {
     TxtResult.Clear();
 }
示例#17
0
 private void V2_Load(object sender, EventArgs e)
 {
     TxtResult.Clear();
 }