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

            if (rowsCount > 0)
            {
                EtNet_Models.TargetProperty model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new EtNet_Models.TargetProperty();
                    if (dt.Rows[n]["TargetTypeId"] != null && dt.Rows[n]["TargetTypeId"].ToString() != "")
                    {
                        model.TargetTypeId = int.Parse(dt.Rows[n]["TargetTypeId"].ToString());
                    }
                    if (dt.Rows[n]["PropertyId"] != null && dt.Rows[n]["PropertyId"].ToString() != "")
                    {
                        model.PropertyId = int.Parse(dt.Rows[n]["PropertyId"].ToString());
                    }
                    if (dt.Rows[n]["PropertyNO"] != null && dt.Rows[n]["PropertyNO"].ToString() != "")
                    {
                        model.PropertyNO = dt.Rows[n]["PropertyNO"].ToString();
                    }
                    if (dt.Rows[n]["PropertyName"] != null && dt.Rows[n]["PropertyName"].ToString() != "")
                    {
                        model.PropertyName = dt.Rows[n]["PropertyName"].ToString();
                    }
                    if (dt.Rows[n]["PropertyType"] != null && dt.Rows[n]["PropertyType"].ToString() != "")
                    {
                        model.PropertyType = int.Parse(dt.Rows[n]["PropertyType"].ToString());
                    }
                    if (dt.Rows[n]["MainFlag"] != null && dt.Rows[n]["MainFlag"].ToString() != "")
                    {
                        if ((dt.Rows[n]["MainFlag"].ToString() == "1") || (dt.Rows[n]["MainFlag"].ToString().ToLower() == "true"))
                        {
                            model.MainFlag = true;
                        }
                        else
                        {
                            model.MainFlag = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(EtNet_Models.TargetProperty model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(EtNet_Models.TargetProperty model)
 {
     return(dal.Add(model));
 }