コード例 #1
0
        public void Update(UserBL user)
        {
            BLToDALMapper poMapper   = new BLToDALMapper();
            User          mappedUser = poMapper.MapUser(user);

            DAL.SDK.Kit.Instance.Users.Update(mappedUser);
        }
コード例 #2
0
        public void Update(ArticleBL article)
        {
            BLToDALMapper poMapper      = new BLToDALMapper();
            Article       mappedArticle = poMapper.MapArticle(article);

            DAL.SDK.Kit.Instance.Articles.UpdateArticle(mappedArticle);
        }
コード例 #3
0
        public void Update(QuestionBL question)
        {
            BLToDALMapper poMapper       = new BLToDALMapper();
            Question      mappedQuestion = poMapper.MapQuestion(question);

            DAL.SDK.Kit.Instance.Questions.UpdateQuestion(mappedQuestion);
        }
コード例 #4
0
        public int Insert(UserBL user)
        {
            BLToDALMapper poMapper   = new BLToDALMapper();
            User          mappedUser = poMapper.MapUser(user);
            int           userId     = DAL.SDK.Kit.Instance.Users.Insert(mappedUser);

            return(userId);
        }
コード例 #5
0
        public int Insert(AnswerBL answer)
        {
            var           insertNewUser = 0;
            BLToDALMapper poMapper      = new BLToDALMapper();
            Answer        mappedAnswer  = poMapper.MapAnswer(answer);

            if (mappedAnswer.IdUser == 0 && (mappedAnswer.AnonymousEmail != "" || mappedAnswer.AnonymousName != ""))
            {
                mappedAnswer.IdUser = DAL.SDK.Kit.Instance.Users.Insert(new User
                {
                    Email          = mappedAnswer.AnonymousEmail,
                    FirstName      = mappedAnswer.AnonymousName,
                    LastName       = "Guest",
                    Flags          = UserFlags.NotConfirmed,
                    JoinDate       = DateTime.Now,
                    UserType       = UserType.Prospect,
                    PasswordHashed = "password"
                });
                insertNewUser = mappedAnswer.IdUser;

                if (mappedAnswer.IdUser == 0)
                {
                    mappedAnswer.IdUser = 6;
                }
                else
                {
                    mappedAnswer.Flags = DAL.Entities.AnswerFlags.NotConfirmed;
                }
            }
            mappedAnswer.CreatedDate = DateTime.Now;

            //insert answer
            var answerId = DAL.SDK.Kit.Instance.Answers.Insert(mappedAnswer);

            //send email
            var question = DAL.SDK.Kit.Instance.Questions.GetQuestionById(answer.IdQuestion);
            var user     = DAL.SDK.Kit.Instance.Users.GetUserById(question.IdUser);

            Softvision.BL.Services.SMTP.sendEmail("*****@*****.**", user.Email, "New answer to your question! ", user.FirstName + ", you have a new answer on on your question");

            return(insertNewUser);
        }
コード例 #6
0
        public int Insert(CommentBL comment)
        {
            var           insertNewUser = 0;
            BLToDALMapper poMapper      = new BLToDALMapper();
            Comment       mappedComment = poMapper.MapComment(comment);

            if (mappedComment.IdUser == 0)
            {
                mappedComment.IdUser = DAL.SDK.Kit.Instance.Users.Insert(new User
                {
                    Email          = comment.AnonymousEmail,
                    FirstName      = comment.AnonymousName,
                    LastName       = "Guest",
                    Flags          = UserFlags.NotConfirmed,
                    JoinDate       = DateTime.Now,
                    UserType       = UserType.Prospect,
                    PasswordHashed = "password"
                });
                insertNewUser = mappedComment.IdUser;
                Softvision.BL.Services.SMTP.sendEmail("*****@*****.**", comment.AnonymousEmail, "Welcome " + comment.AnonymousName + " to Knowledgeshare.ro!", "Welcome! Please log in and continue contributing to our community! Your login email is: " + comment.AnonymousEmail);

                if (mappedComment.IdUser == 0)
                {
                    mappedComment.IdUser = 6;
                }
                else
                {
                    mappedComment.Flags = CommentsFlags.NotConfirmed;
                }
            }
            mappedComment.CreatedDate = DateTime.Now;
            DAL.SDK.Kit.Instance.Comments.InsertComment(mappedComment);

            //send email
            var article = DAL.SDK.Kit.Instance.Articles.GetArticleById(comment.IdArticle);
            var user    = DAL.SDK.Kit.Instance.Users.GetUserById(article.IdUser);

            Softvision.BL.Services.SMTP.sendEmail("*****@*****.**", user.Email, "New comment to your article!", user.FirstName + ", you have a new comment on on your aricle " + article.Title + ". You can check it out: " + comment.TextField);

            return(insertNewUser);
        }