コード例 #1
0
    private void Show()
    {
        EasyDataProvide People = new EasyDataProvide("People");

        DataRow row = People.FillPageControlsById(Request["id"]);
        if (row == null) return;

        gender.Text = gender.Text.ToScodeGenderName();

        DStudent dStudent = new DStudent(Request["id"]);
        telephone_id.Text = dStudent.Phone;
        address_id.Text = dStudent.Address;
        username.Value = dStudent.Account;
        emailAddress.Text = dStudent.Email;
        studentNumber.Text = dStudent.StudentNumber;
        seatNumber.Text = dStudent.SeatNumber;
        hidPeople_id.Value = Request["id"];
        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"]);

        Person person = new Person();
        if (person.Role == Person.LoginRole.Teacher)
        {
            plPassword.Visible = true;

        }
        else
        {
            plPassword.Visible = false;
        }
    }
コード例 #2
0
        public void Run()
        {
            new DStudent().Add(new Student()
            {
                Name = "这不是一个事务"
            });
            using (var context = new LZHData())
            {
                using (var dbContextTransaction = context.Database.BeginTransaction())
                {
                    DPerson  dPerson  = new DPerson(context);
                    DStudent dStudent = new DStudent(context);

                    dPerson.Add(new Person()
                    {
                        Age = 1, FirstName = "f", LastName = "f"
                    });

                    dStudent.Add(new Student()
                    {
                        Name = "f"
                    });

                    dbContextTransaction.Commit();
                }
            }
        }
コード例 #3
0
 private void Show()
 {
     DataLayer dl = new DataLayer();
     DStudent dStudent = new DStudent((new Person()).people_id);
     string ID = dStudent.GradeID;
     DataTable dt = dl.GetTimeTableDatabyGradeId(ID);
     DataList1.DataSource = dt;
     DataList1.DataBind();
 }
コード例 #4
0
 /// <summary>
 /// Get Student details by Id
 /// </summary>
 /// <param name="id">Student Id</param>
 /// <returns>Return Student object filled data by Id</returns>
 public static Student GetStudent(int id)
 {
     try
     {
         return(DStudent.GetStudent(id));
     }
     catch (Exception e)
     {
         BLog.Error("An error has occured on get Student: " + e.Message);
         throw e;
     }
 }
コード例 #5
0
 private void GetBookcases()
 {
     if (_myPerson.Role == Person.LoginRole.Teacher)
     {
         DataTable dtBookCase = _dl.GetMyBookCaseForTeacher(_myPerson.people_id);
         Session["MyBookCase"] = dtBookCase;
     }
     else
     {
         DStudent student = new DStudent(_myPerson.people_id);
         DataTable dtBookCase = _dl.GetMyBookCaseForStudent(_myPerson.people_id, student.GradeID);
         Session["MyBookCase"] = dtBookCase;
     }
 }
コード例 #6
0
 private void Show()
 {
     DStudent dStudent = new DStudent((new Person()).people_id);
     string gradeId = dStudent.GradeID;
     string useDate = DateTime.Now.ToShortDateString();
     if (!string.IsNullOrEmpty(txtDate.Text))
     {
         useDate = txtDate.Text;
     }
     lblROCDate.Text = My.WebForm.Date2CrocWeekFormat(Convert.ToDateTime(useDate));
     DataTable dt = _dl.GetClassSessionDataByDay(useDate, gradeId);
     RepeaterLesson.DataSource = dt;
     RepeaterLesson.DataBind();
 }
コード例 #7
0
 private void Show()
 {
     Person person = new Person();
     DStudent student=new DStudent(person.people_id);
     int totaleItems = dl.GetPublishListCount(Request["ModuleID"], student.GradeID, "", "", DataLayer.SortMethed.OrderByInitDate, false);
     Pagination1.totalitems = totaleItems;
     Pagination1.limit = PageSize;
     Pagination1.targetpage = "Discusses_Students_List.aspx?ModuleID=" + Request["ModuleID"];
     //技巧:利用這種方式才可以呼叫usercontrol裡的public method
     UserControl_Pagination uc = Pagination1;
     uc.showPageControls();
     DataTable dt = dl.GetPublishList(Request["ModuleID"], student.GradeID, "", "", DataLayer.SortMethed.OrderByInitDate, false, PageSize, Request["page"] == null ? 1 : int.Parse(Request["page"]));
     gvList.DataSource = dt;
     gvList.DataBind();
 }
コード例 #8
0
    private void Show()
    {
        Person person = new Person();
        DStudent dStudent =new DStudent(person.people_id);
        string GradeId = dStudent.GradeID;
        DGrade dGrade = new DGrade();

        if(person.Role == Person.LoginRole.Teacher)
        {
            GradeId = Request["grade_id"];
        }
        lblGradeName.Text = dGrade.GetShortGradeNameById(Convert.ToInt16(GradeId));
        DataTable dt = dl.GetStudentList(person.School_id, GradeId, "", "", "-1", "-1", "-1", "", "order by SeatNumber asc", 70, 1);
        Repeater1.DataSource = dt;
        Repeater1.DataBind();
    }
