예제 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.PermisssionsNodes model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update PermisssionsNodes set ");
            strSql.Append("Fk_Permissions_Id=@Fk_Permissions_Id,");
            strSql.Append("Fk_Nodes_Id=@Fk_Nodes_Id");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Fk_Permissions_Id", SqlDbType.Int, 4),
                new SqlParameter("@Fk_Nodes_Id",       SqlDbType.Int, 4),
                new SqlParameter("@Id",                SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Fk_Permissions_Id;
            parameters[1].Value = model.Fk_Nodes_Id;
            parameters[2].Value = model.Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Maticsoft.Model.PermisssionsNodes model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into PermisssionsNodes(");
            strSql.Append("Fk_Permissions_Id,Fk_Nodes_Id)");
            strSql.Append(" values (");
            strSql.Append("@Fk_Permissions_Id,@Fk_Nodes_Id)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Fk_Permissions_Id", SqlDbType.Int, 4),
                new SqlParameter("@Fk_Nodes_Id",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Fk_Permissions_Id;
            parameters[1].Value = model.Fk_Nodes_Id;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #3
0
 private void ShowInfo(int Id)
 {
     Maticsoft.BLL.PermisssionsNodes   bll   = new Maticsoft.BLL.PermisssionsNodes();
     Maticsoft.Model.PermisssionsNodes model = bll.GetModel(Id);
     this.lblId.Text = model.Id.ToString();
     this.ddlFk_Permissions_Id.SelectedValue = model.Fk_Permissions_Id.ToString();
     this.ddlFk_Nodes_Id.SelectedValue       = model.Fk_Nodes_Id.ToString();
 }
예제 #4
0
 private void ShowInfo(int Id)
 {
     Maticsoft.BLL.PermisssionsNodes   bll   = new Maticsoft.BLL.PermisssionsNodes();
     Maticsoft.Model.PermisssionsNodes model = bll.GetModel(Id);
     this.lblId.Text = model.Id.ToString();
     BLL.Permissions   BLLPermissions   = new BLL.Permissions();
     Model.Permissions ModelPermissions = BLLPermissions.GetModel((int)model.Fk_Permissions_Id);
     this.lblFk_Permissions_Id.Text = ModelPermissions.Name;
     BLL.Nodes   BLLNodes   = new BLL.Nodes();
     Model.Nodes ModelNodes = BLLNodes.GetModel((int)model.Fk_Nodes_Id);
     this.lblFk_Nodes_Id.Text = ModelNodes.Name;
 }
예제 #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.PermisssionsNodes DataRowToModel(DataRow row)
 {
     Maticsoft.Model.PermisssionsNodes model = new Maticsoft.Model.PermisssionsNodes();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["Fk_Permissions_Id"] != null && row["Fk_Permissions_Id"].ToString() != "")
         {
             model.Fk_Permissions_Id = int.Parse(row["Fk_Permissions_Id"].ToString());
         }
         if (row["Fk_Nodes_Id"] != null && row["Fk_Nodes_Id"].ToString() != "")
         {
             model.Fk_Nodes_Id = int.Parse(row["Fk_Nodes_Id"].ToString());
         }
     }
     return(model);
 }
예제 #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int Fk_Permissions_Id = int.Parse(this.ddlFk_Permissions_Id.SelectedValue);
            int Fk_Nodes_Id       = int.Parse(this.ddlFk_Nodes_Id.SelectedValue);

            Maticsoft.Model.PermisssionsNodes model = new Maticsoft.Model.PermisssionsNodes();
            model.Fk_Permissions_Id = Fk_Permissions_Id;
            model.Fk_Nodes_Id       = Fk_Nodes_Id;

            Maticsoft.BLL.PermisssionsNodes bll = new Maticsoft.BLL.PermisssionsNodes();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "Add.aspx");
        }
예제 #7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.PermisssionsNodes GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,Fk_Permissions_Id,Fk_Nodes_Id from PermisssionsNodes ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

            Maticsoft.Model.PermisssionsNodes model = new Maticsoft.Model.PermisssionsNodes();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }