private async void btn_confirm_Click(object sender, EventArgs e) { string e_lcns = Globalfunction.Encrypt(doc_lcns.Text); string e_mac = Globalfunction.Encrypt(Globalfunction.pc_lcns); var param = new List <KeyValuePair <string, string> >(); param.Add(new KeyValuePair <string, string>("mt_lcns", e_lcns)); param.Add(new KeyValuePair <string, string>("mt_mac", e_mac)); param.Add(new KeyValuePair <string, string>("mt_name", hp_doctor.Text)); HttpContent content = new FormUrlEncodedContent(param); HttpResponseMessage response = await new HttpClient().PostAsync("http://contentsbox.co.kr" + "/au/check_lcns.php", content); response.EnsureSuccessStatusCode(); List <Pinfo> result = JsonConvert.DeserializeObject <List <Pinfo> >(await response.Content.ReadAsStringAsync()); if (result == null) { return; } else { if (result.Count == 0) { MessageBox.Show("입력하신 정보가 일치하지 않습니다."); } else { end_date.Text = result[0].mt_end; save_EndDate(Globalfunction.Encrypt(end_date.Text), e_mac); } } }
private async void btn_save_Click(object sender, EventArgs e) { string e_lcns = Globalfunction.Encrypt(doc_lcns.Text); string e_mac = Globalfunction.Encrypt(Globalfunction.pc_lcns); var param = new List <KeyValuePair <string, string> >(); param.Add(new KeyValuePair <string, string>("mt_lcns", e_lcns)); param.Add(new KeyValuePair <string, string>("mt_mac", e_mac)); param.Add(new KeyValuePair <string, string>("mt_name", hp_doctor.Text)); HttpContent content = new FormUrlEncodedContent(param); HttpResponseMessage response = await new HttpClient().PostAsync("http://contentsbox.co.kr" + "/au/insert_info.php", content); response.EnsureSuccessStatusCode(); JsonResult result = JsonConvert.DeserializeObject <JsonResult>(await response.Content.ReadAsStringAsync()); if (result == null) { return; } else { MessageBox.Show(result.msg); save_MsDb(e_lcns, e_mac); } }
private Boolean check_lcns() { Boolean access_flag; string dt_name = ""; connStr = String.Format(connStr, "auxology.mdb"); OleDbConnection gConn = new OleDbConnection(connStr); DataSet myDataSet = new DataSet(); string e_lcns = Globalfunction.Encrypt(Globalfunction.pc_lcns); string query = @"select dt_name from d_info where dt_mac=@dt_mac"; OleDbCommand cmd = new OleDbCommand(query, gConn); cmd.Parameters.AddWithValue("@dt_mac", e_lcns); OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(cmd); gConn.Open(); OleDbDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { dt_name = dr[0].ToString(); } if (dt_name != "") { access_flag = true; } else { access_flag = false; } dr.Close(); gConn.Close(); return(access_flag); }