Пример #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hotel_app.Model.Qskyd_xz model)
 {
     return(dal.Add(model));
 }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hotel_app.Model.Qskyd_xz model)
 {
     return(dal.Update(model));
 }
Пример #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hotel_app.Model.Qskyd_xz> DataTableToList(DataTable dt)
        {
            List <Hotel_app.Model.Qskyd_xz> modelList = new List <Hotel_app.Model.Qskyd_xz>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hotel_app.Model.Qskyd_xz model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hotel_app.Model.Qskyd_xz();
                    if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["yydh"] != null && dt.Rows[n]["yydh"].ToString() != "")
                    {
                        model.yydh = dt.Rows[n]["yydh"].ToString();
                    }
                    if (dt.Rows[n]["qymc"] != null && dt.Rows[n]["qymc"].ToString() != "")
                    {
                        model.qymc = dt.Rows[n]["qymc"].ToString();
                    }
                    if (dt.Rows[n]["lsbh"] != null && dt.Rows[n]["lsbh"].ToString() != "")
                    {
                        model.lsbh = dt.Rows[n]["lsbh"].ToString();
                    }
                    if (dt.Rows[n]["krxm"] != null && dt.Rows[n]["krxm"].ToString() != "")
                    {
                        model.krxm = dt.Rows[n]["krxm"].ToString();
                    }
                    if (dt.Rows[n]["yddj"] != null && dt.Rows[n]["yddj"].ToString() != "")
                    {
                        model.yddj = dt.Rows[n]["yddj"].ToString();
                    }
                    if (dt.Rows[n]["zjhm"] != null && dt.Rows[n]["zjhm"].ToString() != "")
                    {
                        model.zjhm = dt.Rows[n]["zjhm"].ToString();
                    }
                    if (dt.Rows[n]["fjrb"] != null && dt.Rows[n]["fjrb"].ToString() != "")
                    {
                        model.fjrb = dt.Rows[n]["fjrb"].ToString();
                    }
                    if (dt.Rows[n]["fjbh"] != null && dt.Rows[n]["fjbh"].ToString() != "")
                    {
                        model.fjbh = dt.Rows[n]["fjbh"].ToString();
                    }
                    if (dt.Rows[n]["ddsj"] != null && dt.Rows[n]["ddsj"].ToString() != "")
                    {
                        model.ddsj = DateTime.Parse(dt.Rows[n]["ddsj"].ToString());
                    }
                    if (dt.Rows[n]["lksj"] != null && dt.Rows[n]["lksj"].ToString() != "")
                    {
                        model.lksj = DateTime.Parse(dt.Rows[n]["lksj"].ToString());
                    }
                    if (dt.Rows[n]["lksj_new"] != null && dt.Rows[n]["lksj_new"].ToString() != "")
                    {
                        model.lksj_new = DateTime.Parse(dt.Rows[n]["lksj_new"].ToString());
                    }
                    if (dt.Rows[n]["czy"] != null && dt.Rows[n]["czy"].ToString() != "")
                    {
                        model.czy = dt.Rows[n]["czy"].ToString();
                    }
                    if (dt.Rows[n]["czsj"] != null && dt.Rows[n]["czsj"].ToString() != "")
                    {
                        model.czsj = DateTime.Parse(dt.Rows[n]["czsj"].ToString());
                    }
                    if (dt.Rows[n]["is_top"] != null && dt.Rows[n]["is_top"].ToString() != "")
                    {
                        if ((dt.Rows[n]["is_top"].ToString() == "1") || (dt.Rows[n]["is_top"].ToString().ToLower() == "true"))
                        {
                            model.is_top = true;
                        }
                        else
                        {
                            model.is_top = false;
                        }
                    }
                    if (dt.Rows[n]["is_select"] != null && dt.Rows[n]["is_select"].ToString() != "")
                    {
                        if ((dt.Rows[n]["is_select"].ToString() == "1") || (dt.Rows[n]["is_select"].ToString().ToLower() == "true"))
                        {
                            model.is_select = true;
                        }
                        else
                        {
                            model.is_select = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }