示例#1
0
 public JsonResult GetMsg(int page, int pageSize)
 {
     JsonResult result = new JsonResult();
     FeedBack bll = new FeedBack();
     var t = bll.FindByPage(pageSize, page);
     return Json(t);
 }
示例#2
0
 public JsonResult Get(int page, int pageSize)
 {
     JsonResult result = new JsonResult();
     FeedBack bll = new FeedBack();
     var t = bll.FindByPage(pageSize, page);
     return Json(t, JsonRequestBehavior.AllowGet);
 }
示例#3
0
 public ActionResult FeedBack(string username,string companyname,string telephone,string content)
 {
     FeedBack fb = new FeedBack();
     fb.UserName = username;
     fb.Telephone = telephone;
     fb.UserContent = content;
     int memberid = CRMMapper.Get().QueryForObject<int>("EnterpriseMemberInfo.myFind", companyname);
     fb.CompanyID = memberid;
     new FeedBackDao().Insert(fb);
     var json = JsonConvert.SerializeObject("true");
     return Content(Request["callback"] + "(" + json + ")", "text/javascript");
 }
        public ActionResult AddAppointmentRequest()
        {
            if (CurrentUser == null)
            {
                throw new NotSupportedException("Добавление должности не из профиля");
            }

            var model = new FeedBack()
            {
                Email       = CurrentUser.Login,
                PhoneNum    = CurrentUser.Phone,
                Description = "Просьба добавить мою должность: "
            };

            return(View(model));
        }
示例#5
0
        public ActionResult Create(FeedBackModel rm)
        {
            DateTime today = DateTime.Now;
            FeedBack rep   = new FeedBack()
            {
                FeedBackDate = today,
                Description  = rm.Description,
                ParentId     = (int)Session["idu"],
            };

            RepService.Add(rep);
            RepService.Commit();


            return(RedirectToAction("Index", "Home"));
        }
示例#6
0
        public JsonResult FeedBack(string name, string email, string content)
        {
            FeedBack fb = new FeedBack();

            fb.Name        = name;
            fb.Email       = email;
            fb.Content     = content;
            fb.CreatedDate = DateTime.Now;
            fb.Status      = 0;
            new FeedBackDao().Insert(fb);

            return(Json(new
            {
                status = true
            }));
        }
        public async Task <string> AddAsync(string id, int rating, string comment)
        {
            var feedBack = new FeedBack
            {
                Id                = Guid.NewGuid().ToString(),
                Rating            = rating,
                Comment           = comment,
                ApplicationUserId = id,
            };

            await this.feedBackRepository.AddAsync(feedBack);

            await this.feedBackRepository.SaveChangesAsync();

            return(feedBack.Id);
        }
示例#8
0
        //
        // GET: /FeedBack/

        #region ajax
        public ActionResult InsertFeedBack(string entity)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            FeedBack             model      = serializer.Deserialize <FeedBack>(entity);

            model.CreateUserID = CurrentUser.UserID;

            bool flag = FeedBackBusiness.InsertFeedBack(model);

            JsonDictionary.Add("Result", flag?1:0);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#9
