protected void btnADD_Click(object sender, EventArgs e)
    {
        EasyDataProvide ModuleFiles = new EasyDataProvide("ModuleFiles");
        //宣告檔案上傳設定
        FileUploadSetup fus = new FileUploadSetup();
        fus.name = "fileUrl";
        fus.fileType = FileUploadSetup.UpfileType.File;
        fus.allowNoFile = false;

        ModuleFiles.FileUploadSetups.Add(fus);

        try //捕抓自訂錯誤
        {
            ModuleFiles.SetPageFormQuest();
        }
        catch (Exception ex1)
        {
            lblError.Text = ex1.Message;
            return;
        }

        ModuleFiles.AddParameter("publishID", Request["publishID"].ToString());
        //處理上傳檔案
        if (ddlFile.SelectedValue == "檔案連結")
        {
            ModuleFiles.AddParameter("fileUrl", fileUrlPath.Text);
        }

        ModuleFiles.Insert();

        string Publish = "_Discusses_Files.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["publishID"];
        My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish));
    }
Exemplo n.º 2
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        EasyDataProvide ContactBook = new EasyDataProvide("ContactBook");
        ContactBook.AddParameter("date", date.Text);
        ContactBook.AddParameter("grade_id", grade_id.SelectedValue);
        int i = ContactBook.GetRowCount("date=@date and grade_id=@grade_id");
        if (i > 0)
        {
            My.WebForm.doJavaScript("alert('該日該班級以建立聯絡簿,請重新選擇!');");
            return;
        }
        ContactBook.AddParameter("description", description.Text);
        string ContactBook_id=  ContactBook.InsertReturnValue();
        EasyDataProvide GradeStudent = new EasyDataProvide("GradeStudent");
        GradeStudent.AddParameter("grade_id",grade_id.SelectedValue);
        DataTable dtStudent = GradeStudent.GetData("grade_id=@grade_id");
        EasyDataProvide StudentContactBook = new EasyDataProvide("StudentContactBook");

        foreach (DataRow row in dtStudent.Rows)
        {
            StudentContactBook.AddParameter("people_id", row["student_id"].ToString());
            StudentContactBook.AddParameter("contactBook_id", ContactBook_id);
            StudentContactBook.Insert();
        }

        My.WebForm.doJavaScript("alert('新增成功');location.href='ContactBook_detail.aspx'");
    }
Exemplo n.º 3
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        //新增地址
        EasyDataProvide Address = new EasyDataProvide("Address");
        Address.AddParameter("city", Request["city"]);
        Address.AddParameter("division", Request["division"]);
        Address.AddParameter("zip", Request["zip"]);
        Address.AddParameter("address", address.Value);
        string addressID = Address.InsertReturnValue();

        //新增電話
        EasyDataProvide Telepone = new EasyDataProvide("Telephone");
        Telepone.AddParameter("areaCode", areaCode.Value);
        Telepone.AddParameter("numberCode", numberCode.Value);
        string telephoneID = Telepone.InsertReturnValue();

        //新增學校
        EasyDataProvide school = new EasyDataProvide("School");
        school.AddParameter("id",id.Text);
        int i = school.GetRowCount("id=@id");
        if(i>0)
        {
            My.WebForm.doJavaScript("alert('學校編號已經重複!')");
            return;
        }
        school.RemoveParameter("id");
        school.SetPlaceHolderFormQuest();

        school.AddParameter("address_id", addressID);
        school.AddParameter("telephone_id", telephoneID);
        school.Insert();
        My.WebForm.doJavaScript("alert('新增成功');location.href='School_List.aspx'");
    }
    private void ShowContactBookMessage()
    {
        EasyDataProvide ContactBook = new EasyDataProvide("ContactBook");
        //如果有資料則撈回學生個別聯絡事項資料
        EasyDataProvide StudentContactBook = new EasyDataProvide("StudentContactBook");
        StudentContactBook.AddParameter("contactBook_id", Request["contactBook_id"]);
        StudentContactBook.AddParameter("people_id", Request["people_id"]);
        DataRow rowSbook = StudentContactBook.GetSingleRow("people_id=@people_id and contactBook_id=@contactBook_id");
        if(rowSbook==null)
        {
            return;
        }

        EasyDataProvide StudentContactBookMessage = new EasyDataProvide("StudentContactBookMessage");
        StudentContactBookMessage.AddParameter("student_id", Request["people_id"]);
        StudentContactBookMessage.AddParameter("studentContactBook_id", rowSbook["id"].ToString());
        StudentContactBookMessage.FillContentPlaceHolderControls("student_id=@student_id and studentContactBook_id=@studentContactBook_id and Role=0");

        DataRow row= ContactBook.FillPlaceHolderControlsById(Request["contactBook_id"]);
        if(row["activity"].ToString()=="True")
        {
            InsertButton.Visible = false;
        }
        ViewState["date"] = row["date"].ToString();
        ViewState["contactBook_id"] = rowSbook["id"].ToString();
    }
Exemplo n.º 5
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        string areaID = "";
        string telID = "";

        //新增或修改電話
        _telephone.AddParameter("areaCode", areaCode.Value);
        _telephone.AddParameter("numberCode", numberCode.Value);

        if (string.IsNullOrEmpty(ViewState["tel"].ToString()))
        {
            telID = _telephone.InsertReturnValue();
        }
        else
        {
            _telephone.UpdateById(ViewState["tel"].ToString());
            telID = ViewState["tel"].ToString();
        }

        //新增或修改地址
        _address.AddParameter("city", Request["city"]);
        _address.AddParameter("division", Request["division"]);
        _address.AddParameter("zip", Request["zip"]);
        _address.AddParameter("address", address.Value);
        if (string.IsNullOrEmpty(ViewState["address"].ToString()))
        {
            areaID = _address.InsertReturnValue();
        }
        else
        {
            _address.UpdateById(ViewState["address"].ToString());
            areaID = ViewState["address"].ToString();
        }

        //更新Pepole
        EasyDataProvide People = new EasyDataProvide("People");
        People.SetPlaceHolderFormQuest();
        People.AddParameter("address_id", telID);
        People.AddParameter("telephone_id", areaID);
        People.UpdateById(Request["id"]);

        //更新teacher
        _teacher.AddParameter("rank", rank.SelectedValue);
        _teacher.UpdateById(Request["id"]);

        //更新People_School

        _people_School.AddParameter("people_id", Request["id"]);
        _people_School.AddParameter("school_id", ddlSchool.SelectedValue);
        _people_School.Update("people_id=@people_id");

        //更新帳號

        _account.AddParameter("password", FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "MD5"));
        _account.AddParameter("emailAddress", emailAddress.Text);
        _account.AddParameter("people_id", Request["id"]);
        _account.UpdateById(Request["id"]);
        My.WebForm.doJavaScript("alert('修改成功');location.href='Teacher_List.aspx'");
    }
