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));
    }
Example #2
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        //宣告檔案上傳設定
        FileUploadSetup fus = new FileUploadSetup();

        fus.name        = "fileUrl";
        fus.fileType    = FileUploadSetup.UpfileType.File;
        fus.allowNoFile = true;
        _ModuleFiles.FileUploadSetups.Add(fus);

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

        //處理上傳檔案
        if (ddlFile.SelectedValue == "檔案連結")
        {
            _ModuleFiles.AddParameter("fileUrl", fileUrlPath.Text);
        }

        _ModuleFiles.UpdateById(Request["ID"].ToString());

        string Publish = "_News_Files.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["publishID"];

        My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish));
    }
    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));
    }
    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));
    }
Example #5
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        _ModuleLinks.SetPageFormQuest();
        _ModuleLinks.UpdateById(Request["ID"]);
        string Publish = "_News_Links.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["publishID"];

        My.WebForm.doJavaScript(String.Format("parent.tb_remove();parent.location='{0}';", Publish));
    }
 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));
 }
Example #7
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));
    }
Example #8
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));
    }
    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.SetPageFormQuest();
        People.AddParameter("id", peopleId);
        People.AddParameter("address_id", addressID);
        People.AddParameter("telephone_id", telephoneID);
        People.AddParameter("role", "1");
        People.Insert();

        //新增Student
        EasyDataProvide Student = new EasyDataProvide("Student");
        Student.AddParameter("id", peopleId);
        Student.AddParameter("studentNumber", studentNumber.Text);
        Student.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();

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

        GradeStudent.AddParameter("student_id", peopleId);
        GradeStudent.AddParameter("grade_id", Request["GradeId"]);

        GradeStudent.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('新增成功');parent.tb_remove();parent.location.reload()");
    }