private void CellControlLogin() { if (EmployeeName_TextBox.Text == "" && DMPID_TextBox.Text == "") { ListBox.Items.Add("Please Enter Your Name and DMP ID to Login"); } else if (EmployeeName_TextBox.Text == "") { ListBox.Items.Add("Enter Employee Name to Login"); } else if (DMPID_TextBox.Text == "") { ListBox.Items.Add("Enter DMP ID to Login"); } else if (EmployeeName_TextBox.Text != "" && DMPID_TextBox.Text != "") { try { SqlConnection CellManagerConnection = new SqlConnection(SQL_Connection); SqlCommand SQL_CellManager = new SqlCommand("Select * from [dbo].[Admin] where EmployeeName=@EmployeeName and EmployeePassword=@EmployeePassword", CellManagerConnection); SQL_CellManager.Parameters.AddWithValue("@EmployeeName", EmployeeName_TextBox.Text); SQL_CellManager.Parameters.AddWithValue("@EmployeePassword", DMPID_TextBox.Text); CellManagerConnection.Open(); SqlDataAdapter adapt = new SqlDataAdapter(SQL_CellManager); DataSet ds = new DataSet(); adapt.Fill(ds); LoginGridView.DataSource = ds.Tables[0]; CellManagerConnection.Close(); int count = ds.Tables[0].Rows.Count; if (count == 1) { Cell_Manager CellManager = new Cell_Manager(); CellManager.User_TextBox.Text = EmployeeName_TextBox.Text; CellManager.Clock_TextBox.Text = Clock_TextBox.Text; CellManager.DMPID_TextBox.Text = DMPID_TextBox.Text; ListBox.Items.Clear(); CellManager.Show(); CellManager.Focus(); OpenNewForm(); } } catch (Exception) { ListBox.Items.Add("Access to Cell Control Denied"); } } }
private void Awake() { _Instance = this; }