Exemplo n.º 6
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        //檢查帳號是否重複
        EasyDataProvide Account = new EasyDataProvide("Account");
        Account.AddParameter("username", username.Text);
        DataRow rowCheck = Account.GetSingleRow("username=@username");
        if (rowCheck != null)
        {
            My.WebForm.doJavaScript("alert('帳號已經存在')");
            return;
        }

        string peopleId = Guid.NewGuid().ToString();
        //新增地址
        EasyDataProvide Address = new EasyDataProvide("Address");
        Address.AddParameter("city", Request["city"]);
        Address.AddParameter("division", Request["division"]);
        Address.AddParameter("zip", Request["zip"]);
        Address.AddParameter("address", address.Value);
        string addressID = Address.InsertReturnValue();

        //新增電話
        EasyDataProvide Telepone = new EasyDataProvide("Telephone");
        Telepone.AddParameter("areaCode", areaCode.Value);
        Telepone.AddParameter("numberCode", numberCode.Value);
        string telephoneID = Telepone.InsertReturnValue();

        //新增Pepole
        EasyDataProvide People = new EasyDataProvide("People");
        People.SetPlaceHolderFormQuest();
        People.AddParameter("id", peopleId);
        People.AddParameter("address_id", addressID);
        People.AddParameter("telephone_id", telephoneID);
        People.AddParameter("role", "2");
        People.Insert();

        //新增Parent
        EasyDataProvide Parent = new EasyDataProvide("Parent");

        Parent.AddParameter("id", peopleId);
        Parent.SetPlaceHolderFormQuest();
        Parent.Insert();

        //新增People_School
        EasyDataProvide People_School = new EasyDataProvide("People_School");
        People_School.AddParameter("people_id", peopleId);
        People_School.AddParameter("school_id", (new Person()).School_id);
        People_School.Insert();

        //新增帳號
        Account.AddParameter("password", FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "MD5"));
        Account.AddParameter("emailAddress", emailAddress.Text);

        Account.AddParameter("people_id", peopleId);
        Account.AddParameter("id", Guid.NewGuid().ToString());
        Account.Insert();

        My.WebForm.doJavaScript("alert('新增成功');location.href='Parent_List.aspx'");
    }
Exemplo n.º 7
0
    private void Show()
    {
        _ModuleClass.AddParameter("moduleID", Request["ModuleID"]);
        DataTable dt = _ModuleClass.GetData("[moduleID] = @moduleID", "ORDER BY [listNum]");

        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
Exemplo n.º 8
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     EasyDataProvide Account = new EasyDataProvide("Account");
     Account.AddParameter("password", FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "MD5"));
     Account.AddParameter("people_id", Request["people_id"]);
     Account.Update("people_id=@people_id");
     My.WebForm.doJavaScript("alert('修改成功');parent.tb_remove()");
 }
Exemplo n.º 9
0
    private void show()
    {
        _ModuleLinks.AddParameter("publishID", Request["ID"]);
        DataTable dt = _ModuleLinks.GetData("publishID=@publishID", "order by listNum asc");

        gvList.DataSource = dt;
        gvList.DataBind();
    }
