Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(GZS.Model.Menu.System model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into System(");
            strSql.Append("Tem)");
            strSql.Append(" values (");
            strSql.Append("@Tem)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Tem", SqlDbType.VarChar, 100)
            };
            parameters[0].Value = model.Tem;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public GZS.Model.Menu.System GetModel(string EmployeeID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 EmployeeID,Tem from System ");
            strSql.Append(" where EmployeeID=@EmployeeID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EmployeeID", SqlDbType.NVarChar)
            };
            parameters[0].Value = EmployeeID;

            GZS.Model.Menu.System model = new GZS.Model.Menu.System();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["EmployeeID"].ToString() != "")
                {
                    model.EmployeeID = ds.Tables[0].Rows[0]["EmployeeID"].ToString();
                }
                model.Tem = ds.Tables[0].Rows[0]["Tem"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <GZS.Model.Menu.System> DataTableToList(DataTable dt)
        {
            List <GZS.Model.Menu.System> modelList = new List <GZS.Model.Menu.System>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                GZS.Model.Menu.System model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new GZS.Model.Menu.System();
                    if (dt.Rows[n]["EmployeeID"].ToString() != "")
                    {
                        model.EmployeeID = dt.Rows[n]["EmployeeID"].ToString();
                    }
                    model.Tem = dt.Rows[n]["Tem"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(GZS.Model.Menu.System model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update System set ");
            strSql.Append("Tem=@Tem");
            strSql.Append(" where EmployeeID=@EmployeeID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@EmployeeID", SqlDbType.NVarChar),
                new SqlParameter("@Tem",        SqlDbType.VarChar, 100)
            };
            parameters[0].Value = model.EmployeeID;
            parameters[1].Value = model.Tem;

            if (DbHelperSQL.ExecuteSql(strSql.ToString(), parameters) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(GZS.Model.Menu.System model)
 {
     dal.Update(model);
 }
Esempio n. 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(GZS.Model.Menu.System model)
 {
     return(dal.Add(model));
 }