⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addscheme.aspx.cs

📁 这是一个自动排课软件(包含源码,需求分析,详细设计).希望对你有所帮助.
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 Entities;
using System.Web.Services;

public partial class CourseManage_AddScheme : System.Web.UI.Page
{
    HtmlLink link = new HtmlLink();
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (Request.Cookies["ThemeCss"] == null)
            link.Href = "../styles/VistaBlue.css";
        else
            link.Href = "../styles/" + Request.Cookies["ThemeCss"].Value;
        link.Attributes["rel"] = "stylesheet";
        link.Attributes["type"] = "text/css";
        Page.Header.Controls.Add(link);
        int classID = Convert.ToInt32(Request.QueryString["classID"]);
        hidClassID.Value = classID.ToString();
        if (!IsPostBack)
        {
            BLL.BCourse bCourse = new BLL.BCourse();
            ArrayList courses=bCourse.Select(classID);
            this.DDLCourse.DataSource = courses;
            this.DDLCourse.DataBind();
            BLL.BTimePlan timePlan = new BLL.BTimePlan();
            this.DDLTimePlan.DataSource=timePlan.Select();
            this.DDLTimePlan.DataBind();

            BLL.BTeachPlan bPlan=new BLL.BTeachPlan();
            ArrayList plans=bPlan.Select(classID);
            DateTime startTime = System.DateTime.Now.Date;
            foreach (TeachPlan plan in plans)
            {
                if (plan.OverDate > startTime)
                    startTime = plan.OverDate;
            }
            this.txtStartDate.Text = startTime.ToString("yyyy-MM-dd");
            int courseID=Convert.ToInt32(this.DDLCourse.SelectedValue);
            int timePlanID=Convert.ToInt32(DDLTimePlan.SelectedValue);
            DateTime startDate=DateTime.Parse(txtStartDate.Text);
            DateTime endDate = GetLastDate(courseID, timePlanID, startDate);
            this.txtEndDate.Text = endDate.ToString("yyyy-MM-dd");
            Detect();
        }
    }
    protected void lbDetect_Click(object sender, EventArgs e)
    {
        Detect();
    }
    private void Detect()
    {
        BLL.BViewTeachPlan viewTeachPlan = new BLL.BViewTeachPlan();
        RptTeacher.DataSource=viewTeachPlan.GetDetectInfo(Convert.ToInt32(this.DDLCourse.SelectedValue), Convert.ToInt32(DDLTimePlan.SelectedValue), DateTime.Parse(txtStartDate.Text));
        RptTeacher.DataBind();
    }
    [WebMethod]
    public static DateTime GetLastDate(int courseID, int timePlanID, DateTime beginDate)
    {
        BLL.BTimePlan bTimePlan=new BLL.BTimePlan();
        BLL.BViewTeachPlan bViewTeachPlan = new BLL.BViewTeachPlan();
        return bViewTeachPlan.GetLastDate(courseID, bTimePlan.SelectSingle(timePlanID), beginDate);
    }
    [WebMethod]
    public static bool Save(int classID, int courseID, int teacherID,int timePlanID, DateTime beginDate, DateTime endDate)
    {
        BLL.BTeachPlan bTeachPlan = new BLL.BTeachPlan();
        TeachPlan teachPlan = new TeachPlan();
        teachPlan.ClassID = classID;
        teachPlan.CourseID = courseID;
        teachPlan.TeacherID = teacherID;
        teachPlan.BeginDate = beginDate;
        teachPlan.OverDate = endDate;
        teachPlan.TimePlanID = timePlanID;
        try
        {
            bTeachPlan.AddTeachPlan(teachPlan);
        }
        catch(Exception err)
        {
            return false;
        }
        return true;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -