Ejemplo n.º 1
0
        private void SetSatisfyBar(string sid)
        {
            //hcate.Value = "课程1, 课程2, 课程3, 课程4, 课程5";
            //hdata.Value = "17, 31, 335, 203, 2";
            hcate.Value = "";
            hdata.Value = "";

            try
            {
                var quesBll = new BLL.Questionnaire();
                var dt = quesBll.GetSatisfybar(sid);
                if (dt != null && dt.Rows.Count > 0)
                {
                    var str1 = new StringBuilder();
                    var str2 = new StringBuilder();
                    foreach (DataRow row in dt.Rows)
                    {
                        str1.Append(row["CourseName"] + ",");
                       // str2.Append(row["Satisfy"].ToString().Substring(0,4) + ",");
                        if (Convert.ToDouble(row["Satisfy"])*100 > 100)
                        {
                            str2.Append("100"+ ",");
                        }
                        else
                        {
                            str2.Append(string.Format("{0:N2}", Convert.ToDouble(row["Satisfy"]) * 100) + ",");
                        }
                    }
                    str1.Remove(str1.Length - 1, 1);
                    str2.Remove(str2.Length - 1, 1);

                    hcate.Value = str1.ToString();
                    hdata.Value = str2.ToString();
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLogofExceptioin(ex);
            }
        }