Esempio n. 1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(DNSABC.Model.DNSABC_Dns model)
 {
     return(dal.Add(model));
 }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DNSABC.Model.DNSABC_Dns model)
 {
     return(dal.Update(model));
 }
Esempio n. 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DNSABC.Model.DNSABC_Dns> DataTableToList(DataTable dt)
        {
            List <DNSABC.Model.DNSABC_Dns> modelList = new List <DNSABC.Model.DNSABC_Dns>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DNSABC.Model.DNSABC_Dns model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DNSABC.Model.DNSABC_Dns();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["ProductID"] != null && dt.Rows[n]["ProductID"].ToString() != "")
                    {
                        model.ProductID = int.Parse(dt.Rows[n]["ProductID"].ToString());
                    }
                    if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    if (dt.Rows[n]["Domain"] != null && dt.Rows[n]["Domain"].ToString() != "")
                    {
                        model.Domain = dt.Rows[n]["Domain"].ToString();
                    }
                    if (dt.Rows[n]["PASSWORD"] != null && dt.Rows[n]["PASSWORD"].ToString() != "")
                    {
                        model.PASSWORD = dt.Rows[n]["PASSWORD"].ToString();
                    }
                    if (dt.Rows[n]["StarTime"] != null && dt.Rows[n]["StarTime"].ToString() != "")
                    {
                        model.StarTime = DateTime.Parse(dt.Rows[n]["StarTime"].ToString());
                    }
                    if (dt.Rows[n]["EndTime"] != null && dt.Rows[n]["EndTime"].ToString() != "")
                    {
                        model.EndTime = DateTime.Parse(dt.Rows[n]["EndTime"].ToString());
                    }
                    if (dt.Rows[n]["isHost"] != null && dt.Rows[n]["isHost"].ToString() != "")
                    {
                        model.isHost = int.Parse(dt.Rows[n]["isHost"].ToString());
                    }
                    if (dt.Rows[n]["isTtl"] != null && dt.Rows[n]["isTtl"].ToString() != "")
                    {
                        model.isTtl = int.Parse(dt.Rows[n]["isTtl"].ToString());
                    }
                    if (dt.Rows[n]["isMonitor"] != null && dt.Rows[n]["isMonitor"].ToString() != "")
                    {
                        model.isMonitor = int.Parse(dt.Rows[n]["isMonitor"].ToString());
                    }
                    if (dt.Rows[n]["isGroupID"] != null && dt.Rows[n]["isGroupID"].ToString() != "")
                    {
                        model.isGroupID = int.Parse(dt.Rows[n]["isGroupID"].ToString());
                    }
                    if (dt.Rows[n]["State"] != null && dt.Rows[n]["State"].ToString() != "")
                    {
                        model.State = int.Parse(dt.Rows[n]["State"].ToString());
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].ToString();
                    }
                    if (dt.Rows[n]["UpdateTime"] != null && dt.Rows[n]["UpdateTime"].ToString() != "")
                    {
                        model.UpdateTime = DateTime.Parse(dt.Rows[n]["UpdateTime"].ToString());
                    }
                    if (dt.Rows[n]["CreateTime"] != null && dt.Rows[n]["CreateTime"].ToString() != "")
                    {
                        model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }