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

            if (rowsCount > 0)
            {
                university.Model.CCOM.View_Admin model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new university.Model.CCOM.View_Admin();
                    if (dt.Rows[n]["User_id"].ToString() != "")
                    {
                        model.User_id = long.Parse(dt.Rows[n]["User_id"].ToString());
                    }
                    model.User_number   = dt.Rows[n]["User_number"].ToString();
                    model.User_password = dt.Rows[n]["User_password"].ToString();
                    model.User_realname = dt.Rows[n]["User_realname"].ToString();
                    if (dt.Rows[n]["User_ID_number_type"].ToString() != "")
                    {
                        model.User_ID_number_type = int.Parse(dt.Rows[n]["User_ID_number_type"].ToString());
                    }
                    model.User_ID_number = dt.Rows[n]["User_ID_number"].ToString();
                    if (dt.Rows[n]["User_gender"].ToString() != "")
                    {
                        if ((dt.Rows[n]["User_gender"].ToString() == "1") || (dt.Rows[n]["User_gender"].ToString().ToLower() == "true"))
                        {
                            model.User_gender = true;
                        }
                        else
                        {
                            model.User_gender = false;
                        }
                    }
                    if (dt.Rows[n]["User_birthday"].ToString() != "")
                    {
                        model.User_birthday = DateTime.Parse(dt.Rows[n]["User_birthday"].ToString());
                    }
                    if (dt.Rows[n]["User_type"].ToString() != "")
                    {
                        model.User_type = int.Parse(dt.Rows[n]["User_type"].ToString());
                    }
                    if (dt.Rows[n]["User_addtime"].ToString() != "")
                    {
                        model.User_addtime = DateTime.Parse(dt.Rows[n]["User_addtime"].ToString());
                    }
                    if (dt.Rows[n]["User_status"].ToString() != "")
                    {
                        if ((dt.Rows[n]["User_status"].ToString() == "1") || (dt.Rows[n]["User_status"].ToString().ToLower() == "true"))
                        {
                            model.User_status = true;
                        }
                        else
                        {
                            model.User_status = false;
                        }
                    }
                    if (dt.Rows[n]["Agency_id"].ToString() != "")
                    {
                        model.Agency_id = int.Parse(dt.Rows[n]["Agency_id"].ToString());
                    }
                    model.Agency_name = dt.Rows[n]["Agency_name"].ToString();
                    if (dt.Rows[n]["Role_id"].ToString() != "")
                    {
                        model.Role_id = int.Parse(dt.Rows[n]["Role_id"].ToString());
                    }
                    model.Role_name = dt.Rows[n]["Role_name"].ToString();


                    modelList.Add(model);
                }
            }
            return(modelList);
        }