コード例 #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Phoneid != null)
         {
             hashCode = hashCode * 59 + Phoneid.GetHashCode();
         }
         if (FeedbackType != null)
         {
             hashCode = hashCode * 59 + FeedbackType.GetHashCode();
         }
         if (FeedbackValue != null)
         {
             hashCode = hashCode * 59 + FeedbackValue.GetHashCode();
         }
         if (FeedbackMessage != null)
         {
             hashCode = hashCode * 59 + FeedbackMessage.GetHashCode();
         }
         if (FeedbackLat != null)
         {
             hashCode = hashCode * 59 + FeedbackLat.GetHashCode();
         }
         if (FeedbackLon != null)
         {
             hashCode = hashCode * 59 + FeedbackLon.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        public void FeedbackPost(IFormCollection collection, string filePath)
        {
            int      i         = 3;
            Feedback feed_back = new Feedback();
            var      form      = formService.GetForm(Convert.ToInt64(collection["FormId"]));
            var      body      = "";

            foreach (var item in formService.GetFormFieldsByFormId(Convert.ToInt64(collection["FormId"])))
            {
                var feedBackValue = new FeedbackValue();

                feedBackValue.FormFieldName = item.Name;
                feedBackValue.FieldType     = item.FieldType;
                feedBackValue.FormFieldId   = (int)item.Id;
                feedBackValue.Position      = item.Position;
                feedBackValue.AddedBy       = "username";
                feedBackValue.AddedDate     = DateTime.Now;
                feedBackValue.ModifiedBy    = "username";
                feedBackValue.ModifiedDate  = DateTime.Now;
                foreach (var item2 in collection)
                {
                    if (item.Name == item2.Key)
                    {
                        feedBackValue.Value = item2.Value;
                        body = body + item2.Key + " : " + item2.Value + "<br/>";
                    }
                }

                feed_back.FeedbackValues.Add(feedBackValue);
            }
            //feedBack.IP = GetUserIP();  // gönderen ip method u eklenecek

            //var remoteIpAddress = Request.HttpContext.Connection.RemoteIpAddress;


            feed_back.FormId   = (int)form.Id;
            feed_back.FormName = form.FormName;

            //feed_back.IP = remoteIpAddress.ToString();
            feed_back.SentDate     = DateTime.Now;
            feed_back.UserName     = "******";
            feed_back.AddedBy      = "username";
            feed_back.AddedDate    = DateTime.Now;
            feed_back.ModifiedDate = DateTime.Now;
            feed_back.ModifiedBy   = "username";

            CreateFeedback(feed_back);
            SaveFeedback();
            body = body + "<br>" + "Gönderilme Tarihi : " + DateTime.Now;
            FeedbackPostMail(body, form.Id);
            //return feed_back.FeedbackValues.ToList();
        }
コード例 #3
0
        /// <summary>
        /// Returns true if ProAcousticFeedback instances are equal
        /// </summary>
        /// <param name="other">Instance of ProAcousticFeedback to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProAcousticFeedback other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Phoneid == other.Phoneid ||
                     Phoneid != null &&
                     Phoneid.Equals(other.Phoneid)
                     ) &&
                 (
                     FeedbackType == other.FeedbackType ||
                     FeedbackType != null &&
                     FeedbackType.Equals(other.FeedbackType)
                 ) &&
                 (
                     FeedbackValue == other.FeedbackValue ||
                     FeedbackValue != null &&
                     FeedbackValue.Equals(other.FeedbackValue)
                 ) &&
                 (
                     FeedbackMessage == other.FeedbackMessage ||
                     FeedbackMessage != null &&
                     FeedbackMessage.Equals(other.FeedbackMessage)
                 ) &&
                 (
                     FeedbackLat == other.FeedbackLat ||
                     FeedbackLat != null &&
                     FeedbackLat.Equals(other.FeedbackLat)
                 ) &&
                 (
                     FeedbackLon == other.FeedbackLon ||
                     FeedbackLon != null &&
                     FeedbackLon.Equals(other.FeedbackLon)
                 ));
        }
コード例 #4
0
        public string EmailString(FeedbackValue feedbackvalue)
        {
            if (feedbackvalue.FieldType.ToString() == "multipleChoice" || feedbackvalue.FieldType.ToString() == "singleChoice" || feedbackvalue.FieldType.ToString() == "radioButtons")
            {
                TagBuilder text = new TagBuilder("text");
                text.InnerHtml.SetHtmlContent(feedbackvalue.FormFieldName);
                TagBuilder list    = new TagBuilder("ul");
                var        items   = feedbackvalue.Value.Split(',');
                string     element = "";
                foreach (var item in items)
                {
                    TagBuilder singlechoice = new TagBuilder("li");
                    singlechoice.Attributes.Add("value", item);
                    singlechoice.InnerHtml.SetHtmlContent(item);
                    element += singlechoice.ToString() + "<br/>";
                }
                list.InnerHtml.SetHtmlContent(element);

                var write = new System.IO.StringWriter();
                text.WriteTo(write, HtmlEncoder.Default);
                var write2 = new System.IO.StringWriter();
                list.WriteTo(write2, HtmlEncoder.Default);

                return(text.ToString() + "<br/>" + write2.ToString() + "<br/>");
            }
            else
            {
                TagBuilder text = new TagBuilder("text");
                text.InnerHtml.SetHtmlContent(feedbackvalue.FormFieldName);
                TagBuilder text2 = new TagBuilder("text");
                text2.InnerHtml.SetHtmlContent(feedbackvalue.Value);

                var write = new System.IO.StringWriter();
                text.WriteTo(write, HtmlEncoder.Default);
                var write2 = new System.IO.StringWriter();
                text2.WriteTo(write2, HtmlEncoder.Default);

                return(write.ToString() + ":" + write2.ToString() + "<br/>");
            }
        }
