当前位置: 首页>>代码示例>>C#>>正文


C# UserManager.Get方法代码示例

本文整理汇总了C#中UserManager.Get方法的典型用法代码示例。如果您正苦于以下问题:C# UserManager.Get方法的具体用法?C# UserManager.Get怎么用?C# UserManager.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserManager的用法示例。


在下文中一共展示了UserManager.Get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddUserToRoleTest

 public void AddUserToRoleTest()
 {
     IUserManager target2 = new UserManager();
     IRoleManager target = CreateInstance();
     UserInfo userInfo = target2.Get(new Guid("80fea4c3-9356-4761-bfce-9769cee93e75"));
     RoleInfo roleInfo = target.Get(new Guid("0c07d62e-b943-4a6b-9a89-e24bde1b6172"));
     target.AddUserToRole(userInfo, roleInfo);
 }
开发者ID:SaintLoong,项目名称:UltraNuke_Library,代码行数:8,代码来源:IRoleManagerTest.cs

示例2: AddFavorite

        public ActionResult AddFavorite(int Id)
        {
            var userManager = new UserManager();
            var favoriteManager = new FavoriteManager();

            var favorite = new Favorite();
            var login = System.Web.HttpContext.Current.User.Identity.Name;

            favorite.Restaurant = _rstManager.Get(Id);
            favorite.User = userManager.Get().FirstOrDefault(u => u.Login == login);
            favoriteManager.Add(favorite);
            return Json(new {result = "success"}, JsonRequestBehavior.AllowGet);
        }
开发者ID:pasha369,项目名称:RestaurantManagementSystem,代码行数:13,代码来源:RestaurantController.cs

示例3: btnSave_OnClick

        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            var ddlRestaurant = GetDdlValue(fvRestaurateur, "ddlRestaurant");
            var ddlUsers = GetDdlValue(fvRestaurateur, "ddlUsers");

            var rstManager = new RestaurantManager();
            var clientManager = new ClientManager();
            var userManager = new UserManager();

            if (fvRestaurateur.CurrentMode == FormViewMode.Edit)
            {
                var client = clientManager.Get(currentId);
                client.Restaurant = rstManager.Get(ddlRestaurant);

                var user = userManager.Get(ddlUsers);
                user.Position = Role.Restaurateur;
                userManager.Update(user);
                client.UserInfo = user;
                clientManager.Update(client);

            }
            else if (fvRestaurateur.CurrentMode == FormViewMode.Insert)
            {
                var client = new ClientInfo();
                client.Restaurant = rstManager.Get(ddlRestaurant);

                var user = userManager.Get(ddlUsers);

                user.Position = Role.Restaurateur;
                userManager.Update(user);
                client.UserInfo = user;

                clientManager.Add(client);

            }
            PopupHelper.HidePopup("#pop", this);
            gvClients.DataBind();
        }
开发者ID:pasha369,项目名称:RestaurantManagementSystem,代码行数:38,代码来源:Users.aspx.cs

示例4: UploadPhoto

        public void UploadPhoto()
        {
            var httpRequest = HttpContext.Current.Request;
            var imageFile = httpRequest.Files["file0"];

            if(imageFile != null)
            {
                var userManager = new UserManager();
                var photoUrl = this.SavePhoto(imageFile);

                var user = userManager.Get()
                    .FirstOrDefault(u => u.Login == HttpContext.Current.User.Identity.Name);
                user.PhotoUrl = photoUrl;
                userManager.Update(user);
            }
        }
开发者ID:pasha369,项目名称:RestaurantManagementSystem,代码行数:16,代码来源:ImageController.cs

示例5: ddlUsers_OnDataBinding

        protected void ddlUsers_OnDataBinding(object sender, EventArgs e)
        {
            var userManager = new UserManager();

            var ddl = sender as DropDownList;
            ddl.DataSource = userManager.Get();
        }
开发者ID:pasha369,项目名称:RestaurantManagementSystem,代码行数:7,代码来源:Users.aspx.cs

