Beispiel #1
0
 private void Button_AddSales_Click(object sender, EventArgs e)
 {
     try
     {
         byte[]     data = AppUtility.StringToByte("{\"user_id\":\"" + User_Textbox.Text + "\",\"pass_id\":\"" + Pass_Textbox.Text + "\",\"fullname\":\"" + SalesName_Textbox.Text + "\",\"region_name\":\"" + list_region_acc.Substring(0, list_region_acc.Length - 1) + "\",\"phone\":\"" + PH_Textbox.Text + "\",\"user_roles\":\"3\",\"segment\":\"" + Segment_list_Label.Text.Substring(0, Segment_list_Label.Text.Length - 1) + "\"}");
         SimpleREST rest = new SimpleREST("http://ultimindserver.mywire.org:3000/register/user");
         rest.RequestAsync(data, delegate(bool status, string message, StreamReader reader)
         {
             if (status)
             {
                 if (reader != null)
                 {
                     string output = reader.ReadToEnd();
                     if (!string.IsNullOrEmpty(output))
                     {
                         MessageBox.Show(output);
                     }
                 }
                 else
                 {
                     if (reader != null)
                     {
                         string output = reader.ReadToEnd();
                         MessageBox.Show(output);
                     }
                 }
                 this.Close();
             }
         }, "Content-Type", "application/json");
     }
     catch (Exception) {
         PicBox_Validation.Visible = true;
     }
 }