コード例 #1
0
ファイル: SysManage1.cs プロジェクト: a14907/zhanneisousuo
        public int AddTreeNode(PZYM.Shop.Model.SysNode model)
		{
			model.NodeID=GetMaxId();

			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into S_Tree(");
			strSql.Append("NodeID,Text,ParentID,Location,OrderID,comment,Url,PermissionID,ImageUrl)");
			strSql.Append(" values (");
			strSql.Append("@NodeID,@Text,@ParentID,@Location,@OrderID,@comment,@Url,@PermissionID,@ImageUrl)");
				
			//
			SqlParameter[] parameters = {
											new SqlParameter("@NodeID", SqlDbType.Int,4),
											new SqlParameter("@Text", SqlDbType.VarChar,100),
											new SqlParameter("@ParentID", SqlDbType.Int,4),										
											new SqlParameter("@Location", SqlDbType.VarChar,50),
											new SqlParameter("@OrderID", SqlDbType.Int,4),
											new SqlParameter("@comment", SqlDbType.VarChar,50),
											new SqlParameter("@Url", SqlDbType.VarChar,100),
											new SqlParameter("@PermissionID", SqlDbType.Int,4),
											new SqlParameter("@ImageUrl", SqlDbType.VarChar,100)};
			parameters[0].Value = model.NodeID;
			parameters[1].Value = model.Text;
			parameters[2].Value = model.ParentID;		
			parameters[3].Value = model.Location;
			parameters[4].Value = model.OrderID;
			parameters[5].Value = model.Comment;
			parameters[6].Value = model.Url;
			parameters[7].Value = model.PermissionID;
			parameters[8].Value = model.ImageUrl;
		
			DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			return model.NodeID;
		}
コード例 #2
0
ファイル: BooksServices.cs プロジェクト: a14907/zhanneisousuo
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(PZYM.Shop.Model.Books model) {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update Books set ");
            strSql.Append("Title=@Title,");
            strSql.Append("Author=@Author,");
            strSql.Append("PublisherId=@PublisherId,");
            strSql.Append("PublishDate=@PublishDate,");
            strSql.Append("ISBN=@ISBN,");
            strSql.Append("WordsCount=@WordsCount,");
            strSql.Append("UnitPrice=@UnitPrice,");
            strSql.Append("ContentDescription=@ContentDescription,");
            strSql.Append("AurhorDescription=@AurhorDescription,");
            strSql.Append("EditorComment=@EditorComment,");
            strSql.Append("TOC=@TOC,");
            strSql.Append("CategoryId=@CategoryId,");
            strSql.Append("Clicks=@Clicks");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters = {
					new SqlParameter("@Title", SqlDbType.NVarChar,200),
					new SqlParameter("@Author", SqlDbType.NVarChar,200),
					new SqlParameter("@PublisherId", SqlDbType.Int,4),
					new SqlParameter("@PublishDate", SqlDbType.DateTime),
					new SqlParameter("@ISBN", SqlDbType.NVarChar,50),
					new SqlParameter("@WordsCount", SqlDbType.Int,4),
					new SqlParameter("@UnitPrice", SqlDbType.Money,8),
					new SqlParameter("@ContentDescription", SqlDbType.NVarChar),
					new SqlParameter("@AurhorDescription", SqlDbType.NVarChar),
					new SqlParameter("@EditorComment", SqlDbType.NVarChar),
					new SqlParameter("@TOC", SqlDbType.NVarChar),
					new SqlParameter("@CategoryId", SqlDbType.Int,4),
					new SqlParameter("@Clicks", SqlDbType.Int,4),
					new SqlParameter("@Id", SqlDbType.Int,4)};
            parameters[0].Value = model.Title;
            parameters[1].Value = model.Author;
            parameters[2].Value = model.PublisherId;
            parameters[3].Value = model.PublishDate;
            parameters[4].Value = model.ISBN;
            parameters[5].Value = model.WordsCount;
            parameters[6].Value = model.UnitPrice;
            parameters[7].Value = model.ContentDescription;
            parameters[8].Value = model.AurhorDescription;
            parameters[9].Value = model.EditorComment;
            parameters[10].Value = model.TOC;
            parameters[11].Value = model.CategoryId;
            parameters[12].Value = model.Clicks;
            parameters[13].Value = model.Id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if(rows > 0) {
                return true;
            } else {
                return false;
            }
        }
コード例 #3
0
ファイル: SysManage.cs プロジェクト: a14907/zhanneisousuo
        public void UpdateNode(PZYM.Shop.Model.SysNode node)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update S_Tree set ");
			strSql.Append("Text='"+node.Text+"',");
			strSql.Append("ParentID="+node.ParentID.ToString()+",");
			strSql.Append("Location='"+node.Location+"',");
			strSql.Append("OrderID="+node.OrderID+",");
			strSql.Append("comment='"+node.Comment+"',");
			strSql.Append("Url='"+node.Url+"',");
			strSql.Append("PermissionID="+node.PermissionID+",");
			strSql.Append("ImageUrl='"+node.ImageUrl+"'");
			strSql.Append(" where NodeID="+node.NodeID);
			DbHelperSQL.ExecuteSql(strSql.ToString());

		}
