/// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(GTMIS.Model.T_SysPremissionModule model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_SysPremissionModule(");
            strSql.Append("FPremissionModuleID,FPremissionID,FModulleID,FCreateBy,FCreateDate");
            strSql.Append(") values (");
            strSql.Append("@FPremissionModuleID,@FPremissionID,@FModulleID,@FCreateBy,@FCreateDate");
            strSql.Append(") ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@FPremissionModuleID", SqlDbType.Int,       4),
                new SqlParameter("@FPremissionID",       SqlDbType.Int,       4),
                new SqlParameter("@FModulleID",          SqlDbType.Int,       4),
                new SqlParameter("@FCreateBy",           SqlDbType.NVarChar, 50),
                new SqlParameter("@FCreateDate",         SqlDbType.DateTime)
            };

            parameters[0].Value = model.FPremissionModuleID;
            parameters[1].Value = model.FPremissionID;
            parameters[2].Value = model.FModulleID;
            parameters[3].Value = model.FCreateBy;
            parameters[4].Value = model.FCreateDate;
            //DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
            SqlHelper.ExecuteScalar(strSql.ToString(), parameters);
        }
Beispiel #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <GTMIS.Model.T_SysPremissionModule> DataTableToList(DataTable dt)
        {
            List <GTMIS.Model.T_SysPremissionModule> modelList = new List <GTMIS.Model.T_SysPremissionModule>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                GTMIS.Model.T_SysPremissionModule model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new GTMIS.Model.T_SysPremissionModule();
                    if (dt.Rows[n]["FPremissionModuleID"].ToString() != "")
                    {
                        model.FPremissionModuleID = int.Parse(dt.Rows[n]["FPremissionModuleID"].ToString());
                    }
                    if (dt.Rows[n]["FPremissionID"].ToString() != "")
                    {
                        model.FPremissionID = int.Parse(dt.Rows[n]["FPremissionID"].ToString());
                    }
                    if (dt.Rows[n]["FModulleID"].ToString() != "")
                    {
                        model.FModulleID = int.Parse(dt.Rows[n]["FModulleID"].ToString());
                    }
                    model.FCreateBy = dt.Rows[n]["FCreateBy"].ToString();
                    if (dt.Rows[n]["FCreateDate"].ToString() != "")
                    {
                        model.FCreateDate = DateTime.Parse(dt.Rows[n]["FCreateDate"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public GTMIS.Model.T_SysPremissionModule GetModel(int FPremissionModuleID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select FPremissionModuleID, FPremissionID, FModulleID, FCreateBy, FCreateDate  ");
            strSql.Append("  from T_SysPremissionModule ");
            strSql.Append(" where FPremissionModuleID=@FPremissionModuleID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@FPremissionModuleID", SqlDbType.Int, 4)
            };
            parameters[0].Value = FPremissionModuleID;


            GTMIS.Model.T_SysPremissionModule model = new GTMIS.Model.T_SysPremissionModule();
            //DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            DataTable dt = SqlHelper.ExecuteDataTable(conn, strSql.ToString(), parameters);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["FPremissionModuleID"].ToString() != "")
                {
                    model.FPremissionModuleID = int.Parse(dt.Rows[0]["FPremissionModuleID"].ToString());
                }
                if (dt.Rows[0]["FPremissionID"].ToString() != "")
                {
                    model.FPremissionID = int.Parse(dt.Rows[0]["FPremissionID"].ToString());
                }
                if (dt.Rows[0]["FModulleID"].ToString() != "")
                {
                    model.FModulleID = int.Parse(dt.Rows[0]["FModulleID"].ToString());
                }
                model.FCreateBy = dt.Rows[0]["FCreateBy"].ToString();
                if (dt.Rows[0]["FCreateDate"].ToString() != "")
                {
                    model.FCreateDate = DateTime.Parse(dt.Rows[0]["FCreateDate"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(GTMIS.Model.T_SysPremissionModule model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_SysPremissionModule set ");

            strSql.Append(" FPremissionModuleID = @FPremissionModuleID , ");
            strSql.Append(" FPremissionID = @FPremissionID , ");
            strSql.Append(" FModulleID = @FModulleID , ");
            strSql.Append(" FCreateBy = @FCreateBy , ");
            strSql.Append(" FCreateDate = @FCreateDate  ");
            strSql.Append(" where FPremissionModuleID=@FPremissionModuleID  ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@FPremissionModuleID", SqlDbType.Int,       4),
                new SqlParameter("@FPremissionID",       SqlDbType.Int,       4),
                new SqlParameter("@FModulleID",          SqlDbType.Int,       4),
                new SqlParameter("@FCreateBy",           SqlDbType.NVarChar, 50),
                new SqlParameter("@FCreateDate",         SqlDbType.DateTime)
            };

            parameters[0].Value = model.FPremissionModuleID;
            parameters[1].Value = model.FPremissionID;
            parameters[2].Value = model.FModulleID;
            parameters[3].Value = model.FCreateBy;
            parameters[4].Value = model.FCreateDate;
            //int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
            int rows = SqlHelper.ExecuteNonQuery(conn, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GTMIS.Model.T_SysPremissionModule model)
 {
     return(dal.Update(model));
 }
Beispiel #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(GTMIS.Model.T_SysPremissionModule model)
 {
     dal.Add(model);
 }