Example #1
0
        public static string ReplyTranslation(long followId, long translationId, string targetContent, Manager currentManager, string filePath)
        {
            EmailFollow      emailFollow      = emailFollowRepository.GetById(followId);
            EmailTranslation emailTranslation = emailTranslationRepository.GetById(translationId);

            if (emailFollow != null)
            {
                emailFollow.TargetContent       = targetContent;
                emailFollow.HandleManagerId     = currentManager.Id;
                emailFollow.TargetFilePath      = filePath;
                emailTranslation.ReceiverStatus = EmailStatusEnum.HasRead;
                emailTranslation.FollowTimes    = emailTranslation.FollowTimes + 1;
                emailTranslation.SenderStatus   = EmailStatusEnum.UnRead;
                emailTranslationRepository.Save(emailTranslation);
                emailFollowRepository.Save(emailFollow);
                if (emailTranslation.EnquiryId > 0)
                {
                    Enquiry enquiry = enquiryRepository.GetById(emailTranslation.EnquiryId);
                    if (enquiry != null)
                    {
                        enquiry.FollowUpTimes = enquiry.FollowUpTimes + 1;
                        enquiry.EmailStatus   = EmailStatusEnum.UnRead;
                        enquiryRepository.Save(enquiry);
                    }
                }
                return(ResponseCode.Ok);
            }
            return(ResponseCode.NotFoundData);
        }
Example #2
0
 public static string SaveTranslation(EmailTranslation emailTranslation, EmailFollow emailFollow)
 {
     if (string.IsNullOrEmpty(emailTranslation.Theme))
     {
         return(ResponseCode.Translation.EmailThemeNullOrEmpty);
     }
     emailTranslationRepository.Save(emailTranslation);
     emailFollow.EmailTransId = emailTranslation.Id;
     emailFollowRepository.Save(emailFollow);
     return(ResponseCode.Ok);
 }
Example #3
0
        public static string CreateEmailFollow(long translationId, string originalContent, string filePath, string targetLanguage = "")
        {
            EmailTranslation emailTranslation = emailTranslationRepository.GetById(translationId);

            if (emailTranslation != null)
            {
                EmailFollow emailFollow = EmailFollowFactory.Create(translationId, originalContent,
                                                                    emailTranslation.OriginalLanguage, emailTranslation.TargetLanguage, filePath);
                emailFollow.FollowId            = emailTranslation.FollowId;
                emailFollow.HandleManagerId     = emailTranslation.HandlerManagerId;
                emailFollow.TargetLanguage      = targetLanguage;
                emailTranslation.ReceiverStatus = EmailStatusEnum.UnRead;
                emailTranslation.TargetLanguage = targetLanguage;
                emailTranslationRepository.Save(emailTranslation);
                emailFollowRepository.Save(emailFollow);
                return(ResponseCode.Ok);
            }
            return(ResponseCode.NotFoundData);
        }
        public ActionResult SendEnquiryEmail(long enquiryId, string emailContent, long emailTranslationId)
        {
            string filePath = string.Empty;

            if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0)
            {
                HttpPostedFileBase file     = Request.Files[0];
                string             fuleName = DateTime.Now.ToString("yyyyMMddHHmmsss") + file.FileName.Substring(file.FileName.LastIndexOf("."));
                filePath = "/uploadFile/" + fuleName;
                string fileName = Server.MapPath("/uploadFile/") + fuleName;
                file.SaveAs(fileName);
            }
            if (enquiryId != 0)
            {
                string targetLanguage = Request["targetLanguage"];
                if (emailTranslationId != 0)
                {
                    TranslationService.CreateEmailFollow(emailTranslationId, emailContent, filePath, targetLanguage);
                }
                else
                {
                    Manager          superManager     = ManageService.GetSuperManager();
                    Enquiry          enquiry          = EnquiryService.GetEnquiryById(enquiryId);
                    EmailTranslation emailTranslation = EmailTranslationFactory.Create(superManager.Id,
                                                                                       enquiry.VisitLanguage, CurrentManager.RealName, CurrentManager.Id, "询盘邮件", emailContent,
                                                                                       filePath);
                    emailTranslation.TargetLanguage = targetLanguage;
                    emailTranslation.EnquiryId      = enquiryId;
                    EmailFollow emailFollow = EmailFollowFactory.Create(0, emailContent, enquiry.VisitLanguage,
                                                                        enquiry.VisitLanguage, filePath);
                    emailFollow.TargetLanguage = targetLanguage;
                    string result = TranslationService.SaveTranslation(emailTranslation, emailFollow);
                }
            }
            return(Redirect("/Enquiry/EnquiryDetail/" + enquiryId));
        }
        public ActionResult EmailTranslationAdd(string emailTheme, string translationContent, long originalLanguage,
                                                long targetLanguage)
        {
            string filePath = string.Empty;

            if (Request.Files.Count > 0 && Request.Files[0].ContentLength > 0)
            {
                HttpPostedFileBase file     = Request.Files[0];
                string             fuleName = DateTime.Now.ToString("yyyyMMddHHmmsss") + file.FileName.Substring(file.FileName.LastIndexOf("."));
                filePath = "/uploadFile/" + fuleName;
                string fileName = Server.MapPath("/uploadFile/") + fuleName;
                file.SaveAs(fileName);
            }
            Manager superManager = ManageService.GetSuperManager();
            Manager selfManager  = ManageService.GetManagerById(CurrentManager.Id);

            if (superManager != null)
            {
                EmailTranslation emailTranslation = EmailTranslationFactory.Create(superManager.Id,
                                                                                   SystemDictionary.GetInstance.GetBaseDictionary(selfManager.Language).Value, selfManager.RealName,
                                                                                   CurrentManager.Id,
                                                                                   emailTheme,
                                                                                   translationContent, filePath);
                BaseDictionary dictionary = BaseService.GetDictionaryById(targetLanguage);
                emailTranslation.TargetLanguage     = dictionary.Value;
                emailTranslation.HandlerManagerName = superManager.RealName;
                EmailFollow emailFollow = EmailFollowFactory.Create(0, translationContent,
                                                                    dictionary.Value, filePath);
                string result = TranslationService.SaveTranslation(emailTranslation, emailFollow);
                if (result == ResponseCode.Ok)
                {
                    return(RedirectToAction("HasReadTranslationList"));
                }
            }
            return(RedirectToAction("EmailTranslationAdd"));
        }