Created
June 1, 2020 03:05
-
-
Save resting/a210fd9d5cd927bbd2f826d7364aefc7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var transaction = UnitOfWorkManager.Begin(TransactionScopeOption.RequiresNew)) | |
{ | |
var _itemSendSMS = _feoSendSMSRepository.GetAll().Where(x => x.Staff_ID == item.StaffId && x.CreationTime>= DateTime.UtcNow.AddMonths(-3)).FirstOrDefault(); | |
if (_itemSendSMS == null) | |
{ | |
var _feoSendSMS = new FeoSendSMS() | |
{ | |
MemberID = item.MemberId, | |
Staff_ID = item.StaffId, | |
MobileNumber = item.MobileNumber, | |
ContentInput = item.ContentInput, | |
DefaultSMS = item.DefaultSMS, | |
TemplateSMS = item.TemplateSMS, | |
Header = item.Header, | |
Footer=item.Footer, | |
ContentFull = item.ContentFull.Replace("#",""), | |
Status = status == true ? 1 : 0, | |
DateSend = Clock.Now, | |
Forward=string.IsNullOrEmpty(item.StaffIdForward)?false: true, | |
CountSend = 1 | |
}; | |
if (claimsId != 0) | |
_feoSendSMS.CreatorUserId = claimsId; | |
if (claimsEmail != "") | |
_feoSendSMS.CreationByEmail = claimsEmail; | |
_feoSendSMSRepository.Insert(_feoSendSMS); | |
CurrentUnitOfWork.SaveChanges(); | |
} | |
else | |
{ | |
_itemSendSMS.CountSend += 1; | |
_feoSendSMSRepository.Update(_itemSendSMS); | |
CurrentUnitOfWork.SaveChanges(); | |
var _feoSendSMSLog = new FeoSendSMSLog() | |
{ | |
MemberID = item.MemberId, | |
Staff_ID = item.StaffId, | |
MobileNumber = item.MobileNumber, | |
ContentInput = item.ContentInput, | |
DefaultSMS = item.DefaultSMS, | |
TemplateSMS = item.TemplateSMS, | |
Header = item.Header, | |
Footer = item.Footer, | |
ContentFull = item.ContentFull.Replace("#", ""), | |
Status = status == true ? 1 : 0, | |
DateSend = Clock.Now, | |
CreatorUserId = claimsId, | |
CreationByEmail = claimsEmail, | |
Forward = string.IsNullOrEmpty(item.StaffIdForward) ? false : true, | |
}; | |
_feoSendSMSLogRepository.Insert(_feoSendSMSLog); | |
CurrentUnitOfWork.SaveChanges(); | |
} | |
transaction.Complete(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment