コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LYSC.CompanyWeb.Model.HKSJ_Clients> DataTableToList(DataTable dt)
        {
            List <LYSC.CompanyWeb.Model.HKSJ_Clients> modelList = new List <LYSC.CompanyWeb.Model.HKSJ_Clients>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LYSC.CompanyWeb.Model.HKSJ_Clients model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LYSC.CompanyWeb.Model.HKSJ_Clients();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["title"] != null && dt.Rows[n]["title"].ToString() != "")
                    {
                        model.title = dt.Rows[n]["title"].ToString();
                    }
                    if (dt.Rows[n]["softName"] != null && dt.Rows[n]["softName"].ToString() != "")
                    {
                        model.softName = dt.Rows[n]["softName"].ToString();
                    }
                    if (dt.Rows[n]["content"] != null && dt.Rows[n]["content"].ToString() != "")
                    {
                        model.content = dt.Rows[n]["content"].ToString();
                    }
                    if (dt.Rows[n]["liaisonPhone"] != null && dt.Rows[n]["liaisonPhone"].ToString() != "")
                    {
                        model.liaisonPhone = dt.Rows[n]["liaisonPhone"].ToString();
                    }
                    if (dt.Rows[n]["liaisonPeple"] != null && dt.Rows[n]["liaisonPeple"].ToString() != "")
                    {
                        model.liaisonPeple = dt.Rows[n]["liaisonPeple"].ToString();
                    }
                    if (dt.Rows[n]["date"] != null && dt.Rows[n]["date"].ToString() != "")
                    {
                        model.date = DateTime.Parse(dt.Rows[n]["date"].ToString());
                    }
                    if (dt.Rows[n]["peple"] != null && dt.Rows[n]["peple"].ToString() != "")
                    {
                        model.peple = dt.Rows[n]["peple"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LYSC.CompanyWeb.Model.HKSJ_Clients model)
 {
     return(dal.Update(model));
 }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LYSC.CompanyWeb.Model.HKSJ_Clients model)
 {
     return(dal.Add(model));
 }