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

            if (rowsCount > 0)
            {
                Hotel_app.Model.VIEW_tt_krlb model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hotel_app.Model.VIEW_tt_krlb();
                    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]["krly"] != null && dt.Rows[n]["krly"].ToString() != "")
                    {
                        model.krly = dt.Rows[n]["krly"].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]["Expr1"] != null && dt.Rows[n]["Expr1"].ToString() != "")
                    {
                        model.Expr1 = dt.Rows[n]["Expr1"].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]["lzfs"] != null && dt.Rows[n]["lzfs"].ToString() != "")
                    {
                        model.lzfs = decimal.Parse(dt.Rows[n]["lzfs"].ToString());
                    }
                    if (dt.Rows[n]["sjfjjg"] != null && dt.Rows[n]["sjfjjg"].ToString() != "")
                    {
                        model.sjfjjg = decimal.Parse(dt.Rows[n]["sjfjjg"].ToString());
                    }
                    if (dt.Rows[n]["xsy"] != null && dt.Rows[n]["xsy"].ToString() != "")
                    {
                        model.xsy = dt.Rows[n]["xsy"].ToString();
                    }
                    if (dt.Rows[n]["main_sec"] != null && dt.Rows[n]["main_sec"].ToString() != "")
                    {
                        model.main_sec = dt.Rows[n]["main_sec"].ToString();
                    }
                    if (dt.Rows[n]["ddbh"] != null && dt.Rows[n]["ddbh"].ToString() != "")
                    {
                        model.ddbh = dt.Rows[n]["ddbh"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }