protected void ButtonDelete_Click(object sender, EventArgs e)
    {
        Button b        = (Button)sender;
        string ButtonID = b.ID;
        int    i;

        for (i = 0; i < ButtonLists.Count; i++)
        {
            Button b1 = (Button)ButtonLists[i];
            if (ButtonID.Equals(b1.ID))
            {
                break;
            }
        }
        TableCell      t          = (TableCell)TableCellLists[i];
        string         courseName = t.Text;
        string         grade      = DropDownList_Grade.SelectedValue;
        string         sql1       = "select subjectno from gcgSubject where subjectname ='" + courseName + "'";
        DBManipulation dbm        = new DBManipulation();
        Object         o          = dbm.ExecuteScalar(sql1, null);

        if (o != null)
        {
            string subjectno = o.ToString();
            string sql2      = "delete from gcgCourse where SubjectNo ='" + subjectno + "' and Grade ='" + grade + "'";
            dbm.ExecuteNonQuery(sql2, null);
        }
        dbm.Close();
        SetItemForChoosableCourse();
        this.Page_Load(this, null);
    }
    protected void Button_submit_Click(object sender, EventArgs e)
    {   //点击确认,提交课时安排
        //通过 TableCellLists  DropDownLists获得每一条记录的科目名以及课时,通过DropDownList_Grade获得年级
        //步骤:一条一条来看,如果原先有课时安排的,就更新,没有的,就插入
        string         grade = DropDownList_Grade.SelectedValue;
        DBManipulation dbm   = new DBManipulation();

        // Response.Write("<script>alert('有新"+ HasNewCourse+" ')</script>");
        for (int i = 0; i < DropDownLists.Count; i++)
        {
            //步骤一:查询这门科目是否有过旧的课时安排记录
            //注意:一开始没有学科,所以要通过按钮增加学科,此时会保证所有记录都有初始课时分布,所以提交按钮仅仅需要将这些记录更新就行了
            TableCell    tc          = (TableCell)TableCellLists[i];
            DropDownList ddl         = (DropDownList)DropDownLists[i];
            string       courseName  = tc.Text;           //获得科目名
            string       courseCount = ddl.SelectedValue; //获得新的分配课时

            string          SearchSql      = "select CourseNo from gcgCourse,gcgSubject where gcgSubject.subjectno = gcgCourse.SubjectNo and Grade = @Grade and subjectname = @subjectname";
            ParameterStruct p1             = new ParameterStruct("@Grade", grade);
            ParameterStruct p2             = new ParameterStruct("@subjectname", courseName);
            ArrayList       parameterList1 = new ArrayList();
            parameterList1.Add(p1);
            parameterList1.Add(p2);
            Object o        = dbm.ExecuteScalar(SearchSql, parameterList1);
            string CourseNo = o.ToString();
            string sql4     = "update gcgCourse set CourseTime = " + courseCount + " where CourseNo = " + CourseNo;
            dbm.ExecuteNonQuery(sql4, null);
        }
        dbm.Close();
        System.Web.UI.ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Button6_Click", "alert('提交已完成!')", true);
    }
    private void setItemsForSelectGroup()
    {
        //为每一个科目的可选学科组下拉框准备数据
        DBManipulation dbm             = new DBManipulation();
        string         sql             = "select subjectno,subjectname,gcgSubject.subjectGroupNo,subjectGroupName from gcgSubject,gcgSubjectGroup where gcgSubject.subjectGroupNo = gcgSubjectGroup.subjectGroupNo";
        DataSet        ds_subject      = dbm.ExecuteQueryOffLine(sql, null);
        string         sql2            = "select subjectGroupNo,subjectGroupName from gcgSubjectGroup";
        DataTable      t               = ds_subject.Tables["defaultTable"];
        DataSet        ds_subjectGroup = dbm.ExecuteQueryOffLine(sql2, null);

        for (int i = 0; i < t.Rows.Count; i++)
        {
            Object       o = DropDownLists[i];
            DropDownList d = (DropDownList)o;
            d.AutoPostBack   = true;
            d.DataSource     = ds_subjectGroup.Tables["defaultTable"];
            d.DataTextField  = ds_subjectGroup.Tables["defaultTable"].Columns[1].ColumnName;
            d.DataValueField = ds_subjectGroup.Tables["defaultTable"].Columns[0].ColumnName;
            d.DataBind();
            DataRow r = t.Rows[i];
            string  subjectGroupName = r["subjectGroupName"].ToString();
            // string subjectGroupNo = r["gcgSubject.subjectGroupNo"].ToString();
            int index = 0;
            for (index = 0; index < ds_subjectGroup.Tables["defaultTable"].Rows.Count; index++)
            {
                DataRow rowInSubjectGroup = ds_subjectGroup.Tables["defaultTable"].Rows[index];
                if (subjectGroupName.Equals(rowInSubjectGroup["subjectGroupName"].ToString()))
                {
                    break;
                }
            }
            d.SelectedIndex = index;
            //下拉框的初始值是以前该科目所属的学科组的组名
        }
    }