コード例 #9
0
    private void ShowContactBookData()
    {
        DStudent student = new DStudent((new Person()).people_id);

        //Step 1:取得ContactBook Data
        DataLayer dl = new DataLayer();
        DataRow rowBook = dl.GetTop1ContentBook(txtDate.Text, student.GradeID, "true");
        //如果txtDate.Text為空,會自動去抓取最新一筆聯絡簿資料
        if (rowBook == null)
        {
            My.WebForm.doJavaScript("alert('無聯絡簿資料!');");
            return;
        }
        description.Text = My.WebForm.TXT2HTML(rowBook["description"].ToString());

        //Step 2:取得StudentContactBook 資料
        //根據contactBook_id 與people_id 取得StudentContactBook 資料
        EasyDataProvide StudentContactBook = new EasyDataProvide("StudentContactBook");
        StudentContactBook.AddParameter("contactBook_id", rowBook["id"].ToString());
        StudentContactBook.AddParameter("people_id", (new Person()).people_id);
        DataRow rowStudentBook = StudentContactBook.GetSingleRow("contactBook_id=@contactBook_id and people_id=@people_id");
        if (rowStudentBook == null)
        {
            return;
        }
        //如果聯絡簿資料已經上傳就不可以再編輯
        if (rowStudentBook["checkUpload"].ToString() == "1")
        {
            Panel1.Visible = false;
        }

        //Step 3:取得StudentContactBookMessage 資料
        //如果有資料則撈回學生個別聯絡事項資料
        EasyDataProvide StudentContactBookMessage = new EasyDataProvide("StudentContactBookMessage");
        StudentContactBookMessage.AddParameter("student_id", (new Person()).people_id);
        StudentContactBookMessage.AddParameter("studentContactBook_id", rowStudentBook["id"].ToString());

        //DataRow rowMessage = StudentContactBookMessage.FillContentPlaceHolderControls("student_id=@student_id and studentContactBook_id=@studentContactBook_id");
        //txtArticle.Text = rowMessage["article"].ToString();

        ViewState["date"] = rowBook["date"].ToString();
        ViewState["contactBook_id"] = rowStudentBook["id"].ToString();
    }
コード例 #10
0
    private void Show()
    {
        DataRow row = _people.FillPlaceHolderControlsById(Request["id"]);
        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 = gender.Text.ToScodeGenderName();

        DStudent dStudent = new DStudent(Request["id"]);
        telephone_id.Text = dStudent.Phone;
        address_id.Text = dStudent.Address;
        username.Text = dStudent.Account;
        emailAddress.Text = dStudent.Email;
        schoolName.Text = dStudent.SchoolName;
        gradeName.Text = dStudent.GradeAllName;
        enable.Text = enable.Text.ToScodeEnableName();
        description.Text = My.WebForm.TXT2HTML(description.Text);
        studentNumber.Text = dStudent.StudentNumber;
        seatNumber.Text = dStudent.SeatNumber;

        StudentName.Text = row["name"].ToString();
    }
コード例 #11
0
    private void Show()
    {
        ViewState["tel"] = "";
        ViewState["address"] = "";
        DataRow row = _people.FillPlaceHolderControlsById(Request["id"]);
        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"]);

        DataRow telRow = _telephone.GetById(row["telephone_id"].ToString());
        if (telRow != null)
        {
            ViewState["tel"] = telRow["id"].ToString();
            areaCode.Value = telRow["areaCode"].ToString();
            numberCode.Value = telRow["numberCode"].ToString();
        }

        DataRow areaRow = _address.GetById(row["address_id"].ToString());
        if (areaRow != null)
        {
            ViewState["address"] = areaRow["id"].ToString();
            hidzip.Value = areaRow["zip"].ToString();
            address.Value = areaRow["address"].ToString();
        }
        DStudent dStudent = new DStudent(Request["id"]);
        username.Text = dStudent.Account;
        emailAddress.Text = dStudent.Email;
        ddlSchool.SelectedValue = dStudent.SchoolID;
        ddlCurrentYear.SelectedValue = dStudent.CurrentYear;
        ShowGrade();
        ddlGrade.SelectedValue = dStudent.GradeID;
        studentNumber.Text = dStudent.StudentNumber;

        StudentName.Text = row["name"].ToString();
    }
コード例 #12
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'");
    }
コード例 #13
0
 private void ShowInfo()
 {
     DStudent dStudent = new DStudent((new Person()).people_id);
     DataRow sRow = dStudent.GetBaseRow();
     GradeName.Text = dStudent.GradeAllName;
     StudentName.Text = sRow["name"].ToString();
 }
コード例 #14
0
    private void Show()
    {
        ViewState["tel"] = "";
        ViewState["address"] = "";
        DataRow row = _people.FillPlaceHolderControlsById((new Person()).people_id);
        if (row == null) return;
        DataRow telRow = _telephone.GetById(row["telephone_id"].ToString());
        if (telRow != null)
        {
            ViewState["tel"] = telRow["id"].ToString();
            areaCode.Value = telRow["areaCode"].ToString();
            numberCode.Value = telRow["numberCode"].ToString();
        }

        DataRow areaRow = _address.GetById(row["address_id"].ToString());
        if (areaRow != null)
        {
            ViewState["address"] = areaRow["id"].ToString();
            hidzip.Value = areaRow["zip"].ToString();
            address.Value = areaRow["address"].ToString();
        }
        DPeople dPeople = new DStudent((new Person()).people_id);
        username.Text = dPeople.Account;
        emailAddress.Text = dPeople.Email;

        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"]);
    }
コード例 #15
0
 /// <summary>
 /// Get List of Student
 /// </summary>
 /// <returns>Return List of Student encountered</returns>
 private static List <Student> GetStudents()
 {
     return(DStudent.GetStudents());
 }
コード例 #16
0
 private void ShowInfo()
 {
     DStudent dStudent = new DStudent(Request["people_id"]);
     DataRow sRow = dStudent.GetBaseRow();
     GradeName.Text = dStudent.GradeAllName;
     StudentName.Text = sRow["name"].ToString();
 }