Graphical report (practice C #)

Source: Internet
Author: User
Note: To reference dll: fusioncharts. dll, add the chart Folder: contains the JS to be used for the chart icon.
Page code: <Div class = "tabscontent" layouth = "100"> <Div id = "charts_show" style = "float: Left; width: 100%; top: 5px; overflow: auto; "> <% = viewdata [" chatsxml "] %> </div> /// <summary> // customer service data statistics /// </Summary> /// <returns> </returns> Public actionresult countinfo (string begintime, string endtime) {string SQL = "select BR. user_id, BB. role_name, bu. user_name "; // 0, 1, 2; string sql1 =" from DBO. base_user _ Role BR left join DBO. base_users BU on BR. user_id = Bu. user_id left join DBO. base_roles BB on BB. role_id = BR. role_id "; string sql2 =" where BB. role_name = 'Customer Service specialization' group by Bu. user_name, BR. user_id, BB. role_name "; string Ss =" "; string AA =" "; string BB =" "; string cc =" "; session [" countinfo "] = NULL; If (! String. isnullorempty (begintime) {SS + = "and datediff (DD, '" + begintime + "', SS. create_time)> = 0 "; AA + =" and datediff (DD, '"+ begintime +"', AA. create_time)> = 0 "; BB + =" and datediff (DD, '"+ begintime +"', BB. create_time)> = 0 "; CC + =" and datediff (DD, '"+ begintime +"', CC. create_time)> = 0 ";} If (! String. isnullorempty (endtime) {SS + = "and datediff (DD, SS. create_time, '"+ endtime +"')> = 0 "; AA + =" and datediff (DD, AA. create_time, '"+ endtime +"')> = 0 "; BB + =" and datediff (DD, BB. create_time, '"+ endtime +"')> = 0 "; CC + =" and datediff (DD, CC. create_time, '"+ endtime +"')> = 0 ";} SQL + =", (select count (*) from DBO. customer SS where ss. create_user = Bu. user_name and SS. gcflag = 0 "+ SS +") 'Number of input customers', "; // 3; SQL + =" (select count (*) from DBO. cus_con AA where AA. create_user = Bu. user_name and AA. gcflag = 0 "+ AA +") as 'customer consulting number', "; // 4; SQL + =" (select count (*) from DBO. cus_appoint BB where BB. create_user = Bu. user_name and BB. gcflag = 0 "+ BB +") as 'customer reservation number', "; // 5 SQL + =" (select count (*) from DBO. cus_follow CC where CC. create_user = Bu. user_name and CC. gcflag = 0 "+ CC +") as 'number of customer visits '"; // 6 L Ist <cuscountinfo> centity = new list <cuscountinfo> (); ilist list = baseservice. executequery (SQL + sql1 + sql2); pagedresult = new pagedresult (); If (list. count> 0) {int Index = 0; For (INT I = 0; I <list. count; I ++) {object [] Ob = list [I] as object []; cuscountinfo CCI = new cuscountinfo (); CCI. rowid = index ++; CCI. name = ob [2]. tostring (); CCI. cuscount = ob [3]. tostring (); // enter the customer CCI. Cusconcount = ob [4]. tostring (); // contact the customer for CCI. cusappointcount = ob [5]. tostring (); // The customer makes an appointment for CCI. cusfollwcount = ob [6]. tostring (); // The customer follows up with centity. add (CCI) ;}}; pagedresult. result = centity; viewdata ["pager"] = pagedresult; tempdata ["customerkfreport"] = pagedresult. result; session ["countinfo"] = pagedresult. result; viewdata ["begintime"] = begintime = NULL? "": Begintime; viewdata ["endtime"] = endtime = NULL? "": Endtime; return view ();} /// <summary> // obtain the customer service workload graphic display /// </Summary> /// <returns> </returns> Public actionresult countimageinfo () {// fzh. CRM. htmlhelper. dbhelp. util = new fzh. CRM. htmlhelper. dbhelp. util (); stringbuilder strxml = new stringbuilder (); strxml. append ("<chart caption = 'Customer Service workload statistics' xaxisname = 'Customer Service name' yaxisname = 'Times' rotateyaxisname = '0' bgswf = '.. /.. /.. /.. /charts/index-logo.png 'canv Asbgalpha = '60' canvasbordercolor = '000000' canvasborderthickness = '0' divlinecolor = '000000'> "); string categories =" "; string vistcount = ""; string groupcount = ""; string intentcount = ""; string favorcount = ""; categories = "<categories>"; vistcount = "<dataset seriesname = 'input customer'> "; groupcount = "<dataset seriesname = 'customer'>"; intentcount = "<dataset seriesname = 'customer'>"; favorcount = "<dataset se Riesname = 'customer return visit '> "; List <cuscountinfo> List = NULL; If (session [" countinfo "]! = NULL) {list = session ["countinfo"] As list <cuscountinfo>; foreach (cuscountinfo item in List) {# region [charts parameter] categories + = "<category label = '" + item. name + "'/>"; vistcount + = "<set value ='" + item. cuscount + "'/>"; groupcount + = "<set value ='" + item. cusappointcount + "'/>"; intentcount + = "<set value ='" + item. cusconcount + "'/>"; favorcount + = "<set value ='" + item. cusfollwcount + "'/>"; # Endregion} else {# region [charts parameter] categories + = "<category label =''/> "; vistcount + = "<set value =''/> "; groupcount + =" <set value = ''/> "; intentcount + = "<set value =''/> "; favorcount + =" <set value = ''/> "; # endregion} categories + = "</Categories>"; vistcount + = "</dataset>"; groupcount + = "</dataset> "; intentcount + = "</dataset>"; favorcount + = "</dataset>"; strxml. append (Cate Gories); strxml. append (vistcount); strxml. append (groupcount); strxml. append (intentcount); strxml. append (favorcount); strxml. append ("<styles>"); strxml. append ("<definition>"); strxml. append ("<style name = 'mycaptionanim 'type = 'animation 'Param =' _ y' easing = 'bounce 'start = '0' duration = '1'/> "); strxml. append ("</definition>"); strxml. append ("<Application>"); strxml. append ("<apply toobject = 'caption' Style S = 'mycaptionanim '/> "); strxml. append ("</Application>"); strxml. append ("</styles>"); // Finally, close <chart> element strxml. append ("</chart>"); int hcount = 0; If (list = NULL) {hcount = 80*5 + 200;} else {hcount = 80 * List. count + 200;} // create the chart-pie 3D chart with data from strxml viewdata ["chatsxml"] = fusioncharts. renderchart (".. /.. /.. /.. /charts/mscolumn3d.swf? Chartnodatatext = no customer service workload statistics "," ", strxml. tostring (), "blockclicksum", hcount. tostring (), "500", false, true, false); Return view ();}

 

Graphical report (practice C #)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.