コード例 #4
0
ファイル: BooksServices.cs プロジェクト: a14907/zhanneisousuo
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(PZYM.Shop.Model.Books model) {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Books(");
            strSql.Append("Title,Author,PublisherId,PublishDate,ISBN,WordsCount,UnitPrice,ContentDescription,AurhorDescription,EditorComment,TOC,CategoryId,Clicks)");
            strSql.Append(" values (");
            strSql.Append("@Title,@Author,@PublisherId,@PublishDate,@ISBN,@WordsCount,@UnitPrice,@ContentDescription,@AurhorDescription,@EditorComment,@TOC,@CategoryId,@Clicks)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@Title", SqlDbType.NVarChar,200),
					new SqlParameter("@Author", SqlDbType.NVarChar,200),
					new SqlParameter("@PublisherId", SqlDbType.Int,4),
					new SqlParameter("@PublishDate", SqlDbType.DateTime),
					new SqlParameter("@ISBN", SqlDbType.NVarChar,50),
					new SqlParameter("@WordsCount", SqlDbType.Int,4),
					new SqlParameter("@UnitPrice", SqlDbType.Money,8),
					new SqlParameter("@ContentDescription", SqlDbType.NVarChar),
					new SqlParameter("@AurhorDescription", SqlDbType.NVarChar),
					new SqlParameter("@EditorComment", SqlDbType.NVarChar),
					new SqlParameter("@TOC", SqlDbType.NVarChar),
					new SqlParameter("@CategoryId", SqlDbType.Int,4),
					new SqlParameter("@Clicks", SqlDbType.Int,4)};
            parameters[0].Value = model.Title;
            parameters[1].Value = model.Author;
            parameters[2].Value = model.PublisherId;
            parameters[3].Value = model.PublishDate;
            parameters[4].Value = model.ISBN;
            parameters[5].Value = model.WordsCount;
            parameters[6].Value = model.UnitPrice;
            parameters[7].Value = model.ContentDescription;
            parameters[8].Value = model.AurhorDescription;
            parameters[9].Value = model.EditorComment;
            parameters[10].Value = model.TOC;
            parameters[11].Value = model.CategoryId;
            parameters[12].Value = model.Clicks;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if(obj == null) {
                return 0;
            } else {
                return Convert.ToInt32(obj);
            }
        }
コード例 #5
0
ファイル: SysManage.cs プロジェクト: a14907/zhanneisousuo
        public int AddTreeNode(PZYM.Shop.Model.SysNode node)
		{
			node.NodeID=GetMaxId();

			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into S_Tree(");
			strSql.Append("NodeID,Text,ParentID,Location,OrderID,comment,Url,PermissionID,ImageUrl)");
			strSql.Append(" values (");
			strSql.Append("'"+node.NodeID+"',");
			strSql.Append("'"+node.Text+"',");
			strSql.Append(""+node.ParentID+",");			
			strSql.Append("'"+node.Location+"',");
			strSql.Append(""+node.OrderID+",");		
			strSql.Append("'"+node.Comment+"',");
			strSql.Append("'"+node.Url+"',");
			strSql.Append(""+node.PermissionID+",");
			strSql.Append("'"+node.ImageUrl+"'");
			strSql.Append(")");						
			DbHelperSQL.ExecuteSql(strSql.ToString());
			return node.NodeID;

		}
コード例 #6
0
ファイル: SysManage1.cs プロジェクト: a14907/zhanneisousuo
        public void UpdateNode(PZYM.Shop.Model.SysNode model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update S_Tree set ");
			strSql.Append("Text=@Text,");
			strSql.Append("ParentID=@ParentID,");
			strSql.Append("Location=@Location,");
			strSql.Append("OrderID=@OrderID,");
			strSql.Append("comment=@comment,");
			strSql.Append("Url=@Url,");
			strSql.Append("PermissionID=@PermissionID,");
			strSql.Append("ImageUrl=@ImageUrl");
			strSql.Append(" where NodeID=@NodeID");

			SqlParameter[] parameters = {
											new SqlParameter("@NodeID", SqlDbType.Int,4),
											new SqlParameter("@Text", SqlDbType.VarChar,100),
											new SqlParameter("@ParentID", SqlDbType.Int,4),										
											new SqlParameter("@Location", SqlDbType.VarChar,50),
											new SqlParameter("@OrderID", SqlDbType.Int,4),
											new SqlParameter("@comment", SqlDbType.VarChar,50),
											new SqlParameter("@Url", SqlDbType.VarChar,100),
											new SqlParameter("@PermissionID", SqlDbType.Int,4),
											new SqlParameter("@ImageUrl", SqlDbType.VarChar,100)};
			parameters[0].Value = model.NodeID;
			parameters[1].Value = model.Text;
			parameters[2].Value = model.ParentID;		
			parameters[3].Value = model.Location;
			parameters[4].Value = model.OrderID;
			parameters[5].Value = model.Comment;
			parameters[6].Value = model.Url;
			parameters[7].Value = model.PermissionID;
			parameters[8].Value = model.ImageUrl;

			DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);

		}
コード例 #7
0
ファイル: BooksManager.cs プロジェクト: a14907/zhanneisousuo
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(PZYM.Shop.Model.Books model)
		{
			return dal.Update(model);
		}
コード例 #8
0
ファイル: BooksManager.cs プロジェクト: a14907/zhanneisousuo
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int  Add(PZYM.Shop.Model.Books model)
		{
			return dal.Add(model);
		}