public bool EditClient(EditClientForm form) { this.Connect(); string dateBirthSQL = form.clientBirthdayDTP.Value.ToString("yyyy-MM-dd"); string passDateSQL = form.clientIssueDateDTP.Value.ToString("yyyy-MM-dd"); MySqlDataAdapter da = new MySqlDataAdapter(); string query = String.Format(@"UPDATE `h982945m_sectech`.`client` SET `client_name` = '{0}', `client_passport_no` = '{1}', `client_passport_issue_date` = '{2}', `client_passport_issue_department` = '{3}', `client_birthdate` = '{4}', `client_male` = {5} WHERE `client_id` = {6};", form.clientNameTB.Text, form.clientPassportIdTextbox.Text, passDateSQL, form.clientPassportIssueDepartmentTB.Text, dateBirthSQL, form.maleRB.Checked ? 1 : 0, form.clientCB.SelectedValue); MySqlCommand sqlCom = new MySqlCommand(query, connection); try { sqlCom.ExecuteNonQuery(); return(true); } catch (Exception ex) { return(false); } }
public bool CreateClient(EditClientForm form) { this.Connect(); string dateBirthSQL = form.clientBirthdayDTP.Value.ToString("yyyy-MM-dd"); string passDateSQL = form.clientIssueDateDTP.Value.ToString("yyyy-MM-dd"); MySqlDataAdapter da = new MySqlDataAdapter(); string query = String.Format(@"INSERT INTO `h982945m_sectech`.`client`(`client_name`, `client_passport_no`, `client_passport_issue_date`, `client_passport_issue_department`, `client_birthdate`,`client_male`) VALUES ('{0}','{1}','{2}','{3}','{4}',{5});", form.clientNameTB.Text, form.clientPassportIdTextbox.Text, passDateSQL, form.clientPassportIssueDepartmentTB.Text, dateBirthSQL, form.maleRB.Checked ? 1 : 0); MySqlCommand sqlCom = new MySqlCommand(query, connection); try { sqlCom.ExecuteNonQuery(); return(true); } catch (Exception ex) { return(false); } }
public void FillClientData(EditClientForm form) { }