예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <lgk.Model.tb_globeParam> DataTableToList(DataTable dt)
        {
            List <lgk.Model.tb_globeParam> modelList = new List <lgk.Model.tb_globeParam>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                lgk.Model.tb_globeParam model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new lgk.Model.tb_globeParam();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = long.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["ParamName"] != null && dt.Rows[n]["ParamName"].ToString() != "")
                    {
                        model.ParamName = dt.Rows[n]["ParamName"].ToString();
                    }
                    if (dt.Rows[n]["ParamAmount"] != null && dt.Rows[n]["ParamAmount"].ToString() != "")
                    {
                        model.ParamAmount = decimal.Parse(dt.Rows[n]["ParamAmount"].ToString());
                    }
                    if (dt.Rows[n]["ParamInt"] != null && dt.Rows[n]["ParamInt"].ToString() != "")
                    {
                        model.ParamInt = int.Parse(dt.Rows[n]["ParamInt"].ToString());
                    }
                    if (dt.Rows[n]["ParamVarchar"] != null && dt.Rows[n]["ParamVarchar"].ToString() != "")
                    {
                        model.ParamVarchar = dt.Rows[n]["ParamVarchar"].ToString();
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
                    if (dt.Rows[n]["EndRemark"] != null && dt.Rows[n]["EndRemark"].ToString() != "")
                    {
                        model.EndRemark = dt.Rows[n]["EndRemark"].ToString();
                    }
                    if (dt.Rows[n]["ParamType"] != null && dt.Rows[n]["ParamType"].ToString() != "")
                    {
                        model.ParamType = int.Parse(dt.Rows[n]["ParamType"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_globeParam model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(lgk.Model.tb_globeParam model)
 {
     return(dal.Add(model));
 }