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'");
    }
Exemple #2
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;
 }
Exemple #3
0
    private void Show()
    {
        _ModuleClass.AddParameter("moduleID", Request["ModuleID"]);
        DataTable dt = _ModuleClass.GetData("[moduleID] = @moduleID", "ORDER BY [listNum]");

        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
Exemple #4
0
    private void show()
    {
        _ModuleLinks.AddParameter("publishID", Request["ID"]);
        DataTable dt = _ModuleLinks.GetData("publishID=@publishID", "order by listNum asc");

        gvList.DataSource = dt;
        gvList.DataBind();
    }
Exemple #5
0
    private void ShowClass1()
    {
        EasyDataProvide ModuleClass = new EasyDataProvide("ModuleClass");
        DataTable       dtClass     = ModuleClass.GetData(string.Format("moduleID='{0}'", Request["ModuleID"]));

        ddlClass1.DataSource = dtClass;
        ddlClass1.DataBind();
    }
Exemple #6
0
    private void show()
    {
        EasyDataProvide ModuleContents = new EasyDataProvide("ModuleContents");

        ModuleContents.AddParameter("publishID", Request["ID"]);
        DataTable dt = ModuleContents.GetData("publishID=@publishID and type=1", "order by initDate desc");

        repReply.DataSource = dt;
        repReply.DataBind();
    }
Exemple #7
0
    private void ShowClass1()
    {
        EasyDataProvide ModuleClass = new EasyDataProvide("ModuleClass");
        DataTable       dtClass     = ModuleClass.GetData(string.Format("moduleID='{0}'", Request["ModuleID"]));

        ddlClass1.DataSource = dtClass;
        ddlClass1.DataBind();
        ListItem item = new ListItem("全部", "");

        ddlClass1.Items.Insert(0, item);
    }
 //秀出所有學校名單(下拉式選單)
 private void ShowSchool()
 {
     EasyDataProvide School = new EasyDataProvide("School");
     DataTable dt = School.GetData("Enable='True'");
     ddlSchool.DataTextField = "name";
     ddlSchool.DataValueField = "id";
     ddlSchool.DataSource = dt;
     ddlSchool.DataBind();
     ListItem list = new ListItem("請選擇", "-1");
     ddlSchool.Items.Insert(0, list);
 }
    protected void RepeaterLesson_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        HiddenField hidID = (HiddenField)e.Item.FindControl("hidID");
        if (!string.IsNullOrEmpty(hidID.Value))
        {
            Repeater repItem = (Repeater)e.Item.FindControl("repItem");
            EasyDataProvide PrepareLessonItem = new EasyDataProvide("PrepareLessonItem");
            PrepareLessonItem.AddParameter("prepareLesson_id", hidID.Value);
            DataTable dt = PrepareLessonItem.GetData("prepareLesson_id=@prepareLesson_id");
            repItem.DataSource = dt;
            repItem.DataBind();

        }
    }
    protected void gvList_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        Repeater repFiles = (Repeater) e.Item.FindControl("repFiles");
        HiddenField hidID = (HiddenField) e.Item.FindControl("hidID");
        EasyDataProvide ModuleFiles = new EasyDataProvide("ModuleFiles");
        ModuleFiles.AddParameter("publishID", hidID.Value);
        DataTable dt = ModuleFiles.GetData("publishID=@publishID");
        repFiles.DataSource = dt;
        repFiles.DataBind();

        Repeater repReply = (Repeater) e.Item.FindControl("repReply");
        DataLayer dl=new DataLayer();
        DataTable dtReply = dl.GetDiscussesReply(hidID.Value);
        repReply.DataSource = dtReply;
        repReply.DataBind();
    }
    private void show()
    {
        EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");
        DataRow row = ModulePublish.FillPlaceHolderControlsById(Request["ID"]);

        EasyDataProvide ModuleContents = new EasyDataProvide("ModuleContents");
        ModuleContents.AddParameter("publishID", Request["ID"]);
        DataRow rowArticle = ModuleContents.GetSingleRow("publishID=@publishID");
        if (rowArticle != null) article.Text =My.WebForm.TXT2HTML(rowArticle["article"].ToString()) ;

        EasyDataProvide ModuleFiles = new EasyDataProvide("ModuleFiles");
        ModuleFiles.AddParameter("publishID", Request["ID"].ToString());
        DataTable dt = ModuleFiles.GetData("publishID=@publishID", "order by listNum asc");
        dlFiles.DataSource = dt;
        dlFiles.DataBind();
    }