Exemplo n.º 10
0
    //private void ShowOrg()
    //{
    //    EasyDataProvide UnitName = new EasyDataProvide("UnitName");
    //    DataTable dt = UnitName.GetAllData();
    //    ddlOrg.DataSource = dt;
    //    ddlOrg.DataBind();
    //}
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        Person person = new Person();

        EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");
        ModulePublish.SetPlaceHolderFormQuest();
        //處理上傳檔案
        if (ddlFile.SelectedValue == "檔案上傳" && fuFile.HasFile)
        {
            //取得副檔名
            string Extension = fuFile.FileName.Split('.')[fuFile.FileName.Split('.').Length - 1];
            //新檔案名稱
            string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);
            fuFile.SaveAs(Server.MapPath(String.Format("~/UploadFiles/Files/{0}", fileName)));
            ModulePublish.AddParameter("fileUrl", fileName);

        }

        //處理上傳圖片

        if (fuPic.HasFile)
        {
            if (fuPic.PostedFile.ContentType.IndexOf("image") == -1)
            {
                My.WebForm.doJavaScript("alert('檔案型態錯誤!');");
                return;
            }

            //取得副檔名
            string Extension = fuPic.FileName.Split('.')[fuPic.FileName.Split('.').Length - 1];
            //新檔案名稱
            string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);
            fuPic.SaveAs(Server.MapPath(String.Format("~/UploadFiles/Images/{0}", fileName)));
            My.WebForm.GenerateThumbnailImage(fileName, fuPic.PostedFile.InputStream, Server.MapPath("~/UploadFiles/Images"), "S", 69, 50);
            ModulePublish.AddParameter("picUrl", fileName);

        }

        ModulePublish.AddParameter("classID", ddlClass1.SelectedValue);
        //ModulePublish.AddParameter("OrgID", ddlOrg.SelectedValue);
        //ModulePublish.AddParameter("OrgNames", ddlOrg.SelectedItem.Text);
        //ModulePublish.AddParameter("updater", person.name);
        //ModulePublish.AddParameter("updaterUnit", person.organization);
        //ModulePublish.AddParameter("lastupdated", DateTime.Now.ToString());
        //不填結束日期時,設定一個800年後的日期
        if (string.IsNullOrEmpty(endDate.Text))
        {
            ModulePublish.AddParameter("endDate", "2800/1/1");
        }
        ModulePublish.UpdateById(Request["ID"]);

        EasyDataProvide ModuleContents = new EasyDataProvide("ModuleContents");
        ModuleContents.AddParameter("publishID", Request["ID"]);
        ModuleContents.AddParameter("article", article.Text);
        ModuleContents.Update("publishID=@publishID");

        Response.Redirect(String.Format("Discusses_List.aspx?ModuleID={0}&page={1}&grade_id={2}", Request["ModuleID"], Request["page"], Request["grade_id"]));
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     Person person = new Person();
     EasyDataProvide TemplateMessage = new EasyDataProvide("TemplateMessage");
     TemplateMessage.AddParameter("messages", messages.Text);
     TemplateMessage.AddParameter("people_id", person.people_id);
     TemplateMessage.Insert();
     My.WebForm.doJavaScript("parent.tb_remove();parent.location.reload()");
 }
Exemplo n.º 12
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        EasyDataProvide InputData = new EasyDataProvide("InputData");

        InputData.SetPlaceHolderFormQuest();
        InputData.AddParameter("customerID", ddlCustomer.SelectedValue);
        InputData.AddParameter("aliasName", ddlCustomer.SelectedItem.Text);
        InputData.Insert();
        Response.Redirect("Input_list.aspx?ModuleID=" + Request["ModuleID"]);
    }
    protected void DataList1_DeleteCommand(object source, DataListCommandEventArgs e)
    {
        string id = DataList1.DataKeys[e.Item.ItemIndex].ToString();
        EasyDataProvide TimeTable = new EasyDataProvide("TimeTable");
        TimeTable.AddParameter("grade_id", Request["id"]);
        TimeTable.AddParameter("sectionIndex_id", id);
        TimeTable.Delete("grade_id=@grade_id and sectionIndex_id=@sectionIndex_id");

        Show();
    }
Exemplo n.º 14
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        EasyDataProvide ModuleClass = new EasyDataProvide("ModuleClass");
        ModuleClass.AddParameter("className", txtAdd.Text);
        ModuleClass.AddParameter("moduleID", Request["ModuleID"]);

        ModuleClass.Insert();
        txtAdd.Text = "";
        Show();
    }
Exemplo n.º 15
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;
            }
        }

        _BookCase.SetPlaceHolderFormQuest();
        _BookCase.UpdateById(Request["id"]);
        _AttachmentFile.SetPlaceHolderFormQuest();
        string Path = GetMyPath();
        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));
            _AttachmentFile.AddParameter("coverPicName", filePic);
        }

        _AttachmentFile.UpdateById(ViewState["file_id"].ToString());

        EasyDataProvide BookCaseGrade = new EasyDataProvide("BookCaseGrade");
        if (_myPerson.Role == Person.LoginRole.Teacher)
        {
            BookCaseGrade.AddParameter("bookCase_id", Request["id"]);
            BookCaseGrade.Delete("bookCase_id=@bookCase_id");
            foreach (ListItem item in cblGrade.Items)
            {
                if (item.Selected)
                {
                    BookCaseGrade.AddParameter("bookCase_id", Request["id"]);
                    BookCaseGrade.AddParameter("grade_id", item.Value);
                    BookCaseGrade.Insert();
                }
            }

        }

        My.WebForm.doJavaScript("alert('修改成功');location.href='BookCase_List.aspx'");
    }