Пример #4
0
        public void initModel(ApplicationDbContext context)
        {
            DBManipulation DB = new DBManipulation(context);

            employees = DB.getEmployees();
            chains    = DB.getHotelChains();
        }
Пример #5
0
        public IActionResult Payment(Dictionary<string, string> parms)
        {
            if (isEmployee())
            {
                DBManipulation db = new DBManipulation(_context);
                int rid = Convert.ToInt32(parms.GetValueOrDefault("roomid"));
                int bid = Convert.ToInt32(parms.GetValueOrDefault("bid"));
                int ssn = Convert.ToInt32(parms.GetValueOrDefault("customerSSN"));
                DateTime startdate = DateTime.Parse(parms.GetValueOrDefault("startdate"));
                DateTime enddate = DateTime.Parse(parms.GetValueOrDefault("enddate"));

                Room room = db.getRoom(rid);

                Booking newBooking = new Booking()
                {
                    CustomerSsn = ssn,
                    Bid = bid,
                    R = room,
                    Rid = room.Rid,
                    StartDate = startdate,
                    EndDate = enddate
                };
                PaymentViewModel model = new PaymentViewModel(newBooking);
                return View(model);
            }
            else
            {
                return RedirectToAction("AccessDenied", "Account");
            }
        }
    protected DataSet getItems_unChosedCourse()
    {   //点击该按钮增加科目,从我们的确认按钮来看。确认按钮已经考虑到了新增加学科的情况
        //所以该按钮只需要提供增加现有科目中这个年级还没有上的学科,可选的科目选项从未选择的科目中取
        //步骤:查询当前年级开设的学科的科目,查询该校总共开设的科目,两者做一个差集即可
        //比如说:该校总共开设:语、数、英、物、化、生、政、史、地
        //但是初一以前只开设语、数、英、生、史、地
        //那么两者的差集就是:物、化、政
        //那么就可以从这三门可中选择

        /*  select *
         *  from gcgSubject
         *  where subjectno not in (
         *          select SubjectNo
         *          from gcgCourse
         *          where Grade = '1' )
         */
        string          sqlForChoosableCourse = "select subjectno,subjectname from gcgSubject where subjectno not in(select SubjectNo from gcgCourse where Grade = @Grade)";
        DBManipulation  dbm            = new DBManipulation();
        ParameterStruct p              = new ParameterStruct("@Grade", DropDownList_Grade.SelectedValue);
        ArrayList       parameterLists = new ArrayList();

        parameterLists.Add(p);
        DataSet ds = dbm.ExecuteQueryOffLine(sqlForChoosableCourse, parameterLists);

        dbm.Close();
        return(ds);
    }
Пример #7
0
        public IActionResult DeleteBooking([FromBody] Booking booking)
        {
            DBManipulation db       = new DBManipulation(_context);
            int            response = db.deleteBooking(booking.Bid, getUser().SSN);
            string         json;

            if (response == 1)
            {
                json = "Booking successfully deleted from your account!";
            }
            else if (response == 0)
            {
                json = "Error: User didn't found in the Database, please try again..";
            }
            else if (response == -1)
            {
                json = "Error: Impossible to delete the selected booking, please try again..";
            }
            else
            {
                json = Constants.GENERICPOSTGREERROR;
            }

            return(Json(json));
        }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //点击增加科目
        //从年级已知,科目号和科目名已知,默认课时为0
        string grade     = DropDownList_Grade.SelectedValue;
        string subjectno = DropDownList2.SelectedValue;

        if (subjectno == "")  //当下拉框已经没有可增加科目时,按钮点击无效
        {
            return;
        }
        string          CourseNo       = grade + subjectno;
        string          courseCount    = "0";
        DBManipulation  dbm            = new DBManipulation();
        string          sql2           = "insert into gcgCourse values(@CourseNo,@SubjectNo,@Grade,@CourseTime)";
        ParameterStruct p3             = new ParameterStruct("@CourseNo", CourseNo + "");
        ParameterStruct p4             = new ParameterStruct("@SubjectNo", subjectno);
        ParameterStruct p5             = new ParameterStruct("@Grade", grade + "");
        ParameterStruct p6             = new ParameterStruct("@CourseTime", courseCount + "");
        ArrayList       parameterList2 = new ArrayList();

        parameterList2.Add(p3);
        parameterList2.Add(p4);
        parameterList2.Add(p5);
        parameterList2.Add(p6);
        dbm.ExecuteNonQuery(sql2, parameterList2);
        dbm.Close();
        SetItemForChoosableCourse();
        this.Page_Load(this, null);
        // Response.Redirect("classTimesArrange.aspx");
    }
