Esempio n. 1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RoadSolution.Model.Userinfo GetModel(string UserID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from Userinfo ");
            strSql.Append(" where UserID='" + UserID + "'");
            RoadSolution.Model.Userinfo model = new RoadSolution.Model.Userinfo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            model.UserID = UserID;
            if (ds.Tables[0].Rows.Count > 0)
            {
                model.Department = ds.Tables[0].Rows[0]["Department"].ToString();
                model.Road       = ds.Tables[0].Rows[0]["Road"].ToString();
                model.Name       = ds.Tables[0].Rows[0]["Name"].ToString();
                model.Gender     = ds.Tables[0].Rows[0]["Gender"].ToString();
                model.Photo      = ds.Tables[0].Rows[0]["Photo"].ToString();
                if (ds.Tables[0].Rows[0]["Age"].ToString() != "")
                {
                    model.Age = int.Parse(ds.Tables[0].Rows[0]["Age"].ToString());
                }
                model.WorkID = ds.Tables[0].Rows[0]["WorkID"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(RoadSolution.Model.Userinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Userinfo set ");
            strSql.Append("Department='" + model.Department + "',");
            strSql.Append("Road='" + model.Road + "',");
            strSql.Append("Name='" + model.Name + "',");
            strSql.Append("Gender='" + model.Gender + "',");
            strSql.Append("Photo='" + model.Photo + "',");
            strSql.Append("Age=" + model.Age + ",");
            strSql.Append("WorkID='" + model.WorkID + "'");
            strSql.Append(" where UserID='" + model.UserID + "'");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string Add(RoadSolution.Model.Userinfo model)
        {
            model.UserID = GetMaxId().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Userinfo(");
            strSql.Append("UserID,Department,Road,Name,Gender,Photo,Age,WorkID");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("'" + model.UserID + "',");
            strSql.Append("'" + model.Department + "',");
            strSql.Append("'" + model.Road + "',");
            strSql.Append("'" + model.Name + "',");
            strSql.Append("'" + model.Gender + "',");
            strSql.Append("'" + model.Photo + "',");
            strSql.Append("" + model.Age + ",");
            strSql.Append("'" + model.WorkID + "'");
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
            return(model.UserID);
        }
Esempio n. 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(RoadSolution.Model.Userinfo model)
 {
     dal.Update(model);
 }
Esempio n. 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public string Add(RoadSolution.Model.Userinfo model)
 {
     return(dal.Add(model));
 }