private void f_cpassword_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { String f_key = fac_key.Text; String f_id = fac_id.Text; String f_name = fac_name.Text; String f_pass = f_password.Text; String f_cpass = f_cpassword.Text; //String url_serv = "http://gubappwebservices.esy.es/faculty_Registraion"; String url_serv = murlf + "faculty_Registraion"; WebClient wc = new WebClient(); if ((f_password.Equals(f_password)) == false) { MessageBox.Show("Password Not Match"); } else { NameValueCollection sign_form = new NameValueCollection(); sign_form.Add("facaultu_key_id", f_key); sign_form.Add("faculty_code", f_id); sign_form.Add("faculty_name", f_name); sign_form.Add("passwo", f_pass); byte[] rep = wc.UploadValues(url_serv, sign_form); String s_resp = Encoding.UTF8.GetString(rep); //MessageBox.Show(s_resp); JavaScriptSerializer jscer = new JavaScriptSerializer(); server_responce ser = jscer.Deserialize <server_responce>(s_resp); //MessageBox.Show(ser.response_code.ToString()); if (ser.response_code == 100) { MessageBox.Show("You are now Registered with us", "Success"); splitContainer1.Panel2.Show(); panel1.Hide(); } else if (ser.response_code == 102) { MessageBox.Show("You are Already Registered ", "Sorry"); } else if (ser.response_code == 101) { MessageBox.Show("Invalid Detail", "Invalid"); } } } }
private void password_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { String f_id = faculty_id.Text; String f_pass = password.Text; String url_serv = murlf + "faculty_login"; // String url_serv = "http://gubappwebservices.esy.es/faculty_login"; Uri mur = new Uri(url_serv); WebClient wc = new WebClient(); NameValueCollection form = new NameValueCollection(); form.Add("faculty_id", f_id); form.Add("faculty_password", f_pass); byte[] ret = wc.UploadValues(url_serv, form); // wc.UploadValuesAsync(mur,form); // String rete = wc.DownloadString(url_serv); String mrestt = Encoding.UTF8.GetString(ret); // String mresp = respo.ToString(); // String ress = resp.ToString(); JavaScriptSerializer jser = new JavaScriptSerializer(); server_responce s_resp = jser.Deserialize <server_responce>(mrestt); // s_resp.response_code if (s_resp.response_code == 100) { Faculty_Dashboard facul_dash = new Faculty_Dashboard(f_id); //facul_dash.Shown += new EventHandler(cacheacces); facul_dash.Show(); // this.Close(); //facul_dash.Show(cacheacces()); // MessageBox.Show(s_resp.response_desc); } else { MessageBox.Show("Invalid Combination", "Invalid"); } } }