Пример #9
0
    protected void SetItemForDropDownList_Class()
    {
        string         sql = "select distinct ClassNo,class_name from gcgLectureForm, temp_class where gcgLectureForm.ClassNo = temp_class.class_id and class_grade = '" + DropDownList_Grade.SelectedValue + "'";
        DBManipulation dbm = new DBManipulation();

        DropDownList_class.Items.Clear();

        /*
         * DataSet ds = dbm.ExecuteQueryOffLine(sql, null);
         * DropDownList_class.AutoPostBack = true;
         * DropDownList_class.DataSource = ds.Tables["defaultTable"];
         * DropDownList_class.DataTextField = ds.Tables["defaultTable"].Columns[1].ColumnName;
         * DropDownList_class.DataValueField = ds.Tables["defaultTable"].Columns[0].ColumnName;
         * DropDownList_class.DataBind();
         */
        SqlDataReader dr = dbm.ExecuteQueryOnLine(sql, null);

        while (dr.Read())
        {
            ListItem item = new ListItem(dr.GetString(1), dr.GetString(0));
            DropDownList_class.Items.Add(item);
        }
        dr.Close();
        dbm.Close();
    }
Пример #10
0
        public void initModel(ApplicationDbContext context, int hcid)
        {
            DBManipulation DB = new DBManipulation(context);

            phones = DB.getHotelChainPhones(hcid);
            emails = DB.getHotelChainEmails(hcid);
        }
Пример #11
0
        public void initModel(ApplicationDbContext context, int hid = 0)
        {
            DBManipulation DB = new DBManipulation(context);

            if (hid > 0)
            {
                rooms = DB.getRooms(hid);
            }
            else
            {
                rooms = DB.getRooms();
            }
            hotels = DB.getHotels();
            hotels.Insert(0, new Hotel
            {
                Hid          = 0,
                Hcid         = -1,
                HotelName    = "All hotels",
                Manager      = -1,
                Category     = -1,
                NumRooms     = -1,
                StreetNumber = -1,
                StreetName   = "null",
                AptNumber    = -1,
                City         = "null",
                HState       = "null",
                Zip          = "null",
                Email        = "null"
            });
        }
    protected void Button2_Click(object sender, EventArgs e)
    {//删除一个学科组,先将组内的学科设为待定组
     // string sql2 = "select subjectGroupNo,subjectGroupName from gcgSubjectGroup";
     //string sql1 = "select subjectno from gcgSubject where subjectGroupNo in (select subjectGroupNo from gcgSubjectGroup where subjectGroupName = @subjectGroupName)";

        string subjectGroupNo = DropDownList1.SelectedValue;

        DBManipulation dbm  = new DBManipulation();
        string         sql1 = "select subjectGroupNo from gcgSubjectGroup where subjectGroupName = '待定'";
        Object         o    = dbm.ExecuteScalar(sql1, null);
        string         subjectGroup_DefalutNo = o.ToString();
        string         sql2 = "select subjectno from gcgSubject where subjectGroupNo ='" + subjectGroupNo + "'";
        DataSet        ds   = dbm.ExecuteQueryOffLine(sql2, null);
        DataTable      t    = ds.Tables["defaultTable"];

        foreach (DataRow r in t.Rows)
        {
            string          subjectno = r["subjectno"].ToString();
            string          sql3      = "update gcgSubject set subjectGroupNo = @subjectGroupNo where subjectno = @subjectno";
            ParameterStruct p1        = new ParameterStruct("@subjectGroupNo", subjectGroup_DefalutNo);
            ParameterStruct p2        = new ParameterStruct("@subjectno", subjectno);
            ArrayList       p         = new ArrayList();
            p.Add(p1);
            p.Add(p2);
            dbm.ExecuteNonQuery(sql3, p);
        }

        string sql = "delete from gcgSubjectGroup where subjectGroupNo = '" + subjectGroupNo + "'";

        dbm.ExecuteNonQuery(sql, null);
        setItem_deleteDropDownList();//为删除下拉框提供新的数据
        this.Page_Load(this, null);
    }
