protected void Page_Load(object sender, EventArgs e) { clsMember m = new clsMember(); m.user_name = "test"; ComSQL.Member_ExistAccount(m); }
public void AddMethodOK() { //create an instance of the class we want to create clsMemberCollection AllMembers = new clsMemberCollection(); //create the item of test data clsMember Test1 = new clsMember(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties Test1.FullName = "Sofyan Koultouma"; Test1.Address = "1 Leicester Road"; Test1.PhoneNumber = "07856681247"; Test1.DOB = DateTime.Parse("1988/07/08"); Test1.MemberID = 20; Test1.MedicalConditions = true; //set ThisAddress to the test data AllMembers.ThisMember = Test1; //add the record PrimaryKey = AllMembers.Add(); //set the primary key to the test data Test1.MemberID = PrimaryKey; //find the record AllMembers.ThisMember.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllMembers.ThisMember, Test1); }
public void ListAndCountOK() { //create an instance of the class we want to create clsMemberCollection AllMembers = new clsMemberCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsMember> Test = new List <clsMember>(); //add an item to the list //create the item of test data clsMember Test1 = new clsMember(); //set the properties of the test object Test1.FullName = "Sofyan Koultouma"; Test1.Address = "1 Leicester Road"; Test1.PhoneNumber = "07856681247"; Test1.DOB = DateTime.Parse("1998/07/08"); Test1.MemberID = 10; Test1.MedicalConditions = false; //add the item to the test list Test.Add(Test1); //asign the data to the property AllMembers.MemberList = Test; //test to see that the wo values are the same Assert.AreEqual(AllMembers.Count, Test.Count); }
public void DeleteMethodOK() { //create an instance of the class we want to create clsMemberCollection AllMembers = new clsMemberCollection(); //create an item of test data clsMember Test1 = new clsMember(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties Test1.FullName = "Sofyan Koultouma"; Test1.Address = "1 Leicester Road"; Test1.PhoneNumber = "07856681247"; Test1.DOB = DateTime.Parse("1988/07/08"); Test1.MemberID = 20; Test1.MedicalConditions = true; //set ThisMember to the test data AllMembers.ThisMember = Test1; //add the record PrimaryKey = AllMembers.Add(); //set the primary key of the test data Test1.MemberID = PrimaryKey; //find the record AllMembers.ThisMember.Find(PrimaryKey); //delete the record AllMembers.Delete(); //now find the record Boolean Found = AllMembers.ThisMember.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void ValidMethodOK() { clsMember AMember = new clsMember(); string Error = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void InstanceOK() { //create an instance of the class we want to create clsMember AMember = new clsMember(); //test to see that it exists Assert.IsNotNull(AMember); }
public static DataTable Member_ExistMail(clsMember m) { DataTable dt = new DataTable(); string cmdSql = string.Format("SELECT * FROM {0} WHERE EMAIl='{1}'", TABLE_MEMBER, m.email); dt = MySqlDbAccess.ExcuteQueryData(cmdSql, false); return(dt); }
public static DataTable Member_ActiveCheck(clsMember m) { DataTable dt = new DataTable(); string cmdSql = string.Format("SELECT * FROM {0} WHERE USER_NAME='{1}' AND PASSWORD='******' AND ACTIVE='Y'", TABLE_MEMBER, m.user_name, m.password); dt = MySqlDbAccess.ExcuteQueryData(cmdSql, false); return(dt); }
public static DataTable Member_ExistPassword(clsMember m) { DataTable dt = new DataTable(); string cmdSql = string.Format("SELECT * FROM {0} WHERE PASSWORD='******'", TABLE_MEMBER, m.password); dt = MySqlDbAccess.ExcuteQueryData(cmdSql, false); return(dt); }
public static DataTable Member_ExistAccount(clsMember m) { DataTable dt = new DataTable(); string cmdSql = string.Format("SELECT * FROM {0} WHERE USER_NAME='{1}'", TABLE_MEMBER, m.user_name); dt = MySqlDbAccess.ExcuteQueryData(cmdSql, false); return(dt); }
public void FullNameExtremeMin() { clsMember AMember = new clsMember(); String Error = ""; String FullName = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void FullNameContainsSpace() { clsMember AMember = new clsMember(); String Error = ""; String FullName = "AAAAAAAAAAAAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void PhoneNumberNotBlank() { clsMember AMember = new clsMember(); String Error = ""; string PhoneNumber = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void PhoneNumberMaxMinusOne() { clsMember AMember = new clsMember(); String Error = ""; string PhoneNumber = "AAAAAAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void DOBInvalidData() { clsMember AMember = new clsMember(); String Error = ""; String DOB = "this is not a date!"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void AddressExtremeMax() { clsMember AMember = new clsMember(); String Error = ""; string Address = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void AddressMinBoundary() { clsMember AMember = new clsMember(); String Error = ""; string Address = "AAAAAAAAAA"; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void AddressMaxBoundary() { clsMember AMember = new clsMember(); String Error = ""; string Address = ""; Address = Address.PadRight(50, 'a'); Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void FullNamExtremeMax() { clsMember AMember = new clsMember(); String Error = ""; String FullName = ""; FullName = FullName.PadRight(100, 'A') + ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void PhoneNumberPropertyOK() { //create an instance of the class we want to create clsMember AMember = new clsMember(); //create some test data to assign to the property string TestData = "07856681287"; //assign the data to the property AMember.PhoneNumber = TestData; //test to see that the two values are the same Assert.AreEqual(AMember.PhoneNumber, TestData); }
public void DOBPropertyOK() { //create an instance of the class we want to create clsMember AMember = new clsMember(); //create some test data to assign to the property DateTime TestData = DateTime.Now.Date; //assign the data to the property AMember.DOB = TestData; //test to see that the two values are the same Assert.AreEqual(AMember.DOB, TestData); }
public void MemberIDPropertyOK() { //create an instance of the class we want to create clsMember AMember = new clsMember(); //create some test data to assign to the property int TestData = 11; //assign the data to the property AMember.MemberID = TestData; //test to see that the two values are the same Assert.AreEqual(AMember.MemberID, TestData); }
public void DOBExtremeMax() { clsMember AMember = new clsMember(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; string DOB = TestDate.AddYears(100).ToString(); Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreNotEqual(Error, ""); }
public void DOBMaxMinusOne() { clsMember AMember = new clsMember(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; string DOB = TestDate.AddYears(-18).AddDays(-1).ToString(); Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); Assert.AreEqual(Error, ""); }
public void MedicalConditionsPropertyOK() { //create an instance of the class we weant to create clsMember AMember = new clsMember(); //create the test data to the property Boolean TestData = true; //assign the data to the property AMember.MedicalConditions = TestData; //test to see that the two values are the same Assert.AreEqual(AMember.MedicalConditions, TestData); }
public void FullNamePropertyOK() { //create instance of the class we want to create clsMember AMember = new clsMember(); //create some test data to assign to the property string TestData = "Sofyan Koultouma"; //asign the data to the property AMember.FullName = TestData; //test to see that the two values are the same Assert.AreEqual(AMember.FullName, TestData); }
public void AddressPropertyOK() { //create an instance of the class we want to create clsMember AMember = new clsMember(); //create some test data to assign to the property String TestData = "1 Leicester road"; //assign the data to the property AMember.Address = TestData; //test to see that the two values are the same Assert.AreEqual(AMember.Address, TestData); }
protected void bttnOK_Click(object sender, EventArgs e) { //create a new instance of clsMember clsMember AMember = new clsMember(); //capture all data for validation string FullName = txtbxFullName.Text; string Address = txtbxAddress.Text; string DOB = txtbxDOB.Text; string PhoneNumber = txtbxPhoneNumber.Text; //variable to store error messages string Error = ""; Error = AMember.Valid(FullName, Address, DOB, PhoneNumber); if (Error == "") { //capture all the data AMember.MemberID = MemberID; AMember.FullName = FullName; AMember.Address = Address; AMember.DOB = Convert.ToDateTime(DOB); AMember.PhoneNumber = PhoneNumber; AMember.MedicalConditions = chkbxMedicalConditions.Checked; //create a new instance of the Member collection clsMemberCollection AllMembers = new clsMemberCollection(); //if this is a new record then add the data if (MemberID == -1) { //set the ThisMember property AllMembers.ThisMember = AMember; //add the new record AllMembers.Add(); } else //otherwise it must be an update { //find the record to update AllMembers.ThisMember.Find(MemberID); //set the ThisMember property AllMembers.ThisMember = AMember; //update the record AllMembers.Update(); } //redirect back to the listpage Response.Redirect("MemberList.aspx"); } else { lblErrorMessage.Text = Error; } }
public static int Member_Register(clsMember m) { MySqlInsert ins = new MySqlInsert(TABLE_MEMBER); foreach (var prop in m.GetType().GetProperties()) { ins.Add(prop.Name, prop.GetValue(m, null)); } string cmdSql = ins.ToString(); return(MySqlDbAccess.ExecuteNonQueryInt(cmdSql, false)); }
public void FindMethodOK() { //Create an instance of the class we want to create clsMember AMember = new clsMember(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 TestData = 7; //invoke the method Found = AMember.Find(TestData); Assert.IsTrue(Found); }
public static DataTable Member_ActiveCheck(clsMember m) { DataTable dt = new DataTable(); string cmdSql = string.Format("select * from {0} where user_name='{1}' and password='******' and active='y'", TABLE_MEMBER, m.user_name, m.password); dt = MySqlDbAccess.ExcuteQueryData(cmdSql, false); return dt; }
public static DataTable Member_GetUserName(clsMember m) { DataTable dt = new DataTable(); string cmdSql = string.Format("select * from {0} where email='{1}'", TABLE_MEMBER, m.email); dt = MySqlDbAccess.ExcuteQueryData(cmdSql, false); return dt; }
public static int Member_Register(clsMember m) { if (m.zipcode.Length == 0) m.zipcode = "000"; MySqlInsert ins = new MySqlInsert(TABLE_MEMBER); foreach (var prop in m.GetType().GetProperties()) { ins.Add(prop.Name, prop.GetValue(m, null)); } ins.Remove("verify"); string cmdSql = ins.ToString(); return MySqlDbAccess.ExecuteNonQueryInt(cmdSql, false); }
public static int Member_Update(clsMember m) { MySqlUpdate update = new MySqlUpdate(TABLE_MEMBER); foreach (var prop in m.GetType().GetProperties()) { update.Add(prop.Name, prop.GetValue(m, null)); } update.Remove("verify"); string cmdSql = update.ToString() + " where user_name='" + m.user_name + "'"; return MySqlDbAccess.ExecuteNonQueryInt(cmdSql, false); }
public static DataTable Member_ExistPassword(clsMember m) { DataTable dt = new DataTable(); string cmdSql = string.Format("select * from {0} where password='******'", TABLE_MEMBER, m.password); dt = MySqlDbAccess.ExcuteQueryData(cmdSql, false); return dt; }