public void Refresh() { DateTime thisDay = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")); try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string sqlquery = "Select id, dt , STUFF(RIGHT('0' + CONVERT(VarChar(7), stime, 0), 7), 6, 0, ' ') AS st, STUFF(RIGHT('0' + CONVERT(VarChar(7), etime, 0), 7), 6, 0, ' ') AS et,pln from pbplan where unam = @a and dt = @b and sec = @c ORDER BY dt asc"; SqlCommand sqlcmd = new SqlCommand(sqlquery, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; sqlcmd.Parameters.Add("@b", SqlDbType.Date).Value = thisDay; sqlcmd.Parameters.Add("@c", SqlDbType.VarChar).Value = "no"; SqlDataAdapter data_adapter = new SqlDataAdapter(sqlcmd); DataTable dt = new DataTable("pbplan"); data_adapter.Fill(dt); id.ItemsSource = dt.DefaultView; data_adapter.Update(dt); sqlcon.Close(); } catch (Exception) { massage mass = new massage("Opps..."); mass.ShowDialog(); } }
public void contain() { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string commandstring = "select dt , STUFF(RIGHT('0' + CONVERT(VarChar(7), stime, 0), 7), 6, 0, ' ') AS st, STUFF(RIGHT('0' + CONVERT(VarChar(7), etime, 0), 7), 6, 0, ' ') AS et, pln from pbplan where id = @a"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; SqlDataReader read = sqlcmd.ExecuteReader(); while (read.Read()) { pdate.Text = read["dt"].ToString(); stime.Text = read["st"].ToString(); etime.Text = read["et"].ToString(); plan.Text = read["pln"].ToString(); } sqlcon.Close(); } catch (Exception) { massage mass = new massage("Errore cunnection"); mass.ShowDialog(); } }
public void contain() { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string commandstring = "select * from contact where Id = @a"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; SqlDataReader read = sqlcmd.ExecuteReader(); while (read.Read()) { name.Text = read["Name"].ToString(); number.Text = read["Number"].ToString(); email.Text = read["Email"].ToString(); fb.Text = read["Fb"].ToString(); other.Text = read["Other"].ToString(); add.Text = read["Address"].ToString(); } sqlcon.Close(); } catch (Exception) { massage mass = new massage("Errore cunnection"); mass.ShowDialog(); } }
public void contain() { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string commandstring = "select * from Bank where id = @a"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; SqlDataReader read = sqlcmd.ExecuteReader(); while (read.Read()) { bname.Text = read["Bname"].ToString(); anumber.Text = read["Anumber"].ToString(); cnumber.Text = read["Cnumber"].ToString(); cpass.Text = read["Cpassword"].ToString(); } sqlcon.Close(); } catch (Exception) { massage mass = new massage("Errore cunnection"); mass.ShowDialog(); } }
public void conain() { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string commandstring = "select * from note where Id = @a"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; SqlDataReader read = sqlcmd.ExecuteReader(); while (read.Read()) { title.Text = read["title"].ToString(); note.Text = read["notes"].ToString(); } sqlcon.Close(); } catch (Exception) { massage mass = new massage("Errore cunnection"); mass.ShowDialog(); } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (pdate.Text.Length == 0) { massage masse = new massage("Set Plan Date !!"); masse.ShowDialog(); } else if (stime.Text == null) { massage masse = new massage("Set Plan Start Time !!"); masse.ShowDialog(); } else if (etime.Text == null) { massage masse = new massage("Set Plan End Time !!"); masse.ShowDialog(); } else if (plan.Text == "") { massage masse = new massage("Set Your Plan Detail !!"); masse.ShowDialog(); } else { DateTime P_date = Convert.ToDateTime(string.Format("{0:yyyy-mm-dd}", pdate.Text)); TimeSpan S_time = DateTime.Parse(string.Format("{0:hh:mm tt}", stime.Text)).TimeOfDay; TimeSpan E_time = DateTime.Parse(string.Format("{0:hh:mm tt}", etime.Text)).TimeOfDay; string Pln = plan.Text; try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); SqlCommand cmd = new SqlCommand("UPDATE pbplan SET dt = @b, stime = @c, etime = @d, pln = @e WHERE Id=@a", sqlcon); cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; cmd.Parameters.Add("@b", SqlDbType.Date).Value = P_date; cmd.Parameters.Add("@c", SqlDbType.Time).Value = S_time; cmd.Parameters.Add("@d", SqlDbType.Time).Value = E_time; cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Pln; sqlcon.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { massage mass = new massage("Plan Set Successful !!"); mass.ShowDialog(); this.Close(); } sqlcon.Close(); } catch (Exception) { massage mass = new massage("Connection Error !!"); mass.ShowDialog(); } } }
public void Refresh(string valu) { if (valu != "") { DateTime date = Convert.ToDateTime(string.Format("{0:yyyy-mm-dd}", valu)); try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string sqlquery = "Select id, dt , STUFF(RIGHT('0' + CONVERT(VarChar(7), stime, 0), 7), 6, 0, ' ') AS st, STUFF(RIGHT('0' + CONVERT(VarChar(7), etime, 0), 7), 6, 0, ' ') AS et ,pln from pbplan where unam = @a and sec = @c And dt like @b ORDER BY dt asc"; SqlCommand sqlcmd = new SqlCommand(sqlquery, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; sqlcmd.Parameters.Add("@b", SqlDbType.Date).Value = date; sqlcmd.Parameters.Add("@c", SqlDbType.VarChar).Value = "ok"; SqlDataAdapter data_adapter = new SqlDataAdapter(sqlcmd); DataTable dt = new DataTable("pbplan"); data_adapter.Fill(dt); id.ItemsSource = dt.DefaultView; data_adapter.Update(dt); sqlcon.Close(); } catch (Exception) { massage mass = new massage("Opps..."); mass.ShowDialog(); } } else { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string sqlquery = "Select id, dt , STUFF(RIGHT('0' + CONVERT(VarChar(7), stime, 0), 7), 6, 0, ' ') AS st, STUFF(RIGHT('0' + CONVERT(VarChar(7), etime, 0), 7), 6, 0, ' ') AS et,pln from pbplan where unam = @a and sec = @b ORDER BY dt asc"; SqlCommand sqlcmd = new SqlCommand(sqlquery, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = "ok"; SqlDataAdapter data_adapter = new SqlDataAdapter(sqlcmd); DataTable dt = new DataTable("pbplan"); data_adapter.Fill(dt); id.ItemsSource = dt.DefaultView; data_adapter.Update(dt); sqlcon.Close(); } catch (Exception) { massage mass = new massage("Opps..."); mass.ShowDialog(); } } }
private void Button_Click(object sender, RoutedEventArgs e) { string Name = name.Text; string Number = number.Text; string Email = email.Text; string Fb = fb.Text; string Other = other.Text; string Address = add.Text; if (Name != "") { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); SqlCommand cmd = new SqlCommand("insert into Contact values(@a,@b,@c,@d,@e,@f,@g)", sqlcon); cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = Name; cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = Number; cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = Email; cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Fb; cmd.Parameters.Add("@f", SqlDbType.VarChar).Value = Other; cmd.Parameters.Add("@g", SqlDbType.VarChar).Value = Address; sqlcon.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { massage masse = new massage("Save Successful !!"); masse.ShowDialog(); name.Text = ""; number.Text = ""; email.Text = ""; fb.Text = ""; other.Text = ""; add.Text = ""; } sqlcon.Close(); } catch (Exception) { massage masse = new massage("Connection Error !!"); masse.ShowDialog(); } } else { massage masse = new massage("Name Must be Requerd !!"); masse.ShowDialog(); } }
public void Refresh(string valu) { if (valu != "") { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string sqlquery = "Select * from Contact where unam = @a And Name like + @b + '%' ORDER BY Name asc"; SqlCommand sqlcmd = new SqlCommand(sqlquery, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = valu; SqlDataAdapter data_adapter = new SqlDataAdapter(sqlcmd); DataTable dt = new DataTable("Contact"); data_adapter.Fill(dt); id.ItemsSource = dt.DefaultView; data_adapter.Update(dt); sqlcon.Close(); } catch (Exception) { massage mass = new massage("Opps..."); mass.ShowDialog(); } } else { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string sqlquery = "Select * from Contact where unam = @a ORDER BY Name asc"; SqlCommand sqlcmd = new SqlCommand(sqlquery, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; SqlDataAdapter data_adapter = new SqlDataAdapter(sqlcmd); DataTable dt = new DataTable("Contact"); data_adapter.Fill(dt); id.ItemsSource = dt.DefaultView; data_adapter.Update(dt); sqlcon.Close(); } catch (Exception) { massage mass = new massage("Opps..."); mass.ShowDialog(); } } }
private void s_btn(object sender, RoutedEventArgs e) { string o_pass = opass.Password; string pass1 = npass.Password; string pass2 = cpass.Password; if (pass1 == pass2) { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); string commandstring = "update regis set pass=@pre where unam = @a and pass = @b"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@pre", SqlDbType.VarChar).Value = pass1; sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = o_pass; sqlcon.Open(); int rows = sqlcmd.ExecuteNonQuery(); sqlcon.Close(); if (rows == 1) { massage mass = new massage("Password Changed Successfully.."); mass.ShowDialog(); } else { massage mass = new massage("Password does not Match.."); mass.ShowDialog(); } } catch (Exception) { massage mass = new massage("User Name And Forgot key does not Match.."); mass.ShowDialog(); } } else { massage mass = new massage("Password does not Match !!"); mass.ShowDialog(); } opass.Password = ""; npass.Password = ""; cpass.Password = ""; }
private void Button_Click(object sender, RoutedEventArgs e) { string P_name = pname.Text; string URL = url.Text; string EMUN = emun.Text; string Passw = passw.Text; if (P_name != "") { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); SqlCommand cmd = new SqlCommand("insert into Password values(@a,@b,@c,@d,@e)", sqlcon); cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = P_name; cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = URL; cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = EMUN; cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Passw; sqlcon.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { massage masse = new massage("Save Successful !!"); masse.ShowDialog(); pname.Text = ""; url.Text = ""; emun.Text = ""; passw.Text = ""; } sqlcon.Close(); } catch (Exception) { massage masse = new massage("Connection Error !!"); masse.ShowDialog(); } } else { massage masse = new massage("Name Must be Requerd !!"); masse.ShowDialog(); } }
private void Button_Click(object sender, RoutedEventArgs e) { string Bname = bname.Text; string Anumber = anumber.Text; string Cnumber = cnumber.Text; string Cpass = cpass.Text; if (Bname != "") { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); SqlCommand cmd = new SqlCommand("insert into Bank values(@a,@b,@c,@d,@e)", sqlcon); cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = Bname; cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = Anumber; cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = Cnumber; cmd.Parameters.Add("@e", SqlDbType.VarChar).Value = Cpass; sqlcon.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { massage masse = new massage("Save Successful !!"); masse.ShowDialog(); bname.Text = ""; anumber.Text = ""; cnumber.Text = ""; cpass.Text = ""; } sqlcon.Close(); } catch (Exception) { massage masse = new massage("Connection Error !!"); masse.ShowDialog(); } } else { massage masse = new massage("Name Must be Requerd !!"); masse.ShowDialog(); } }
private void logbtn(object sender, RoutedEventArgs e) { string u_nam = uname.Text; string pass = passw.Password; int count = 0; try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); sqlcon.Open(); string commandstring = "select * from regis where unam = @a and pass = @b"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = u_nam; sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = pass; SqlDataReader read = sqlcmd.ExecuteReader(); while (read.Read()) { count++; if (read["unam"].ToString() == u_nam && read["pass"].ToString() == pass) { massage mass = new massage("Login Successful !!"); mass.ShowDialog(); main ma = new main(read["unam"].ToString()); ma.Show(); this.Close(); } } if (count == 0) { massage mass = new massage("Invalid Username And Password"); mass.ShowDialog(); } sqlcon.Close(); } catch (Exception) { massage mass = new massage("Invalid Username And Password"); mass.ShowDialog(); } }
private void svcl(object sender, RoutedEventArgs e) { string title = ftit.Text; string mass = nd.Text; if (title != "" && mass != "") { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); SqlCommand cmd = new SqlCommand("insert into note values(@a,@b,@c)", sqlcon); cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = title; cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = mass; sqlcon.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { massage masse = new massage("Save Successful !!"); masse.ShowDialog(); ftit.Text = ""; nd.Text = ""; } sqlcon.Close(); } catch (Exception) { massage masse = new massage("Title And Note Must 200 & 700 !!"); masse.ShowDialog(); } } else { massage masse = new massage("Opps input all fields!!"); masse.ShowDialog(); } }
private void Save_Click(object sender, RoutedEventArgs e) { string tit = title.Text; string mass = note.Text; if (tit != "" && mass != "") { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); SqlCommand cmd = new SqlCommand("UPDATE note SET title = @b, notes = @c WHERE Id=@a ", sqlcon); cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = uid; cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = tit; cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = mass; sqlcon.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { massage masse = new massage("Save Successful !!"); masse.ShowDialog(); this.Close(); } sqlcon.Close(); } catch (Exception) { massage masse = new massage("Title And Note Must 150 & 500 !!"); masse.ShowDialog(); } } else { massage masse = new massage("Opps input all fields!!"); masse.ShowDialog(); } }
private void delclk(object sender, RoutedEventArgs e) { var myValue = ((Button)sender).Tag; config cn = new config(); SqlConnection sqlcon = cn.cunnection(); string commandstring = "delete from Contact where id= @a"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = myValue; sqlcon.Open(); int rows = sqlcmd.ExecuteNonQuery(); sqlcon.Close(); if (rows > 0) { massage mass = new massage("delete successfully..."); mass.ShowDialog(); this.Refresh(shbx.Text); } }
private void success(object sender, RoutedEventArgs e) { var myValue = ((Button)sender).Tag; config cn = new config(); SqlConnection sqlcon = cn.cunnection(); string commandstring = "UPDATE pbplan SET sec=@b where id= @a"; SqlCommand sqlcmd = new SqlCommand(commandstring, sqlcon); sqlcmd.Parameters.Add("@a", SqlDbType.VarChar).Value = myValue; sqlcmd.Parameters.Add("@b", SqlDbType.VarChar).Value = "ok"; sqlcon.Open(); int rows = sqlcmd.ExecuteNonQuery(); sqlcon.Close(); if (rows > 0) { massage mass = new massage("This Plan Is Successfule..."); mass.ShowDialog(); this.Refresh(); } }
private void regclk(object sender, RoutedEventArgs e) { string u_nam = unam.Text; string name = nam.Text; string f_key = fkey.Text; string pass1 = pass.Password; string pass2 = cpass.Password; if (u_nam == "") { massage mass = new massage("Input User Name.."); mass.ShowDialog(); } else if (name == "") { massage mass = new massage("Input Name.."); mass.ShowDialog(); } else if (f_key == "") { massage mass = new massage("Input Forgot key.."); mass.ShowDialog(); } else if (pass1 == "") { massage mass = new massage("Input Password.."); mass.ShowDialog(); } else if (pass2 == "") { massage mass = new massage("Input Confirm Password.."); mass.ShowDialog(); } else { if (pass1 == pass2) { try { config cn = new config(); SqlConnection sqlcon = cn.cunnection(); SqlCommand cmd = new SqlCommand("insert into regis values(@a,@b,@c,@d)", sqlcon); cmd.Parameters.Add("@a", SqlDbType.VarChar).Value = u_nam; cmd.Parameters.Add("@b", SqlDbType.VarChar).Value = name; cmd.Parameters.Add("@c", SqlDbType.VarChar).Value = f_key; cmd.Parameters.Add("@d", SqlDbType.VarChar).Value = pass1; sqlcon.Open(); int rows = cmd.ExecuteNonQuery(); if (rows > 0) { massage mass = new massage("Registration Successful !!"); mass.ShowDialog(); main mi = new main(u_nam); mi.Show(); this.Close(); } sqlcon.Close(); } catch (Exception) { massage mass = new massage("This User Name is Alrady Used !!"); mass.ShowDialog(); } } else { massage mass = new massage("Password does not Match !!"); mass.ShowDialog(); } } }