Пример #1
0
        protected void btSub_Click(object sender, EventArgs e)
        {
            try
            {
                FeedBack m = new FeedBack();

                m.title   = this.tbtitle.Value.Trim();
                m.company = this.tbcompany.Value.Trim();
                m.address = this.tbaddress.Value.Trim();
                // m["zip"] = this.tbzip.Value.Trim();
                m.username = this.tbusername.Value.Trim();
                // m["mobile"] = this.tbmobile.Value.Trim();
                m.phone = this.tbphone.Value.Trim();
                // m["fax"] = this.tbFax.Value.Trim();
                m.email   = this.tbemail.Value.Trim();
                m.content = this.tbcontent.Value;
                m.addtime = DateTime.Now;
                m.flag    = false;
                m.type    = 1;
                FeedBackService.InsertFeedBack(m);
                ShowJs.ShowAndRedirect("感谢您的留言!", Request.Url.ToString(), this.Page);
            }
            catch (Exception)
            {
                ShowJs.ShowAndBack("提交失败!", this.Page);
            }
        }
Пример #2
0
        private void CarregarListaFeedback()
        {
            List <FeedBack> feedbacks = FeedBackService.GetAll();

            listViewFeedback.Items.Clear();
            listViewFeedback.Items.AddRange(feedbacks.Select(it => {
                var item = new ListViewItem(it.Nome);
                item.SubItems.Add(it.Id.ToString());
                return(item);
            }).Cast <ListViewItem>().ToArray());

            if (condicao != null)
            {
                if (condicao.FeedBackQuadrado1 != null)
                {
                    textFeedback1.Text = FeedBackService.GetById(condicao.FeedBackQuadrado1.Id).Nome;
                }
                if (condicao.FeedBackQuadrado2 != null)
                {
                    textFeedback2.Text = FeedBackService.GetById(condicao.FeedBackQuadrado2.Id).Nome;
                }
                if (condicao.FeedBackQuadrado3 != null)
                {
                    textFeedback3.Text = FeedBackService.GetById(condicao.FeedBackQuadrado3.Id).Nome;
                }
            }
        }
Пример #3
0
        public IHttpActionResult Get(string strAccess = null)
        {
            var requestData = new PagesRows();

            if (strAccess != null)
            {
                requestData = JsonConvert.DeserializeObject <PagesRows>(strAccess);
            }
            var token = string.Empty;

            if (Request != null && Request.Headers.Contains("X-Token"))
            {
                token = Request.Headers.GetValues("X-Token").FirstOrDefault();
            }
            else if (requestData.Token != null)
            {
                token = requestData.Token;
            }
            var memberService = new MemberService();
            var memberInfo    = memberService.TokenToMember(token).Result;
            var response      = new BaseResponse <FeedBackGetResponse>();

            response.Success = false;
            response.Data    = new FeedBackGetResponse();

            if (memberInfo == null)
            {
                response.State   = LogState.Logout;
                response.Message = "已登出";
                return(Ok(response));
            }
            var authService     = new AuthService();
            var isSystemAccount = authService.CheckSystemAdmin(memberInfo.Id);

            if (isSystemAccount == false)
            {
                response.State   = LogState.Error;
                response.Message = "沒有權限";
                return(Ok(response));
            }
            var feedBackService = new FeedBackService();
            var responseData    = (requestData.Pages != null && requestData.Rows != null) ?
                                  feedBackService.GetList(memberInfo.OrgId, requestData.Pages, requestData.Rows) :
                                  feedBackService.GetList(memberInfo.OrgId);

            if (responseData == null)
            {
                response.Message = "查無資料";
                response.State   = LogState.Error;
            }
            else
            {
                response.Success = true;
                response.Message = "查詢成功";
                response.Data    = responseData;
            }
            return(Ok(response));
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["type"] != null)
            {
                if (Request["type"] == "1")
                {
                    if (!RankService.IsModuleRank(1001))
                    {
                        Response.Write("<div style='width:100%;margin-top:200px;text-align:center;color:red;'>您没有本模块的操作权限! 请与管理员联系!</div>");
                        Response.End();
                    }
                }
                if (Request["type"] == "2")
                {
                    if (!RankService.IsModuleRank(1002))
                    {
                        Response.Write("<div style='width:100%;margin-top:200px;text-align:center;color:red;'>您没有本模块的操作权限! 请与管理员联系!</div>");
                        Response.End();
                    }
                }
            }
            else
            {
                if (!RankService.IsModuleRank(1001))
                {
                    Response.Write("<div style='width:100%;margin-top:200px;text-align:center;color:red;'>您没有本模块的操作权限! 请与管理员联系!</div>");
                    Response.End();
                }
            }
            if (!IsPostBack)
            {
                this.ddltype.DataSource     = FeedBackTypeService.GetAllFeedBackType();
                this.ddltype.DataTextField  = "typename";
                this.ddltype.DataValueField = "id";
                this.ddltype.DataBind();
                this.ddltype.Items.Insert(0, new ListItem("全部", "all"));

                this.rtNews.DataSource = pds();
                this.rtNews.DataBind();
                if (Request["flag"] != null)
                {
                    FeedBackService.SetFlag(Request["flag"].ToString() == "1"?true:false, int.Parse(Request["id"]));


                    Response.Redirect("feedback.aspx?page=" + Request["page"] + getcanshu());
                }
                else if (Request["del"] != null)
                {
                    string[] page = Request["page"].Split(',');
                    FeedBackService.DeleteFeedBack(int.Parse(Request["del"]));

                    Response.Redirect(Request["reUrl"].Replace("|", "&"));
                }
            }
        }
Пример #5
0
        private void btnDeletarFeedback_Click(object sender, EventArgs e)
        {
            if (listViewFeedback.SelectedItems.Count == 0)
            {
                MessageBox.Show("Nenhum Feedback selecionado!", "Advertência");
                return;
            }

            FeedBackService.Deletar(GetFeedbackSelecionado());
            CarregarListaFeedback();
            MessageBox.Show("Feedback deletado com sucesso!", "Sucesso");
        }
Пример #6
0
 protected void btDel_Click(object sender, EventArgs e)
 {
     if (Request["sel"] != null)
     {
         string[] a = Request["sel"].Split(',');
         for (int i = 0; i < a.Length; i++)
         {
             FeedBackService.DeleteFeedBack(int.Parse(a[i]));
         }
     }
     Response.Redirect(Request.UrlReferrer.ToString());
 }
Пример #7
0
 protected void btsetflag2_Click(object sender, EventArgs e)
 {
     if (Request["sel"] != null)
     {
         string[] a = Request["sel"].Split(',');
         for (int i = 0; i < a.Length; i++)
         {
             FeedBackService.SetFlag(false, int.Parse(a[i]));
         }
     }
     Response.Redirect("feedback.aspx?page=" + (Request["page"] == null ? "0" : Request["page"]) + getcanshu());
 }
Пример #8
0
        public ActionResult FeedbackDo(FeedBack model)
        {
            if (string.IsNullOrEmpty(model.VCode) || model.VCode != Convert.ToString(Session["CodeImage"]))
            {
                return(Json(new { state = -2, error = "验证码错误" }, JsonRequestBehavior.DenyGet));
            }

            string error  = "";
            int    result = new FeedBackService().Add(model, out error);

            return(Json(new { state = result, error = error }, JsonRequestBehavior.DenyGet));
        }
        public void GetUserFeedBacksCorrectNumber()
        {
            var repository = new Mock <IDeletableEntityRepository <FeedBack> >();

            repository.Setup(f => f.All())
            .Returns(this.GetTestFeedBacksProfile()
                     .AsQueryable());

            var service = new FeedBackService(repository.Object);
            var list    = service.GetUserFeedBacks("Pesho").ToList();

            Assert.Equal(2, list.Count());
        }
Пример #10
0
        protected PagedDataSource pds()
        {
            string sql = "";

            if (Request["key"] != null)
            {
                sql = " and title like '%" + Request["key"] + "%' ";

                tbKey.Text = Request["key"];
            }
            if (Request["username"] != null && Request["username"] != "")
            {
                sql            += " and username='******'";
                tbusername.Text = Request["username"];
            }

            if (Request["time1"] != null && Request["time1"] != "")
            {
                sql         += " and addtime>='" + Request["time1"] + "'";
                tbTime1.Text = Request["time1"];
            }
            if (Request["time2"] != null && Request["time2"] != "")
            {
                sql         += " and addtime<='" + Request["time2"] + "'";
                tbTime2.Text = Request["time2"];
            }
            if (Request["type"] != null && Request["type"] != "all")
            {
                sql += " and type=" + Request["type"] + "";
                this.ddltype.SelectedValue = Request["type"];
            }
            string sql3 = " order by addtime desc";

            if (Request["paixu"] != null)
            {
                sql3 = " order by " + Request["paixu"] + " " + Request["paixu2"];
                this.drPaixu.SelectedValue  = Request["paixu"];
                this.drPaixu2.SelectedValue = Request["paixu2"];
            }
            // string sql2 = "select * from tFeedBack where 1=1 " + sql + sql3;
            string sql2 = string.Format("where 1=1 {0} {1}", sql, sql3);
            //Response.Write(sql);
            //Response.End();
            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = FeedBackService.GetTable(sql2);
            pds.AllowPaging      = true;                                         //允许分页
            pds.PageSize         = 20;                                           //分页数
            pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]); //当前页CurrentPageIndex,通过获得传来的参数page来设置
            return(pds);
        }
