public static void loadCases(ComboBox selectCombo) { List <Case_Personal_Info> caselist = new case_Control().getAllCases(); if (caselist != null) { // ComboSelectCase.Items.Clear(); Dictionary <int, string> comboSource = new Dictionary <int, string>(); comboSource.Add(0, "--Select a Case--"); foreach (Case_Personal_Info mycase in caselist) { comboSource.Add(mycase.id, "CASE-" + mycase.id + " / " + mycase.fullname + " / " + mycase.guardian + " / " + mycase.c_address); } selectCombo.DataSource = new BindingSource(comboSource, null); selectCombo.DisplayMember = "Value"; selectCombo.ValueMember = "Key"; caselist = null; } else { MessageBox.Show("Somthing Went Wrong. Try Again", "ERROR", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } }
private void case_personal_btn_Click(object sender, EventArgs e) { if (Combo_PersonalInfo_Verifier.SelectedIndex != 0) { Cursor.Current = Cursors.WaitCursor; Label_ErrorMessagePersonalInfo.Text = ""; Case_Personal_Info case_new = new Case_Personal_Info(); case_new.fullname = TextBox_FullName.Text; case_new.guardian = TextBox_Guardian.Text; case_new.p_address = TextBox_pAddress.Text; case_new.c_address = TextBox_cAddress.Text; case_new.age = TextBox_Age.Text; case_new.contact = TextBox_ContactNumber.Text; case_new.aadhaar = TextBox_Aadhaar.Text; //SMS Checkboxes below case_new.SMSCheckBox = CheckBox_SendSMS.Checked; case_new.verifier = Combo_PersonalInfo_Verifier.SelectedValue.ToString(); case_new.secondary_verifier = Combo_SecondaryVerifier.SelectedValue.ToString(); MemoryStream stream = new MemoryStream(); Image img = ImageController.ReduceImg(PictureBox_Photo.Image, 5); img.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg); case_new.picture = stream.ToArray(); stream.Flush(); case_Control c_con = new case_Control(); if (c_con.checkForEmpty(case_new)) { if (c_con.validateForChars(case_new)) { if (c_con.InsertPersonalInf(case_new)) { if (c_con.smsChecked(case_new)) { NotifySMS sms = new NotifySMS(); if (sms.loginSMS()) { //long contact = ((KeyValuePair<long, string>)Combo_PersonalInfo_Verifier.SelectedItem).Key; if (sms.notifyViaSMS(case_new)) { MessageBox.Show("SMS Notification has been Sent Successfully", "SMS Sent", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show("The SMS Notification was not Sent. Make sure you are connected to the internet.", "SMS not Sent", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } } else { MessageBox.Show("The SMS Login Failed.", "Message Not Sent", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } } clearPersonalInfo(); MessageBox.Show("Registration Success. Switch tabs to fill more details.", "Successfully Registered", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); loadCases(ComboSelectCase); loadCases(combo_bank); loadCases(comboBox_otherDetails); loadCases(NeedTab_ComboBoxCases); loadCases(ComboBox_RemarksTab); //viewAll.loadGrid_Cases(); } else { Label_ErrorMessagePersonalInfo.Text = case_new.message; } } else { Label_ErrorMessagePersonalInfo.Text = case_new.message; } } else { Label_ErrorMessagePersonalInfo.Text = case_new.message; } } else { MessageBox.Show("Please Choose a Verifier for this Case", "Verifier Not Selected", MessageBoxButtons.OK, MessageBoxIcon.Information); } }