private void menuItem1_Click(object sender, EventArgs e) { Form config = new formConfig(); config.Show(); this.Hide(); }
private void btnLogin_Click(object sender, EventArgs e) { btnLogin.Enabled = false; syncDateTime(); if (txtLoginId.Text == "") { MessageBox.Show("Please Enter Login Id."); classLog.writeLog("Warning @:Please Enter Login Id."); } else if (txtPassword.Text == "") { MessageBox.Show("Please Enter Login Password."); classLog.writeLog("Warning @:Please Enter Login Password."); } else { string LoginId = txtLoginId.Text.ToString().Trim(); string Password = txtPassword.Text.ToString().Trim(); //string connectionString = "Data Source=" + //(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + //"\\localdb.sdf;Persist Security info=False"; string connectionString = localConnection; using (SqlCeConnection connection = new SqlCeConnection(connectionString)) { connection.Open(); string cmd = "select LoginId,LoginType from UserMst where LoginId='" + LoginId + "' and Password='******'"; SqlCeDataAdapter da = new SqlCeDataAdapter(cmd, connectionString); DataSet ds = new DataSet(); try { da.Fill(ds); string usr = ds.Tables[0].Rows[0].ItemArray[0].ToString(); string usrtype = ds.Tables[0].Rows[0].ItemArray[1].ToString(); classLogin.User = usr; classLogin.UserType = usrtype; getReaderOperation(); if (usr.ToString().Trim() == LoginId.ToString().Trim()) { classLogin.User = usr; if (usrtype.ToString().Trim() == "admin") { Form config = new formConfig(); config.Show(); this.Hide(); } else if (usrtype.ToString().Trim() == "user") { if (id != "2") { formConnection config = new formConnection(); config.Show(); this.Hide(); } else { MessageBox.Show("Please Configure first."); classLog.writeLog("Message @:Please Configure first."); } } else { MessageBox.Show("User Details Not Updated Properly."); } } else { MessageBox.Show("Login Details Invalid"); classLog.writeLog("Error @:Login Details Invalid"); } } catch { MessageBox.Show("Login Details Invalid..."); classLog.writeLog("Error @:Login Details Invalid..."); } } } btnLogin.Enabled = true; }
private void imageButtonConfig_Click(object sender, EventArgs e) { formConfig f = new formConfig(); f.ShowDialog(); }