Exemplo n.º 16
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        EasyDataProvide ModuleClass = new EasyDataProvide("ModuleClass");

        ModuleClass.AddParameter("className", txtAdd.Text);
        ModuleClass.AddParameter("moduleID", Request["ModuleID"]);

        ModuleClass.Insert();
        txtAdd.Text = "";
        Show();
    }
Exemplo n.º 17
0
    protected void btnSure_Click(object sender, EventArgs e)
    {
        EasyDataProvide Member   = new EasyDataProvide("Member");
        string          password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5");

        string[] strUserData = ((FormsIdentity)(Page.User.Identity)).Ticket.UserData.Split(new Char[] { ';' });
        Member.AddParameter("password", password);
        Member.AddParameter("account", strUserData[4]);
        Member.Update("account=@account");
        My.WebForm.doJavaScript("alert('已經修改成功,下次登入請用新密碼登入')");
    }
Exemplo n.º 18
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        string strUserData = ((FormsIdentity)(HttpContext.Current.User.Identity)).Ticket.UserData;

        EasyDataProvide InputData = new EasyDataProvide("InputData");

        InputData.SetPlaceHolderFormQuest();
        InputData.AddParameter("customerID", User.Identity.Name);
        InputData.AddParameter("aliasName", strUserData);
        InputData.Insert();
        My.WebForm.doJavaScript("alert('已送出!管理者審核中!');location='index.aspx'");
    }
Exemplo n.º 19
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (ddlCourseSubject.Items.Count > 0)
     {
         EasyDataProvide GradeCourseSubject = new EasyDataProvide("GradeCourseSubject");
         GradeCourseSubject.AddParameter("courseSubject_id", ddlCourseSubject.SelectedValue);
         GradeCourseSubject.AddParameter("grade_id", Request["id"]);
         GradeCourseSubject.AddParameter("teacher_id", ddlTeacher.SelectedValue);
         GradeCourseSubject.Insert();
         Response.Redirect(Request.Url.ToString());
     }
 }
Exemplo n.º 20
0
    protected void BtnAdd2_Click(object sender, EventArgs e)
    {
        EasyDataProvide RoleUserMapping = new EasyDataProvide("RoleUserMapping");

        RoleUserMapping.AddParameter("roleID", Request["RoleID"]);
        foreach (GridViewRow row in GridView2.Rows)
        {
            string strID = GridView2.DataKeys[row.RowIndex].Value.ToString();
            RoleUserMapping.AddParameter("userID", strID);
            RoleUserMapping.Insert();
        }
        My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", "Role_Mapping.aspx?RoleID=" + Request["RoleID"]));
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        EasyDataProvide ParentChildren = new EasyDataProvide("ParentChildren");
        foreach (GridViewRow row in GridView1.Rows)
        {
            string ID = GridView1.DataKeys[row.RowIndex].Value.ToString();
            ParentChildren.AddParameter("student_id", ID);
            ParentChildren.AddParameter("parent_id", Request["ParentId"].ToString());
            ParentChildren.Insert();
        }

        Session["Datatable"] = null; //session 清空
        My.WebForm.doJavaScript("parent.tb_remove();parent.location.reload()");
    }
Exemplo n.º 22
0
    protected void btnRelation_Click(object sender, EventArgs e)
    {
        EasyDataProvide ParentChildren = new EasyDataProvide("ParentChildren");
        foreach (GridViewRow row in gvList.Rows)
        {
            string ID = gvList.DataKeys[row.RowIndex].Value.ToString();
            TextBox txtRelationship = (TextBox)row.FindControl("txtRelationship");
            ParentChildren.AddParameter("relationship", txtRelationship.Text);
            ParentChildren.AddParameter("student_id", ID);
            ParentChildren.Update("student_id=@student_id");

        }
        Show();
        My.WebForm.doJavaScript("alert('儲存成功');");
    }
Exemplo n.º 23
0
    protected void lnkAddMyBookCase_Click(object sender, EventArgs e)
    {
        EasyDataProvide BookCase = new EasyDataProvide("BookCase");

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

        BookCase.Insert();

        Response.Redirect("BookCase_List.aspx");
    }
Exemplo n.º 24
0
 /// <summary>
 /// 取得老師授課所有班級列表
 /// </summary>
 /// <returns>老師授課所有班級列表</returns>
 public DataTable GetGradeList()
 {
     EasyDataProvide V_Teacher_Grade = new EasyDataProvide("V_Teacher_Grade");
     V_Teacher_Grade.AddParameter("teacher_id", _pepoleID.ToString());
     DataTable dt = V_Teacher_Grade.GetData("teacher_id=@teacher_id");
     return dt;
 }
Exemplo n.º 25
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        EasyDataProvide GradeTeacher = new EasyDataProvide("GradeTeacher");
        foreach (GridViewRow row in GridView1.Rows)
        {
            string ID = GridView1.DataKeys[row.RowIndex].Value.ToString();
            GradeTeacher.AddParameter("teacher_id", ID);
            GradeTeacher.AddParameter("grade_id", Request["GradeId"].ToString());
            DropDownList ddlClassify = (DropDownList)row.FindControl("ddlClassify");
            GradeTeacher.AddParameter("classify", ddlClassify.SelectedValue);
            GradeTeacher.Insert();
        }

        Session["Datatable"] = null; //session 清空
        My.WebForm.doJavaScript("parent.tb_remove();parent.location.reload()");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataLayer dataLayer = new DataLayer();
        DataRow row = dataLayer.Login(User.Identity.Name, Password.Text);
        if (row == null)
        {
            My.WebForm.doJavaScript("alert('密碼錯誤')");
            return;
        }

        Person person = new Person();

        EasyDataProvide StudentContactBookMessage = new EasyDataProvide("StudentContactBookMessage");
        StudentContactBookMessage.AddParameter("studentContactBook_id", ViewState["studentContactBook_id"].ToString());

        //先刪除
        StudentContactBookMessage.AddParameter("studentContactBook_id", ViewState["studentContactBook_id"].ToString());
        StudentContactBookMessage.Delete("studentContactBook_id=@studentContactBook_id and Role=2");
        //後新增
        StudentContactBookMessage.AddParameter("student_id", Request["people_id"]);
        StudentContactBookMessage.AddParameter("people_id", person.people_id);
        StudentContactBookMessage.AddParameter("Role", "2");
        StudentContactBookMessage.AddParameter("article", txtArticle.Text);
        StudentContactBookMessage.AddParameter("contactBookDate", ViewState["date"].ToString());
        StudentContactBookMessage.Insert();

        EasyDataProvide StudentContactBook = new EasyDataProvide("StudentContactBook");
        StudentContactBook.AddParameter("isSign", "true");
        StudentContactBook.UpdateById(ViewState["studentContactBook_id"].ToString());

        My.WebForm.doJavaScript(String.Format("alert('新增成功');location.href='ContactBook_ForParent.aspx?people_id={0}'", Request["people_id"]));
    }
    protected void btnADD_Click(object sender, EventArgs e)
    {
        EasyDataProvide ModulePictures = new EasyDataProvide("ModulePictures");
        FileUploadSetup fus = new FileUploadSetup();
        fus.name = "picUrl";
        fus.fileType = FileUploadSetup.UpfileType.Image;
        fus.allowNoFile = false;

        ThumbnailImage timg = new ThumbnailImage();
        timg.suffix = "s";
        timg.maxWidth = 142;
        timg.MaxHight = 89;

        fus.ThumbnailImages.Add(timg);
        ModulePictures.FileUploadSetups.Add(fus);
        try
        {
            ModulePictures.SetPageFormQuest();
        }
        catch (Exception ex1)
        {
            lblError.Text = ex1.Message;
            return;
        }

        ModulePictures.AddParameter("publishID", Request["publishID"].ToString());

        ModulePictures.Insert();
        string Publish = "_News_Pictures.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["publishID"];
        My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish));
    }