0
        public bool Insert(FeedBack back)
        {
            try
            {
                back.Status = false;
                db.FeedBacks.Add(back);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
        }
        public static FeedBack InsertFeedBack(int Raiting, int ProductId, int OrderId)
        {
            MarketBotDbContext db = new MarketBotDbContext();

            var feed = db.FeedBack.Where(f => f.ProductId == ProductId && f.OrderId == OrderId).LastOrDefault();

            var product = db.Product.Find(ProductId);

            try
            {
                if (feed != null)
                {
                    feed.RaitingValue = Raiting;
                    feed.OrderId      = OrderId;
                    db.Update <FeedBack>(feed);
                    db.SaveChanges();
                    feed.Product = product;
                    return(feed);
                }

                else
                {
                    FeedBack feedBack = new FeedBack
                    {
                        OrderId      = OrderId,
                        ProductId    = ProductId,
                        RaitingValue = Raiting,
                        Enable       = false
                    };

                    db.FeedBack.Add(feedBack);
                    db.SaveChanges();
                    feedBack.Product = product;
                    return(feedBack);
                }
            }

            catch
            {
                return(null);
            }

            finally
            {
                db.Dispose();
            }
        }
示例#11
0
        private static void ChainDelegateDemo1(DelegateTest t)
        {
            Console.WriteLine("Start Chain Delegate Demo1...");
            FeedBack fb1     = new FeedBack(t.FeedBackToFile);
            FeedBack fb2     = new FeedBack(FeedBackToConsole);
            FeedBack fb3     = new FeedBack(FeedBackToMessageBox);
            FeedBack fbChain = null;

            fbChain = (FeedBack)Delegate.Combine(fbChain, fb1);
            fbChain = (FeedBack)Delegate.Combine(fbChain, fb2);
            fbChain = (FeedBack)Delegate.Combine(fbChain, fb3);
            //Counter(1, 2, fbChain);
            Console.WriteLine();
            fbChain = (FeedBack)Delegate.Remove(fbChain, fb1);
            fbChain = (FeedBack)Delegate.Remove(fbChain, new FeedBack(FeedBackToMessageBox));
            Counter(1, 2, fbChain);
        }
 public ActionResult Edit(FeedBack feedback)
 {
     if (ModelState.IsValid)
     {
         var dao    = new FeedBackDao();
         var result = dao.Update(feedback);
         if (result)
         {
             return(RedirectToAction("Index", "FeedBack"));
         }
         else
         {
             ModelState.AddModelError("", "Không thêm được");
         }
     }
     return(View("Index"));
 }
示例#13
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            FeedBack item = new FeedBack();

            item.UserName = txtusername.Value;
            item.Subject  = txtsubject.Value;
            item.Content  = txtcontent.Value;

            if (new FeedBackBLL().AddItem(item) > 0)
            {
                Utils.alert("提交成功!", "feedback.aspx");
            }
            else
            {
                Utils.alert("提交成功!", "feedback.aspx");
            }
        }
示例#14
0
        public float[] Withdraw(string clientCPF, string dateTime)
        {
            if (!clientCPF.All(char.IsDigit))
            {
                return(null);
            }
            if (clientCPF.Length != 11)
            {
                return(null);
            }

            DateTime time = Convert.ToDateTime(dateTime);
            //long CPF = long.Parse(clientCPF);
            FeedBack f = operationCaller.CreateOperation(clientCPF, OperationType.Withdraw, time);

            return(f != null ? f.values : null);
        }
示例#15
0
        public static List <FeedBack> GetFeedBacks(string keywords, string beginDate, string endDate, int type, int status, int pageSize, int pageIndex, out int totalCount, out int pageCount)
        {
            string sqlWhere = "1=1";

            if (type != -1)
            {
                sqlWhere += " and type=" + type;
            }

            if (status != -1)
            {
                sqlWhere += " and status=" + status;
            }

            if (!string.IsNullOrEmpty(keywords))
            {
                sqlWhere += " and (Title like '%" + keywords + "%'";
                sqlWhere += " or ContactName like '%" + keywords + "%'";
                sqlWhere += " or MobilePhone like '%" + keywords + "%'";
                sqlWhere += " or Remark like '%" + keywords + "%' )";
            }

            if (!string.IsNullOrEmpty(beginDate))
            {
                sqlWhere += " and createtime>=" + beginDate;
            }

            if (!string.IsNullOrEmpty(endDate))
            {
                sqlWhere += " and createtime<=" + DateTime.Parse(endDate).AddDays(1);
            }

            DataTable dt = CommonBusiness.GetPagerData("FeedBack", "*", sqlWhere, "AutoID", pageSize, pageIndex, out totalCount, out pageCount);

            List <FeedBack> list = new List <FeedBack>();
            FeedBack        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new FeedBack();
                model.FillData(item);
                list.Add(model);
            }

            return(list);
        }
示例#16
0
 public static void AddFeedback(GeneralFeedbackModel feedback)
 {
     using (var dbcontext = new KaamShaamEntities())
     {
         var obj = new FeedBack
         {
             Title       = feedback.Title,
             Description = feedback.Des,
             PostedBy    = feedback.PostedById,
             Status      = false,
             IsApproved  = false,
             DateTime    = DateTime.Now
         };
         dbcontext.FeedBacks.Add(obj);
         dbcontext.SaveChanges();
     }
 }
