コード例 #1
0
 public string findAll()
 {
     return(JsonCast.DataTableToJSON(du.findAll(), false).ToString());
 }
コード例 #2
0
 //获取该用户的所有   管理的实验室的门标
 public string  findUserRole(string name)
 {
     return(JsonCast.DataTableToJSON(du.findUserRole(name), false).ToString());
 }
コード例 #3
0
 public string getOne(string id)
 {
     return(JsonCast.DataTableToJSON(du.getOne(id), false).ToString());
 }
コード例 #4
0
 public string findFunction(string num)
 {
     try
     {
         DataTable dd = l.findFunction(num);
         DataTable dt = new DataTable();
         dt.Columns.Add("id");
         dt.Columns.Add("周次");
         dt.Columns.Add("星期");
         dt.Columns.Add("节次");
         string        type    = "";
         List <string> week    = new List <string>();
         List <string> section = new List <string>();
         type = dd.Rows[0][0].ToString();
         for (int i = 0; i < dd.Rows.Count; i++)
         {
             if (dd.Rows[i]["type"].ToString() == "section")
             {
                 section.Add(dd.Rows[i]["no"].ToString());
             }
             else
             {
                 week.Add(dd.Rows[i]["no"].ToString());
             }
         }
         for (int j = 0; j < week.Count; j++)
         {
             for (int i = 0; i < section.Count; i++)
             {
                 DataRow r = dt.NewRow();
                 r[0] = k.ToString();
                 r[1] = week[j];
                 int a = int.Parse(section[i]);
                 int b = a % 7;
                 if (b == 0)
                 {
                     r[2] = "7";
                 }
                 else
                 {
                     r[2] = b.ToString();
                 }
                 if (a <= 7)
                 {
                     r[3] = "1.2";
                 }
                 else if (a > 7 && a <= 14)
                 {
                     r[3] = "3.4";
                 }
                 else if (a > 14 && a <= 21)
                 {
                     r[3] = "5.6";
                 }
                 else if (a > 21 && a <= 28)
                 {
                     r[3] = "7.8";
                 }
                 else
                 {
                     r[3] = "9.10";
                 }
                 dt.Rows.Add(r.ItemArray);
                 k++;
             }
         }
         DataView dataView = dt.DefaultView;
         dataView.Sort = "星期 asc";
         dt            = dataView.ToTable();
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             dt.Rows[i][2] = chinese(int.Parse(dt.Rows[i][2].ToString()));
         }
         return(JsonCast.DataTableToJSON(dt, false).ToString());
     }
     catch (Exception)
     {
         return(null);
     }
 }
コード例 #5
0
        public string findRecord(string labNo)
        {
            DataTable dt = l.findCourseByLab(labNo);
            DataTable d  = dt.Clone();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataTable dd = l.findDetailByCno(dt.Rows[i]["id"].ToString());
                for (int j = 0; j < dd.Rows.Count; j++)
                {
                    DataRow r = dt.NewRow();
                    for (int k = 0; k < dt.Columns.Count; k++)
                    {
                        if (dt.Columns[k].ColumnName == "week")
                        {
                            r[k] = dd.Rows[j]["week"].ToString();
                        }
                        else if (dt.Columns[k].ColumnName == "section")
                        {
                            r[k] = dd.Rows[j]["remark2"].ToString();
                        }
                        else if (dt.Columns[k].ColumnName == "remark2")
                        {
                            r[k] = dd.Rows[j]["remark1"].ToString();
                        }
                        else
                        {
                            r[k] = dt.Rows[i][k].ToString();
                        }
                    }
                    d.Rows.Add(r.ItemArray);
                }
            }
            DataTable sec = l.findSec("section");

            for (int i = 0; i < sec.Rows.Count; i++)
            {
                int a = int.Parse(sec.Rows[i]["no"].ToString());
                if (a <= 7)
                {
                    sec.Rows[i]["no"] = "1.2";
                }
                else if (a <= 14 && a > 7)
                {
                    sec.Rows[i]["no"] = "3.4";
                }
                else if (a <= 21 && a > 14)
                {
                    sec.Rows[i]["no"] = "5.6";
                }
                else if (a <= 28 && a > 21)
                {
                    sec.Rows[i]["no"] = "7.8";
                }
                else
                {
                    sec.Rows[i]["no"] = "9.10";
                }
                sec.Rows[i]["remark1"] = chinese(a % 7);
            }
            DataTable t = new DataTable();

            t.Columns.Add("week");
            for (int i = 0; i < sec.Rows.Count; i++)
            {
                for (int j = 0; j < d.Rows.Count; j++)
                {
                    if (sec.Rows[i]["no"].ToString().Trim() == d.Rows[j]["section"].ToString().Trim() && sec.Rows[i]["remark1"].ToString().Trim() == d.Rows[j]["remark2"].ToString().Trim())
                    {
                        DataRow r = t.NewRow();
                        r[0] = d.Rows[j]["week"].ToString().Trim();
                        t.Rows.Add(r.ItemArray);
                    }
                }
            }
            //去除datatable重复行
            DataView dv = new DataView(t);

            t = dv.ToTable(true);

            return(JsonCast.DataTableToJSON(t, false).ToString());
        }
コード例 #6
0
 public string findSec(string type)
 {
     return(JsonCast.DataTableToJSON(l.findSec(type), false).ToString());
 }