Exemplo n.º 28
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();
        }
    }
Exemplo n.º 29
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (txtAdd.Text.Trim() == "")
        {
            return;
        }

        EasyDataProvide ModuleClass = new EasyDataProvide("ModuleClass");
        ModuleClass.AddParameter("className", txtAdd.Text);
        ModuleClass.AddParameter("OrgID", Request["grade_id"]);
        ModuleClass.AddParameter("moduleID", Request["ModuleID"]);

        ModuleClass.Insert();
        txtAdd.Text = "";
        Show();
    }
Exemplo n.º 30
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        _ModulePictures.SetPageFormQuest();
        //處理上傳圖片
        if (ddlPic.SelectedValue == "上傳圖片")
        {
            if (fuPic.HasFile)
            {
                if (fuPic.PostedFile.ContentType.IndexOf("image") == -1)
                {
                    My.WebForm.doJavaScript("alert('檔案型態錯誤!');");
                    return;
                }

                //取得副檔名
                string Extension = fuPic.FileName.Split('.')[fuPic.FileName.Split('.').Length - 1];
                //新檔案名稱
                string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);
                fuPic.SaveAs(Server.MapPath(String.Format("~/UploadFiles/Images/{0}", fileName)));
                _ModulePictures.AddParameter("picUrl", fileName);
                //產生縮圖

                My.WebForm.GenerateThumbnailImage(fileName, fuPic.PostedFile.InputStream, Server.MapPath("~/UploadFiles/Images/"), "S", 142, 89);
            }
            else
            {
                My.WebForm.doJavaScript("alert('沒有上傳檔案');");
                return;
            }
        }
        _ModulePictures.UpdateById(Request["ID"]);
        string Publish = "_News_Pictures.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["publishID"];

        My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish));
    }
Exemplo n.º 31
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.º 32
0
 protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     EasyDataProvide ParentChildren = new EasyDataProvide("ParentChildren");
     string ID = gvList.DataKeys[e.RowIndex].Value.ToString();
     ParentChildren.AddParameter("student_id", ID);
     ParentChildren.Delete("student_id=@student_id");
     Show();
 }
Exemplo n.º 33
0
 private void ShowTemplateMessage()
 {
     Person person = new Person();
     EasyDataProvide TemplateMessage = new EasyDataProvide("TemplateMessage");
     TemplateMessage.AddParameter("people_id", person.people_id);
     DataTable dt = TemplateMessage.GetData("people_id=@people_id");
     Repeater1.DataSource = dt;
     Repeater1.DataBind();
 }
Exemplo n.º 34
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        EasyDataProvide courseSubject = new EasyDataProvide("CourseSubject");
        courseSubject.SetPlaceHolderFormQuest();

        courseSubject.AddParameter("school_id",(new Person()).School_id);
        courseSubject.Insert();
        My.WebForm.doJavaScript("alert('新增成功');location.href='CourseSubject_List.aspx'");
    }
Exemplo n.º 35
0
 //秀出所有學校名單(下拉式選單)
 /*
    * private void ShowSchools()
 {
     EasyDataProvide School = new EasyDataProvide("School");
     DataTable dt = School.GetData("disable='False'");
     school_id.DataTextField ="name";
     school_id.DataValueField = "id";
     school_id.DataSource = dt;
     school_id.DataBind();
 }
    * */
 protected void InsertButton_Click(object sender, EventArgs e)
 {
     //新增班級
     EasyDataProvide grade = new EasyDataProvide("Grade");
     grade.SetPlaceHolderFormQuest();
     grade.AddParameter("school_id", (new Person()).School_id);
     grade.Insert();
     My.WebForm.doJavaScript("alert('新增成功');location.href='Grade_List.aspx'");
 }
