Example #1
0
 public static void ChangeEmailTranslationStatus(EmailTranslation emailTranslation, Manager currentManager)
 {
     if (emailTranslation != null)
     {
         if (emailTranslation.ReceiverStatus == EmailStatusEnum.UnRead &&
             currentManager.ManagerType == ManagerTypeEnum.Super && emailTranslation.HandlerManagerId == currentManager.Id)
         {
             emailTranslation.ReceiverStatus = EmailStatusEnum.HasRead;
         }
         if (emailTranslation.SenderStatus == EmailStatusEnum.UnRead &&
             currentManager.ManagerType == ManagerTypeEnum.Common &&
             emailTranslation.FollowId == currentManager.Id)
         {
             emailTranslation.SenderStatus = EmailStatusEnum.HasRead;
         }
         emailTranslationRepository.Save(emailTranslation);
         if (emailTranslation.EnquiryId > 0)
         {
             Enquiry enquiry = enquiryRepository.GetById(emailTranslation.EnquiryId);
             if (enquiry != null)
             {
                 enquiry.EmailStatus = EmailStatusEnum.HasRead;
                 enquiryRepository.Save(enquiry);
             }
         }
     }
 }
Example #2
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 #3
0
        /// <summary>
        /// 移动到意向客户
        /// </summary>
        /// <param name="id"></param>
        public static void MoveToIntentionCustom(long translationId, long intentId)
        {
            EmailTranslation emailTranslation = emailTranslationRepository.GetById(translationId);

            emailTranslation.IntentionId          = (int)intentId;
            emailTranslation.IntentionDescription = intentionRepository.GetById(intentId).Description;
            emailTranslationRepository.Save(emailTranslation);
        }
Example #4
0
        public static void RecoveryEmailTranlations(long translationId)
        {
            EmailTranslation emailTranslation = emailTranslationRepository.GetById(translationId);

            if (emailTranslation != null)
            {
                emailTranslation.IsDeleted = Utils.CoreDefaultValue.False;
                emailTranslationRepository.Save(emailTranslation);
            }
        }
Example #5
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 #6
0
        public static void IssueEmailToChildManager(long translationId, long managerId)
        {
            EmailTranslation emailTranslation = emailTranslationRepository.GetById(translationId);
            Manager          childManager     = managerRepository.GetById(managerId);

            if (emailTranslation != null && childManager != null)
            {
                emailTranslation.HandlerManagerId   = managerId;
                emailTranslation.HandlerManagerName = childManager.RealName;
                emailTranslationRepository.Save(emailTranslation);
            }
        }
Example #7
0
        public static string DeleteTranslation(long translationId, long managerId)
        {
            EmailTranslation emailTranslation = emailTranslationRepository.GetById(translationId);

            if (emailTranslation.FollowId == managerId || emailTranslation.ReceiverId == managerId ||
                emailTranslation.SenderId == managerId)
            {
                emailTranslation.IsDeleted = Utils.CoreDefaultValue.True;
                emailTranslationRepository.Save(emailTranslation);
                return(ResponseCode.Ok);
            }
            return(ResponseCode.Translation.NoPermissionDeleteTrans); //无权
        }
        public ActionResult EmailTranslationDetail(long id)
        {
            ViewBag.Languages      = BaseService.GetBaseDictionaries(ValueTypeEnum.Language);
            ViewBag.CurrentManager = CurrentManager;
            ViewBag.Intentions     = BaseService.GetIntentions(CurrentManager.ParentId != 0 ? CurrentManager.ParentId : CurrentManager.Id);
            EmailTranslation      emailTranslation  = TranslationService.GeEmailTranslationById(id);
            PageTranslationFollow translationFollow =
                new PageTranslationFollow(emailTranslation,
                                          TranslationService.GetEmailFollows(id));

            TranslationService.ChangeEmailTranslationStatus(emailTranslation, CurrentManager);
            return(View(translationFollow));
        }
Example #9
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 EnquiryDetail(long id)
        {
            Enquiry enquiry = EnquiryService.GetEnquiryById(id);

            EnquiryService.ChangeEnquiryStatus(CurrentManager, enquiry);
            EmailTranslation emailTranslation = TranslationService.GeEmailTranslationByEnquiryId(id);
            PageEnquiry      pageEnquiry      = new PageEnquiry();

            pageEnquiry.Enquiry          = enquiry;
            pageEnquiry.EmailTranslation = emailTranslation;
            if (emailTranslation != null)
            {
                pageEnquiry.EnquiryTransFollows = TranslationService.GetEmailFollows(emailTranslation.Id);
            }
            ViewBag.CurrentManager = CurrentManager;
            ViewBag.Intentions     = BaseService.GetIntentions(CurrentManager.ParentId != 0 ? CurrentManager.ParentId : CurrentManager.Id);
            ViewBag.UserDefineds   = BaseService.GetUserDefineds(CurrentManager.ParentId != 0 ? CurrentManager.ParentId : CurrentManager.Id);
            ViewBag.Languages      = BaseService.GetBaseDictionaries(ValueTypeEnum.Language);
            return(View(pageEnquiry));
        }
Example #11
0
        /// <summary>
        ///返回给总账号
        /// </summary>
        public static void BackTranslationToMain(long translationId, Manager currentManager)
        {
            if (currentManager.ParentId == 0)
            {
                return;
            }
            EmailTranslation emailTranslation = emailTranslationRepository.GetById(translationId);
            Manager          mainManager      = managerRepository.GetById(currentManager.ParentId);

            if (currentManager.ManagerType == ManagerTypeEnum.Super)
            {
                emailTranslation.HandlerManagerId   = mainManager.Id;
                emailTranslation.HandlerManagerName = mainManager.RealName;
            }
            if (currentManager.ManagerType == ManagerTypeEnum.Common)
            {
                emailTranslation.FollowId   = mainManager.Id;
                emailTranslation.FollowName = mainManager.RealName;
            }

            emailTranslationRepository.Save(emailTranslation);
        }
        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"));
        }
Example #14
0
 public PageTranslationFollow(EmailTranslation emailTranslationModel, IList <EmailFollow> emailFollows)
 {
     EmailTranslationModel = emailTranslationModel;
     EmailFollows          = emailFollows;
 }