private void textBox1_KeyDown(object sender, KeyEventArgs e) { if ((e.KeyValue == (char)Keys.Enter) && (listBox1.SelectedIndex != -1)) { if (textBox1.Text == dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[1].Value.ToString()) { label4.Text = "OK"; label4.BackColor = System.Drawing.Color.Green; timerStatus.Enabled = true; WriteExcelFile(); dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex + 1].Cells[0]; dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.CurrentCell.RowIndex; textBox1.Clear(); if (serialPort1.IsOpen) { serialPort1.Write("1"); } } else { label4.Text = "NG"; label4.BackColor = System.Drawing.Color.Red; //MessageBox.Show("Lütfen doğru etiketi okutunuz", "Hatalı Etiket", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Clear(); // Display the password form. PassForm passForm = new PassForm(); if (passForm.ShowDialog() != DialogResult.OK) { this.Close(); } else { label4.Text = "Durum"; label4.BackColor = System.Drawing.Color.Gray; } } DataGridViewRow row0 = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex]; row0.Height = 40; row0.DefaultCellStyle.BackColor = Color.LightGray; DataGridViewRow rowBefore = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex - 1]; rowBefore.Height = 22; rowBefore.DefaultCellStyle.BackColor = Color.White; e.SuppressKeyPress = true; } }
public ActionResult changePassword(string old, string newPass, string newPassConfirm) { if (newPass.Equals(newPassConfirm)) { PassForm p = new PassForm(); p.old = old; p.newPass = newPass; HttpClient client = new HttpClient(); client.BaseAddress = new Uri("http://localhost:8081"); string jwtEncodedString = Request.Cookies["Token"].Value; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", jwtEncodedString); HttpResponseMessage msg = client.PostAsJsonAsync <PassForm>("userapi/updatePassword", p).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode()).Result; } ViewBag.user = this.currentUser(); return(RedirectToAction("profile")); }
private void btnResetCount_Click(object sender, EventArgs e) { PassForm passform = new PassForm(this); passform.ShowDialog(); if (apcept) { if (File.Exists(@"D:\Noise Check Barcode Data\count.txt")) { using (var writer = new StreamWriter(@"D:\Noise Check Barcode Data\count.txt")) { writer.Write("0"); writer.Close(); lblCount.Text = "0"; lblCount.BackColor = System.Drawing.Color.FromArgb(242, 247, 236); } } if (File.Exists(@"D:\Noise Check Barcode Data\HistoryChangeConnector.txt")) { using (var reader = new StreamReader(@"D:\Noise Check Barcode Data\HistoryChangeConnector.txt")) { string line = ""; string[] array = new string[2]; array[0] = "-"; array[1] = "-"; while ((line = reader.ReadLine()) != null) { array = line.Split(';'); } lbldatetime.Text = "- " + array[0].ToString(); lblteach.Text = "- " + array[1].ToString(); reader.Close(); } } } }