示例6: GetCommentReplyHtml

    protected String GetCommentReplyHtml(Comment comment, RepeaterItem item)
    {
        CommentReplyManager manager = new CommentReplyManager();
        IList<CommentReply> replyes = manager.GetCommentReplyByCommentID(comment.ID);
        HtmlGenericControl divReply = item.FindControl("divReply") as HtmlGenericControl;
        HyperLink hplReply = item.FindControl("hplReply") as HyperLink;

        if (replyes != null && replyes.Count > 0)
        {
            ///Show the Reply Link
            divReply.Visible = true;
            hplReply.Attributes["onclick"] = String.Format("ShowPopupForCommentReply({0}, this);", comment.ID);

            UserManager userManager = new UserManager();
            StringBuilder sb = new StringBuilder(10);
            #region Expand Collapse Implementation
            //sb.Append("Comment Replyes:");
            //foreach (CommentReply reply in replyes)
            //{
            //    PlanningPrepUser user = userManager.Get(reply.UserID);
            //    sb.Append("<div style='margin-top:10px;'>");
            //    sb.Append("<div class='ExamTitle' onclick='ToggleCollapse(this)' style='cursor:pointer'>");
            //    sb.AppendFormat("<img class='clickableimage' src='/Images/plus.gif' alt='Expand' title='Expand'/> {0}", user.Username);
            //    sb.Append("</div>");
            //    sb.AppendFormat("<div class='replymessage' style='display:none;'>{0}</div>", AppUtil.FormatText(reply.Message));
            //    sb.Append("</div>");
            //}
            #endregion

            for(int i=0; i<replyes.Count; i++)
            {
                CommentReply reply = replyes[i];
                PlanningPrepUser user = userManager.Get(reply.UserID);
                if (i == 0)
                    sb.Append("<div class='replymessagecontainer' style='margin-top:10px;'>");
                else
                    sb.Append("<div class='replymessagecontainer'>");
                sb.AppendFormat("<div class='replymessageheading'>Reply of <b>{0}</b></div>", AppUtil.Encode(string.Format("{0} {1}",user.FirstName,user.LastName)));
                sb.Append(string.Format("\"{0}\"", AppUtil.FormatText(reply.Message)));
                sb.Append("</div>");
            }

            return sb.ToString();
        }
        else
        {
            ///Show the Reply Link if this commment is not the users own comment
            if (comment.UserID != _LoggedInUser.Author_ID)
            {
                divReply.Visible = true;
                hplReply.Attributes["onclick"] = String.Format("ShowPopupForCommentReply({0}, this);", comment.ID);
            }
        }
        if (_LoggedInUser.Author_ID == 0)
            divReply.Visible = false;

        return String.Empty;
    }
开发者ID:kaiss78,项目名称:planningprep,代码行数:58,代码来源:Commenting.ascx.cs

示例7: LoadUserProfileInfo

    protected void LoadUserProfileInfo()
    {
        UserManager manager = new UserManager();
        PlanningPrepUser user = manager.Get(this.UserID);
        if (user == null)
        {
            ltrProfileHeading.Text = "Sorry! The requested user profile was not found.";
            pnlUserProfile.Visible = false;
        }
        else
        {
            ltrProfileHeading.Text = String.Format("Profile for {0} {1} ({2})", user.FirstName, user.LastName, user.Username);
            Page.Title = AppUtil.GetPageTitle(String.Format("Member Profile - {0}", ltrProfileHeading.Text));
            hplProfileEdit.NavigateUrl = AppConstants.Pages.EDIT_PROFILE;
            if (ShowInfoText)
            {
                divInfoText.Visible = true;
            }

            lblFirstName.Text = GetFormatedText(user.FirstName);
            lblLastName.Text = GetFormatedText(user.LastName);
            lblUserName.Text = GetFormatedText(user.Username);
            lblPassword.Text = "*******";
            lblAddress.Text = GetFormatedText(user.Address);
            lblEmail.Text = GetFormatedText(user.Author_email);
            lblPhoneNumber.Text = GetFormatedText(user.HomePhone);
            if (String.IsNullOrEmpty(user.Homepage))
                ltrHomePage.Text = "Not Specified";
            else
                ltrHomePage.Text = String.Format("<a href='{0}' target='_blank'>{1}</a>", AppUtil.GetCompleteUrl(user.Homepage), user.Homepage);

            lblQuestionMode.Text = GetFormatedText(user.Mode);
            lblCity.Text = GetFormatedText(user.City);
            lblState.Text = GetFormatedText(user.State);
            lblZip.Text = GetFormatedText(user.ZIP);
            lblDateJoined.Text = user.Join_date.ToString(AppConstants.ValueOf.DATE_FROMAT_DISPLAY);
        }
    }
