public async Task <bool> InsertAsync(CurrencyConverterInsert command) { string query = @"INSERT INTO TRANSACTIONCURRENCY VALUES ( null, @IdUser, @CurrencyFrom, @CurrencyTo, @ValueFrom, @ValueTo, @RateConversionUsed, @Date )"; Dictionary <string, object> parameters = new Dictionary <string, object> { { "Id", null }, { "IdUser", command.IdUser }, { "CurrencyFrom", command.CurrencyFrom }, { "CurrencyTo", command.CurrencyTo }, { "ValueFrom", command.ValueFrom }, { "ValueTo", command.ValueTo }, { "RateConversionUsed", command.RateConversionUsed }, { "Date", DateTime.Now } }; try { return(IntExtension.TryParse( await _sqlDataContext.ExecuteScalar(NameDataBase, query, parameters)) > 0); } catch (Exception ex) { throw new ArgumentException("Error requisition to DatabAse!", "insert table => TRANSACTIONCURRENCY", ex); } }
private void button19_Click(object sender, EventArgs e) { StringBuilder ierrinfo1 = new StringBuilder(2048); StringBuilder cardno = new StringBuilder(20480); StringBuilder ierrinfo = new StringBuilder(20480); int port = IntExtension.Parse(textBox1.Text); int com = 0;//usb=100 int ret = 0; ret = SSCard.iDOpenPort(port, ref com, ierrinfo1); if (ret != 0) { MessageBox.Show("打开端口失败" + ierrinfo1.ToString()); return; } else { ret = SSCard.getCardNO(IntExtension.Parse(textBox1.Text), cardno, ierrinfo); if (ret != 0) { MessageBox.Show("读取卡号失败:" + ierrinfo.ToString()); } else { MessageBox.Show(cardno.ToString()); } } }
static int ProcessSalaryInput(string salary) { var inputValidation = decimal.TryParse(salary, out decimal income); if (inputValidation) { return(IntExtension.Rounding(income / 12M)); } return(0); }
private void button1_Click(object sender, EventArgs e) { AppCfg.Instance.Port = IntExtension.Parse(textBoxPort.Text.Trim()); AppCfg.Instance.Save(); if (button1.Text == "开启") { textBoxPort.Enabled = false; button1.Text = "停止"; HostConfiguration hostConfig = new HostConfiguration() { UrlReservations = new UrlReservations() { //create URL reservations automatically CreateAutomatically = true } }; Uri uri = new Uri("http://localhost:" + AppCfg.Instance.Port); nancySelfHost = new NancyHost(hostConfig, uri); nancySelfHost.Start(); AppReportManager.Instance.Send(new LogEntity() { Log = "开启监测" }); } else { nancySelfHost.Stop(); textBoxPort.Enabled = true; button1.Text = "开启"; AppReportManager.Instance.Send(new LogEntity() { Log = "停止监测" }); } }
private void button1_Click(object sender, EventArgs e) { Configs.Handle = dcrf.dc_init(IntExtension.Parse(textBox1.Text), IntExtension.Parse(textBox2.Text)); MessageBox.Show(Configs.Handle.ToString()); }
public void Rounding_ShouldRoundDown_ReturnWholeNumber(decimal number, decimal output) { var result = IntExtension.Rounding(number); Assert.That(result, Is.EqualTo(output)); }
public void SetUp() { intExtension = new IntExtension(); }
public void GreatestCommonDivisor_IntMinValue_ArgumentException(params int[] numbers) { var ex = Assert.Catch <Exception>(() => IntExtension.GreatestCommonDevisor(numbers)); StringAssert.Contains("Numbers can't be min value of integer", ex.Message); }
public void BinaryAlgorithmGreatestCommonDivisor_IntMinValue_ArgumentException(int number1, int number2, int number3) { var ex = Assert.Catch <Exception>(() => IntExtension.BinaryAlgotithmGreatestCommonDevisor(number1, number2, number3)); StringAssert.Contains("Numbers can't be min value of integer", ex.Message); }
private static bool IsPrime(int userInput) { var solution = new IntExtension(); return(solution.IsPrimeMap(userInput)); }