Exemplo n.º 36
0
 protected void btnSend_Click(object sender, EventArgs e)
 {
     EasyDataProvide ContactBook = new EasyDataProvide("ContactBook");
     ContactBook.AddParameter("activity", "true");
     ContactBook.UpdateById(ViewState["id"].ToString());
     ShowContact();
     ShowStudents();
     My.WebForm.doJavaScript("alert('聯絡簿已經送出!');");
 }
Exemplo n.º 37
0
 protected void btnADD_Click(object sender, EventArgs e)
 {
     EasyDataProvide ModuleLinks = new EasyDataProvide("ModuleLinks");
     ModuleLinks.SetPageFormQuest();
     ModuleLinks.AddParameter("publishID", Request["publishID"].ToString());
     ModuleLinks.Insert();
     string Publish = "_News_Links.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["publishID"];
     My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish));
 }
    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();
    }
Exemplo n.º 39
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        EasyDataProvide Role = new EasyDataProvide("Role");

        Role.SetPlaceHolderFormQuest();
        Role.AddParameter("permission", PermissionUserControl2.permissionString);
        Role.Insert();


        Response.Redirect("Role_list.aspx?ModuleID=A02");
    }
Exemplo n.º 40
0
    protected void btnADD_Click(object sender, EventArgs e)
    {
        EasyDataProvide ModuleFiles = new EasyDataProvide("ModuleFiles");
        //宣告檔案上傳設定
        FileUploadSetup fus = new FileUploadSetup();

        fus.name        = "fileUrl";
        fus.fileType    = FileUploadSetup.UpfileType.File;
        fus.allowNoFile = false;

        ModuleFiles.FileUploadSetups.Add(fus);

        try //捕抓自訂錯誤
        {
            ModuleFiles.SetPageFormQuest();
        }
        catch (Exception ex1)
        {
            lblError.Text = ex1.Message;
            return;
        }



        ModuleFiles.AddParameter("publishID", Request["publishID"].ToString());
        //處理上傳檔案
        if (ddlFile.SelectedValue == "檔案連結")
        {
            ModuleFiles.AddParameter("fileUrl", fileUrlPath.Text);
        }

        ModuleFiles.Insert();

        string Publish = "_i-post_Files.aspx?ID=" + Request["publishID"];

        My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish));
    }
Exemplo n.º 41
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (User.Identity.IsAuthenticated)
            {
                string strUserData = ((FormsIdentity)(HttpContext.Current.User.Identity)).Ticket.UserData;
                if (strUserData.Length > 20)
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect(Request.Url.ToString());
                }

                string username = User.Identity.Name;

                EasyDataProvide Customer = new EasyDataProvide("Customer");
                Customer.AddParameter("username", username);
                DataRow rowCustomer = Customer.GetSingleRow("username=@username");
                if (rowCustomer == null)
                {
                    FormsAuthentication.SignOut();
                    Response.Redirect("index.aspx");
                }
                allName.Text         = rowCustomer["name"].ToString();
                gender.SelectedValue = rowCustomer["gender"].ToString();
                emailAddress.Text    = rowCustomer["emailAddress"].ToString();
                phoneNumber.Text     = rowCustomer["areaCode"].ToString() + "-" + rowCustomer["numberCode"].ToString();
            }


            //驗證圖片產生
            string captchaImageText = GenerateRandomCode();
            this.Session["Captcha"] = captchaImageText;
            ViewState["Captcha"]    = captchaImageText;
            imgMVcode.Src           = "../Ashx/JpegImage.ashx";;
        }
    }