示例#17
0
        public async Task <bool> Add(AddFeedbackDto dto)
        {
            var hasRecordOfToday = await _repo.GetUserTodayFeedbacks(dto.UserKey, AbortToken);

            if (hasRecordOfToday.Count > 0)
            {
                return(false);
            }

            var feedback = FeedBack.Create(dto.Title, dto.Content);

            feedback.SetFeedBackUser(dto.UserKey);
            feedback.SetTag(dto.Tag);
            await _repo.AddAsync(feedback);

            return(true);
        }
        // GET: FeedBacks/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FeedBack feedBack = await db.FeedBack.FindAsync(id);

            if (feedBack == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Recipes_id = new SelectList(db.Recipes, "id", "Title", feedBack.Recipes_id);
            ViewBag.Tip_id     = new SelectList(db.Tips, "id", "Content", feedBack.Tip_id);
            ViewBag.Use_id     = new SelectList(db.Users, "id", "UPhone", feedBack.Use_id);
            return(View(feedBack));
        }
        public ActionResult DeleteFeedBack(int id)
        {
            User user = (User)Session[WebUtils.Current_User];

            if (!(user != null && user.IsInRole(WebUtils.Admin)))
            {
                return(RedirectToAction("Login", "Users", new { ctl = "Feedback", act = "DeleteFeedBack" }));
            }
            UniversalContext db       = new UniversalContext();
            FeedBack         feedBack = (from c in db.FeedBacks
                                         where c.Id == id
                                         select c).FirstOrDefault();

            db.Entry(feedBack).State = EntityState.Deleted;
            db.SaveChanges();
            return(Json("Delete", JsonRequestBehavior.AllowGet));
        }
 public ActionResult Create(FeedBack feedback)
 {
     if (ModelState.IsValid)
     {
         var  dao = new FeedBackDao();
         long id  = dao.Insert(feedback);
         if (id > 0)
         {
             return(RedirectToAction("Index", "FeedBack"));
         }
         else
         {
             ModelState.AddModelError("", "Không thêm được");
         }
     }
     return(View("Index"));
 }
        public void AddAnswer(FeedBackDTO feedBackDTO)
        {
            FeedBack feedBack = Database.FeedBack.Get(feedBackDTO.Id);

            if (feedBack == null)
            {
                throw new ValidationException($"Feedback with id {feedBackDTO.Id} not found", string.Empty);
            }

            feedBack.Answer          = feedBackDTO.Answer;
            feedBack.DateTimeAnswer  = feedBackDTO.DateTimeAnswer;
            feedBack.UserIdAnswering = feedBackDTO.UserIdAnswering;
            feedBack.IsAnswered      = feedBackDTO.IsAnswered;

            Database.FeedBack.Update(feedBack);
            Database.Save();
        }
示例#22
0
        public int AddFeedBack(FeedBack feedBack)//发布反馈
        {
            int       result    = 0;
            SqlHelper sqlHelper = new SqlHelper();
            string    sql       = "insert into FeedBack values(@Phone,@Name,@Message,@Evaluate,@Time)";

            SqlParameter[] spms =
            {
                new SqlParameter("@Phone",    feedBack.Phone),
                new SqlParameter("@Name",     feedBack.Name),
                new SqlParameter("@Message",  feedBack.Message),
                new SqlParameter("@Evaluate", feedBack.Evaluate),
                new SqlParameter("@Time",     feedBack.Time)
            };
            result = sqlHelper.ExcuteNoneQuery(sql, spms);
            return(result);
        }
