示例#1
0
 public IList <EmailTranslation> GetEmailTranslations(ManagerTypeEnum managerType, EmailStatusEnum emailStatus, short isDeleted, long receiveId, long intentionId, int pageIndex, int pageSize, out int totalCount)
 {
     using (var session = GetSession())
     {
         var query = session.QueryOver <EmailTranslation>();
         query = query.Where(m => m.IsDeleted == isDeleted);
         if (managerType == ManagerTypeEnum.Super)
         {
             query =
                 query.And(
                     m =>
                     m.ReceiverStatus == emailStatus &&
                     (m.ReceiverId == receiveId || m.HandlerManagerId == receiveId));
         }
         if (managerType == ManagerTypeEnum.Common)
         {
             if (emailStatus == EmailStatusEnum.UnRead)
             {
                 query = query.And(m => m.EnquiryId < 1);
             }
             query =
                 query.And(
                     m =>
                     m.SenderStatus == emailStatus &&
                     (m.SenderId == receiveId || m.FollowId == receiveId));
         }
         if (intentionId != 0)
         {
             query = query.And(m => m.IntentionId == intentionId);
         }
         totalCount = query.RowCount();
         return(query.OrderBy(m => m.Id).Desc.Take(pageSize).Skip((pageIndex - 1) * pageSize).List());
     }
 }
示例#2
0
        public int GetEmailTranslationsCount(ManagerTypeEnum managerType, EmailStatusEnum emailStatus, long managerId)
        {
            using (var session = GetSession())
            {
                var query = session.QueryOver <EmailTranslation>();
                query = query.Where(m => m.IsDeleted == Utils.CoreDefaultValue.False);

                if (managerType == ManagerTypeEnum.Common)
                {
                    if (emailStatus == EmailStatusEnum.UnRead)
                    {
                        query = query.And(m => m.EnquiryId < 1);
                    }
                    query =
                        query.And(
                            m => m.SenderStatus == emailStatus && (m.SenderId == managerId || m.FollowId == managerId));
                }
                if (managerType == ManagerTypeEnum.Super)
                {
                    query =
                        query.And(
                            m =>
                            m.ReceiverStatus == emailStatus &&
                            (m.HandlerManagerId == managerId || m.ReceiverId == managerId));
                }
                return(query.RowCount());
            }
        }
示例#3
0
        public ActionResult ManagerEdit(long id, string userName, string realName,
                                        string company, int language, ManagerTypeEnum managerType, string bindEmail)
        {
            short isAutoDistribute = Utils.CoreDefaultValue.False;

            if (!string.IsNullOrEmpty(Request["isAutoDistribute"]))
            {
                isAutoDistribute = Utils.CoreDefaultValue.True;
            }
            string  responseCode = ResponseCode.NotFoundData;
            Manager manager      = ManageService.GetManagerById(id);

            if (manager != null)
            {
                manager.UserName         = userName;
                manager.RealName         = realName;
                manager.Company          = company;
                manager.Language         = language;
                manager.IsAutoDistribute = isAutoDistribute;
                manager.ManagerType      = managerType;
                manager.EncryptPassword();
                manager.BindEmail = bindEmail;
                responseCode      = ManageService.Save(CurrentManager, manager);
            }
            return(Json(InfoTools.GetMsgInfo(responseCode), JsonRequestBehavior.AllowGet));
        }
 public IList <Manager> GetManagerTypeManagers(ManagerTypeEnum managerType)
 {
     using (var session = GetSession())
     {
         return
             (session.QueryOver <Manager>()
              .Where(m => m.ManagerType == managerType).List());
     }
 }
示例#5
0
        public static PageModel <Manager> GetManagerPages(ManagerTypeEnum managerType, int pageIndex, int pageSize,
                                                          long parentId)
        {
            int             totalCount = 0;
            IList <Manager> managers   = managerRepository.GetManagersByPage(managerType, pageIndex, pageSize, parentId,
                                                                             out totalCount);

            return(new PageModel <Manager>(managers, pageIndex, pageSize, totalCount));
        }
示例#6
0
        public static PageModel <EmailTranslation> GetRecycledTranslationList(ManagerTypeEnum managerType, long receiveId,
                                                                              int pageIndex, int pageSize)
        {
            int totalCount = 0;
            IList <EmailTranslation> emailTranslations =
                emailTranslationRepository.RecycledTranslationList(managerType, receiveId,
                                                                   pageIndex, pageSize, out totalCount);

            return(new PageModel <EmailTranslation>(emailTranslations, pageIndex, pageSize, totalCount));
        }
示例#7
0
        public static PageModel <EmailTranslation> GetEmailTranslations(ManagerTypeEnum managerType,
                                                                        EmailStatusEnum emailStatus, short isDeleted, long receiveId,
                                                                        long intentionId, int pageIndex, int pageSize)
        {
            int totalCount = 0;
            IList <EmailTranslation> emailTranslations =
                emailTranslationRepository.GetEmailTranslations(managerType, emailStatus, isDeleted, receiveId,
                                                                intentionId, pageIndex, pageSize, out totalCount);

            return(new PageModel <EmailTranslation>(emailTranslations, pageIndex, pageSize, totalCount));
        }
