예제 #1
0
        private void getAuth()
        {
            id  = IDBox.Text.ToString();
            pwd = PwdBox.Text.ToString();
            cid = CidBox.Text.ToString();

            if (CidBox.Text.ToString().Equals(""))
            {
                CidBox.Focus();
                MessageBox.Show("전화번호를 입력해 주세요");
            }
            else
            {
                string url = "https://daemuri.net/util/sendPushAuthAjax.do?id=" + id +
                             //string url = "http://127.0.0.1:8080/util/sendPushAuthAjax.do?id=" + id +
                             "&pwd=" + pwd +
                             "&cid=" + cid;
                try
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    request.Method      = "POST";
                    request.ContentType = "Application/json;charset=utf-8";

                    string sendData = "";

                    byte[] buffer;
                    buffer = Encoding.Default.GetBytes(sendData);
                    request.ContentLength = buffer.Length;
                    Stream sendStream = request.GetRequestStream();
                    sendStream.Write(buffer, 0, buffer.Length);
                    sendStream.Close();
                    HttpWebResponse response       = (HttpWebResponse)request.GetResponse();
                    Stream          respPostStream = response.GetResponseStream();
                    StreamReader    readerPost     = new StreamReader(respPostStream, Encoding.UTF8);
                    string          resultJson     = readerPost.ReadToEnd();
                    if (!resultJson.Contains("<!DOCTYPE html"))
                    {
                        if (resultJson.Equals("전송완료"))
                        {
                            AuthBox.Visible = true;
                            //button3.Visible = true;
                            AuthBox.Focus();
                        }
                        else
                        {
                            MessageBox.Show("등록된 사용자가 아닙니다.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("등록된 사용자가 아닙니다.");
                    }
                }
                catch (System.Net.WebException er)
                {
                    MessageBox.Show(er.Message);
                }
            }
        }
예제 #2
0
        private void loginOk1()
        {
            id  = IDBox.Text.ToString();
            pwd = PwdBox.Text.ToString();
            if (PwdBox.Text.ToString().Equals(""))
            {
                IDBox.Focus();
                MessageBox.Show("아이디를 입력해 주세요");
            }
            else if (IDBox.Text.ToString().Equals(""))
            {
                PwdBox.Focus();
                MessageBox.Show("비밀번호를 입력해 주세요");
            }
            else
            {
                string url = "https://daemuri.net/main/getSendAuth.do?id=" + id + "&pwd=" + pwd;
                //string url = "http://127.0.0.1:8080/main/getSendAuth.do?id=" + id + "&pwd=" + pwd;
                try
                {
                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    request.Method      = "POST";
                    request.ContentType = "Application/json;charset=utf-8";

                    string sendData = "";

                    byte[] buffer;
                    buffer = Encoding.Default.GetBytes(sendData);
                    request.ContentLength = buffer.Length;
                    Stream sendStream = request.GetRequestStream();
                    sendStream.Write(buffer, 0, buffer.Length);
                    sendStream.Close();

                    HttpWebResponse response       = (HttpWebResponse)request.GetResponse();
                    Stream          respPostStream = response.GetResponseStream();
                    StreamReader    readerPost     = new StreamReader(respPostStream, Encoding.UTF8);

                    string resultJson = readerPost.ReadToEnd();
                    if (!resultJson.Contains("<!DOCTYPE html"))
                    {
                        JObject obj = new JObject();
                        obj = JObject.Parse(resultJson);
                        string rs = obj["rs"].ToString();

                        if (rs.Equals("fail"))
                        {
                            MessageBox.Show("등록된 사용자가 아닙니다.");
                            this.Height = 218;
                        }
                        else
                        {
                            JObject obj2 = new JObject();
                            obj2           = JObject.Parse(rs);
                            callcenter_idx = obj2["callcenter_idx"].ToString();
                            //MessageBox.Show("callcenter_idx = " + callcenter_idx);
                            CidBox.Visible  = true;
                            button3.Visible = true;
                            CidBox.Focus();
                            this.Height = 335;
                        }
                    }
                    else
                    {
                        MessageBox.Show("등록된 사용자가 아닙니다.");
                        this.Height = 217;
                    }
                }
                catch (System.Net.WebException er)
                {
                    MessageBox.Show(er.Message);
                }
            }
        }