using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Data.SqlClient;
|
using System.Text;
|
using Terra.YaoGan.Common;
|
|
namespace Terra.YaoGan.Service
|
{
|
public class FirstCatlogService
|
{
|
sqlserverDBhelper DB = new sqlserverDBhelper();
|
|
public int Add(string name, string pname)
|
{
|
|
string id = Guid.NewGuid().ToString("N"); ;
|
string s = "SELECT * FROM SecondCatlog WHERE name='" + pname + "'";
|
DataTable DT = DB.QueryTable(s);
|
string pid = DT.Rows[0][0].ToString();
|
|
string sql = string.Format("INSERT INTO ThirdCatlog VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}');", id, name, DateTime.Now.ToString(), "", "false", "false", "false", pid);
|
|
return DB.GetRow(sql);
|
// return -1;
|
}
|
|
|
|
|
public DataTable GetTable(string where)
|
{
|
string sql = " select ft.name,st.name sname,st.id from (select * from FirstCatlog where parentId='" + where+ "') ft LEFT JOIN SecondCatlog st on ft.id=st.FirstPid ORDER BY ft.name ;";
|
DataTable dt= DB.QueryTable(sql);
|
return dt;
|
}
|
|
|
|
|
}
|
|
|
}
|