コード例 #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ClassLibrary.Model.RouteDetails model)
 {
     return(dal.Update(model));
 }
コード例 #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ClassLibrary.Model.RouteDetails> DataTableToList(DataTable dt)
        {
            List <ClassLibrary.Model.RouteDetails> modelList = new List <ClassLibrary.Model.RouteDetails>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ClassLibrary.Model.RouteDetails model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ClassLibrary.Model.RouteDetails();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["RouteID"].ToString() != "")
                    {
                        model.RouteID = int.Parse(dt.Rows[n]["RouteID"].ToString());
                    }
                    if (dt.Rows[n]["DayOrder"].ToString() != "")
                    {
                        model.DayOrder = int.Parse(dt.Rows[n]["DayOrder"].ToString());
                    }
                    model.DayDetail = dt.Rows[n]["DayDetail"].ToString();
                    model.DayTitle  = dt.Rows[n]["DayTitle"].ToString();

                    if (dt.Rows[n]["BreakFast"].ToString() != "")
                    {
                        model.BreakFast = Convert.ToBoolean(dt.Rows[n]["BreakFast"].ToString());
                    }

                    if (dt.Rows[n]["Lunch"].ToString() != "")
                    {
                        model.Lunch = Convert.ToBoolean(dt.Rows[n]["Lunch"].ToString());
                    }
                    if (dt.Rows[n]["Dinner"].ToString() != "")
                    {
                        model.Dinner = Convert.ToBoolean(dt.Rows[n]["Dinner"].ToString());
                    }
                    if (dt.Rows[n]["BreakFastDesc"].ToString() != "")
                    {
                        model.Breakfastdesc = dt.Rows[n]["BreakFastDesc"].ToString();
                    }
                    else
                    {
                        model.Breakfastdesc = "";
                    }
                    if (dt.Rows[n]["LunchDesc"].ToString() != "")
                    {
                        model.Lunchdesc = dt.Rows[n]["LunchDesc"].ToString();
                    }
                    else
                    {
                        model.Lunchdesc = "";
                    }
                    if (dt.Rows[n]["DinnerDesc"].ToString() != "")
                    {
                        model.Dinnerdesc = dt.Rows[n]["DinnerDesc"].ToString();
                    }
                    else
                    {
                        model.Dinnerdesc = "";
                    }
                    if (dt.Rows[n]["Hotel"].ToString() != "")
                    {
                        model.Hotel = dt.Rows[n]["Hotel"].ToString();
                    }
                    else
                    {
                        model.Hotel = "";
                    }
                    if (dt.Rows[n]["CreateTime"].ToString() != "")
                    {
                        model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString());
                    }
                    if (dt.Rows[n]["titletype"].ToString() != "")
                    {
                        model.Titletype = Convert.ToBoolean(dt.Rows[n]["titletype"].ToString());
                    }
                    if (dt.Rows[n]["scenicnum"].ToString() != "")
                    {
                        model.Scenicnum = Convert.ToInt32(dt.Rows[n]["scenicnum"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(ClassLibrary.Model.RouteDetails model)
 {
     return(dal.Add(model));
 }