示例#1
0
    public dotNetFlexGrid.DataHandlerResult DotNetFlexGrid1DataHandler(dotNetFlexGrid.DataHandlerParams p)
    {
        dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult();
        result.page  = p.page; //设定当前返回的页号
        result.total = 100;    //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际



        TeModel tm = new TeModel();

        result.table = tm.DecoctingDisplayInfo();

        dotNetFlexGrid.FieldFormatorHandle proc1a = delegate(DataRow dr)
        {
            string z       = "";
            int    bstatus = Convert.ToInt32(dr["tisanestatus"].ToString());
            string start   = dr["starttime"].ToString();



            if (bstatus == 0)
            {
                System.DateTime currentTime = new System.DateTime();
                currentTime = System.DateTime.Now;
                string   strtime = currentTime.ToString("yyyy-MM-dd HH:mm:ss");                                                                              //
                DateTime d1      = Convert.ToDateTime(strtime);                                                                                              //当前时间

                DateTime d2 = Convert.ToDateTime(start);                                                                                                     //开始时间

                TimeSpan d3 = d1.Subtract(d2);                                                                                                               //泡药时间

                int dT = Convert.ToInt32(d3.Days.ToString()) * 24 * 60 + Convert.ToInt32(d3.Hours.ToString()) * 60 + Convert.ToInt32(d3.Minutes.ToString()); //转化为分钟数

                string dt = dT.ToString();

                z = dt;
            }
            else
            {
                z = dr["tisanetime"].ToString();
            }

            return(z);
        };

        result.FieldFormator.Register("tisanetime", proc1a);


        dotNetFlexGrid.FieldFormatorHandle proc = delegate(DataRow dr)
        {
            string a = "";

            int tstatus = Convert.ToInt32(dr["tisanestatus"].ToString());

            if (tstatus == 0)
            {
                a = "开始煎药";
            }
            else if (tstatus == 1)
            {
                a = "煎药完成";
            }

            return(a);
        };

        result.FieldFormator.Register("tisanestatus", proc);



        dotNetFlexGrid.FieldFormatorHandle proc2 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["sex"].ToString());
            if (a == 1)
            {
                return("男");
            }
            else
            {
                return("女");
            }
        };
        result.FieldFormator.Register("sex", proc2);
        dotNetFlexGrid.FieldFormatorHandle proc3 = delegate(DataRow dr)
        {
            int b = Convert.ToInt32(dr["decscheme"].ToString());
            if (b == 1)
            {
                return("微压(密闭)解表(15min)");
            }
            else if (b == 2)
            {
                return("微压(密闭)汤药(15min)");
            }
            else if (b == 3)
            {
                return("微压(密闭)补药(15min)");
            }
            else if (b == 4)
            {
                return("常压解表(10min,10min)");
            }
            else if (b == 5)
            {
                return("常压汤药(20min,15min)");
            }
            else if (b == 6)
            {
                return("常压补药(25min,20min)");
            }
            else if (b == 20)
            {
                return("先煎解表(10min,10min,10min)");
            }
            else if (b == 21)
            {
                return("先煎汤药(10min,20min,15min)");
            }
            else if (b == 22)
            {
                return("先煎补药(10min,25min,20min)");
            }
            else if (b == 36)
            {
                return("后下解表(10min(3:7),10min)");
            }
            else if (b == 37)
            {
                return("后下汤药(20min(13:7),15min)");
            }
            else if (b == 38)
            {
                return("后下补药(25min(18:7),20min)");
            }
            else if (b == 81)
            {
                return("微压自定义");
            }
            else if (b == 82)
            {
                return("常压自定义");
            }
            else if (b == 83)
            {
                return("先煎自定义");
            }
            else
            {
                return("后下自定义");
            }
        };
        result.FieldFormator.Register("decscheme", proc3);

        dotNetFlexGrid.FieldFormatorHandle proc4 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["decmothed"].ToString());
            if (a == 1)
            {
                return("先煎");
            }
            else if (a == 2)
            {
                return("后下");
            }
            else
            {
                return("加糖加蜜");
            }
        };
        result.FieldFormator.Register("decmothed", proc4);
        dotNetFlexGrid.FieldFormatorHandle proc6 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["takeway"].ToString());
            if (a == 1)
            {
                return("水煎餐后");
            }
            else
            {
                return("");
            }
        };
        result.FieldFormator.Register("takeway", proc6);
        dotNetFlexGrid.FieldFormatorHandle proc5 = delegate(DataRow dr)
        {
            int a = Convert.ToInt32(dr["dtbtype"].ToString());
            if (a == 1)
            {
                return("顺丰");
            }
            else if (a == 2)
            {
                return("圆通");
            }
            else
            {
                return("中通");
            }
        };
        result.FieldFormator.Register("dtbtype", proc5);



        return(result);
    }