Пример #13
0
    protected void Button_submit_Click(object sender, EventArgs e)
    {
        //点击此按钮,清除该学科组收到的所有反馈信息

        /*create table gcgFeedBack(  --排课组内部专用表
         *  class_id char(4) not null,
         *      CourseNo char(3) not null,
         *      TeacherNo char(8) not null,
         *      primary key(class_id,CourseNo)
         * )*/
        string         subjectGroupName = Label_SubjectGroup.Text;
        string         sql0             = "select subjectGroupNo from gcgSubjectGroup where subjectGroupName ='" + subjectGroupName + "'";
        DBManipulation dbm = new DBManipulation();
        Object         o   = dbm.ExecuteScalar(sql0, null);

        if (o == null)
        {
            //说明没有这个学科组
            System.Web.UI.ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Button6_Click", "alert('没有该学科组存在!')", true);
            //实际上是不可能的
            return;//不再查询数据
        }
        string subjectGroupNo = o.ToString();

        dbm.Close();
        string          sql1   = "select CourseNo from gcgSubject,gcgCourse where gcgCourse.SubjectNo = gcgSubject.subjectno and Grade = @Grade and subjectGroupNo = @subjectGroupNo";
        ParameterStruct p1     = new ParameterStruct("@Grade", DropDownList_Grade.SelectedValue);
        ParameterStruct p2     = new ParameterStruct("@subjectGroupNo", subjectGroupNo);
        ArrayList       pList1 = new ArrayList();

        pList1.Add(p1);
        pList1.Add(p2);
        SqlDataReader dr           = dbm.ExecuteQueryOnLine(sql1, pList1);
        ArrayList     courseNoList = new ArrayList();

        while (dr.Read())
        {
            courseNoList.Add(dr.GetString(0));
        }
        dr.Close();
        foreach (string courseno in courseNoList)
        {
            string sql_deletefromGcgFeedBack = "delete from gcgFeedBack where CourseNo = '" + courseno + "'";
            dbm.ExecuteNonQuery(sql_deletefromGcgFeedBack, null);
        }
        //如果发现反馈表中已经没有了记录,那么就直接删掉,神不知鬼不觉~
        string sql_checkgcgFeedBack = "select * from gcgFeedBack";
        object isEmpty = dbm.ExecuteScalar(sql_checkgcgFeedBack, null);

        if (isEmpty == null)
        {
            //没有反馈记录了
            string sql_droptable = "drop table gcgFeedBack";
            dbm.ExecuteNonQuery(sql_droptable, null);
        }
        dbm.Close();
        System.Web.UI.ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Button6_Click", "alert('已清除反馈信息!')", true);
        CreateTable();
    }
    protected void SetValueForHtmlTextBox()
    {
        string grade = DropDownList_Grade.SelectedValue;
        string week  = DropDownList_Week.SelectedValue;
        //select * from gcgSchedule where Grade = '1' and DayNo = '1'
        string          sql1   = "select LessonNo,StartH,StartM,EndH,EndM from gcgSchedule where Grade = @Grade and DayNo = @DayNo order by LessonNo";
        ParameterStruct p1     = new ParameterStruct("@Grade", grade);
        ParameterStruct p2     = new ParameterStruct("@DayNo", week);
        ArrayList       plist1 = new ArrayList();

        plist1.Add(p1);
        plist1.Add(p2);
        DBManipulation dbm = new DBManipulation();
        // SqlDataReader dr = dbm.ExecuteQueryOnLine(sql1, plist1);
        DataSet   ds       = dbm.ExecuteQueryOffLine(sql1, plist1);
        DataTable schedule = ds.Tables["defaultTable"];

        if (schedule.Rows.Count == 0)
        {
            return;
        }
        string[] startTime = new string[8];
        string[] endTime   = new string[8];
        for (int i = 0; i < 8; i++)
        {
            string startH = schedule.Rows[i][1].ToString();
            if (startH.Length == 1)
            {
                startH = "0" + startH;
            }
            string startM = schedule.Rows[i][2].ToString();
            if (startM.Length == 1)
            {
                startM = "0" + startM;
            }
            string endH = schedule.Rows[i][3].ToString();
            if (endH.Length == 1)
            {
                endH = "0" + endH;
            }
            string endM = schedule.Rows[i][4].ToString();
            if (endM.Length == 1)
            {
                endM = "0" + endM;
            }
            startTime[i] = startH + ":" + startM;
            endTime[i]   = endH + ":" + endM;
        }

        this.TextBox_11.Text = startTime[0]; this.TextBox_12.Text = endTime[0];
        this.TextBox_21.Text = startTime[1]; this.TextBox_22.Text = endTime[1];
        this.TextBox_31.Text = startTime[2]; this.TextBox_32.Text = endTime[2];
        this.TextBox_41.Text = startTime[3]; this.TextBox_42.Text = endTime[3];
        this.TextBox_51.Text = startTime[4]; this.TextBox_52.Text = endTime[4];
        this.TextBox_61.Text = startTime[5]; this.TextBox_62.Text = endTime[5];
        this.TextBox_71.Text = startTime[6]; this.TextBox_72.Text = endTime[6];
        this.TextBox_81.Text = startTime[7]; this.TextBox_82.Text = endTime[7];
    }