Пример #11
0
        public IHttpActionResult Post(FeedBackPostRequest requestData)
        {
            var requestService = new Service.Utility.RequestDataHelper <FeedBackPostRequest>();
            var checkColumnKey = new string[3] {
                "feedbacktype", "system", "email"
            };
            var checkEmpty = requestService.CheckColumnEmpty(requestData, checkColumnKey);
            var response   = new Infrastructure.ViewModel.Base.BaseResponse <FeedBack>();

            response.Success = false;
            response.Data    = new FeedBack();

            if (Request != null && Request.Headers.Contains("X-Token"))
            {
                requestData.Token = Request.Headers.GetValues("X-Token").FirstOrDefault();
            }
            else if (requestData.Token != string.Empty && requestData.Token != null)
            {
                requestData.Token = requestData.Token;
            }
            if (checkEmpty == false)
            {
                response.Message = "遺漏參數";
                response.State   = LogState.RequestDataError;
                return(Content(HttpStatusCode.BadRequest, response));
            }
            /*判斷email格式是否有問題*/
            if (requestData.Email.Contains("@") == false)
            {
                response.Message = "email格式錯誤";
                response.State   = LogState.RequestDataError;
                return(Content(HttpStatusCode.BadRequest, response));
            }
            var feedBackService = new FeedBackService();
            var responseData    = feedBackService.Insert(requestData);

            if (responseData != null)
            {
                response.Success = true;
                response.Data    = responseData;
                response.Message = "新增成功";
            }
            else
            {
                response.Message = "新增失敗";
                response.State   = LogState.Error;
            }
            return(Ok(response));
        }
Пример #12
0
        private async void SubmitCommandExcute(object obj)
        {
            try
            {
                if (!IsBusy)
                {
                    IsBusy = true;
                    var dialog = new ThanksPopupPage();
                    dialog.BindingContext = this;
                    if (!string.IsNullOrEmpty(AddFeedback.Name) && !string.IsNullOrEmpty(AddFeedback.Email) && !string.IsNullOrEmpty(AddFeedback.Feedback))
                    {
                        var feedBackService = new FeedBackService();
                        var result          = await feedBackService.AddFeedback(AddFeedback);

                        if (result.Status == "Success")
                        {
                            FeedbackAdded = "Thank you for your feedback";
                            await PopupNavigation.Instance.PushAsync(dialog);

                            Device.StartTimer(new TimeSpan(0, 0, 5), () =>
                            {
                                App.Current.MainPage.Navigation.PushAsync(new HomePage());
                                return(false);
                            });
                        }
                        else
                        {
                            FeedbackAdded = "Something wrong happen try agian later";
                            await App.Current.MainPage.Navigation.PushAsync(new HomePage());
                        }
                    }
                    else
                    {
                        FeedbackAdded = "Please fill out all the fields";
                        await PopupNavigation.Instance.PushAsync(dialog);
                    }
                }
            }
            catch (Exception e)
            {
                IsBusy = false;
                Crashes.TrackError(e);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public void AddFeedBacksCorrectly()
        {
            var dbContext = new DbContextOptionsBuilder <ApplicationDbContext>()
                            .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository = new EfDeletableEntityRepository <FeedBack>(new ApplicationDbContext(dbContext.Options));

            repository.SaveChangesAsync().GetAwaiter().GetResult();

            var service = new FeedBackService(repository);

            _ = service.AddAsync("Stamat", 10, "Beshe gotino");
            var list = service.GetAllFeedBacks().ToList();

            Assert.Single(list);
            Assert.Equal(10, list[0].Rating);
            Assert.Equal("Beshe gotino", list[0].Comment);
        }
Пример #14
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();
        }
Пример #15
0
        public IHttpActionResult Put(FeedBackPutRequest requestData)
        {
            var requestService = new Service.Utility.RequestDataHelper <FeedBackPutRequest>();
            var checkColumnKey = new string[2] {
                "id", "status"
            };
            var checkEmpty = requestService.CheckColumnEmpty(requestData, checkColumnKey);
            var response   = new Infrastructure.ViewModel.Base.BaseResponse <FeedBack>();

            response.Success = false;
            response.Data    = new FeedBack();
            if (checkEmpty == false)
            {
                response.Message = "遺漏參數";
                response.State   = LogState.RequestDataError;
                return(Content(HttpStatusCode.BadRequest, response));
            }

            if (Request != null && Request.Headers.Contains("X-Token"))
            {
                requestData.Token = Request.Headers.GetValues("X-Token").FirstOrDefault();
            }
            else if (requestData.Token != string.Empty && requestData.Token != null)
            {
                requestData.Token = requestData.Token;
            }

            var feedBackService = new FeedBackService();
            var responseData    = feedBackService.Update(requestData);

            if (responseData != null)
            {
                response.Success = true;
                response.Data    = responseData;
                response.Message = "更新成功";
            }
            else
            {
                response.Message = "更新失敗";
                response.State   = LogState.Error;
            }
            return(Ok(response));
        }
Пример #16
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            feedback.NomeAudio = AudioService.CopiaAudioParaPasta(textNomeAudio.Text);
            feedback.Pontos    = Convert.ToInt32(numericPontos.Value);
            feedback.CorBlink  = panelCorBlink.BackColor.ToArgb();

            FeedBack feedBackExistente = FeedBackService.GetByObj(feedback);

            if (feedBackExistente != null)
            {
                MessageBox.Show("Feedback já existente!", "Advertência");
                return;
            }

            FeedBackService.Salvar(feedback);
            MessageBox.Show("Feedback salvo com sucesso!", "Sucesso");
            fileDialog.Dispose();
            Close();
        }
