private void DecodeSpy_Click(object sender, EventArgs e) { string log; int TotalSum; ChangeBox.Text = rsaMethod.Decode(ChangeBox.Text, KeyBox1.Text, KeyBox2.Text, out log, out TotalSum); TSBox2.Text = TotalSum.ToString(); LogForm form = new LogForm(log); form.Show(); }
private void button1_Click(object sender, EventArgs e) { string key1, key2, log; int TotalSum; ChangeBox.Text = rsaMethod.Encode(InputBox.Text, out key1, out key2, out log, out TotalSum); KeyBox1.Text = key1; KeyBox2.Text = key2; TSBox1.Text = TotalSum.ToString(); LogForm form = new LogForm(log); form.Show(); }
private void CheckButton_Click(object sender, EventArgs e) { string log; int TotalSum; OutputBox.Text = rsaMethod.Decode(OutputBox.Text, KeyBox1.Text, KeyBox2.Text, out log, out TotalSum); TSBox2.Text = TotalSum.ToString(); LogForm form = new LogForm(log); form.Show(); if (TSBox1.Text == TSBox2.Text) { MessageBox.Show("Сообщение не изменилось"); } else { MessageBox.Show("Сообщение изменилось"); } }
private void SorokFeldolgozasa() { Sorhiba = false; t = sor.Split(';'); if (t[0].ToString() == string.Empty) { MessageBox.Show("Adóazonosító jel hiányzik! (" + rownum + ". sor)"); bFeldolg.Enabled = false; return; } Tag ujtag = new Tag(); ujtag.adoazon = t[0].ToString(); ujtag.tag_pnr_id = TagEll(ujtag.adoazon); if (ujtag.tag_pnr_id == 0) { // visszagörgetés if (TranID != 0) { TransactionRollback(); } // alaphelyzet openFileDialog1.FileName = string.Empty; bFeldolg.Enabled = false; // leáll return; } try { ujtag.sajat = int.Parse(t[1].ToString()); SajatSum += ujtag.sajat; txSajatSumC.Text = SajatSum.ToString(); ujtag.mh = int.Parse(t[2].ToString()); MunkSum += ujtag.mh; txMunkSumC.Text = MunkSum.ToString(); ujtag.egyszeri = int.Parse(t[3].ToString()); EgyszeriSum += ujtag.egyszeri; TxEgyszeriSumC.Text = EgyszeriSum.ToString(); ujtag.rendszeres = int.Parse(t[4].ToString()); RendszSum += ujtag.rendszeres; txRendszSumC.Text = RendszSum.ToString(); } catch { MessageBox.Show("Hibás összeg: " + rownum + ". sor!"); // visszagörgetés if (TranID != 0) { TransactionRollback(); } // alaphelyzet openFileDialog1.FileName = string.Empty; bFeldolg.Enabled = false; // leáll return; } TotalSum = SajatSum + MunkSum + EgyszeriSum + RendszSum; TxTotalC.Text = TotalSum.ToString(); tagok.Add(ujtag); txTagokSumC.Text = tagok.Count.ToString(); // db insert int forgid = InsertSor(ujtag); if (forgid == 0) { MessageBox.Show("Sor rögzítése sikertelen: " + rownum + ". sor!"); // visszagörgetés if (TranID != 0) { TransactionRollback(); } // alaphelyzet openFileDialog1.FileName = string.Empty; bFeldolg.Enabled = false; // leáll return; } RowVerification(ujtag, forgid); // szerződési feltételek ellenőrzése //munkáltatói hj if (ujtag.mh > 0) { mhEll(ujtag, forgid); // } // támogatás if (ujtag.rendszeres > 0) { mhEll(ujtag, forgid); // } if (Sorhiba) { ujtag.ervenyes = "N"; UpdateSor(ujtag, forgid); } }
private void SubscribeToChanges(ProductInOrder newProductInOrder) { int previousSelectedQuantity = 0; newProductInOrder.WhenAnyValue(x => x.SelectedDiscount, x => x.SelectedQuantity) .Subscribe(a => { float newSelectedDiscount = a.Item1; int newSelectedQuantity = a.Item2; //Value(price) that will be added(or removed) to(from) TotalPrice decimal newValue = (decimal)newProductInOrder.UnitPrice * (newSelectedQuantity - previousSelectedQuantity); //-1% or +1% discount decimal percentageOff = (decimal)(newSelectedDiscount - newProductInOrder.PreviousSelectedDiscount) / 100; //Executing when the SelectedDiscount has changed if (percentageOff != 0) { newProductInOrder.Sum -= newProductInOrder.SelectedQuantity * (decimal)newProductInOrder.UnitPrice * percentageOff; TotalSum -= newProductInOrder.SelectedQuantity * (decimal)newProductInOrder.UnitPrice * percentageOff; } //Executing when the SelectedQuantity has changed and the SelectedDiscount is greater than zero. else if (newSelectedDiscount != 0) { decimal sumOff = ((decimal)newProductInOrder.PreviousSelectedDiscount / 100) * newProductInOrder.SelectedQuantity * (decimal)newProductInOrder.UnitPrice; decimal sumToAdd = sumOff - newProductInOrder.Sum; newProductInOrder.Sum = sumOff; TotalSum += sumToAdd; TotalSumString = TotalSum.ToString("C2"); return; } newProductInOrder.PreviousSelectedDiscount = newSelectedDiscount; newProductInOrder.Sum += newValue; TotalSum += newValue; TotalSumString = TotalSum.ToString("C2"); }); newProductInOrder.WhenAnyValue(x => x.SelectedQuantity) .Select(newSelectedQuantity => { if (newSelectedQuantity == 0) { return(0); } int deltaQuantity = newSelectedQuantity - previousSelectedQuantity; //Quantity of products that will be added or removed(in case of negative value) from the stock of the current product previousSelectedQuantity = newSelectedQuantity; return(deltaQuantity); }) .Subscribe(newValue => { newProductInOrder.SourceProductOnStore.UnitsInStock -= (short)newValue; Product productToReplace = productsList.First(x => x.ProductID == newProductInOrder.ProductID); productToReplace.UnitsInStock -= (short)newValue; }); }