本文整理汇总了C#中Member.insert方法的典型用法代码示例。如果您正苦于以下问题:C# Member.insert方法的具体用法?C# Member.insert怎么用?C# Member.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member.insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddMember
private void AddMember(object sender, RoutedEventArgs e)
{
DateTime dob = DateTime.Today;
string firstName = FirstNameTextBox.Text;
string lastName = LastNameTextBox.Text;
string idNumber = IdNumTextBox.Text;
string cellPhone = CellphoneTextBox.Text;
string email = EmailTextBox.Text;
string address = AddressTextBox.Text;
//Make sure DOB is not blank
if (DOBDatePicker.SelectedDate.HasValue)
{
dob = DOBDatePicker.SelectedDate.Value;
}
else {
DisplayError("Please enter a valid date for Date of Birth.");
}
//Error handling First Name
if (firstName.Length == 0){
DisplayError("Please enter a valid first name.");
}
//Error handling Last Name
if (lastName.Length == 0){
DisplayError("Please enter a valid last name.");
}
//Error handling Id number
if (idNumber.Length == 0){
DisplayError("Please enter a valid Id Number.");
}
Member m = new Member();
m.stokvel_idStr = stokvel_id;
m.firstNameStr = firstName;
m.lastNameStr = lastName;
m.idNumberStr = idNumber;
m.emailStr = email;
m.cellPhoneStr = cellPhone;
m.addressStr = address;
m.dobDt = dob;
m.insert();
//Check if user is busy with Wizard and continue if true.
if (StaticStokvel.wizard)
{
MessageBoxResult result = MessageBox.Show("Would you like to verify this member now?", "Verify Member", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
//Get member OTP
var connectionString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
string CmdString;
using (SqlConnection con = new SqlConnection(connectionString))
{
Console.WriteLine(StaticMemberOTP.member_id);
CmdString = String.Format("select OTP from member_otp where member_id = {0}", StaticMemberOTP.member_id);
SqlCommand cmd = new SqlCommand(CmdString, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable("MemberID");
sda.Fill(dt);
foreach (DataRow row in dt.Rows)
{
StaticMemberOTP.otp = row["OTP"].ToString();
string number = cellPhone.Substring(1, 9);
number = String.Concat("27", number);
Sms_OTP_Send.SmsSendYes(StaticMemberOTP.otp, number);
Member_Verification_OTP mvo = new Member_Verification_OTP();
mvo.Show();
}
}
}
}
this.Close();
}