Exemple #12
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        EasyDataProvide Customer   = new EasyDataProvide("Customer");
        DataTable       dtCustomer = Customer.GetData("emailAddress IS NOT NULL AND emailAddress<>''");

        string subject = "【雲施團分享】" + title.Text;

        string mailBody = article.Text.Replace(@"/UploadFiles/", ConfigurationManager.AppSettings["ServerHost"] + @"/UploadFiles/");

        mailBody += "<br />發表人:團長|發表日期:" + DateTime.Now.ToShortDateString();

        mailBody += "<br /><br />文章網址:<a href='" + ConfigurationManager.AppSettings["ServerHost"] + "News_Detail.aspx?id=" + ViewState["GUID"].ToString() + "'>" + ConfigurationManager.AppSettings["ServerHost"] + "News_Detail.aspx?id=" + ViewState["GUID"].ToString() + "</a>";

        //My.WebForm.SystemSendMailCC("*****@*****.**", "*****@*****.**", subject, mailBody);
        foreach (DataRow row in dtCustomer.Rows)
        {
            My.WebForm.SystemSendMailCC("*****@*****.**", row["emailAddress"].ToString(), subject, mailBody);
        }
        Response.Redirect(String.Format("News_List.aspx?ModuleID={0}&page={1}", Request["ModuleID"], Request["page"]));
    }
 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();
 }
 private void ShowTab()
 {
     EasyDataProvide BookTab = new EasyDataProvide("BookTab");
     DataTable dt = BookTab.GetData("status = 0");
     cblTab.DataTextField = "subject";
     cblTab.DataValueField = "id";
     cblTab.DataSource = dt;
     cblTab.DataBind();
 }
 private void ShowSchool()
 {
     EasyDataProvide School = new EasyDataProvide("School");
     DataTable dtTable = School.GetData("enable='True'");
     ddlSchool.DataTextField = "name";
     ddlSchool.DataValueField = "id";
     ddlSchool.DataSource = dtTable;
     ddlSchool.DataBind();
 }
 private void ShowGrade()
 {
     if (ddlSchool.SelectedValue != "-1" || ddlCurrentYear.SelectedValue != "-1")
     {
         EasyDataProvide Grade = new EasyDataProvide("Grade");
         DataTable dt = Grade.GetData(String.Format("Enable='True' and school_id='{0}' and currentYear={1}", ddlSchool.SelectedValue, ddlCurrentYear.SelectedValue));
         ddlGrade.DataSource = dt;
         ddlGrade.DataBind();
     }
 }
 private void ShowTabs()
 {
     EasyDataProvide BookTab = new EasyDataProvide("BookTab");
     BookTab.AddParameter("people_id", _myPerson.people_id);
     DataTable dt = BookTab.GetData("people_id=@people_id or status=2");
     tab_id.DataTextField = "subject";
     tab_id.DataValueField = "id";
     tab_id.DataSource = dt;
     tab_id.DataBind();
 }
Exemple #18
0
    private void Show()
    {
        DataRow rowPublish = _ModulePublish.FillPlaceHolderControlsById(Request["id"]);

        if (rowPublish == null)
        {
            Response.Redirect("index.aspx");
        }
        this.Title = " " + rowPublish["title"].ToString();

        EasyDataProvide ModuleFiles = new EasyDataProvide("ModuleFiles");

        ModuleFiles.AddParameter("publishID", Request["id"]);
        DataTable dtFile = ModuleFiles.GetData("publishID=@publishID order by listNum Asc");

        dlFile.DataSource = dtFile;
        dlFile.DataBind();

        if (dlFile.Items.Count == 0)
        {
            h2file.Visible = false;
        }

        //EasyDataProvide ModulePictures = new EasyDataProvide("ModulePictures");
        //ModulePictures.AddParameter("publishID", Request["id"]);
        //DataTable dtImages = ModulePictures.GetData("publishID=@publishID order by listNum Asc");
        //dlImages.DataSource = dtImages;
        //dlImages.DataBind();


        //EasyDataProvide ModuleLinks = new EasyDataProvide("ModuleLinks");
        //ModuleLinks.AddParameter("publishID", Request["id"]);
        //DataTable dtLinks = ModuleLinks.GetData("publishID=@publishID order by listNum Asc");
        //repLinks.DataSource = dtLinks;
        //repLinks.DataBind();



        _ModuleContents.AddParameter("publishID", Request["id"]);
        DataRow rowContent = _ModuleContents.FillContentPlaceHolderControls("publishID=@publishID and type is null");

        article.Text = rowContent["article"].ToString();

        DataTable dtReply = _ModuleContents.GetData("publishID=@publishID and type=1", "order by initDate desc");

        repReply.DataSource = dtReply;
        repReply.DataBind();

        DataLayer dl = new DataLayer();

        dl.ModulePublish_UpdateCountsPlus(Request["ID"]);

        if (!User.Identity.IsAuthenticated)
        {
            txtReply.Visible     = false;
            lblMessage.Visible   = true;
            btnReply.Visible     = false;
            btnOpenReply.Visible = false;
        }
        else
        {
            string strUserData = ((FormsIdentity)(HttpContext.Current.User.Identity)).Ticket.UserData;
            if (strUserData.Length > 20)
            {
                FormsAuthentication.SignOut();
                Response.Redirect(Request.Url.ToString());
            }

            txtReply.Visible     = true;
            lblMessage.Visible   = false;
            btnReply.Visible     = true;
            btnOpenReply.Visible = true;
        }
    }
 private void ShowFile2()
 {
     if (ViewState["exist"].ToString() == "False") return;
     EasyDataProvide PrepareLessonFile = new EasyDataProvide("PrepareLessonFile");
     PrepareLessonFile.AddParameter("prepareLesson_id", ViewState["ID"].ToString());
     DataTable dtPrepareLessonFile = PrepareLessonFile.GetData("prepareLesson_id=@prepareLesson_id and type=8");
     GridView3.DataSource = dtPrepareLessonFile;
     GridView3.DataBind();
 }
Exemple #20
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(article.Text))
        {
            My.WebForm.doJavaScript("alert('詳細說明不可以空白.');");
            return;
        }
        //if (shortDescription.Text.Length >= 500)
        //{
        //    My.WebForm.doJavaScript("alert('簡單說明不可以超過500個字.');");
        //    return;
        //}

        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", 127, 127);
            ModulePublish.AddParameter("picUrl", fileName);
        }

        ModulePublish.AddParameter("id", ViewState["GUID"].ToString());
        ModulePublish.AddParameter("moduleID", Request["ModuleID"]);
        ModulePublish.AddParameter("OrgID", ddlOrg.SelectedValue);
        ModulePublish.AddParameter("OrgNames", ddlOrg.SelectedItem.Text);
        ModulePublish.AddParameter("classID", ddlClass1.SelectedValue);

        Person person = new Person();

        ModulePublish.AddParameter("poster", person.name);
        ModulePublish.AddParameter("posterUnit", person.organization);
        ModulePublish.AddParameter("updater", person.name);
        ModulePublish.AddParameter("updaterUnit", person.organization);
        //不填結束日期時,設定一個800年後的日期
        if (string.IsNullOrEmpty(endDate.Text))
        {
            ModulePublish.AddParameter("endDate", "2800/1/1");
        }

        if (initDate.Text == DateTime.Now.ToString("yyyy/MM/dd"))
        {
            DateTime d = DateTime.Now;
            ModulePublish.AddParameter("initDate", d.ToString());
            ModulePublish.AddParameter("lastupdated", d.ToString());
        }
        else
        {
            ModulePublish.AddParameter("lastupdated", initDate.Text);
        }
        //if (DataLayer.IsInRole("admins", HttpContext.Current.User.Identity.Name))
        //{
        //    ModulePublish.addParameter("beSelect", "1"); //admin 群組發佈的
        //}
        ModulePublish.Insert();

        EasyDataProvide ModuleContents = new EasyDataProvide("ModuleContents");

        ModuleContents.AddParameter("publishID", ViewState["GUID"].ToString());
        ModuleContents.AddParameter("article", article.Text);
        ModuleContents.Insert();
        if (chkAlert.Checked)
        {
            EasyDataProvide Customer   = new EasyDataProvide("Customer");
            DataTable       dtCustomer = Customer.GetData("emailAddress IS NOT NULL AND emailAddress<>''");

            string subject = "【雲施團分享】" + title.Text;

            string mailBody = article.Text.Replace(@"/UploadFiles/", ConfigurationManager.AppSettings["ServerHost"] + @"/UploadFiles/");

            mailBody += "<br />發表人:團長|發表日期:" + DateTime.Now.ToShortDateString();

            mailBody += "<br /><br />文章網址:<a href='" + ConfigurationManager.AppSettings["ServerHost"] + "News_Detail.aspx?id=" + ViewState["GUID"].ToString() + "'>" + ConfigurationManager.AppSettings["ServerHost"] + "News_Detail.aspx?id=" + ViewState["GUID"].ToString() + "</a>";

            //My.WebForm.SystemSendMailCC("*****@*****.**", "*****@*****.**", subject, mailBody);
            foreach (DataRow row in dtCustomer.Rows)
            {
                My.WebForm.SystemSendMailCC("*****@*****.**", row["emailAddress"].ToString(), subject, mailBody);
            }
        }


        Session[Request["ModuleID"] + "ddlOrg"] = ddlOrg.SelectedValue;
        Session[Request["ModuleID"] + "Class1"] = ddlClass1.SelectedValue;
        Response.Redirect("_News_Files.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + ViewState["GUID"]);
    }
    private void Show()
    {
        DataRow rowBookCase = _BookCase.FillPlaceHolderControlsById(Request["id"]);
        if (rowBookCase == null) return;
        DataRow rowAttachmentFile = _AttachmentFile.FillPlaceHolderControlsById(rowBookCase["file_id"].ToString());
        ViewState["file_id"] = rowBookCase["file_id"].ToString();
        if (rowAttachmentFile == null) return;

        type.Text = type.Text.ToScodeBookTypeName();
        publicLevel.Text = publicLevel.Text.ToScodePublicLevelName();
        hlPic.NavigateUrl = ConfigurationManager.AppSettings["FileUploadPath"] + "/" + rowAttachmentFile["school_id"] + "/" + rowAttachmentFile["people_id"] + "/" + rowAttachmentFile["coverPicName"];

        EasyDataProvide BookCaseGrade = new EasyDataProvide("BookCaseGrade");
        BookCaseGrade.AddParameter("bookCase_id", Request["id"]);
        DataTable dtGrade = BookCaseGrade.GetData("bookCase_id=@bookCase_id");

        System.Text.StringBuilder tempGeaidStringBuilder = new System.Text.StringBuilder();
        foreach (DataRow row in dtGrade.Rows)
        {
            tempGeaidStringBuilder.Append(String.Format(",{0},", row["grade_id"]));
        }

        foreach (ListItem item in cblGrade.Items)
        {
            if (tempGeaidStringBuilder.ToString().IndexOf(String.Format(",{0},", item.Value)) >= 0)
            {
                item.Selected = true;
            }
        }
    }
Exemple #22
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(article.Text))
        {
            My.WebForm.doJavaScript("alert('詳細說明不可以空白.');");
            return;
        }
        DateTime d = DateTime.Now;

        EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");

        ModulePublish.SetPlaceHolderFormQuest();

        ModulePublish.AddParameter("id", ViewState["GUID"].ToString());
        ModulePublish.AddParameter("moduleID", "N02");
        ModulePublish.AddParameter("startDate", d.ToString());
        ModulePublish.AddParameter("endDate", "2800/1/1");
        string strUserData = ((FormsIdentity)(HttpContext.Current.User.Identity)).Ticket.UserData;

        ModulePublish.AddParameter("poster", strUserData);


        ModulePublish.Insert();

        EasyDataProvide ModuleContents = new EasyDataProvide("ModuleContents");

        ModuleContents.AddParameter("publishID", ViewState["GUID"].ToString());
        ModuleContents.AddParameter("article", article.Text);
        ModuleContents.Insert();



        EasyDataProvide ModuleFiles = new EasyDataProvide("ModuleFiles");

        //取得副檔名
        if (fileUrl.HasFile)
        {
            string Extension = fileUrl.FileName.Split('.')[fileUrl.FileName.Split('.').Length - 1];
            //新檔案名稱
            string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);
            fileUrl.SaveAs(Server.MapPath(String.Format("~/UploadFiles/Files/{0}", fileName)));
            ModuleFiles.AddParameter("fileUrl", fileName);
            ModuleFiles.AddParameter("fileName", "點我下載");


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

            ModuleFiles.Insert();
        }
        else if (fileUrlPath.Text != "")
        {
            ModuleFiles.AddParameter("fileName", "點我下載");


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

            ModuleFiles.Insert();
        }
        if (chkAlert.Checked)
        {
            EasyDataProvide Customer   = new EasyDataProvide("Customer");
            DataTable       dtCustomer = Customer.GetData("emailAddress IS NOT NULL AND emailAddress<>''");

            string subject = "【雲施團分享】" + title.Text;

            string mailBody = article.Text.Replace(@"/UploadFiles/", ConfigurationManager.AppSettings["ServerHost"] + @"/UploadFiles/");

            mailBody += "<br />發表人:" + strUserData + "|發表日期:" + d.ToShortDateString();

            mailBody += "<br /><br />文章出處:<a href='" + ConfigurationManager.AppSettings["ServerHost"] + "MemberNews_Detail.aspx?id=" + ViewState["GUID"].ToString() + "'>" + ConfigurationManager.AppSettings["ServerHost"] + "MemberNews_Detail.aspx?id=" + ViewState["GUID"].ToString() + "</a>";
            foreach (DataRow row in dtCustomer.Rows)
            {
                My.WebForm.SystemSendMailCC("*****@*****.**", row["emailAddress"].ToString(), subject, mailBody);
            }
        }



        Response.Redirect("index.aspx");
    }
 private void ShowClass1()
 {
     EasyDataProvide ModuleClass = new EasyDataProvide("ModuleClass");
     DataTable dtClass = ModuleClass.GetData(string.Format("moduleID='{0}'", Request["ModuleID"]));
     ddlClass1.DataSource = dtClass;
     ddlClass1.DataBind();
 }
 private void ShowClass1()
 {
     EasyDataProvide ModuleClass = new EasyDataProvide("ModuleClass");
     ModuleClass.AddParameter("ModuleID", Request["ModuleID"]);
     ModuleClass.AddParameter("OrgID", Request["grade_id"]);
     DataTable dtClass = ModuleClass.GetData("ModuleID=ModuleID and OrgID=@OrgID");
     ddlClass1.DataSource = dtClass;
     ddlClass1.DataBind();
 }