コード例 #5
0
        public void FeedbackPost(IFormCollection collection, string ip, string appTenantId, IFormFile[] upload)
        {
            Feedback feed_back = new Feedback();

            feed_back.IP          = ip;
            feed_back.AppTenantId = appTenantId;
            var formId = Convert.ToInt64(collection["Id"]);

            if (formId == 0)
            {
                formId = Convert.ToInt64(collection["FormId"]);
            }
            var form = GetForm(formId);
            var body = "";

            foreach (var item in GetFormFieldsByFormId(formId))
            {
                var feedBackValue = new FeedbackValue();

                feedBackValue.FormFieldName = item.Name;
                feedBackValue.FieldType     = item.FieldType;
                feedBackValue.FormFieldId   = (int)item.Id;
                feedBackValue.Position      = item.Position;
                feedBackValue.CreatedBy     = "username";
                feedBackValue.CreateDate    = DateTime.Now;
                feedBackValue.UpdatedBy     = "username";
                feedBackValue.UpdateDate    = DateTime.Now;
                feedBackValue.AppTenantId   = appTenantId;

                foreach (var item2 in collection)
                {
                    if (item.Name == item2.Key)
                    {
                        feedBackValue.Value = item2.Value;
                        body = body + item2.Key + " : " + item2.Value + "<br/>";
                    }
                }

                feed_back.FeedbackValues.Add(feedBackValue);
            }
            //feedBack.IP = GetUserIP();  // gönderen ip method u eklenecek

            //var remoteIpAddress = Request.HttpContext.Connection.RemoteIpAddress;


            feed_back.FormId   = (int)form.Id;
            feed_back.FormName = form.FormName;

            //feed_back.IP = remoteIpAddress.ToString();
            feed_back.SentDate   = DateTime.Now;
            feed_back.UserName   = "******";
            feed_back.CreatedBy  = "username";
            feed_back.CreateDate = DateTime.Now;
            feed_back.UpdateDate = DateTime.Now;
            feed_back.UpdatedBy  = "username";


            CreateFeedback(feed_back);
            SaveFeedback();
            body = body + "<br>" + "Gönderilme Tarihi : " + DateTime.Now;
            FeedbackPostMail(body, form.Id, upload);
            //return feed_back.FeedbackValues.ToList();
        }
コード例 #6
0
 public void UpdateFeedbackValue(FeedbackValue feedbackValue)
 {
     feedbackValueRepository.Update(feedbackValue);
 }
コード例 #7
0
 public void CreateFeedbackValue(FeedbackValue feedbackValue)
 {
     feedbackValueRepository.Add(feedbackValue);
 }