示例#23
0
        public IActionResult Upload()
        {
            if (Request.Form.Files.Any())
            {
                //去重
                var file   = Request.Form.Files[0];
                var fileId = file.FileName.Split("-")[0];
                var path   = Path.Combine(_host.WebRootPath, "tjqxj", "uploadimg", fileId);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                using (var fs = System.IO.File.Create(Path.Combine(path, file.FileName.Split("-")[1])))
                {
                    file.CopyTo(fs);
                    fs.Flush();
                }
            }
            else
            {
                var temp = JsonHelper.DeserializeStringToDictionary <string, string>(Request.Form["json"]);

                var db       = new EFContext();
                var feedBack = new FeedBack();
                feedBack.ID = Convert.ToInt64(temp["id"]);

                var path = Path.Combine(_host.WebRootPath, "tjqxj", "uploadimg", temp["id"]);
                if (Directory.Exists(path))//此路径存在,证明有照片
                {
                    var files = Directory.GetFiles(path, "*.*").Select(u => u.Replace(_host.WebRootPath, ""));
                    feedBack.Images = string.Join('#', files);
                }

                feedBack.Address    = temp["address"];
                feedBack.Climate    = temp["climate"];
                feedBack.Remark     = temp["remark"];
                feedBack.IsHandled  = 0;
                feedBack.IsThank    = 0;
                feedBack.OpenId     = temp["openid"];
                feedBack.UploadTime = DateTime.Now;
                db.FeedBacks.Add(feedBack);
                db.SaveChanges();
                LogHelper.Info("收到灾情反馈:" + Request.Form["json"]);
            }
            return(Content("success"));
        }
示例#24
0
        /// <summary>
        /// metodo para agregar informacion sobre reportes de feedback
        /// </summary>
        /// <param name="feedback">feedback que se desea obtener informacion</param>
        /// <returns>lista de ReportRecipe</returns>
        static public List <RecipeReport> recipeFeedBackData(FeedBack feedback)
        {
            var reports = getRecipeReportData();

            foreach (var report in reports)
            {
                foreach (var recipe in feedback.recipeName)
                {
                    if (recipe == report.recipeName)
                    {
                        report.totalStars = report.totalStars + feedback.recipeStars;
                    }
                }
            }
            writeRecipeReportData(reports);
            return(reports);
        }
示例#25
0
        public string feedBack(string username, string subject, string content)
        {
            FeedBack item = new FeedBack();

            item.UserName = username;
            item.Subject  = subject;
            item.Content  = content;

            if (new FeedBackBLL().AddItem(item) > 0)
            {
                return("ok");
            }
            else
            {
                return("fail");
            }
        }
示例#26
0
        public async Task <ActionResult <FeedBackCM> > CreateFeedback([FromForm] FeedBackCM feedbackModel)
        {
            //TODO: Implements BookingDetail.GetById(int id) does not exist, return BadRequest()
            //TODO: Implements GaleryId.GetById(int id) does not exist, return BadRequest()

            if (feedbackModel.File != null)
            {
                GalleryCM galleryCM = new GalleryCM();
                galleryCM.Name        = "Hình feedback cho dịch vụ trong đơn " + feedbackModel.BookingDetailId;
                galleryCM.Description = "Hình feedback cho dịch vụ trong đơn " + feedbackModel.BookingDetailId;

                Gallery gallery    = _mapper.Map <Gallery>(galleryCM);
                Gallery crtGallery = await _galleryService.AddAsync(gallery);

                await _galleryService.Save();

                feedbackModel.GalleryId = crtGallery.Id;

                ImageCM imageCM = new ImageCM();
                imageCM.Description = "Hình feedback trong đơn " + feedbackModel.BookingDetailId;
                imageCM.GalleryId   = crtGallery.Id;
                imageCM.ImageUrl    = await _uploadFileService.UploadFile("123456798", feedbackModel.File, "service", "service-detail");

                Image image = _mapper.Map <Image>(imageCM);
                await _imageService.AddAsync(image);
            }

            FeedBack crtFeedback = _mapper.Map <FeedBack>(feedbackModel);

            try
            {
                crtFeedback.CreateDate = DateTime.Now;

                await _service.AddAsync(crtFeedback);

                await _service.Save();
            }
            catch (Exception e)
            {
                //return StatusCode(StatusCodes.Status500InternalServerError);
                NotFound(e);
            }

            return(CreatedAtAction("GetFeedBackById", new { id = crtFeedback.Id }, crtFeedback));
        }
示例#27
0
        public ActionResult FeedBackForm([Bind(Include = "Content,Name,Email,Address,CreatedDate,ModifiedDate,Status,Type,Phone")] FeedBack feed)
        {
            if (User.Identity.IsAuthenticated)
            {
                feed.Name  = User.Identity.Name;
                feed.Email = context.Users.Find(User.Identity.GetUserId()).Email;
            }

            if (!string.IsNullOrEmpty(feed.Name) || !string.IsNullOrEmpty(feed.Content) || !string.IsNullOrEmpty(feed.Email))
            {
                feed.CreatedDate = DateTime.Now;
                context.FeedBacks.Add(feed);
                context.SaveChanges();
                return(Content("Success"));
            }

            return(Content("Fail"));
        }
示例#28
0
 public void AddFeedBack(FeedBack feedObj)
 {
     try
     {
         _feedResponsitory.Insert(feedObj);
     }
     catch (Exception ex)
     {
         _exceptionResponsitory.Insert(new Model.LogException
         {
             FileException = GetType().ToString(),
             Exception = ex.Message,
             Time = DateTime.Now,
             MethodName = "AddFeedBack",
             StatusException = EnumKey.Running
         });
     }
 }
示例#29
0
        public FeedBackViewModel DetailsMethod(int?id)
        {
            FeedBackViewModel dr = new FeedBackViewModel();

            using (var fd = new FeedBackRepository())
            {
                if (id.HasValue && id != 0)
                {
                    FeedBack _fb = fd.GetById(id.Value);

                    dr.PatientId = _fb.PatientId;
                    dr.Name      = _fb.Name;
                    dr.Email     = _fb.Email;
                    dr.Comment   = _fb.Comment;
                }
                return(dr);
            }
        }
示例#30
0
        private static void ChainDelegateDemo2(DelegateIntro p)
        {
            Console.WriteLine("----- Chain Delegate Demo 2 -----");
            FeedBack fb1 = new FeedBack(FeedbackToConsole);
            FeedBack fb2 = new FeedBack(FeedbackToMsgBox);
            FeedBack fb3 = new FeedBack(p.FeedbackToFile);

            FeedBack fbChain = null;

            fbChain += fb1;
            fbChain += fb2;
            fbChain += fb3;
            Counter(1, 2, fbChain);

            Console.WriteLine();
            fbChain -= new FeedBack(FeedbackToMsgBox);
            Counter(1, 2, fbChain);
        }
 public IActionResult Create(FeedBack obj)
 {
     try
     {
         if (obj is null)
         {
             ViewBag.Message = "Something Went Wrong when creating the obj pls try again";
             return View("NotFound");
         }
         feedBack.Create(obj);
         return RedirectToAction(nameof(Index));
     }
     catch(Exception ex)
     {
         ViewBag.Message = ex.Message;
         return View("NotFound");
     }
 }
示例#32
0
        public ActionResult Contact(Feedback_Model f)
        {
            using (DB18Entities1 db = new DB18Entities1())
            {
                FeedBack fb = new FeedBack();
                fb.Name    = f.Name;
                fb.Email   = f.Email;
                fb.Message = f.Message;
                db.FeedBacks.Add(fb);
                db.SaveChanges();


                ViewBag.saveresult = "saved";
                ModelState.Clear();
            }

            return(View(new Feedback_Model()));
        }
示例#33
0
        private static void CreateReports(CarsDbContext dbContext)
        {
            // local variables
            DateTime createdDate      = new DateTime(2016, 03, 01, 12, 30, 00);
            DateTime lastModifiedDate = DateTime.Now;
            // Create the "Admin" ApplicationUser account (if it doesn't exist already)
            var report = new FeedBack()
            {
                CarId       = 4,
                UserId      = 6,
                Mark        = 5,
                Text        = "Все очень понравилось!",
                CreatedDate = createdDate
            };

            dbContext.Reports.Add(report);
            dbContext.SaveChanges();
        }
示例#34
0
        public void addback()
        {
            string   aa    = "反馈提交失败";
            string   tel   = Request["tels"];
            string   body  = Request["texts"];
            FeedBack Fback = new FeedBack();

            Fback.FTel  = tel;
            Fback.FText = body;

            if (FeedBackService.Add(Fback))
            {
                aa = "反馈提交成功";
            }
            Response.ContentType = "text/plain";
            Response.Write(aa);
            Response.End();
        }