Пример #15
0
        public IActionResult ViewTwo(ViewTwoViewModel model)
        {
            DBManipulation db = new DBManipulation(_context);

            model.viewtwos = (model.hotelSelected == -1) ? db.getViewTwo() : db.getViewTwo(model.hotelSelected);
            model.hotels   = db.getHotels();

            return(View(model));
        }
Пример #16
0
        public IActionResult ViewOne(ViewOneViewModel model)
        {
            DBManipulation db = new DBManipulation(_context);

            model.viewones = model.stateSelected.Equals("All") ? db.getViewOne() : db.getViewOne(model.stateSelected);
            model.states   = db.getHotelStates();

            return(View(model));
        }
    protected void Button_AddSubjectGroup_Click(object sender, EventArgs e)
    {//增加学科组
        string         subjectGroupName = TextBox_SubjectGroup.Text;
        string         subjectGroupId;
        DBManipulation dbm = new DBManipulation();
        string         sql1 = "select subjectGroupNo from gcgSubjectGroup order by subjectGroupNo";
        DataSet        ds_subjectGroup = dbm.ExecuteQueryOffLine(sql1, null);
        int            i = 0, j;
        bool           mark = true; //一个标志量

        for (i = 1; i < 90; i++)    //学科组号仅有2位
        {
            mark = true;
            for (j = 0; j < ds_subjectGroup.Tables["defaultTable"].Rows.Count; j++)
            {
                string str = ds_subjectGroup.Tables["defaultTable"].Rows[j]["subjectGroupNo"].ToString();
                char[] ch  = str.ToCharArray();
                if (ch[0] == '0')
                {
                    str = ch[1] + "";
                }
                if (i == int.Parse(str))
                {
                    mark = false;
                    break;
                }
            }
            if (mark)  //如果没有任何一个id相等,那么这个就是可用id
            {
                break;
            }
        }
        if (i < 10)
        {
            subjectGroupId = "0" + i;
        }
        else
        {
            Response.Write("<script>alert('i > 10')</script>");
            subjectGroupId = i + "";
        }
        string          sql2          = "insert into gcgSubjectGroup values(@subjectGroupNo,@subjectGroupName,null)";
        ParameterStruct p1            = new ParameterStruct("@subjectGroupNo", subjectGroupId);
        ParameterStruct p2            = new ParameterStruct("@subjectGroupName", subjectGroupName);
        ArrayList       parameterlist = new ArrayList();

        parameterlist.Add(p1);
        parameterlist.Add(p2);
        debug1.Text = subjectGroupId;
        debug2.Text = subjectGroupName;
        dbm.ExecuteNonQuery(sql2, parameterlist);
        CreateTableDynamicly();       //生成表
        setItemsForSelectGroup();     //为每一个科目的可选学科组下拉框准备数据
        setItem_deleteDropDownList(); //为删除下拉框生成数据
        TextBox_SubjectGroup.Text = "";
    }
Пример #18
0
        public void initModel(ApplicationDbContext _context)
        {
            DBManipulation db = new DBManipulation(_context);

            HotelChains     = db.getHotelChains();
            States          = db.getHotelStates();
            CategoryOfHotel = new List <int>(
                new int[] { 1, 2, 3, 4, 5 }
                );
        }
Пример #19
0
    protected void login_Click(object sender, EventArgs e)
    {                                    //用户点击登入
        string userName = username.Text;
        string token    = password.Text; //Token:令牌
        string sql      = "select * from UserTable where username = @username and token = @token";

        ArrayList       parameterList = new ArrayList();
        ParameterStruct p1            = new ParameterStruct("@username", userName);//设置参数映射列表
        ParameterStruct p2            = new ParameterStruct("@token", token);

        parameterList.Add(p1);
        parameterList.Add(p2);
        DBManipulation dbm = new DBManipulation();

        SqlDataReader dataReader = dbm.ExecuteQueryOnLine(sql, parameterList);

        if (dataReader.HasRows)                        //如果有记录,说明是合法账户
        {
            dataReader.Read();                         //指针后移,读取第一条记录
            string position = dataReader.GetString(3); //获得身份
            Session["username"] = dataReader.GetString(1);
            dataReader.Close();
            dbm.Close();
            switch (position)
            {
            case "教导主任":
                Session["UserRank"] = PermissionEnum.EducationDean;
                Response.Redirect("../educationDean/TimeArrange.aspx");
                break;

            case "学科组长":
                Session["UserRank"]         = PermissionEnum.CourseMaster;
                Session["subjectGroupName"] = "综合组";
                Response.Redirect("../courseMaster/setTeacher.aspx");
                break;

            case "排课组长":
                Session["UserRank"] = PermissionEnum.AcademicDean;
                Response.Redirect("../academicDean/courseArrangement.aspx");
                break;

            case "教师":
                Session["UserRank"] = PermissionEnum.Teacher;
                Response.Redirect("../Teacher/viewSchedule_Class.aspx");
                break;

            default:
                break;
            }
        }
        else
        {
            Response.Redirect("error.aspx");
        }
    }
Пример #20
0
 public IActionResult ManageCustomers()
 {
     if (isEmployee())
     {
         List <Person> model = new DBManipulation(_context).getCustomers();
         return(View(model));
     }
     else
     {
         return(RedirectToAction("AccessDenied"));
     }
 }
Пример #21
0
        public IActionResult ViewOne()
        {
            DBManipulation   db    = new DBManipulation(_context);
            ViewOneViewModel model = new ViewOneViewModel()
            {
                stateSelected = "All",
                viewones      = db.getViewOne(),
                states        = db.getHotelStates()
            };

            return(View(model));
        }
Пример #22
0
        public IActionResult ViewTwo()
        {
            DBManipulation   db    = new DBManipulation(_context);
            ViewTwoViewModel model = new ViewTwoViewModel()
            {
                viewtwos      = db.getViewTwo(),
                hotels        = db.getHotels(),
                hotelSelected = -1
            };

            return(View(model));
        }
Пример #23
0
 public IActionResult ManageHotels()
 {
     if (isEmployee())
     {
         List<Hotel> hotels = new DBManipulation(_context).getHotelsFullNav();
         return View(hotels);
     }
     else
     {
         return RedirectToAction("AccessDenied", "Account");
     }
 }
