Exemplo n.º 1
0
    /// <summary>
    /// 班級年級、名稱、ID、座號
    /// </summary>
    public DStudent(string peopleId)
        : base(peopleId)
    {
        EasyDataProvide gradeStudent = new EasyDataProvide("GradeStudent");
        gradeStudent.AddParameter("student_id", peopleId);
        DataRow gradeStudentRow = gradeStudent.GetSingleRow("student_id=@student_id");
        if (gradeStudentRow != null)
        {
            _gradeID = gradeStudentRow["grade_id"].ToString();
            EasyDataProvide Grade = new EasyDataProvide("Grade");
            DataRow gradeRow = Grade.GetById(gradeStudentRow["grade_id"].ToString());
            if (gradeRow == null) return;
            _currentYear = gradeRow["currentYear"].ToString();
            _gradeName = gradeRow["name"].ToString();

        }

        if (gradeStudentRow != null) _seatNumber = gradeStudentRow["seatNumber"].ToString();

        EasyDataProvide student = new EasyDataProvide("Student");
        student.AddParameter("id", peopleId);
        DataRow studentRow = student.GetSingleRow("id=@id");
        if (studentRow != null)
        {
            _studentNumber = studentRow["studentNumber"].ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //驗證身份
            Person myPerson = new Person();
            if (myPerson.Role == Person.LoginRole.Teacher || myPerson.Role == Person.LoginRole.Student || myPerson.Role == Person.LoginRole.Parent)
            {
                Response.Redirect("~/Default.aspx");
            }
            if (myPerson.Role == Person.LoginRole.SchoolAdmin)
            {
                PublishTab1.isOpenEditTab = true;
                //addPan.Visible = true;
                gvList.Columns[gvList.Columns.Count - 1].Visible = true;

                EasyDataProvide Grade = new EasyDataProvide("Grade");
                DataRow row = Grade.GetById(Request["id"]);
                if (row == null) return;
                ViewState["currentYear"] = row["currentYear"].ToString();
                ShowTeacher();
                ShowCourseSubject();
            }

            Show();
        }
    }
Exemplo n.º 3
0
    private void Show()
    {
        DataTable dt = dl.GetStudentList((new Person()).School_id, "-1", "", "", "-1", "-1", Request["ID"], "", "order by StudentNumber asc", 70, 1);
        gvList.DataSource = dt;
        gvList.DataBind();

        EasyDataProvide People = new EasyDataProvide("People");
        DataRow row = People.GetById(Request["id"]);
        ParentName.Text = row["name"].ToString();
    }
Exemplo n.º 4
0
    private void Show()
    {
        DataTable dt = dl.GetTeacherByGradeID(Request["id"]);
        gvList.DataSource = dt;
        gvList.DataBind();

        EasyDataProvide Grade = new EasyDataProvide("Grade");
        DataRow row = Grade.GetById(Request["ID"]);
        DGrade dGrade = new DGrade();
        AllName.Text = dGrade.GetFullGradeNameById((int)row["id"]);
    }
Exemplo n.º 5
0
    protected void Show()
    {
        EasyDataProvide Grade = new EasyDataProvide("Grade");
        DataRow row = Grade.GetById(Request["ID"]);
        if(row==null) return;
        DataTable dt = dl.GetStudentList(row["school_id"].ToString(), Request["ID"], "", "", "-1", "-1", "-1", "", "order by SeatNumber asc", 70, 1);
        gvList.DataSource = dt;
        gvList.DataBind();

        DGrade dGrade = new DGrade();
        AllName.Text = dGrade.GetFullGradeNameById((int)row["id"]);
    }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         show();
         EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");
         DataRow row = ModulePublish.GetById(Request["ID"].ToString());
         //if (!DataLayer.IsInRole("admins", User.Identity.Name))
         //{
         //    if (row["beSelect"].ToString() != "0") //���O�ۤv�o�G��
         //    {
         //        btnSure.Visible = false;
         //    }
         //}
     }
 }
Exemplo n.º 7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         show();
         EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");
         DataRow         row           = ModulePublish.GetById(Request["ID"].ToString());
         //if (!DataLayer.IsInRole("admins", User.Identity.Name))
         //{
         //    if (row["beSelect"].ToString() != "0") //不是自己發佈的
         //    {
         //        btnSure.Visible = false;
         //    }
         //}
     }
 }