示例#8
0
        public ActionResult ManagerAdd(string userName, string password, string realName,
                                       string company, int language, ManagerTypeEnum managerType, string bindEmail)
        {
            short isAutoDistribute = Utils.CoreDefaultValue.False;

            if (!string.IsNullOrEmpty(Request["isAutoDistribute"]))
            {
                isAutoDistribute = Utils.CoreDefaultValue.True;
            }
            long    parentId = CurrentManager.Id;
            Manager manager  = ManagerFactory.Create(userName, password, parentId, managerType, realName, company,
                                                     isAutoDistribute, language, CurrentManager.UserName, bindEmail);

            manager.EncryptPassword();
            string responseCode = ManageService.Save(CurrentManager, manager);

            return(Json(InfoTools.GetMsgInfo(responseCode), JsonRequestBehavior.AllowGet));
        }
 public IList <Manager> GetManagersByPage(ManagerTypeEnum managerType, int pageIndex, int pageSize, long parentId,
                                          out int totalCount)
 {
     using (var session = GetSession())
     {
         var query = session.QueryOver <Manager>()
                     .Where(m => m.ManagerType == managerType);
         if (parentId != 0)
         {
             query = query.And(m => m.ParentId == parentId);
         }
         totalCount = query.RowCount();
         return
             (query.OrderBy(m => m.Id)
              .Desc.Take(pageSize)
              .Skip((pageIndex - 1) * pageSize)
              .List());
     }
 }
示例#10
0
 public IList <EmailTranslation> RecycledTranslationList(ManagerTypeEnum managerType,
                                                         long receiveId, int pageIndex, int pageSize, out int totalCount)
 {
     using (var session = GetSession())
     {
         var query = session.QueryOver <EmailTranslation>();
         query = query.Where(m => m.IsDeleted == Utils.CoreDefaultValue.True);
         if (managerType == ManagerTypeEnum.Super)
         {
             query = query.And(m => m.HandlerManagerId == receiveId || m.ReceiverId == receiveId);
         }
         if (managerType == ManagerTypeEnum.Common)
         {
             query = query.And(m => m.SenderId == receiveId || m.FollowId == receiveId);
             ;
         }
         totalCount = query.RowCount();
         return(query.OrderBy(m => m.Id).Desc.Take(pageSize).Skip((pageIndex - 1) * pageSize).List());
     }
 }
示例#11
0
        public ActionResult ManagerList()
        {
            int pageIndex = 1;
            int pageSize  = 10;

            if (!string.IsNullOrEmpty(Request["pageIndex"]))
            {
                int.TryParse(Request["pageIndex"].ToString(), out pageIndex);
            }

            if (!string.IsNullOrEmpty(Request["pageSize"]))
            {
                int.TryParse(Request["pageSize"].ToString(), out pageSize);
            }

            ViewBag.ManagerTypes = EnumTools.GetEnumDescriptions <ManagerTypeEnum>();
            ManagerTypeEnum managerType = CurrentManager.ManagerType;

            if (!string.IsNullOrEmpty(Request["managerType"]))
            {
                managerType = (ManagerTypeEnum)short.Parse(Request["managerType"].ToString());
            }
            ViewBag.CurrentManagerType = managerType;
            ViewBag.CurrentManager     = CurrentManager;
            PageModel <Manager> pageModel = null;

            if (CurrentManager.ManagerType == ManagerTypeEnum.Common)
            {
                pageModel = ManageService.GetManagerPages(pageIndex, pageSize, CurrentManager.Id);
            }
            else
            {
                pageModel = ManageService.GetManagerPages(managerType, pageIndex, pageSize, CurrentManager.ParentId);
            }
            return(View(pageModel));
        }
 public static PageModel<Manager> GetManagerPages(ManagerTypeEnum managerType, int pageIndex, int pageSize,
     long parentId)
 {
     int totalCount = 0;
     IList<Manager> managers = managerRepository.GetManagersByPage(managerType, pageIndex, pageSize, parentId,
         out totalCount);
     return new PageModel<Manager>(managers, pageIndex, pageSize, totalCount);
 }
示例#13
0
 public static int GetEmailTranslationsCount(ManagerTypeEnum managerType, EmailStatusEnum emailStatus,
                                             long managerId)
 {
     return(emailTranslationRepository.GetEmailTranslationsCount(managerType, emailStatus, managerId));
 }
示例#14
0
 public static IList <Manager> GetMainManagerTypeManagers(ManagerTypeEnum managerType)
 {
     return(managerRepository.GetMainManagerTypeManagers(managerType));
 }
示例#15
0
 public static Manager Create(string userName, string password, long parentId, ManagerTypeEnum managerType
                              , string realName, string company, short isAutoDistribute, int language, string creator, string bindEmail)
 {
     return(new Manager()
     {
         UserName = userName,
         Password = password,
         ParentId = parentId,
         ManagerType = managerType,
         RealName = realName,
         Company = company,
         IsAutoDistribute = isAutoDistribute,
         Language = language,
         Creator = creator,
         CreateTime = DateTime.Now,
         BindEmail = bindEmail
     });
 }
示例#16
0
 public static Manager Create(string userName, string password, long parentId, ManagerTypeEnum managerType
     , string realName, string company, short isAutoDistribute, int language, string creator,string bindEmail)
 {
     return new Manager()
     {
         UserName = userName,
         Password = password,
         ParentId = parentId,
         ManagerType = managerType,
         RealName=realName,
         Company = company,
         IsAutoDistribute = isAutoDistribute,
         Language=language,
         Creator = creator,
         CreateTime = DateTime.Now,
         BindEmail = bindEmail
     };
 }
 public static IList<Manager> GetMainManagerTypeManagers(ManagerTypeEnum managerType)
 {
     return managerRepository.GetMainManagerTypeManagers(managerType);
 }