Пример #24
0
    /*
     * protected override void OnLoad(EventArgs e)
     * {
     *
     * }
     */
    protected void Page_Load(object sender, EventArgs e)
    {
        //外部添加局部刷新控件
        ScriptManager1.RegisterAsyncPostBackControl(this.DropDownList_Grade);
        ScriptManager1.RegisterAsyncPostBackControl(this.DropDownList_semester);
        ScriptManager1.RegisterAsyncPostBackControl(this.DropDownList_year);
        if (!IsPostBack)
        {
            if (!(LoginAndPermissionChecking.LoginChecking()))
            {
                Response.Redirect("/ErrorPage/error_NotLogin.aspx");
            }
            if (!(LoginAndPermissionChecking.PermissionChecking(PermissionEnum.EducationDean)))
            {
                Response.Redirect("/ErrorPage/error_DeniedPermission.aspx");
            }
            //首先先检查是否有gcgFeedBack这张表,如果不存在就新建
            string         sql_LookForgcgFeedBack = "select * from sysobjects where name = 'gcgFeedBack' and xtype = 'U'";
            DBManipulation dbm = new DBManipulation();
            object         o   = dbm.ExecuteScalar(sql_LookForgcgFeedBack, null);
            if (o == null)
            {
                string sql_CreategcgFeedBack = "create table gcgFeedBack(" +
                                               "class_id char(4) not null," +
                                               "CourseNo char(3) not null," +
                                               "TeacherNo char(8) not null," +
                                               "primary key(class_id, CourseNo)" +
                                               ")";
                dbm.ExecuteNonQuery(sql_CreategcgFeedBack, null);
            }

            /*create table gcgFeedBack(  --排课组内部专用表
             *      class_id char(4) not null,
             *      CourseNo char(3) not null,
             *      TeacherNo char(8) not null,
             *      primary key(class_id,CourseNo)
             * )*/
            //页面第一次载入之前,要查询gcgFeedBack授课安排反馈表,看看是不是还有未确认的反馈信息
            string sql = "select class_id,CourseNo from gcgFeedBack";
            // DBManipulation dbm = new DBManipulation();
            SqlDataReader dr = dbm.ExecuteQueryOnLine(sql, null);
            while (dr.Read())
            {
                string buttonName = dr.GetString(0) + dr.GetString(1);
                //Session[buttonName] = "nameRedButton";//我们使用Session保存有意见的老师安排的css样式
                Session[buttonName] = "aspTableCellBrown2";//把原先红色的恢复成黑色
            }
            dr.Close();
            dbm.Close();
        }

        createtable(GetSemesterNo());
    }
    protected void SetItemForDropDownList_Class()
    {
        //string sql = "select class_id,class_name from temp_class where class_grade = '" + DropDownList_Grade.SelectedValue + "'";
        string         sql = "select distinct ClassNo,class_name from gcgLectureForm, temp_class where gcgLectureForm.ClassNo = temp_class.class_id and class_grade = '" + DropDownList_Grade.SelectedValue + "'";
        DBManipulation dbm = new DBManipulation();
        DataSet        ds  = dbm.ExecuteQueryOffLine(sql, null);

        DropDownList_class.AutoPostBack   = true;
        DropDownList_class.DataSource     = ds.Tables["defaultTable"];
        DropDownList_class.DataTextField  = ds.Tables["defaultTable"].Columns[1].ColumnName;
        DropDownList_class.DataValueField = ds.Tables["defaultTable"].Columns[0].ColumnName;
        DropDownList_class.DataBind();
    }
Пример #26
0
    //生成该年级该学科组所包含的所有科目,为下拉框绑定数据
    protected void ProvideDataForSelectSubject()
    {
        string grade = DropDownList_Grade.SelectedValue;
        //debug1.Text = "年级:" + grade;
        string         subjectGroupName = Label_SubjectGroup.Text;
        string         sql0             = "select subjectGroupNo from gcgSubjectGroup where subjectGroupName ='" + subjectGroupName + "'";
        DBManipulation dbm = new DBManipulation();
        Object         o   = dbm.ExecuteScalar(sql0, null);

        if (o == null)
        {
            //说明没有这个学科组
            System.Web.UI.ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "Button6_Click", "alert('没有该学科组存在!')", true);
            return;//不再查询数据
        }
        string subjectGroupNo = o.ToString();

        dbm.Close();
        string          sql1   = "select CourseNo,subjectname from gcgSubject,gcgCourse where gcgCourse.SubjectNo = gcgSubject.subjectno and Grade = @Grade and subjectGroupNo = @subjectGroupNo";
        ParameterStruct p1     = new ParameterStruct("@Grade", grade);
        ParameterStruct p2     = new ParameterStruct("@subjectGroupNo", subjectGroupNo);
        ArrayList       pList1 = new ArrayList();

        pList1.Add(p1);
        pList1.Add(p2);

        /*
         * SqlDataReader dr = dbm.ExecuteQueryOnLine(sql1,pList1);
         * while (dr.Read()) {
         *  ListItem item = new ListItem(dr.GetString(1),dr.GetString(0));
         *  item.Attributes.Add("style", "color:red");
         *  DropDownList_Course.Items.Add(item);
         * }*/

        DataSet ds_Course = dbm.ExecuteQueryOffLine(sql1, pList1);

        DropDownList_Course.AutoPostBack   = true;
        DropDownList_Course.DataSource     = ds_Course.Tables["defaultTable"];
        DropDownList_Course.DataTextField  = ds_Course.Tables["defaultTable"].Columns[1].ColumnName;
        DropDownList_Course.DataValueField = ds_Course.Tables["defaultTable"].Columns[0].ColumnName;
        ListItem item = new ListItem();

        //DropDownList_Subject.SelectedIndex = 0;
        DropDownList_Course.DataBind();
        //要先清洗掉上一个年级残存的老师集合
        foreach (DropDownList d in DropDownList_select)
        {
            d.Items.Clear();
        }
        setDataForEachTeacherDropDownList();
    }
