subsnic实例!
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using SubSonic;
using ygApp.DAL;
namespace BLL
{
public class epiboly
{
public DataTable readEpiboly()
{
Query q = ygApp.DAL.Epiboly.CreateQuery();
q.AddWhere(ygApp.DAL.Epiboly.Columns.Tag, 0);
DataTable dtb = q.ExecuteDataSet().Tables[0];
return dtb;
}
public DataTable readEpiboly(int id)
{
Query q = ygApp.DAL.Epiboly.CreateQuery();
q.AddWhere(ygApp.DAL.Epiboly.Columns.Id, id);
DataTable dtb = q.ExecuteDataSet().Tables[0];
return dtb;
}
public static bool del(int id)
{
Query auditing = ygApp.DAL.Epiboly.CreateQuery();
auditing.QueryType = QueryType.Update;
auditing.AddWhere(ygApp.DAL.Epiboly.Columns.Id, id);
auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.Tag, 1);
try
{
auditing.Execute();
return true;
}
catch
{
return false;
}
}
public bool update(int Id,string ItamName,string Name,string Email,string Mobile,string Telephone,string ReqIntro,DateTime? WriteTime,int? Tag)
{
//Query auditing = ygApp.DAL.Epiboly.CreateQuery();
//auditing.QueryType = QueryType.Update;
//auditing.AddWhere(ygApp.DAL.Epiboly.Columns.Id, Id);
//auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.ItamName, ItamName);
//auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.Name, Name);
//auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.Email, Email);
//auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.Mobile, Mobile);
//auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.Telephone, Telephone);
//auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.ReqIntro, ReqIntro);
//auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.WriteTime, WriteTime);
////auditing.AddUpdateSetting(ygApp.DAL.Epiboly.Columns.ItamName, ItamName);
//try
//{
// auditing.Execute();
// return true;
//}
//catch
//{
// return false;
//}
EpibolyController mc = new EpibolyController();
try
{
mc.Update(Id, ItamName, Name, Email, Mobile, Telephone, ReqIntro, WriteTime, Tag);
return true;
}
catch
{
return false;
}
}
}
}