public string InsertStudentAccount(CreateStudentAccount model) { DateTime birth = new DateTime(model.year, model.month, model.day); string md5pass = new Md5Function().MD5HashFunction(model.password); ModifyAccount ma = new ModifyAccount(); ModifyStudent ms = new ModifyStudent(); if (ma.Check(model.username)) { return("false"); } else { ma.Insert(model.username, md5pass, 3); ms.Insert(model.name, birth, model.gender, model.country, model.address, model.username, model.course, model.branch); return("true"); } }
public string InsertTeacherAccount(CreateTeacherAccount model) { DateTime birth = new DateTime(model.year, model.month, model.day); string md5pass = new Md5Function().MD5HashFunction(model.password); ModifyAccount ma = new ModifyAccount(); ModifyTeacher mt = new ModifyTeacher(); if (ma.Check(model.username)) { return("false"); } else { ma.Insert(model.username, md5pass, 2); mt.Insert(model.name, model.gender, model.country, model.branch, birth, model.phoneNumber, model.username); return("true"); } }
public string InsertAdminAccount(string username, string password, int positionID, string name) { ModifyAccount ma = new ModifyAccount(); Md5Function md5 = new Md5Function(); ModifyAdmin mad = new ModifyAdmin(); if (ma.Check(username)) { return("false"); } else { string md5pass = md5.MD5HashFunction(password); ma.Insert(username, md5pass, positionID); mad.Insert(mad.GetNextID(), name, username); return("true"); } }