📄 grd_mis_1.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using PersistenceLayer;
using BusinessEntity;
/// <summary>
/// grd_MIS 的摘要说明
/// </summary>
namespace grd_MIS
{
public partial class manager
{
public manager()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public static bool Add_Report(String title,String name,DateTime timer,String place,String content,String type,String remark)
{
//功能说明:向数据库学术报告信息表中添加一条记录
//添加成功返回true, 失败返回false
ReportInfoEntity report = new ReportInfoEntity();
report.ReportName = title;//学术报告名字
report.ReportSpeaker = name;//学术报告人名称
report.ReportDate = timer;//学术报告时间
report.ReportReplace = place;//学术报告地点
report.ReportConent = content;//学术报告内容
report.ReportType = type;//学术报告类型
report.Remark = remark;//学术报告备注
try
{
report.Save();
}
catch //(PlException exp)
{ /////插入失败,返回false
return false;
}
return true;
}
public static bool Add_ReportJioner(int ReportNum, String StuNum, String remark)
{
//功能说明:向参加学术报告人员名单表中添加一条信息
JoinReportStuEntity joinReportStu = new JoinReportStuEntity();
joinReportStu.ReportID = ReportNum;//学术报告的ID
joinReportStu.StuID = StuNum;//参加学术报告的学生ID
joinReportStu.Remark = remark;//remark备注
try
{
joinReportStu.Save();//insert a record
}
catch //(PlException exp)
{//insert failed ,return false
return false;
}
return true;
}
public static bool Add_Activity(String title, int money, DateTime timer, String place, String content, String type, String remark)
{
//功能说明:向数据库的学生活动信息表添加一条记录
//添加成功返回true, 失败返回false
ActivityInfoEntity activityInfo = new ActivityInfoEntity();
activityInfo.ActivityName = title;
//title---活动名称
activityInfo.ActivityDate = timer;
//timer—活动时间
activityInfo.ActivityPlace = place;
//place—报告地点
activityInfo.ActivityContent = content;
//content---活动内容
activityInfo.ActivityType = type;
//type—活动类型
activityInfo.ActivityOutlay = Convert.ToString(money);
//nomey—活动金费
activityInfo.Remark = remark;
//remark—备注---
try
{//insert the record
activityInfo.Save();
}
catch //(PlException exp)
{//insert failed,return false
return false;
}
return true;
}
public static bool Add_ActivityJioner(int ActivityNum, String StuNum, String remark)
{
//功能说明:向 JoinActivStu表中添加一条信息
//添加成功返回true, 失败返回false
JoinActivStuEntity joinActivityStu = new JoinActivStuEntity();
joinActivityStu.ActivityID = ActivityNum;
//ActivityNum--活动的ID
joinActivityStu.StuID = StuNum;
//StuNum 学生学号
joinActivityStu.Remark = remark;
//remark备注
try
{
joinActivityStu.Save();
}
catch //(PlException exp)
{//insert failed,return false
return false;
}
return true;
}
public static bool Add_ExcellInfo(String ExcellenceName, String Remark,int years/*年份*/,int tearm/*学期*/,String filename,String context/*评优介绍*/)
{
//向 ExcellInfo表中添加一条记录
ExcellInfoEntity excellInfo = new ExcellInfoEntity();
excellInfo.ExcellenceName = ExcellenceName;
excellInfo.Remark = Remark;
excellInfo.TermYear = years;
excellInfo.Term = tearm;
excellInfo.FileName = filename;
excellInfo.ExcellenceContent = context;
excellInfo.Enable = 1;
try
{
excellInfo.Save();
}
catch //(PlException exp)
{
return false;
}
return true;
}
public static bool Add_ScholarInfo(String ScholarshipName, int ScholarshipMoney, String Remark, int years/*年份*/, int tearm/*学期*/, String filename, String context/*奖学金介绍*/)
{
//向 ScholarInfo表中添加一条记录
ScholarInfoEntity scholarInfo = new ScholarInfoEntity();
scholarInfo.ScholarshipName = ScholarshipName;
scholarInfo.ScholarshipMoney = ScholarshipMoney;
scholarInfo.Remark = Remark;
scholarInfo.TermYear = years;
scholarInfo.Term = tearm;
scholarInfo.FileName = filename;
scholarInfo.ScholarshipContent = context;
scholarInfo.Enable = 1;
try
{
scholarInfo.Save();
}
catch //(PlException exp)
{
return false;
}
return true;
}
public static bool Add_OneLoanInfo(String StuID, DateTime LoanData, String Remark, int LoanMoney)
{
//向LoanInfo表中添加一条记录
LoanInfoEntity loanInfo = new LoanInfoEntity();
loanInfo.StuID = StuID;
loanInfo.LoanData = LoanData;
loanInfo.Remark = Remark;
loanInfo.LoanMoney = Convert.ToString(LoanMoney);
try
{
loanInfo.Save();
}
catch //(Exception exp)
{
return false;
}
return true;
}
public static bool Save_Report(int id, String title, String name, DateTime timer, String place, String content, String type, String remark)
{
//向数据库学术报告信息表中修改ReportID==id的一条记录
//修改成功返回true, 失败返回false
UpdateCriteria uc = new UpdateCriteria(typeof(ReportInfoEntity));
Condition c1 = uc.GetNewCondition();
c1.AddEqualTo(ReportInfoEntity.__REPORTID, id);
uc.AddAttributeForUpdate(ReportInfoEntity.__REPORTNAME, title);
//title---报告名称
uc.AddAttributeForUpdate(ReportInfoEntity.__REPORTSPEAKER, name);
//name---报告人
uc.AddAttributeForUpdate(ReportInfoEntity.__REPORTDATE, timer);
//timer—报告时间
uc.AddAttributeForUpdate(ReportInfoEntity.__REPORTREPLACE, place);
//place—报告地点
uc.AddAttributeForUpdate(ReportInfoEntity.__REPORTCONENT, content);
//content---报告内容
uc.AddAttributeForUpdate(ReportInfoEntity.__REPORTTYPE, type);
//type—报告类型
uc.AddAttributeForUpdate(ReportInfoEntity.__REMARK, remark);
//remakrk—备注
try
{
int re = uc.Perform();
if (re > 0)
return true;
else
return false;
}
catch //(PlException exp)
{
return false;
}
// return true;
}
public static bool Save_Activity(int id, String title, int nomey, DateTime timer, String place, String content, String type, String remark)
{
//向数据库的学生活动信息表更新 ActivityID=id的这条记录
//添加成功返回true, 失败返回false
UpdateCriteria uc = new UpdateCriteria(typeof(ActivityInfoEntity));
Condition c1 = uc.GetNewCondition();
c1.AddEqualTo(ActivityInfoEntity.__ACTIVITYID, id);
uc.AddAttributeForUpdate(ActivityInfoEntity.__ACTIVITYNAME, title);
//title---活动名称
uc.AddAttributeForUpdate(ActivityInfoEntity.__ACTIVITYDATE, timer);
//timer—活动时间
uc.AddAttributeForUpdate(ActivityInfoEntity.__ACTIVITYPLACE, place);
//place—报告地点
uc.AddAttributeForUpdate(ActivityInfoEntity.__ACTIVITYCONTENT, content);
//content---活动内容
uc.AddAttributeForUpdate(ActivityInfoEntity.__ACTIVITYTYPE, type);
//type—活动类型
uc.AddAttributeForUpdate(ActivityInfoEntity.__ACTIVITYOUTLAY, nomey);
//nomey—活动金费
uc.AddAttributeForUpdate(ActivityInfoEntity.__REMARK, remark);
//remakrk—备注
try
{
int re = uc.Perform();
if (re > 0)
return true;
else
return false;
}
catch //(PlException exp)
{
return false;
}
}
public static DataTable GetData_Report()
{
//返回数据库学术报告信息表的所有信息
//返回时按ID降序排列
//失败返回NULL
try
{
RetrieveCriteria rc = new RetrieveCriteria(typeof(ReportInfoEntity));
Condition c = rc.GetNewCondition();
rc.OrderBy(ReportInfoEntity.__REPORTID, false);//true表示升序,false表示降序
DataTable dt = rc.AsDataTable();
return dt;
}
catch //(PlException exp)
{
return null;
}
}
public static DataTable GetData_ReportJioner()
{
//功能说明:列出所有有效的听取报告的学生的名单
//返回的DataTable需要3张表连接,学生信息表(StudentInfo),报告表(ReportInfo),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -