Browse Source

[WHAT] ip位址 [WHY] 開發 ShowEasy 後臺

Dev
Janie 2 years ago
parent
commit
d02da57396
  1. 125
      EuroTran/EasyBL.WEBAPP/ShowEasy/SignupService.cs
  2. 2
      EuroTran/WebApp/Web.config

125
EuroTran/EasyBL.WEBAPP/ShowEasy/SignupService.cs

@ -23,66 +23,95 @@ namespace EasyBL.WEBAPP.SYS
{
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)
{
//string sMsg = null;
SuccessResponseMessage srm = SugarBase.ExecTran(db =>
{
do
{
string sAccount = newUser.Email;
string sPassword = newUser.Password;
string sEmail = newUser.Email;
string sFirstName = newUser.FirstName;
string sLastName = newUser.LastName;
//string sSubscribe = newUser.Subscribe;
string sMemberID = Guid.NewGuid().ToString(); //會員編號為GUID
string sOrgID = "TG"; //公司編號預設為TG
string sStatus = "0"; //會員狀態為未驗證(F)
string sType = "Email";
string sError = ""; //寄信若有錯誤回傳之訊息
SuccessResponseMessage srm = null;
var db = SugarBase.GetIntance();
string sError = null;
string sEncryptPwd = SecurityUtil.Encrypt(sPassword); //密碼加密
newUser.MemberID = sMemberID;
newUser.OrgID = sOrgID;
newUser.Status = sStatus;
newUser.Password = sEncryptPwd;
newUser.Account = newUser.Email;
newUser.MemberType = sType;
//開始寄信
var oEmail = new Emails(); //寄件人
var toEmail = new List<EmailTo>(); //收件人
var oEmailTo = new EmailTo //收件人資訊
try {
do
{
string sAccount = newUser.Email;
string sPassword = newUser.Password;
string sEmail = newUser.Email;
string sFirstName = newUser.FirstName;
string sLastName = newUser.LastName;
//string sSubscribe = newUser.Subscribe;
string sMemberID = Guid.NewGuid().ToString(); //會員編號為GUID
string sOrgID = "TG"; //公司編號預設為TG
string sStatus = "0"; //會員狀態為未驗證(F)
string sType = "Email";
var checkAccount = db.Queryable<SETB_CMS_Member>()
.Where(x => x.OrgID == sOrgID && x.Account == sAccount)
.Count();
if (checkAccount > 0)
{
ToUserID = newUser.MemberID,
ToUserName = newUser.LastName,
ToEmail = newUser.Email,
Type = "to"
};
toEmail.Add(oEmailTo);
oEmail.FromUserName = "【ShowEasy 會員認證】"; //取fonfig
oEmail.Title = "感謝您註冊ShowEasy"; //取fonfig
oEmail.EmailBody = VerifyAccount_Mail(newUser.OrgID, newUser.MemberID, newUser.FirstName);
oEmail.IsCCSelf = false;
oEmail.Attachments = null;
oEmail.EmailTo = toEmail;
var bSend = new MailService(sOrgID, true).MailFactory(oEmail, out sError);
var iRel = db.Insertable(newUser).ExecuteCommand();
sError = @"該帳號已註冊"; //該帳號無效
break;
srm = new SuccessResponseMessage(null, null);
srm.DATA.Add(BLWording.REL, newUser);
} while (false);
}
return srm;
string sEncryptPwd = SecurityUtil.Encrypt(sPassword); //密碼加密
newUser.MemberID = sMemberID;
newUser.OrgID = sOrgID;
newUser.Status = sStatus;
newUser.Password = sEncryptPwd;
newUser.Account = newUser.Email;
newUser.MemberType = sType;
});
var iRel = db.Insertable(newUser).ExecuteCommand();
//開始寄信
var oEmail = new Emails(); //寄件人
var toEmail = new List<EmailTo>(); //收件人
var oEmailTo = new EmailTo //收件人資訊
{
ToUserID = newUser.MemberID,
ToUserName = newUser.LastName,
ToEmail = newUser.Email,
Type = "to"
};
toEmail.Add(oEmailTo);
oEmail.FromUserName = "【ShowEasy 會員認證】"; //取fonfig
oEmail.Title = "感謝您註冊ShowEasy"; //取fonfig
oEmail.EmailBody = VerifyAccount_Mail(newUser.OrgID, newUser.MemberID, newUser.FirstName);
oEmail.IsCCSelf = false;
oEmail.Attachments = null;
oEmail.EmailTo = toEmail;
var bSend = new MailService(sOrgID, true).MailFactory(oEmail, out sError);
srm = new SuccessResponseMessage(null, null);
srm.DATA.Add(BLWording.REL, newUser);
} while (false);
}
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));
}

2
EuroTran/WebApp/Web.config

@ -87,7 +87,7 @@
<add key="ida:AppId" value="8509ba61-9451-4960-94d8-10934d5365cc" />
<add key="ida:AppPassword" value="qWWKUV056{*{)fuowwgHK31" />
<add key="ida:RedirectUri" value="http://localhost:3466" />
<add key="ida:WebsiteUri" value="http://localhost:3001" />
<add key="ida:WebsiteUri" value="http://localhost:3000" />
<add key="ida:AppScopes" value=" User.Read Mail.ReadWrite Mail.Send Calendars.ReadWrite Contacts.Read Contacts.ReadWrite" />
<add key="ida:GraphRootUri" value="https://graph.microsoft.com/beta" />
</appSettings>

Loading…
Cancel
Save