コード例 #8
0
        public ActionResult Post(FeedbackViewModel feedBack, IFormCollection collection, IFormFile upload)
        {
            int i = 3;

            if (ModelState.IsValid)
            {
                List <FeedbackValue> FeedBackValues = new List <FeedbackValue>();
                var form = formService.GetForm((long)feedBack.FormId);
                foreach (var item in formService.GetFormFieldsByFormId((long)feedBack.FormId))
                {
                    var feedBackValue = new FeedbackValue();
                    feedBackValue.FormFieldName = item.Name;
                    feedBackValue.FieldType     = item.FieldType;
                    feedBackValue.FormFieldId   = (int)item.Id;
                    feedBackValue.Position      = item.Position;
                    feedBackValue.Value         = item.Value;
                    feedBackValue.AddedBy       = User.Identity.Name ?? "username";
                    feedBackValue.AddedDate     = DateTime.Now;
                    feedBackValue.ModifiedBy    = User.Identity.Name ?? "username";
                    feedBackValue.ModifiedDate  = DateTime.Now;

                    if (item.FieldType.ToString() == "multipleChoice" || item.FieldType.ToString() == "radioButtons" || item.FieldType.ToString() == "singleChoice")
                    {
                        feedBackValue.Value = "";
                        var choices = item.Value.Split(',');
                        foreach (var choice in choices)
                        {
                            if (i < collection.Count && choice == collection[i.ToString()])
                            {
                                feedBackValue.Value += "(+)" + collection[i.ToString()] + ",";
                                i++;
                            }
                            else if (i < collection.Count)
                            {
                                feedBackValue.Value += choice.ToString() + ",";
                            }
                        }
                        feedBackValue.Value = feedBackValue.Value.Remove(feedBackValue.Value.Length - 1);
                    }
                    else if (item.FieldType.ToString() == "file")
                    {
                        string FilePath    = ViewBag.UploadPath + "\\feedback\\";
                        string dosyaYolu   = Path.GetFileName(upload.FileName);
                        var    yuklemeYeri = Path.Combine(FilePath + dosyaYolu);
                        try
                        {
                            if (!Directory.Exists(FilePath))
                            {
                                Directory.CreateDirectory(FilePath);//Eğer klasör yoksa oluştur
                                upload.CopyTo(new FileStream(yuklemeYeri, FileMode.Create));
                            }
                            else
                            {
                                upload.CopyTo(new FileStream(yuklemeYeri, FileMode.Create));
                            }
                        }
                        catch (Exception) { }
                    }
                    else
                    {
                        if (i < collection.Count)
                        {
                            //feedBackValue.Value = collection[i.ToString()];
                            i++;
                        }
                    }
                    FeedBackValues.Add(feedBackValue);
                }

                //feedBack.IP = GetUserIP();  // gönderen ip method u eklenecek

                feedBack.SentDate = DateTime.Now;
                if (User.Identity.Name != null)
                {
                    feedBack.UserName = User.Identity.Name;
                }
                feedBack.FormName = form.FormName;
                var      remoteIpAddress = Request.HttpContext.Connection.RemoteIpAddress;
                Feedback feed_back       = new Feedback();
                feed_back.Id             = feedBack.Id;
                feed_back.FormId         = feedBack.FormId;
                feed_back.FormName       = feedBack.FormName;
                feed_back.FeedbackValues = feedBack.FeedbackValues;
                feed_back.IP             = remoteIpAddress.ToString();
                feed_back.SentDate       = DateTime.Now;

                feed_back.UserName       = User.Identity.Name ?? "username";
                feed_back.AddedBy        = User.Identity.Name ?? "username";
                feed_back.AddedDate      = DateTime.Now;
                feed_back.ModifiedDate   = DateTime.Now;
                feed_back.ModifiedBy     = User.Identity.Name ?? "username";
                feed_back.FeedbackValues = FeedBackValues;

                feedbackService.CreateFeedback(feed_back);
                feedbackService.SaveFeedback();

                var userName = feedBack.UserName;
                var formId   = feedBack.FormId;

                // MESAJ GÖNDERİMİ BURAYA GELECEK
                if (form.EmailBcc != null || form.EmailCc != null || form.EmailTo != null)
                {
                    var message = new MimeMessage();
                    if (form.EmailCc != null)
                    {
                        var email_cc_list = form.EmailCc.Split(',');
                        foreach (var item2 in email_cc_list)
                        {
                            message.Cc.Add(new MailboxAddress(item2.Trim(), item2.Trim()));
                        }
                    }
                    if (form.EmailBcc != null)
                    {
                        var email_bcc_list = form.EmailBcc.Split(',');
                        foreach (var item2 in email_bcc_list)
                        {
                            message.Bcc.Add(new MailboxAddress(item2.Trim(), item2.Trim()));
                        }
                    }
                    if (form.EmailTo != null)
                    {
                        var email_to_list = form.EmailTo.Split(',');
                        foreach (var item2 in email_to_list)
                        {
                            message.To.Add(new MailboxAddress(item2.Trim(), item2.Trim()));
                        }
                    }
                    message.From.Add(new MailboxAddress("CMS Core", settingService.GetSettingByName("Email").Value));
                    var bodyBuilder = new BodyBuilder();
                    message.Subject = "CMS Core " + feedBack.FormName;
                    foreach (var item in feed_back.FeedbackValues)
                    {
                        //message.Body += EmailString(item).ToString() + "<br/>";
                        bodyBuilder.HtmlBody += EmailString(item);
                    }
                    message.Body = bodyBuilder.ToMessageBody();
                    try
                    {
                        using (var client = new SmtpClient())
                        {
                            client.Connect("smtp.gmail.com", 587, false);
                            client.AuthenticationMechanisms.Remove("XOAUTH2");
                            // Note: since we don't have an OAuth2 token, disable   // the XOAUTH2 authentication mechanism.
                            client.Authenticate(settingService.GetSettingByName("Email").Value, settingService.GetSettingByName("EmailPassword").Value);
                            client.Send(message);
                            client.Disconnect(true);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
                return(RedirectToAction("Posted", "Feedback", new { id = formId }));
            }


            return(RedirectToAction("Index", "Feedback"));
        }
コード例 #9
0
 public async Task <IActionResult> Edit(long id, [Bind("UserName,SentDate,FormId,FormName,IP,Id,CreateDate,CreatedBy,UpdateDate,UpdatedBy,AppTenantId")] Feedback feedback, FeedbackValue feedbackValue)
 {
     if (id != feedback.Id)
     {
         return(NotFound());
     }
     feedback.UpdatedBy   = User.Identity.Name ?? "username";
     feedback.UpdateDate  = DateTime.Now;
     feedback.AppTenantId = tenant.AppTenantId;
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(feedback);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!FeedbackExists(feedback.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index"));
     }
     return(View(feedback));
 }