开发者ID:kaiss78,项目名称:planningprep,代码行数:38,代码来源:UserProfile.ascx.cs

示例8: LoadPorfileForEdit

    private void LoadPorfileForEdit()
    {
        UserManager manager = new UserManager();
        PlanningPrepUser user = manager.Get(this.UserID);
        if (user != null)
        {
            ltrProfileHeading.Text = String.Format("Modify Profile for {0} {1} ({2})", user.FirstName, user.LastName, user.Username);
            Page.Title = AppUtil.GetPageTitle(ltrProfileHeading.Text);
            divInfoText.InnerHtml = "Use this form below to update data in our membership database. Make any changes below and press submit.";
            divInfoText.Visible = true;
            hplProfileEdit.Visible = false;

            txtFirstName.Text = user.FirstName.Trim();
            txtLastName.Text = user.LastName.Trim();
            lblUserNameEdit.Text = GetFormatedText(user.Username);
            txtUserPassword.Attributes["value"] = user.Password;

            txtAddress.Text = user.Address.Trim();
            txtEmail.Text = user.Author_email.Trim();
            txtPhoneNumber.Text = user.HomePhone.Trim();
            txtHomePage.Text = user.Homepage.Trim();
            txtCity.Text = user.City.Trim();
            txtState.Text = user.State.Trim();
            txtZip.Text = user.ZIP.Trim();
            lblDateJoinedEdit.Text = user.Join_date.ToString(AppConstants.ValueOf.DATE_FROMAT_DISPLAY);
            if (!String.IsNullOrEmpty(user.Mode))
                ddlQuestionMode.SelectedValue = user.Mode;
        }
        else
        {
            ltrProfileHeading.Text = String.Format("Add a new user");
            Page.Title = AppUtil.GetPageTitle(ltrProfileHeading.Text);
            divInfoText.InnerHtml = "Use this form below to add a User in the membership database.";
            divInfoText.Visible = true;
            hplProfileEdit.Visible = false;

            txtUserName.Visible = true;
            rfvUserName.Visible = true;
            lblUserNameEdit.Visible = false;
            lblDateJoinedEdit.Visible = false;
            lblDateJoinedLabel.Visible = false;
        }
    }
开发者ID:kaiss78,项目名称:planningprep,代码行数:43,代码来源:UserProfile.ascx.cs

示例9: SaveUserInfo

 protected void SaveUserInfo()
 {
     int userId = 0;
     int.TryParse(ViewState[USER_ID].ToString(), out userId);
     UserManager manager = new UserManager();
     PlanningPrepUser user = manager.Get(userId);
     if (user != null)
     {
         ///Populate the Object
         user.FirstName = txtFirstName.Text;
         user.LastName = txtLastName.Text;
         //lblUserName.Text = GetFormatedText(user.Username);
         user.Password = txtUserPassword.Text;
         user.Address = txtAddress.Text;
         user.Author_email = txtEmail.Text;
         user.HomePhone = lblPhoneNumber.Text;
         user.Homepage = txtHomePage.Text;
         user.HomePhone = txtPhoneNumber.Text;
         user.City = txtCity.Text;
         user.State = txtState.Text;
         user.ZIP = txtZip.Text;
         //lblDateJoinedEdit.Text = user.Join_date.ToString(AppConstants.ValueOf.DATE_FROMAT_DISPLAY);
         user.Mode = ddlQuestionMode.SelectedValue;
         manager.SaveOrUpdate(user);
     }
 }