示例#35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int tryParseInt = 0;

        if (CommonUtility.SafeCheckByParams<string>(Request["feedBackId"], ref tryParseInt))
        {
            int feedbackId = tryParseInt;//取得URL参数
            DalOperationFeedBack dofb = new DalOperationFeedBack();
            feedback = dofb.FindFeedBackById(feedbackId); //绑定到对象实例
            if (feedback != null)
            {
                dofb.UpdateFeedBackIsReadById(feedbackId); //更新阅读的状态为已读
                if (!IsPostBack)
                {
                    txtbackinfo.Text = feedback.backInfo;
                }
            }
        }
    }
示例#36
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Trim().Length == 0 || txtContent.Text.Trim().Length == 0)
        {

            Javascript.GoHistory(-1, "标题和内容不能为空,请输入!", Page);
        }
        else
        {
            UserCookiesInfo user = BllOperationAboutUser.GetUserCookiesInfo();
            DalOperationFeedBack dofb = new DalOperationFeedBack();
            DalOperationAboutStudent dals = new DalOperationAboutStudent();
            FeedBack feedback = new FeedBack();

            feedback.feedBackTitle = CommonUtility.JavascriptStringFilter(txtTitle.Text.Trim());
            feedback.feedBackContent =  CommonUtility.JavascriptStringFilter(txtContent.Text.Trim());
            feedback.feedBackContactTo =  CommonUtility.JavascriptStringFilter(txtContact.Text.Trim())+" 由"+user.userName+"反馈 ";
            feedback.backUserNo=user.userNo;
            feedback.backUserType = user.userType;
            feedback.type = Convert.ToInt32( this.ddltType.SelectedValue);
            if (user.userType == 3 &&feedback.type ==2)
            {
                feedback.resolver = dals.GetTeacherNoByStudent(user.userNo);
            }
            try
            {
                dofb.AddFeedBack(feedback); //保存反馈意见
                Javascript.AlertAndRedirect("意见反馈成功!", "/Common/FeedBack.aspx?fragment=2", Page);
            }
            catch (Exception ex)
            {
                MongoDBLog.LogRecord(ex);
                Javascript.GoHistory(-1, "意见反馈失败,请检查格式是否有误!", Page);
            }

        }
    }
示例#37
0
 /// <summary>
 /// 保存用户反馈的信息
 /// </summary>
 /// <param name="type"></param>
 /// <param name="name"></param>
 /// <param name="content"></param>
 /// <param name="imgUrl"></param>
 /// <param name="gender"></param>
 /// <param name="gjwNumber"></param>
 /// <param name="email"></param>
 /// <param name="checkCode"></param>
 /// <param name="telpPhone"></param>
 /// <returns></returns>
 public ActionResult SaveFeedBack(int type, string name, string content, string imgUrl, bool gender, string gjwNumber,
    string email, string checkCode, string telPhone)
 {
     if (string.IsNullOrEmpty(checkCode))
     {
         return this.Json(new AjaxResponse(0, "验证码不能为空"));
     }
     if (this.TempData[this.Session.SessionID] == null || checkCode != this.TempData[this.Session.SessionID].ToString())
     {
         return this.Json(new AjaxResponse(0, "验证码输入有误"));
     }
     var feedBack = new FeedBack()
     {
         Type = type,
         Name = name,
         Content = content,
         ImgUrl = imgUrl,
         Gender = gender,
         GjwNumber = gjwNumber,
         Email = email,
         TelPhone = telPhone
     };
     var returnValue = new FeedBackService().Inert(feedBack);
     if (returnValue > 0)
     {
         return Json(new AjaxResponse(1, "提交成功"));
     }
     return this.Json(string.Empty);
 }
示例#38
0
 public Result Insert(FeedBack c)
 {
     return db.insert( c );
 }
示例#39
0
 public void Add(FeedBack report)
 {
     feedbackList.Add(report);
 }
示例#40
0
 public Result Update(FeedBack c)
 {
     return db.update( c );
 }