Пример #17
0
        public FeedbackCrud(long idFeedback = 0)
        {
            InitializeComponent();

            if (idFeedback == 0)
            {
                feedback = new FeedBack();
                Text     = "Criando novo Feedback";
                return;
            }
            else
            {
                feedback = FeedBackService.GetById(idFeedback);
            }

            Text = "Editando Feedback";

            textNomeAudio.Text      = feedback.NomeAudio;
            numericPontos.Value     = feedback.Pontos;
            panelCorBlink.BackColor = feedback.ColorBlink;
        }
Пример #18
0
 // GET: FeedBack
 public FeedBackController(FeedBackService feedBackService)
 {
     _feedBackService = feedBackService;
 }
Пример #19
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);
 }
Пример #20
0
 private FeedBack GetFeedbackSelecionado()
 {
     return(FeedBackService.GetById(GetIdFeedbackSelecionado()));
 }
Пример #21
0
 public PartialViewResult LookFeedBack(int id)
 {
     this.feedBackService = new FeedBackService();
     var model = this.feedBackService.QueryFeedBackByID(id);
     if (model != null)
     {
         var feedModel = new FeedBackModel
         {
             ID = model.ID,
             Name = model.Name,
             Email = model.Email,
             Content = model.Content,
             Gender = model.Gender,
             GjwNumber = model.GjwNumber,
             ImgUrl = model.ImgUrl,
             TelPhone = model.TelPhone,
             Type = model.Type
         };
         return this.PartialView("LookFeedBack", feedModel);
     }
     return this.PartialView("LookFeedBack");
 }
Пример #22
0
        /// <summary>
        /// 查询用户反馈信息
        /// </summary>
        /// <param name="request">分页对象</param>
        /// <param name="gender">性别</param>
        /// <param name="type">类型</param>
        /// <param name="keyword">关键字</param>
        /// <returns></returns>
        public ActionResult GetFeedBack([DataSourceRequest] DataSourceRequest request, int gender, int type, string keyword)
        {
            if (request.Page <= 0)
            {
                request.Page = 1;
            }
            if (request.PageSize == 0)
            {
                request.Page = 10;
            }
            var criteria = "ID>0";
            if (!string.IsNullOrEmpty(keyword))
            {

                criteria += " and ";

                criteria += "[Name] like '%" + keyword + "%' or [Content] like '%" + keyword + "%'";
            }
            if (gender != -1)
            {
                criteria += " and ";

                criteria += "[Gender]=" + gender + "";

            }
            if (type != 0)
            {

                criteria += " and ";

                criteria += "[Type]=" + type + "";
            }

            try
            {
                int pageCount;
                int totalCount;
                var paging = new Paging("[FeedBack]", null, "ID", criteria, request.Page, request.PageSize);
                this.feedBackService = new FeedBackService();
                var pagingFeedBack = this.feedBackService.Paging(paging, out pageCount, out totalCount);
                var modelList = new List<FeedBackModel>();
                if (pagingFeedBack != null && pagingFeedBack.Any())
                {
                    foreach (var feedBack in pagingFeedBack)
                    {
                        modelList.Add(DataTransfer.Transfer<FeedBackModel>(feedBack, typeof(FeedBack)));
                    }
                    var data = new DataSource()
                    {
                        Data = modelList,
                        Total = totalCount
                    };
                    return this.Json(data);
                }
            }
            catch (Exception exception)
            {
                TextLogger.Instance.Log("查询出错", Category.Error, exception);
            }
            return Json(string.Empty, JsonRequestBehavior.AllowGet);
        }