Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JMP.MDL.appmonitor> DataTableToList(DataTable dt)
        {
            List <JMP.MDL.appmonitor> modelList = new List <JMP.MDL.appmonitor>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JMP.MDL.appmonitor model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JMP.MDL.appmonitor();
                    if (dt.Rows[n]["a_id"].ToString() != "")
                    {
                        model.a_id = int.Parse(dt.Rows[n]["a_id"].ToString());
                    }
                    if (dt.Rows[n]["a_appid"].ToString() != "")
                    {
                        model.a_appid = int.Parse(dt.Rows[n]["a_appid"].ToString());
                    }
                    if (dt.Rows[n]["a_request"].ToString() != "")
                    {
                        model.a_request = decimal.Parse(dt.Rows[n]["a_request"].ToString());
                    }
                    if (dt.Rows[n]["a_minute"].ToString() != "")
                    {
                        model.a_minute = int.Parse(dt.Rows[n]["a_minute"].ToString());
                    }
                    if (dt.Rows[n]["a_state"].ToString() != "")
                    {
                        model.a_state = int.Parse(dt.Rows[n]["a_state"].ToString());
                    }
                    if (dt.Rows[n]["a_datetime"].ToString() != "")
                    {
                        model.a_datetime = DateTime.Parse(dt.Rows[n]["a_datetime"].ToString());
                    }
                    //a_type
                    if (dt.Rows[n]["a_type"].ToString() != "")
                    {
                        model.a_type = int.Parse(dt.Rows[n]["a_type"].ToString());
                    }
                    model.a_time_range = dt.Rows[n]["a_time_range"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JMP.MDL.appmonitor model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(JMP.MDL.appmonitor model)
 {
     return(dal.Add(model));
 }