private void show_ClientExist() { //pix_login.Visible = true; String enteredUsername = xamlTextBoxUsername.Text.Trim(); individual_data strResponse = null; //Task.Run(() => { { // displayMessage("Verifying Template File.....", Utils.COLOR_DERMALOG_RED); //string externalAPI = Properties.Settings.Default.ExternalAPIAddress; //string servNAME = string.Format("infometriq-partner-api/individuals/{0}/username", enteredUsername); //strResponse = Utils.call_External_WEBAPI_GETService(servNAME); using (tranxDataContext tx = new tranxDataContext()) { tx.Connection.ConnectionString = Utils.getConnection(); var ds = tx.individual_datas.FirstOrDefault(s => s.username == enteredUsername); strResponse = ds; //strResponse = Newtonsoft.Json.JsonConvert.SerializeObject(ds); } //strResponse = Utils.call_WEBAPI_GETService("infometriq-partner-api/individuals"); } } //).Wait(); //AlertForm1 fmm = new AlertForm1("Client Data Received Successfully....."); //fmm.ShowDialog(); //pix_login.Visible = false; winforms.Form_data fm = new winforms.Form_data(strResponse, true); fm.ShowDialog(); }
//public Form_data(string data,bool disableSave) //{ // Control.CheckForIllegalCrossThreadCalls = false; // InitializeComponent(); // strResponse = data; // if (disableSave) btn_save.Visible = false; // NewMethod_callService(data); // //dd.dob = DateTime.Now; //} public Form_data(individual_data data, bool disableSave) { Control.CheckForIllegalCrossThreadCalls = false; InitializeComponent(); //strResponse = data; if (disableSave) { btn_save.Visible = false; } //NewMethod_callService(data); NewMethod_callService_local(data); //dd.dob = DateTime.Now; }
//private void NewMethod_callService_local(individual_data individual) private void NewMethod_callService_local(individual_data individual) { try { dynamic dm = new ExpandoObject(); //dm = JObject.Parse((string)Newtonsoft.Json.JsonConvert.DeserializeObject(individual.strResponse)); dm = JObject.Parse((string)(individual.strResponse)); //dm = Newtonsoft.Json.JsonConvert.DeserializeObject(individual.strResponse); string id = individual.id; lb_firstname.Text = individual.first_name; lb_lastname.Text = individual.last_name; //txt_username.Text = lb_username.Text = individual.username; lb_email.Text = individual.email; lb_DOB.Text = DateTime.Parse((string)individual.dob).ToString("MMMM dd yyyy"); //txt_state.Text = dm.data.individual.state; lb_country.Text = individual.country; //txt_profession.Text = dm.data.individual.profession; lb_profession.Text = individual.profession_name; //string about = dm.data.individual.about; lb_phone.Text = individual.phone; //string website = dm.data.individual.website; lb_gender.Text = individual.gender; string confirmation_code = individual.confirmation_code; lb_confirmationCode.Text = individual.confirmation_code; //string social_facebook = dm.data.individual.social_facebook; //string social_twitter = dm.data.individual.social_twitter; //string social_instagram = dm.data.individual.social_instagram; //string social_linkedin = dm.data.individual.social_linkedin; //string social_youtube = dm.data.individual.social_youtube; //string politics = dm.data.individual.politics; // string recognition = dm.data.individual.recognition; //string hide_dob = dm.data.individual.hide_dob; lb_accountType.Text = individual.account_type; lb_status.Text = individual.status; lb_verifiedStatus.Text = individual.verified_status; lb_createDT.Text = DateTime.Parse((string)individual.created_on).ToString("MMMM dd yyyy"); //string last_updated_on = dm.data.individual.last_updated_on; //string state_name = dm.data.individual.state_name; lb_state.Text = individual.state_name; Pix_client.Image = Utils.Base64TOImage((string)dm.data.picture); Pix_client.Refresh(); genBarcode(confirmation_code); dynamic vcard = new ExpandoObject(); vcard.name = string.Format(@"{0} {1}", (string)individual.first_name, (string)individual.last_name).Replace(' ', '+'); //dynamic ddd = new ExpandoObject(); //ddd = JObject.Parse((string)dm.data.work_history[0]); vcard.org = dm.data.work_history[0].company.ToString().Replace(' ', '+'); vcard.title = dm.data.work_history[0].position.ToString().Replace(' ', '+').ToUpper(); vcard.work = individual.phone == null ? "Not+Provided" : individual.phone.ToString().Replace(' ', '+'); vcard.email = (string)individual.email.Replace("@", "%40"); vcard.url = (string)individual.website.Replace("@", "%40"); vcard.note = string.Format(@" InfoMetriQ VCard : [{0}] [{1}] Award:[{2}]", (string)individual.verified_status.Replace(' ', '+'), (string)individual.account_type.Replace(' ', '+'), individual.recognition != null? Utils.TrimNonAscii((string)individual.recognition.Replace(' ', '+')):"None"); pictureBox1.Image = Utils.gen_specialQRCODE(vcard); //Utils.showAnimation(Pix_client, bunifuTransition1); } catch (Exception ex) { } }
private void saveData(dynamic dm, string Profession_desc, string strResponse) { //dynamic dm = new ExpandoObject(); // individual_data ind = Newtonsoft.Json.JsonConvert.DeserializeObject<individual_data>(dd); //individual_data ind = dd; try { using (tranxDataContext tx = new tranxDataContext()) { tx.Connection.ConnectionString = Utils.getConnection(); string strUsername = dm.username; var ds = tx.individual_datas.FirstOrDefault(s => s.username == strUsername); if (ds == null) { individual_data ind = new individual_data(); ind.id = dm.id; ind.first_name = dm.first_name; ind.last_name = dm.last_name; ind.username = dm.username; ind.email = dm.email; ind.dob = dm.dob; ind.state = dm.state; ind.country = dm.country; ind.profession = dm.profession; ind.about = dm.about; ind.phone = dm.phone; ind.website = dm.website; ind.gender = dm.gender; ind.confirmation_code = dm.confirmation_code; ind.social_facebook = dm.social_facebook; ind.social_twitter = dm.social_twitter; ind.social_instagram = dm.social_instagram; ind.social_linkedin = dm.social_linkedin; ind.social_youtube = dm.social_youtube; ind.politics = dm.politics; ind.recognition = dm.recognition; ind.hide_dob = dm.hide_dob; ind.rating = dm.rating; ind.status = dm.status; ind.verified_status = dm.verified_status; ind.created_on = dm.created_on; ind.last_updated_on = dm.last_updated_on; ind.state_name = dm.state_name; ind.profession_name = Profession_desc; ind.strResponse = strResponse; ind.account_type = dm.account_type; tx.individual_datas.InsertOnSubmit(ind); tx.SubmitChanges(); AlertForm1 fm = new AlertForm1("Saved Successfully...", AlertForm1.AlertOptions.OK, AlertForm1.AlertType.success); var rst = fm.ShowDialog(); } else { AlertForm1 fm = new AlertForm1("User Details already saved...", AlertForm1.AlertOptions.OK, AlertForm1.AlertType.info); var rst = fm.ShowDialog(); btn_save.Enabled = false; } } } catch (Exception ex) { AlertForm1 fm = new AlertForm1(ex.Message, AlertForm1.AlertOptions.OK, AlertForm1.AlertType.error); var rst = fm.ShowDialog(); } }