Exemplo n.º 8
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        if (_myPerson.Role == Person.LoginRole.Teacher)
        {
            bool flag = false;
            foreach (ListItem item in cblGrade.Items)
            {
                if (item.Selected)
                {
                    flag = true;
                }
            }
            if (!flag)
            {
                My.WebForm.doJavaScript("alert('請選擇班級!!')");
                return;
            }
        }

        EasyDataProvide AttachmentFile = new EasyDataProvide("AttachmentFile");
        EasyDataProvide BookCase = new EasyDataProvide("BookCase");
        AttachmentFile.SetPlaceHolderFormQuest();
        //取得副檔名
        string Path = GetMyPath();

        if (!fuFile.HasFile)
        {
            My.WebForm.doJavaScript("alert('請上傳檔案')");
            return;
        }
        string Extension = fuFile.FileName.Split('.')[fuFile.FileName.Split('.').Length - 1];
        //新檔案名稱
        string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);

        fuFile.SaveAs(String.Format("{0}/{1}", Path, fileName));

        string filePic = "";
        if (fuPic.HasFile)
        {
            string PicExtension = fuPic.FileName.Split('.')[fuPic.FileName.Split('.').Length - 1];
            //新檔案名稱
            filePic = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, PicExtension);

            fuPic.SaveAs(String.Format("{0}/{1}", Path, filePic));
            My.WebForm.GenerateThumbnailImage(filePic, fuPic.PostedFile.InputStream, Path, "S", 86, 69);

            AttachmentFile.AddParameter("coverPicName", filePic);
        }

        AttachmentFile.AddParameter("fileName", fileName);
        AttachmentFile.AddParameter("extension", Extension);
        AttachmentFile.AddParameter("school_id", _myPerson.School_id);
        AttachmentFile.AddParameter("people_id", _myPerson.people_id);

        EasyDataProvide School = new EasyDataProvide("School");
        DataRow row = School.GetById(_myPerson.School_id);
        string domainName = "";
        if (row != null)
        {
            domainName = row["domainName"].ToString();
        }
        AttachmentFile.AddParameter("domainName", domainName);
        string file_id = AttachmentFile.InsertReturnValue();

        BookCase.SetPlaceHolderFormQuest();
        BookCase.AddParameter("file_id", file_id);
        BookCase.AddParameter("school_id", _myPerson.School_id);
        BookCase.AddParameter("people_id", _myPerson.people_id);
        BookCase.AddParameter("role", _myPerson.Role == Person.LoginRole.Teacher ? "0" : "1");

        string BookCaseID = BookCase.InsertReturnValue();
        EasyDataProvide BookCaseGrade = new EasyDataProvide("BookCaseGrade");
        if (_myPerson.Role == Person.LoginRole.Teacher)
        {
            foreach (ListItem item in cblGrade.Items)
            {
                if (item.Selected)
                {
                    BookCaseGrade.AddParameter("bookCase_id", BookCaseID);
                    BookCaseGrade.AddParameter("grade_id", item.Value);
                    BookCaseGrade.Insert();
                }
            }

        }
        else
        {
            DStudent dStudent=new DStudent(_myPerson.people_id);
            BookCaseGrade.AddParameter("bookCase_id", BookCaseID);
            BookCaseGrade.AddParameter("grade_id", dStudent.GradeID);
            BookCaseGrade.Insert();
        }
        My.WebForm.doJavaScript("alert('新增成功');location.href='BookCase_List.aspx'");
    }