示例#41
0
    //Generates a FeedBack based on a reason parameter. It then instantiate a window to display it.
    void GenerateFeedBack(string reason)
    {
        FeedBack fb = new FeedBack();
        switch(reason)
        {
        case "Expensive":
            fb.rating = Random.Range(rangesOfRatings[0],rangesOfRatings[1]);
            fb.feedbackType = 2;
            fb.content = comments[0][Random.Range(0,comments[0].Count)];
            break;
        case "Dirty":
            fb.rating = Random.Range(rangesOfRatings[2],rangesOfRatings[3]);
            fb.feedbackType = 2;
            fb.content = comments[1][Random.Range(0,comments[1].Count)];
            break;
        case "Full":
            fb.rating = Random.Range(rangesOfRatings[4],rangesOfRatings[5]);
            fb.feedbackType = 2;
            fb.content = comments[2][Random.Range(0,comments[2].Count)];
            break;
        case "OverBooked":
            fb.rating = Random.Range(rangesOfRatings[6],rangesOfRatings[7]);
            fb.feedbackType = 2;
            fb.content = comments[3][Random.Range(0,comments[3].Count)];
            break;
        case "Great":
            fb.rating = Random.Range(rangesOfRatings[8],rangesOfRatings[9]);
            fb.feedbackType = 1;
            fb.content = comments[4][Random.Range(0,comments[4].Count)];
            break;
        case "Special":
            fb.rating = Random.Range(rangesOfRatings[10],rangesOfRatings[11]);
            fb.feedbackType = 3;
            fb.content = comments[5][Random.Range(0,comments[5].Count)];
            break;
        }
        float sizingFactor = Screen.width/800f;
        fb.person = nameArray[Random.Range(0,1000)];
        //Instatiate a new popup with the comment infos.
        GameObject newFeedback = new GameObject();
        newFeedback = Instantiate(feedBackPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity) as GameObject;
        newFeedback.transform.SetParent(GameObject.FindGameObjectWithTag("UI").transform);

        newFeedback.transform.position = new Vector3(Screen.width-( newFeedback.GetComponent<RectTransform>().sizeDelta.x/2f*sizingFactor),
                                                     200f + (listOfFeedbacks.Count * newFeedback.GetComponent<RectTransform>().sizeDelta.y *2f), 0f);
        newFeedback.transform.FindChild("txt_Name").GetComponent<Text>().text = fb.person;
        newFeedback.transform.FindChild("txt_Comment").GetComponent<Text>().text = fb.content;
        newFeedback.transform.FindChild("Img_Rating").GetComponent<Image>().sprite = stars[Mathf.RoundToInt((fb.rating/5f)*10)];
        newFeedback.GetComponent<Button>().onClick.AddListener(() => { DeleteOnClick(newFeedback); });
        newFeedback.transform.localScale = new Vector3(1f,1f,1f);

        listOfFeedbacks.Add(newFeedback);//Added to list of active feedback on the screen.
        archivedListOfFeedbacks.Add(fb);//Added to archived list. Saved so we can access at a later time.
    }
