public string[] AddRegistrtaion(Registration registrationUser) { var returnParam = new string[2]; if (registrationUser!=null) { if(string.IsNullOrEmpty(registrationUser.TCKNo) || string.IsNullOrEmpty(registrationUser.MobileNumber) || string.IsNullOrEmpty(registrationUser.Name) || string.IsNullOrEmpty(registrationUser.Surname) || string.IsNullOrEmpty(registrationUser.FatherName)) { // TODO : throw new Exception("Bos Olamaz"); registrationUser.TCKNo = null; registrationUser.MobileNumber = null; registrationUser.Name = null; registrationUser.Surname = null; registrationUser.FatherName = null; } else { returnParam = _registrationRepository.AddRegistrtaion(registrationUser); } } return returnParam; }
public string[] AddRegistrtaion(Registration registrationUser) { try { const string CmdText = "insert into Registration" + " (TCKNo,Name,Surname,FatherName,FatherTNo,FatherJob,MotherName,MotherJob,MailAdress,BirthPlace,BirthDate,MobileNumber,Number,Adress,SchoolLeaver,Chapter)" + " values(@TCKNo,@Name,@Surname,@FatherName,@FatherTNo,@FatherJob,@MotherName,@MotherJob,@MailAdress,@BirthPlace,@BirthDate,@MobileNumber,@Number,@Adress,@SchoolLeaver,@Chapter)"; SqlParameter[] sqlParamArray = { new SqlParameter("@TCKNo", SqlDbType.NVarChar) { Value = registrationUser .TCKNo }, new SqlParameter("@Name", SqlDbType.NVarChar) { Value = registrationUser .Name }, new SqlParameter("@Surname", SqlDbType.NVarChar) { Value = registrationUser .Surname }, new SqlParameter("@FatherName", SqlDbType.NVarChar) { Value = registrationUser .FatherName }, new SqlParameter("@FatherTNo", SqlDbType.NVarChar) { Value = registrationUser .FatherTNo }, new SqlParameter("@FatherJob", SqlDbType.NVarChar) { Value = registrationUser .FatherJob }, new SqlParameter("@MotherName", SqlDbType.NVarChar) { Value = registrationUser .MotherName }, new SqlParameter("@MotherJob", SqlDbType.NVarChar) { Value = registrationUser .MotherJob }, new SqlParameter("@MailAdress", SqlDbType.NVarChar) { Value = registrationUser .MailAdress }, new SqlParameter("@BirthPlace", SqlDbType.NVarChar) { Value = registrationUser .BirthPlace }, new SqlParameter("@BirthDate", SqlDbType.NVarChar) { Value = registrationUser .BirthDate }, new SqlParameter("@MobileNumber", SqlDbType.NVarChar) { Value = registrationUser .MobileNumber }, new SqlParameter("@Number", SqlDbType.NVarChar) { Value = registrationUser .Number }, new SqlParameter("@Adress", SqlDbType.NVarChar) { Value = registrationUser .Adress }, new SqlParameter("@SchoolLeaver", SqlDbType.NVarChar) { Value = registrationUser .SchoolLeaver }, new SqlParameter("@Chapter", SqlDbType.NVarChar) { Value = registrationUser .Chapter } }; _sqlHelper.Cmd(CmdText, sqlParamArray); } catch (Exception exception) { throw exception; } string[] userInfo = { registrationUser.Name, registrationUser.Surname }; return userInfo; }