Exemplo n.º 1
0
        private bool AnswerQuestion_Base(Guid id)
        {
            PartnerBLL          partnerBLL = new PartnerBLL(WebApp.Connector);
            CustomerQuestionDTO question   = partnerBLL.ReadCustomerQuestionById(Account, id);
            bool isAnswerable = question != null && question.Answer == null;

            if (isAnswerable)
            {
                ViewBag.Question = question;
            }
            return(isAnswerable);
        }
Exemplo n.º 2
0
 public AnswerQuestionResult AnswerQuestion(PartnerDTO partner, Guid questionId, string answer, string baseUrl)
 {
     Connector.IsTransaction = true;
     try
     {
         CustomerQuestionBLL  questionBLL = new CustomerQuestionBLL(Connector);
         CustomerQuestionDTO  question    = questionBLL.ReadById(questionId);
         AnswerQuestionResult result      = default;
         if (question.Answer == null)
         {
             CustomerQuestionBLL.UpdateResult baseResult = questionBLL.Update(questionId, new Dictionary <string, object>()
             {
                 { "Answer", answer },
                 { "AnswerTimeStamp", DateTime.UtcNow }
             });
             result = (AnswerQuestionResult)(byte)baseResult;
             if (result == AnswerQuestionResult.OK)
             {
                 string      fullName = question.Customer.FullName;
                 MailAddress to       = new MailAddress(question.Customer.EmailAddress, fullName);
                 if (baseUrl.LastIndexOf('/') == baseUrl.Length - 1)
                 {
                     baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
                 }
                 string logoUrl = new UriBuilder(baseUrl)
                 {
                     Path = "/png/Logo_361x86.png"
                 }.ToString(), propertyName = question.Property.Name;
                 string subject = string.Format(AnswerQuestionEmailSubject, propertyName);
                 string body    = string.Format(AnswerQuestionEmailTemplate, logoUrl, propertyName, fullName, question.Question, answer);
                 EmailSender.Send(to, subject, body);
             }
         }
         else
         {
             result = AnswerQuestionResult.QuestionHasBeenAlreadyAnswered;
         }
         Connector.CommitTransaction();
         return(result);
     }
     catch (Exception exception)
     {
         Connector.RollbackTransaction();
         throw exception;
     }
 }
Exemplo n.º 3
0
        public ActionResult ViewCustomerQuestion(Guid id)
        {
            PartnerBLL          partnerBLL = new PartnerBLL(WebApp.Connector);
            CustomerQuestionDTO question   = partnerBLL.ReadCustomerQuestionById(Account, id);

            if (question != null)
            {
                if (!question.HasQuestionBeenRead)
                {
                    partnerBLL.MarkQuestionAsRead(Account, id);
                }
                return(View(question));
            }
            else
            {
                return(HttpNotFound());
            }
        }