Exemplo n.º 9
0
    private void Show()
    {
        EasyDataProvide ParentChildren = new EasyDataProvide("ParentChildren");
        ParentChildren.AddParameter("student_id",Request["id"]);
        DataRow pcRow = ParentChildren.GetSingleRow("student_id=@student_id");
        if(pcRow==null)
        {
            Panel2.Visible = true;
            Panel1.Visible = false;
            return;
        }else
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
        }

        DataRow row = _people.FillPlaceHolderControlsById(pcRow["parent_id"].ToString());
        if (row == null) return;
        myPhoto.ImageUrl = row["myPhoto"].ToString() == "" ? (row["gender"].ToString() == "True" ? "~/images/Male90x85.jpg" : "~/images/FeMale90x85.jpg") : String.Format("{0}/{1}/{2}/M{3}", ConfigurationManager.AppSettings["FileUploadPath"], (new Person()).School_id, row["id"], row["myPhoto"]);

        gender.Text = SCode.ToScodeGenderName(gender.Text);
        DParent dParent = new DParent(pcRow["parent_id"].ToString());
        telephone_id.Text = dParent.Phone;
        address_id.Text = dParent.Address;
        occupation.Text = dParent.Occupation;
        username.Text = dParent.Account;
        emailAddress.Text = dParent.Email;
        schoolName.Text = dParent.SchoolName;
        enable.Text = enable.Text.ToScodeEnableName();
        description.Text = My.WebForm.TXT2HTML(description.Text);
        EasyDataProvide people = new EasyDataProvide("People");
        DataRow peoplwRow = people.GetById(Request["id"]);
        StudentName.Text = peoplwRow["name"].ToString();
    }
Exemplo n.º 10
0
    protected void BtnUpFile1_Click1(object sender, EventArgs e)
    {
        if (ViewState["exist"].ToString() == "False")
        {
            My.WebForm.doJavaScript("alert('請先輸入課程備註、重要事項或備課事項');");
            return;
        }
        EasyDataProvide TimeTable = new EasyDataProvide("TimeTable");
        DataRow rowTime = TimeTable.GetById(Request["timetable_id"]);
        if(rowTime==null)
        {
            My.WebForm.doJavaScript("備課資料有誤!");
            return;
        }
        string grade_id = rowTime["grade_id"].ToString();

        Person myPerson = new Person();
        EasyDataProvide AttachmentFile = new EasyDataProvide("AttachmentFile");
        AttachmentFile.SetPlaceHolderFormQuest();
        //取得副檔名
        string Path = GetMyPath();

        if (!FuFile1.HasFile)
        {
            My.WebForm.doJavaScript("alert('請上傳檔案')");
            return;
        }
        string Extension = FuFile1.FileName.Split('.')[FuFile1.FileName.Split('.').Length - 1];
        //新檔案名稱
        string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);

        FuFile1.SaveAs(String.Format("{0}/{1}", Path, fileName));
        AttachmentFile.AddParameter("fileName", fileName);
        AttachmentFile.AddParameter("extension", Extension);
        AttachmentFile.AddParameter("school_id", myPerson.School_id);
        AttachmentFile.AddParameter("people_id", myPerson.people_id);

        EasyDataProvide School = new EasyDataProvide("School");
        DataRow row = School.GetById(myPerson.School_id);
        string domainName = "";
        if (row != null)
        {
            domainName = row["domainName"].ToString();
        }
        AttachmentFile.AddParameter("domainName", domainName);
        string file_id = AttachmentFile.InsertReturnValue();

        EasyDataProvide PrepareLessonFile = new EasyDataProvide("PrepareLessonFile");
        PrepareLessonFile.AddParameter("type", "0");
        PrepareLessonFile.AddParameter("prepareLesson_id", ViewState["ID"].ToString());
        PrepareLessonFile.AddParameter("file_id", file_id);
        PrepareLessonFile.AddParameter("initDate", DateTime.Now.ToShortDateString());
        PrepareLessonFile.AddParameter("poster", myPerson.account);
        PrepareLessonFile.Insert();

        EasyDataProvide BookCase = new EasyDataProvide("BookCase");
        BookCase.SetPlaceHolderFormQuest();
        BookCase.AddParameter("file_id", file_id);
        BookCase.AddParameter("school_id", myPerson.School_id);
        BookCase.AddParameter("people_id", myPerson.people_id);
        BookCase.AddParameter("role", myPerson.Role == Person.LoginRole.Teacher ? "0" : "1");

        string BookCaseID = BookCase.InsertReturnValue();

        EasyDataProvide BookCaseGrade = new EasyDataProvide("BookCaseGrade");
        BookCaseGrade.AddParameter("bookCase_id", BookCaseID);
        BookCaseGrade.AddParameter("grade_id", grade_id);
        BookCaseGrade.AddParameter("tab_id", "7");
        BookCaseGrade.Insert();
        ShowFile1();
    }
Exemplo n.º 11
0
 public DataRow GetBaseRow()
 {
     EasyDataProvide People = new EasyDataProvide("People");
     DataRow row = People.GetById(_pepoleID);
     return row;
 }