示例#42
0
        /// <summary>
        /// 添加意见反馈
        /// </summary>
        private HttpResponseMessage AddFeedBack(HttpRequestMessage request)
        {
            log.Debug(Constant.DEBUG_START);

            string sign = ApiQueryUtil.QueryHeader(Constant.HTTP_HEADER_SIGN);
            string cmd = ApiQueryUtil.QueryHeader(Constant.HTTP_HEADER_CMD);
            string random = ApiQueryUtil.QueryHeader(Constant.HTTP_HEADER_RANDOM);

            string content = ApiQueryUtil.QueryArgByPost("content");
            string contact = ApiQueryUtil.QueryArgByPost("contact");
            string terminalTypeString = ApiQueryUtil.QueryArgByPost("terminal_type");

            Dictionary<string, string> args = new Dictionary<string, string>()
            {
                { Constant.HTTP_HEADER_CMD, cmd },
                { Constant.HTTP_HEADER_RANDOM, random },
                { "content", content },
                { "contact", contact },
                { "terminal_type", terminalTypeString }
            }.OrderBy(element => element.Key).ToDictionary(o => o.Key, p => p.Value);

            ServiceInvokeDTO result = null;
            try
            {
                // Check sign
                if (securityService.CheckSign(args, Config.ApiSignSecretKey, sign))
                {
                    FeedBack feedback = new FeedBack();
                    feedback.Content = content;
                    feedback.Contact = contact;
                    feedback.TerminalType = Convert.ToInt32(terminalTypeString);

                    result = commonService.AddFeedBack(feedback);
                }
                else
                {
                    result = new ServiceInvokeDTO(InvokeCode.SYS_SIGN_ERROR);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
                result = new ServiceInvokeDTO(InvokeCode.SYS_INNER_ERROR);
            }
            log.Debug(Constant.DEBUG_END);

            return request.CreateResponse(HttpStatusCode.OK, result);
        }
示例#43
0
 public JsonResult SendMessage(string models)
 {
     try
     {
         var code = Request.QueryString["code"];
         var sesion = Session["ValidateCode"] != null ? Session["ValidateCode"].ToString().ToLower() : "";
         if (code != sesion)
         {
             return Json(0);
         }
         if (!string.IsNullOrEmpty(models))
         {
             var entity = SerializeHelper.JsonDeserialize<sd_message>(models);
             entity.addtime = DateTime.Now;
             entity.ip = Fetch.UserIp;
             var check = new FeedBack().Check(entity.name, entity.email, entity.contact, entity.addtime);
             if (!check)
             {
                 var list = new FeedBack().Add(entity);
                 return Json(list);
             }
             else
             {
                 return Json(1);
             }
         }
         return Json(false);
     }
     catch (Exception ex)
     {
         return Json(ex.Message);
     }
 }
示例#44
0
        /// <summary>
        /// desc,images,id
        /// </summary>
        /// <param name="model"></param>
        /// <param name="bodyString"></param>
        /// <returns></returns>
        public static bool SyncQuestionToPM(FeedBack model, string platform = "Android")
        {
            string serverUrl = "https://hk03.ablemobile.com:18443/projects/bigline-sys/issues.json";
            try
            {
                var request = WebRequest.Create(serverUrl);
                request.Timeout = 5000; // Timeout after 5 seconds
                request.Method = "POST";
                request.Headers["X-Redmine-API-Key"] = "8081ad1b64826ab3534e125fc0c4b0fd90944577";

                request.ContentType = "application/json";

                Issue _issue = new Issue()
                {
                    project_id = 77,
                    tracker_id = 2,
                    //1 = Bug, 2 = Feature, 5 = Documentation, 6 = Study, 8 = Enhancement
                    status_id = 1, //1 = New,
                    priority_id = 3, //2 = Normal, 3 = High
                    subject = "客戶匯報:" + (model.Desc.Length > 200 ? model.Desc.Substring(0, 200) : model.Desc),
                };

                _issue.custom_fields = new List<custom_field>() {
                        new custom_field() {
                            id = 1, //Platform
                            value = platform
                        },
                        new custom_field()
                        {
                            id = 2, //Test Version
                            value = DateTime.Now.ToString("yyyy-MM-dd")
                        },
                        new custom_field()
                        {
                            id = 3, //Ref Question Id
                            value = model.Id.ToString()
                        },
                        new custom_field()
                        {
                            id = 5, //Ref Source
                            value = HttpContext.Current.Request.Url.Host
                        }
                    };

                _issue.description = model.Desc + "<br/>";

                if (!string.IsNullOrEmpty(model.Images))
                {
                    var imgList = model.Images.ConvertToList(ConfigHelper.GetConfigString("ImgUrl"));
                    foreach (var item in imgList)
                    {
                        _issue.description += string.Format("<br/><br/><img src='{0}' />", item);
                    }
                }

                string postData = Newtonsoft.Json.JsonConvert.SerializeObject(new ReportIssue() { issue = _issue });
                byte[] byteArray = Encoding.UTF8.GetBytes(postData);
                request.ContentLength = byteArray.Length;

                Stream dataStream = request.GetRequestStream();

                dataStream.Write(byteArray, 0, byteArray.Length);
                dataStream.Close();

                // Get the response.
                WebResponse response = request.GetResponse();
                // Display the status.
                Console.WriteLine(((HttpWebResponse)response).StatusDescription);
                // Get the stream containing content returned by the server.
                dataStream = response.GetResponseStream();
                // Open the stream using a StreamReader for easy access.
                StreamReader reader = new StreamReader(dataStream);
                // Read the content.
                string responseFromServer = reader.ReadToEnd();

                // Clean up the streams.
                reader.Close();
                dataStream.Close();
                response.Close();

                return true;
            }
            catch (Exception)
            {
                //Console.WriteLine(e.Message);
                //Do nothing
                return false;
            }
        }