private void getRfid() { string rfid = null; SerialPortTerminal.frmTerminal frm = new SerialPortTerminal.frmTerminal(); frm.ShowDialog(); if (File.Exists(Application.StartupPath + "\\RFID Number\\FromRFID.txt")) { StreamReader sw1 = new StreamReader(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); rfid = (sw1.ReadToEnd()).ToString(); sw1.Close(); } try { File.Delete(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); con.Open(); SqlCommand cmd = new SqlCommand("select CardNo from Card where RfidNo='" + rfid + "'", con); txtCardNo.Text = cmd.ExecuteScalar().ToString(); con.Close(); } catch (Exception e) { MessageBox.Show("card not registred already or some problem with login try again "); } }
private void getRfid() { SerialPortTerminal.frmTerminal frm = new SerialPortTerminal.frmTerminal(); frm.ShowDialog(); lblRfid.Text = ""; if (File.Exists(Application.StartupPath + "\\RFID Number\\FromRFID.txt")) { StreamReader sw1 = new StreamReader(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); lblRfid.Text = (sw1.ReadToEnd()).ToString(); sw1.Close(); } File.Delete(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); }
private void getRfid() { string rfid = null; SerialPortTerminal.frmTerminal frm = new SerialPortTerminal.frmTerminal(); frm.ShowDialog(); if (File.Exists(Application.StartupPath + "\\RFID Number\\FromRFID.txt")) { StreamReader sw1 = new StreamReader(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); rfid = (sw1.ReadToEnd()).ToString(); sw1.Close(); } File.Delete(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); con.Open(); SqlCommand cmd = new SqlCommand("select CardNo from Card where RfidNo='" + rfid + "'", con); txtCardNo.Text = cmd.ExecuteScalar().ToString(); con.Close(); }
private void getRfid() { try { SerialPortTerminal.frmTerminal frm = new SerialPortTerminal.frmTerminal(); frm.ShowDialog(); lblRfid.Text = ""; if (File.Exists(Application.StartupPath + "\\RFID Number\\FromRFID.txt")) { StreamReader sw1 = new StreamReader(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); lblRfid.Text = (sw1.ReadToEnd()).ToString(); sw1.Close(); } File.Delete(Application.StartupPath + "\\RFID Number\\FromRFID.txt"); } catch (Exception e) { MessageBox.Show("problem with RF - ID Scanner"); } }
private void btnPurchase_Click(object sender, EventArgs e) { MessageBox.Show("inside purchase cs "); string msg = "You(" + lblCardNo.Text + ") Purchased."; int Rice = 0, Sugar = 0, wheat = 0, oil = 0; if (!txtRice.Enabled || txtRice.Text == "#") { Rice = 0; } else { Rice = Convert.ToInt32(txtRice.Text); msg += "\n Rice=" + txtRice.Text; } if (!txtSugar.Enabled || txtSugar.Text == "#") { Sugar = 0; } else { Sugar = Convert.ToInt32(txtSugar.Text); msg += "\n Sugar=" + txtSugar.Text; } if (!txtWheat.Enabled || txtWheat.Text == "#") { wheat = 0; } else { wheat = Convert.ToInt32(txtWheat.Text); msg += "\n Wheat =" + txtWheat.Text; } if (!txtOil.Enabled || txtOil.Text == "#") { oil = 0; } else { oil = Convert.ToInt32(txtOil.Text); msg += "\n Oil =" + txtOil.Text; } con.Open(); SqlCommand cmdPurchase = new SqlCommand("insPurchase", con); cmdPurchase.CommandType = CommandType.StoredProcedure; cmdPurchase.Parameters.AddWithValue("@date", DateTime.Now); cmdPurchase.Parameters.AddWithValue("@CardNo", lblCardNo.Text); cmdPurchase.Parameters.AddWithValue("@month", DateTime.Now.Month); cmdPurchase.Parameters.AddWithValue("@Rice", Rice); cmdPurchase.Parameters.AddWithValue("@Sugar", Sugar); cmdPurchase.Parameters.AddWithValue("@wheat", wheat); cmdPurchase.Parameters.AddWithValue("@oil", oil); cmdPurchase.ExecuteNonQuery(); con.Close(); msg += "\n on " + DateTime.Now.ToString(); btnCheck.Visible = false; btnPurchase.Visible = false; lblPurchase.Text = msg; SerialPortTerminal.frmTerminal objTer = new SerialPortTerminal.frmTerminal(); objTer.SendData("openED"); check_stock(); getMobileNo(msg); }