public IActionResult Index()
 {
     var res = feedBack.GetFeedBacks();
     return View(res);
 }
Ejemplo n.º 2
0
    public string GetFeedBacks()
    {
        string    nickname      = "";
        string    type_name     = "";
        int       Feedback_Type = 0;
        string    keyword       = tools.CheckStr(Request["keyword"]);
        int       isreply       = tools.CheckInt(Request["isreply"]);
        string    date_start    = tools.CheckStr(Request.QueryString["date_start"]);
        string    date_end      = tools.CheckStr(Request.QueryString["date_end"]);
        QueryInfo Query         = new QueryInfo();

        Query.PageSize    = tools.CheckInt(Request["rows"]);
        Query.CurrentPage = tools.CheckInt(Request["page"]);
        Query.ParamInfos.Add(new ParamInfo("AND", "str", "FeedBackInfo.Feedback_Site", "=", Public.GetCurrentSite()));

        string listtype = tools.CheckStr(Request.QueryString["listtype"]);

        switch (listtype)
        {
        case "message":
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "FeedBackInfo.Feedback_Type", "=", "1"));
            break;

        case "idea":
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "FeedBackInfo.Feedback_Type", "!=", "1"));
            break;

        case "suggest":
            Query.ParamInfos.Add(new ParamInfo("AND(", "int", "FeedBackInfo.Feedback_Type", "=", "3"));
            Query.ParamInfos.Add(new ParamInfo("OR)", "int", "FeedBackInfo.Feedback_Type", "=", "4"));
            break;

        case "complain":
            Query.ParamInfos.Add(new ParamInfo("AND(", "int", "FeedBackInfo.Feedback_Type", "=", "5"));
            Query.ParamInfos.Add(new ParamInfo("OR)", "int", "FeedBackInfo.Feedback_Type", "=", "6"));
            break;

        default:
            Query.ParamInfos.Add(new ParamInfo("AND", "int", "FeedBackInfo.Feedback_Type", "=", "1"));
            break;
        }
        if (isreply == 1)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FeedBackInfo.Feedback_Reply_Content", "<>", ""));
        }
        else if (isreply == 2)
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "str", "FeedBackInfo.Feedback_Reply_Content", "=", ""));
        }
        if (keyword.Length > 0)
        {
            Query.ParamInfos.Add(new ParamInfo("AND(", "str", "FeedBackInfo.Feedback_Name", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR", "str", "FeedBackInfo.Feedback_CompanyName", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR", "str", "FeedBackInfo.Feedback_Tel", "like", keyword));
            Query.ParamInfos.Add(new ParamInfo("OR)", "str", "FeedBackInfo.Feedback_Email", "like", keyword));
        }
        if (date_start != "")
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "funint", "DATEDIFF(d, '" + date_start + "',{FeedBackInfo.Feedback_Addtime})", ">=", "0"));
        }
        if (date_end != "")
        {
            Query.ParamInfos.Add(new ParamInfo("AND", "funint", "DATEDIFF(d, '" + date_end + "',{FeedBackInfo.Feedback_Addtime})", "<=", "0"));
        }
        Query.OrderInfos.Add(new OrderInfo(tools.CheckStr(Request["sidx"]), tools.CheckStr(Request["sord"])));

        PageInfo             pageinfo = MyFeedback.GetPageInfo(Query, Public.GetUserPrivilege());
        IList <FeedBackInfo> entitys  = MyFeedback.GetFeedBacks(Query, Public.GetUserPrivilege());

        if (entitys != null)
        {
            StringBuilder jsonBuilder = new StringBuilder();
            jsonBuilder.Append("{\"page\":" + pageinfo.CurrentPage + ",\"total\":" + pageinfo.PageCount + ",\"records\":" + pageinfo.RecordCount + ",\"rows\"");
            jsonBuilder.Append(":[");
            foreach (FeedBackInfo entity in entitys)
            {
                nickname = "游客";
                MemberInfo member = new MemberInfo();

                if (entity.Feedback_MemberID > 0)
                {
                    member = MyBLL.GetMemberByID(entity.Feedback_MemberID, Public.GetUserPrivilege());
                    if (member != null)
                    {
                        nickname = member.Member_NickName;
                    }
                }

                SupplierInfo supplierinfo = new SupplierInfo();

                if (entity.Feedback_SupplierID > 0)
                {
                    supplierinfo = MySupplier.GetSupplierByID(entity.Feedback_SupplierID, Public.GetUserPrivilege());
                    if (supplierinfo != null)
                    {
                        nickname = supplierinfo.Supplier_Nickname;
                    }
                }

                switch (entity.Feedback_Type)
                {
                //case 1:
                //    type_name = "简单的留言";
                //    break;
                //case 2:
                //    type_name = "对网站的意见";
                //    break;
                //case 3:
                //    type_name = "对公司的建议";
                //    break;
                //case 4:
                //    type_name = "具有合作意向";
                //    break;
                //case 5:
                //    type_name = "产品投诉";
                //    break;
                //case 6:
                //    type_name = "服务投诉";
                //    break;


                case 1:
                    type_name = "网站留言";
                    break;

                case 2:
                    type_name = "商业承兑融资";
                    break;

                case 3:
                    type_name = "应收账款融资";
                    break;

                case 4:
                    type_name = "货押融资";
                    break;

                    //case 3:
                    //    type_name = "对公司的建议";
                    //    break;
                    //case 4:
                    //    type_name = "具有合作意向";
                    //    break;
                    //case 5:
                    //    type_name = "产品投诉";
                    //    break;
                    //case 6:
                    //    type_name = "服务投诉";
                    //break;
                }

                jsonBuilder.Append("{\"id\":" + entity.Feedback_ID + ",\"cell\":[");
                //各字段
                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Feedback_ID);
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(entity.Feedback_Name));
                jsonBuilder.Append("\",");

                //jsonBuilder.Append("\"");
                //jsonBuilder.Append(Public.JsonStr(entity.Feedback_CompanyName));
                //jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(type_name));
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(Public.JsonStr(entity.Feedback_Tel));
                jsonBuilder.Append("\",");

                if (Feedback_Type == 1)
                {
                    jsonBuilder.Append("\"");
                    jsonBuilder.Append(Public.JsonStr(entity.Feedback_Email));
                    jsonBuilder.Append("\",");
                }
                else
                {
                    jsonBuilder.Append("\"");
                    jsonBuilder.Append(tools.CheckFloat(entity.Feedback_Amount.ToString()));
                    jsonBuilder.Append("\",");
                }


                jsonBuilder.Append("\"");
                if (entity.Feedback_Reply_Content != "")
                {
                    jsonBuilder.Append("已回复");
                }
                else
                {
                    jsonBuilder.Append("未回复");
                }

                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append(entity.Feedback_Addtime.ToString("yy-MM-dd"));
                jsonBuilder.Append("\",");

                jsonBuilder.Append("\"");
                jsonBuilder.Append("<img src=\\\"/images/icon_view.gif\\\" alt=\\\"查看\\\" align=\\\"absmiddle\\\"> <a href=\\\"feedback_view.aspx?feedback_id=" + entity.Feedback_ID + "\\\" title=\\\"查看\\\">查看</a> ");

                if (Public.CheckPrivilege("cc567804-3e2e-4c6c-aa22-c9a353508074"))
                {
                    jsonBuilder.Append("<img src=\\\"/images/icon_del.gif\\\" alt=\\\"删除\\\" align=\\\"absmiddle\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('supplier_do.aspx?action=feedbackmove&listtype=" + listtype + "&feedback_id=" + entity.Feedback_ID + "')\\\" title=\\\"删除\\\">删除</a>");


                    //jsonBuilder.Append(" <img src=\\\"/images/icon_del.gif\\\"  alt=\\\"删除\\\"> <a href=\\\"javascript:void(0);\\\" onclick=\\\"confirmdelete('depot_do.aspx?action=move&depot_id=" + Depot_ID + "')\\\" title=\\\"删除\\\">删除</a>");
                }

                jsonBuilder.Append("\",");

                jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
                jsonBuilder.Append("]},");

                supplierinfo = null;
            }
            jsonBuilder.Remove(jsonBuilder.Length - 1, 1);
            jsonBuilder.Append("]");
            jsonBuilder.Append("}");
            return(jsonBuilder.ToString());
        }
        else
        {
            return(null);
        }
    }