Пример #27
0
    protected void ButtonForFeedBack_onClick(object sender, EventArgs e)
    {
        MyButton button     = (MyButton)sender;
        string   buttonName = button.Class_id + button.CourseNo1;


        if (Session[buttonName] == null || Session[buttonName].ToString().Equals("aspTableCell"))
        {
            Session[buttonName] = "aspTableCellBrown2";//用session记录这个Button被点击过
            //插入反馈记录

            /*create table gcgFeedBack(
             *      class_id char(4) not null,
             *      CourseNo char(3) not null,
             *      TeacherNo char(8) not null,
             *      primary key(class_id,CourseNo)
             * )*/
            string          sql         = "insert into gcgFeedBack values(@class_id,@CourseNo,@TeacherNo)";
            ParameterStruct p_classid   = new ParameterStruct("@class_id", button.Class_id);
            ParameterStruct p_courseno  = new ParameterStruct("@CourseNo", button.CourseNo1);
            ParameterStruct p_teacherno = new ParameterStruct("@TeacherNo", button.TeacherNo1);
            ArrayList       plist       = new ArrayList();
            plist.Add(p_classid);
            plist.Add(p_courseno);
            plist.Add(p_teacherno);
            DBManipulation dbm = new DBManipulation();
            try {
                dbm.ExecuteNonQuery(sql, plist);
            }
            catch (Exception)
            {
            }
        }
        else
        {
            Session[buttonName] = "aspTableCell";
            string          sql        = "delete from gcgFeedBack where class_id = @class_id and CourseNo = @CourseNo";
            ParameterStruct p_classid  = new ParameterStruct("@class_id", button.Class_id);
            ParameterStruct p_courseno = new ParameterStruct("@CourseNo", button.CourseNo1);
            //ParameterStruct p_teacherno = new ParameterStruct("@TeacherNo", button.TeacherNo1);
            ArrayList plist = new ArrayList();
            plist.Add(p_classid);
            plist.Add(p_courseno);
            //plist.Add(p_teacherno);
            DBManipulation dbm = new DBManipulation();
            dbm.ExecuteNonQuery(sql, plist);
            // Session.Remove(name);
        }
        createtable(GetSemesterNo());
    }
Пример #28
0
        public IActionResult CustomerBookings()
        {
            DBManipulation db = new DBManipulation(_context);

            var user = getUser();

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }

            List <Booking> bookings = db.getPersonBookings(user.SSN);

            return(View(bookings));
        }
Пример #29
0
        public IActionResult BookRoomFromSearch(Dictionary <string, string> parms)
        {
            DBManipulation db = new DBManipulation(_context);

            string   s_rid = "";
            int      rid = -1;
            string   s_startdate = "", s_enddate = "";
            DateTime startdate = new DateTime(), enddate = new DateTime();

            if (parms.TryGetValue("roomid", out s_rid))
            {
                rid = Int32.Parse(s_rid);
            }
            if (parms.TryGetValue("startdate", out s_startdate))
            {
                startdate = DateTime.Parse(s_startdate);
            }
            if (parms.TryGetValue("enddate", out s_enddate))
            {
                enddate = DateTime.Parse(s_enddate);
            }

            var user = getUser();

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }

            Person  customer   = db.getCustomer(user.SSN);
            Room    room       = db.getRoom(rid);
            Booking newBooking = new Booking()
            {
                CustomerSsnNavigation = customer.Customer,
                CustomerSsn           = customer.Ssn,
                R         = room,
                Rid       = room.Rid,
                StartDate = startdate,
                EndDate   = enddate
            };

            return(View(newBooking));
        }
    private void setItem_deleteDropDownList()
    {
        DBManipulation dbm             = new DBManipulation();
        string         sql1            = "select subjectGroupNo,subjectGroupName from gcgSubjectGroup";
        DataSet        ds_subjectGroup = dbm.ExecuteQueryOffLine(sql1, null);

        DropDownList1.AutoPostBack = true;
        DropDownList1.Items.Clear();
        DataTable t = ds_subjectGroup.Tables["defaultTable"];

        foreach (DataRow r in t.Rows)
        {
            string subjectGroupNo   = r["subjectGroupNo"].ToString();
            string subjectGroupName = r["subjectGroupName"].ToString();
            if (subjectGroupNo.Equals("00"))
            {
                continue;
            }
            ListItem item = new ListItem(subjectGroupName, subjectGroupNo);
            DropDownList1.Items.Add(item);
        }
    }