|
@ -23,15 +23,22 @@ namespace EasyBL.WEBAPP.SYS |
|
|
{ |
|
|
{ |
|
|
public class SignupService : ServiceBase |
|
|
public class SignupService : ServiceBase |
|
|
{ |
|
|
{ |
|
|
public static string SERVER_IP = "localhost"; |
|
|
|
|
|
public static string SERVER_PORT = "3466"; |
|
|
|
|
|
|
|
|
//public static string SERVER_IP = "localhost";
|
|
|
|
|
|
//public static string SERVER_PORT = "3466";
|
|
|
|
|
|
|
|
|
|
|
|
public static string SERVER_IP = "www.origtek.com"; |
|
|
|
|
|
public static string SERVER_PORT = "9105"; |
|
|
|
|
|
|
|
|
//使用者以信箱註冊
|
|
|
//使用者以信箱註冊
|
|
|
public HttpResponseMessage SignupWithEmail(SETB_CMS_Member newUser) |
|
|
public HttpResponseMessage SignupWithEmail(SETB_CMS_Member newUser) |
|
|
{ |
|
|
{ |
|
|
//string sMsg = null;
|
|
|
//string sMsg = null;
|
|
|
SuccessResponseMessage srm = SugarBase.ExecTran(db => |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
SuccessResponseMessage srm = null; |
|
|
|
|
|
var db = SugarBase.GetIntance(); |
|
|
|
|
|
string sError = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
do |
|
|
do |
|
|
{ |
|
|
{ |
|
|
string sAccount = newUser.Email; |
|
|
string sAccount = newUser.Email; |
|
@ -45,7 +52,17 @@ namespace EasyBL.WEBAPP.SYS |
|
|
string sStatus = "0"; //會員狀態為未驗證(F)
|
|
|
string sStatus = "0"; //會員狀態為未驗證(F)
|
|
|
string sType = "Email"; |
|
|
string sType = "Email"; |
|
|
|
|
|
|
|
|
string sError = ""; //寄信若有錯誤回傳之訊息
|
|
|
|
|
|
|
|
|
var checkAccount = db.Queryable<SETB_CMS_Member>() |
|
|
|
|
|
.Where(x => x.OrgID == sOrgID && x.Account == sAccount) |
|
|
|
|
|
.Count(); |
|
|
|
|
|
|
|
|
|
|
|
if (checkAccount > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
sError = @"該帳號已註冊"; //該帳號無效
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
string sEncryptPwd = SecurityUtil.Encrypt(sPassword); //密碼加密
|
|
|
string sEncryptPwd = SecurityUtil.Encrypt(sPassword); //密碼加密
|
|
|
newUser.MemberID = sMemberID; |
|
|
newUser.MemberID = sMemberID; |
|
@ -55,6 +72,8 @@ namespace EasyBL.WEBAPP.SYS |
|
|
newUser.Account = newUser.Email; |
|
|
newUser.Account = newUser.Email; |
|
|
newUser.MemberType = sType; |
|
|
newUser.MemberType = sType; |
|
|
|
|
|
|
|
|
|
|
|
var iRel = db.Insertable(newUser).ExecuteCommand(); |
|
|
|
|
|
|
|
|
//開始寄信
|
|
|
//開始寄信
|
|
|
var oEmail = new Emails(); //寄件人
|
|
|
var oEmail = new Emails(); //寄件人
|
|
|
var toEmail = new List<EmailTo>(); //收件人
|
|
|
var toEmail = new List<EmailTo>(); //收件人
|
|
@ -74,15 +93,25 @@ namespace EasyBL.WEBAPP.SYS |
|
|
oEmail.EmailTo = toEmail; |
|
|
oEmail.EmailTo = toEmail; |
|
|
var bSend = new MailService(sOrgID, true).MailFactory(oEmail, out sError); |
|
|
var bSend = new MailService(sOrgID, true).MailFactory(oEmail, out sError); |
|
|
|
|
|
|
|
|
var iRel = db.Insertable(newUser).ExecuteCommand(); |
|
|
|
|
|
|
|
|
|
|
|
srm = new SuccessResponseMessage(null, null); |
|
|
srm = new SuccessResponseMessage(null, null); |
|
|
srm.DATA.Add(BLWording.REL, newUser); |
|
|
srm.DATA.Add(BLWording.REL, newUser); |
|
|
} while (false); |
|
|
} while (false); |
|
|
|
|
|
|
|
|
return srm; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
sError = Util.GetLastExceptionMsg(ex); |
|
|
|
|
|
} |
|
|
|
|
|
finally |
|
|
|
|
|
{ |
|
|
|
|
|
if (null != sError) |
|
|
|
|
|
{ |
|
|
|
|
|
srm = new SuccessResponseMessage(null, null) |
|
|
|
|
|
{ |
|
|
|
|
|
STATUSCODE = (int)StatusCodeEnum.ParameterError, |
|
|
|
|
|
MSG = sError |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm)); |
|
|
return HttpResponseExtension.ToJson(JsonConvert.SerializeObject(srm)); |
|
|
} |
|
|
} |
|
|