开发者ID:kaiss78,项目名称:planningprep,代码行数:26,代码来源:UserProfile.ascx.cs

示例10: GetCardSubscribers

        private List<UserDto> GetCardSubscribers(NavigationCard card, NavigationCardsManager cardManager, UserManager userManager, UserDto owner)
        {
            if (!owner.Entity.Active) return new List<UserDto>();

            Dictionary<int, UserDto> subscribers = new Dictionary<int, UserDto>();

            subscribers.Add(owner.Entity.Id, owner);

            foreach (var user in card.CardData.Subscription.Users)
            {
                var userDto = userManager.Get(user);

                if(user != owner.Entity.Id && userDto != null && userDto.Entity.Active) subscribers.Add(user, userDto);
            }

            var groupUsers = cardManager.GetUsersFromGroups(card, card.CardData.Subscription.Groups);

            foreach (var user in groupUsers)
            {
                if (!subscribers.ContainsKey(user.Entity.Id)) subscribers.Add(user.Entity.Id, user);
            }

            return new List<UserDto>(subscribers.Values);
        }
开发者ID:jastorgalj,项目名称:App-EmailNotificationEngine,代码行数:24,代码来源:EmailNotificationEngine.cs

示例11: ProcessWatchers

        private void ProcessWatchers(List<IssueDto> issues, DateTime lastChecked)
        {
            var lastCheckedLocal = lastChecked.ToLocal(_issueManager.UserContext.User.TimeZone);

            Dictionary<int, WatcherData> targets = new Dictionary<int, WatcherData>();
            Dictionary<string, WatcherData> emailTargets = new Dictionary<string, WatcherData>();
            var userManager = new UserManager(_issueManager);
            List<int> projectsMissingFollowerTemplate = new List<int>();
            int emailWatchers = -3;

            // Build array of users that are watching issues
            foreach (var issue in issues)
            {
                //Safety check
                if (issue.Watchers.Count == 0) continue;
                if (issue.Revised == issue.Created) continue;
                if (issue.Revised.ToUtc(_issueManager.UserContext.User.TimeZone) <= lastChecked) continue;

                var history = _issueManager.GetHistory(issue);

                issue.History = new List<IssueAuditDto>(history);

                history.RemoveAll(h => h.Entity.Created <= lastCheckedLocal);

                foreach (var watcher in issue.Watchers)
                {
                    if (watcher.Entity.UserId != null)
                    {
                        if (targets.ContainsKey(watcher.Entity.UserId.Value))
                        {
                            WatcherData data = targets[watcher.Entity.UserId.Value];

                            var permissionManager = new PermissionsManager(data.User, _types, _permissionSets, _organizations, _issueManager.UserContext.Config.HelpDeskModeGroup, false);

                            if (!permissionManager.CanSeeItem(issue.Project, issue)) continue;

                            if (!data.User.Entity.EmailMeMyChanges && IsUserOnlyChange(history, data.User.Entity.Id)) continue;

                            data.IssueId.Add(issue.Entity.Id);
                        }
                        else
                        {
                            WatcherData data = new WatcherData();

                            data.User = userManager.Get(watcher.Entity.UserId.Value);

                            if (data.User.Entity.Active)
                            {
                                var permissionManager = new PermissionsManager(data.User, _types, _permissionSets, _organizations, _issueManager.UserContext.Config.HelpDeskModeGroup, false);

                                if (!permissionManager.CanSeeItem(issue.Project, issue)) continue;

                                if (!data.User.Entity.EmailMeMyChanges && IsUserOnlyChange(history, data.User.Entity.Id)) continue;

                                data.IssueId.Add(issue.Entity.Id);

                                targets.Add(watcher.Entity.UserId.Value, data);
                            }
                        }
                    }
                    else
                    {
                        if (emailTargets.ContainsKey(watcher.Entity.Email.ToLower()))
                        {
                            WatcherData data = emailTargets[watcher.Entity.Email.ToLower()];
                            data = targets[data.User.Entity.Id];
                            data.IssueId.Add(issue.Entity.Id);
                        }
                        else
                        {
                            WatcherData data = new WatcherData();
                            data.User = new UserDto(new User());
                            data.User.Entity.Id = emailWatchers--;
                            data.User.Entity.Email = watcher.Entity.Email;
                            data.User.Entity.EmailMe = true;
                            data.User.Entity.EmailMeMyChanges = true;
                            data.User.Entity.ProjectGroups.Add(new ProjectGroupMembership() { ProjectGroupId = Constants.GlobalGroupEveryone, UserId = data.User.Entity.Id });
                            UserSettings settings = new UserSettings();
                            settings.IndividualFollowerAlerts = true;
                            data.User.Entity.Settings = settings.ToJson();
                            var group = new ProjectGroup() { Id = Constants.GlobalGroupEveryone, Members = new List<ProjectGroupMembership>() };
                            group.Members2.Add(new ProjectGroupMembership() { UserId = data.User.Entity.Id, ProjectGroupId = Constants.GlobalGroupEveryone });
                            data.User.ProjectGroups.Add(group);
                            data.IssueId.Add(issue.Entity.Id);
                            emailTargets.Add(watcher.Entity.Email.ToLower(), data);
                            targets.Add(data.User.Entity.Id, data);
                        }
                    }
                }
            }

            AlertsTemplateHelper alerts = new AlertsTemplateHelper(_templates, GetUrl(_issueManager));

            // Now loop through users sending them watcher summary email
            Dictionary<int, List<IssueCommentDto>> originalComments = new Dictionary<int, List<IssueCommentDto>>();
            List<int> processedProjects;

            foreach (var target in targets)
            {
                processedProjects = new List<int>();
//.........这里部分代码省略.........
开发者ID:jastorgalj,项目名称:App-EmailNotificationEngine,代码行数:101,代码来源:EmailNotificationEngine.cs

示例12: ProcessAppNavCardAlerts

        private void ProcessAppNavCardAlerts()
        {
            var navigationCardsManager = new NavigationCardsManager(_issueManager);

            List<NavigationCard> cards = navigationCardsManager.GetPendingAlertCards();

            LogDebugMessage("Email templates loaded: " + _templates.Count);

            LogDebugMessage("Pending card alerts: " + cards.Count);

            // ? We need to store user id and issue id for every email we send out -- avoids dupes?
            List<string> issuesEmailedToUsers = new List<string>(50);

            List<string> individualIssuesEmailedToUsers = new List<string>(50);

            AlertsTemplateHelper alerts = new AlertsTemplateHelper(_templates, GetUrl(_issueManager));

            UserManager userManager = new UserManager(_issueManager);

            bool refreshCache = false;

            var allOptOuts = navigationCardsManager.GetOptOuts();

            foreach (NavigationCard card in cards)
            {
                List<IssueDto> individualIssues = new List<IssueDto>();

                // Safety checks
                if (!card.UserId.HasValue) continue;

                if (card.CardData.Alerts.Count == 0) continue;

                UserDto recepient = userManager.Get(card.UserId.Value);

                // Safety check
                if (!recepient.Entity.EmailMe || recepient.Entity.Email.IsEmpty()) continue;

                DateTime lastChecked = card.CardData.AlertsLastSent.HasValue ? card.CardData.AlertsLastSent.Value : card.Created;

                DateTime lastCheckedLocal = lastChecked.ToLocal(_issueManager.UserContext.User.TimeZone);

                AlertTypeAppNavAlertsTemplateModel model = new AlertTypeAppNavAlertsTemplateModel();

                model.TheRecipient = recepient;

                model.Version = GeminiVersion.Version;

                model.GeminiUrl = alerts.GeminiUrl;

                List<int> issuesToAlert = new List<int>(card.CardData.Alerts);

                foreach (int issueId in issuesToAlert)
                {
                    IssueDto issue = _issueManager.Get(issueId);

                    // Safety check
                    if (issue == null || issue.Entity.IsNew) continue;

                    // Dupe check
                    string dupeKey = string.Format("{0}-{1}-{2}", recepient.Entity.Id, issueId, card.Id);

                    if (issuesEmailedToUsers.Contains(dupeKey)) continue;

                    var permissionManager = new PermissionsManager(recepient, _types, _permissionSets, _organizations, _issueManager.UserContext.Config.HelpDeskModeGroup, false);

                    if (!permissionManager.CanSeeItem(issue.Project, issue)) continue;

                    foreach (var comment in issue.Comments)
                    {
                        if (!permissionManager.CanSeeComment(issue, comment))
                        {
                            issue.Comments.RemoveAll(c => !permissionManager.CanSeeComment(issue, c));
                            break;
                        }
                    }

                    issue.ChangeLog = _issueManager.GetChangeLog(issue, _issueManager.UserContext.User, recepient, lastCheckedLocal);

                    // Populate model for email template
                    if (card.CardData.Subscription.IndividualAlert) individualIssues.Add(issue);

                    if (card.CardData.Subscription.Created && issue.Created.ToUtc(_issueManager.UserContext.User.TimeZone) >= lastChecked)
                    {
                        model.TheItemsCreated.Add(issue);
                    }
                    else
                    {
                        List<IssueAuditDto> allChanges = issue.History.FindAll(h => h.Entity.Created.ToUtc(_issueManager.UserContext.User.TimeZone) >= lastChecked);

                        List<IssueAuditDto> commentChanges = allChanges.FindAll(a => !a.Entity.IsCustom && a.Entity.AttributeChanged == ItemAttributeVisibility.AssociatedComments);

                        List<IssueAuditDto> nonCommentChanges = allChanges.FindAll(a => a.Entity.IsCustom || a.Entity.AttributeChanged != ItemAttributeVisibility.AssociatedComments);

                        // Add comments and updates
                        if (card.CardData.Subscription.Updated && nonCommentChanges.Count > 0 || card.CardData.Subscription.Commented && commentChanges.Count > 0 && issue.Comments.Count > 0)
                        {
                            model.TheItemsUpdated.Add(issue);
                        }

                        if (card.CardData.Subscription.Commented && commentChanges.Count > 0 && issue.Comments.Count > 0)
//.........这里部分代码省略.........
开发者ID:jastorgalj,项目名称:App-EmailNotificationEngine,代码行数:101,代码来源:EmailNotificationEngine.cs

示例13: GetRolesForUserTest

 public void GetRolesForUserTest()
 {
     IUserManager target2 = new UserManager();
     IRoleManager target = CreateInstance();
     UserInfo userInfo = target2.Get(new Guid("80fea4c3-9356-4761-bfce-9769cee93e75"));
     IList<RoleInfo> actual;
     actual = target.GetRolesForUser(userInfo);
     Assert.IsTrue(actual.Count>0);
 }
开发者ID:SaintLoong,项目名称:UltraNuke_Library,代码行数:9,代码来源:IRoleManagerTest.cs

示例14: MigrateSurveyCustomer

        public static void MigrateSurveyCustomer()
        {
            PortalDbContext portalDbContext = new PortalDbContext();
            PortalDbRepository<Access> accesPortalDbRepository = new PortalDbRepository<Access>(portalDbContext);
            PortalDbRepository<SurveyCustomer> surveyCustomerRepository = new PortalDbRepository<SurveyCustomer>(portalDbContext);
            PortalDbRepository<SurveyQuestion> surveyQuestionRepository = new PortalDbRepository<SurveyQuestion>(portalDbContext);
            PortalDbRepository<SurveysGeneralAnswer> surveysGeneralAnswerRepository = new PortalDbRepository<SurveysGeneralAnswer>(portalDbContext);
            PortalDbRepository<SurveysPossibleAnswer> surveyPossibleAnswerRepository = new PortalDbRepository<SurveysPossibleAnswer>(portalDbContext);

            Manager portalDbManager = new Manager(accesPortalDbRepository);
            /////////////===================>>>>>>>>>>>>>>>>>>>
            SurveyCustomerDbManager SurveyCustomerDbManager = new SurveyCustomerDbManager(surveyCustomerRepository, portalDbManager);
            SurveyQuestionManager SurveyQuestionManager = new SurveyQuestionManager(surveyQuestionRepository, portalDbManager);
            SurveyGeneralAnswerManager SurveyGeneralAnswerManager = new SurveyGeneralAnswerManager(surveysGeneralAnswerRepository, portalDbManager);
            SurveyPossibleAnswerManager SurveyPossibleAnswerManager = new SurveyPossibleAnswerManager(surveyPossibleAnswerRepository, portalDbManager);

            //////////////////////////////////////////////////
            CosmeticExpressDbContext cosmeticExpressDbContext = new CosmeticExpressDbContext();
            CosmeticExpressDbRepository<Access> accesCosmeticExpressDbRepository = new CosmeticExpressDbRepository<Access>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<User> userRepository = new CosmeticExpressDbRepository<User>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<Schedule> scheduleRepository = new CosmeticExpressDbRepository<Schedule>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<Office> officeRepository = new CosmeticExpressDbRepository<Office>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<VWCompleteSurgery> VWCompleteSurgeryRepository = new CosmeticExpressDbRepository<VWCompleteSurgery>(cosmeticExpressDbContext);
            CosmeticExpressDbRepository<Entity.CosmeticExpress.Patient> CosmeticExpressPatientRepository = new CosmeticExpressDbRepository<Entity.CosmeticExpress.Patient>(cosmeticExpressDbContext);


            Manager cosmeticExpressDbManager = new Manager(accesCosmeticExpressDbRepository);
            UserManager userManager = new UserManager(userRepository, cosmeticExpressDbManager);
            ScheduleManager scheduleManager = new ScheduleManager(scheduleRepository, cosmeticExpressDbManager);
            OfficeManager officeManager = new OfficeManager(officeRepository, cosmeticExpressDbManager);
            VWCompleteSurgeryManager vwCompleteSurgeryManager = new VWCompleteSurgeryManager(VWCompleteSurgeryRepository, cosmeticExpressDbManager);
            CosmeticExpressPatientManager CosmeticExpressPatientManager = new CosmeticExpressPatientManager(CosmeticExpressPatientRepository, cosmeticExpressDbManager);

            //////////////////////////////////////////////////
            ApplicationDbContext applicationDbContext = new ApplicationDbContext();
            ApplicationDbRepository<Access> accesApplicationDbRepository = new ApplicationDbRepository<Access>(applicationDbContext);
            ApplicationDbRepository<Review> reviewRepository = new ApplicationDbRepository<Review>(applicationDbContext);
            ApplicationDbRepository<Doctor> doctorRepository = new ApplicationDbRepository<Doctor>(applicationDbContext);
            ApplicationDbRepository<Lead> leadRepository = new ApplicationDbRepository<Lead>(applicationDbContext);
            ApplicationDbRepository<Expert> expertRepository = new ApplicationDbRepository<Expert>(applicationDbContext);
            ApplicationDbRepository<Center> centerRepository = new ApplicationDbRepository<Center>(applicationDbContext);
            ApplicationDbRepository<Entity.ReviewManagerEntities.Patient> ApplicationPatientRepository = new ApplicationDbRepository<Entity.ReviewManagerEntities.Patient>(applicationDbContext);


            Manager applicationDbManager = new Manager(accesApplicationDbRepository);
            ReviewManager reviewManager = new ReviewManager(reviewRepository, applicationDbManager);
            ///////////////////=============================>>>>>>>>>>>>>>>
            DoctorManager doctorManager = new DoctorManager(doctorRepository, applicationDbManager);
            LeadManager leadManager = new LeadManager(leadRepository, applicationDbManager);
            ExpertManager expertManager = new ExpertManager(expertRepository, applicationDbManager);
            CenterManager centerManager = new CenterManager(centerRepository, applicationDbManager);
            ApplicationPatientManager ApplicationPatientManager = new ApplicationPatientManager(ApplicationPatientRepository, cosmeticExpressDbManager);

            var SurveyQuestionCollection = SurveyQuestionManager.Get().ToArray();
            var SurveyCustomerCollection = SurveyCustomerDbManager.Get().ToArray();
            var SurveyPossibleAnswerCollection = SurveyPossibleAnswerManager.Get().ToArray();
            var SurveyGeneralAnswerCollection = SurveyGeneralAnswerManager.Get().ToArray();
            ICollection<VWCompleteSurgery> vwCompleteSurgeriesCollection = vwCompleteSurgeryManager.Get().ToArray();

            var doctors = doctorManager.Get().Select(d => new{ d.Id, d.FullName, d.Reviews.Count }).ToArray();
            var sources = reviewManager.Get().GroupBy(r => r.Source).ToArray().Select(group => new {Source = group.Key, Count = group.Count()});

            ICollection<Review> ReviewCollection = new List<Review>();

            foreach (var sgAnswer in SurveyGeneralAnswerCollection)
            {
                if (!reviewManager.Get().Any(review => review.ExternalId == sgAnswer.Id && review.Source == "Portal") && sgAnswer.SurveyTemplateId == 2)
                {
                    //Schedule Schedule = scheduleManager.Get(sched =>
                    //sched.PatientID == sgAnswer.SurveyCustomer.ExternalId
                    //&& sched.ServiceID == 5
                    //&& sched.dtStart.AddMonths(3) >= sgAnswer.SurveyDate).FirstOrDefault();

                    VWCompleteSurgery surgery = vwCompleteSurgeriesCollection.Where(surg => surg.PatientID == sgAnswer.SurveyCustomer.ExternalId && surg.dtStart.AddMonths(3) >= sgAnswer.SurveyDate).FirstOrDefault();


                    if (surgery != null)
                    {
                        Review review = new Review();
                        review.Source = "Portal";
                        review.ExternalId = sgAnswer.Id;
                        review.Rating = 0;

                        review.CreatedOn = surgery.dtStart;

                        //FROM CEXPRESS/Patient/Patient
                        Entity.CosmeticExpress.Patient CosmeticExpressPatient = CosmeticExpressPatientManager.Get(patient => patient.PatientID == surgery.PatientID).FirstOrDefault();
                        var existingApplicationPatient = ApplicationPatientManager.Get(patient => patient.ExternalId == CosmeticExpressPatient.PatientID && patient.Source == "CosmeticExpress").FirstOrDefault();
                        if (existingApplicationPatient != null)
                        {
                            review.PatientId = existingApplicationPatient.Id;
                        }
                        else
                        {
                            Entity.ReviewManagerEntities.Patient Patient = new Entity.ReviewManagerEntities.Patient()
                            {
                                ExternalId = CosmeticExpressPatient.PatientID,
                                FirstName = CosmeticExpressPatient.FirstName,
                                LastName = CosmeticExpressPatient.LastName,
                                MiddleName = CosmeticExpressPatient.MiddleName,
//.........这里部分代码省略.........
开发者ID:jecabana,项目名称:ReviewManager,代码行数:101,代码来源:Migrator.cs


注:本文中的UserManager.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。