Exemplo n.º 1
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.º 2
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.º 3
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.º 4
0
    protected void btnSure_Click(object sender, EventArgs e)
    {
        EasyDataProvide ModuleContents = new EasyDataProvide("ModuleContents");
        ModuleContents.AddParameter("publishID", Request["ID"]);
        DataRow row = ModuleContents.GetSingleRow("publishID=@publishID");
        ModuleContents.SetPlaceHolderFormQuest();
        if (row == null)
        {
            ModuleContents.Insert();
        }
        else
        {
            //DataLayer.setBehaviour("�ʺA�o���t��", "�ק�" + ViewState["title"]);
            ModuleContents.Update("publishID=@publishID");
        }

        Response.Redirect("_News_Files.aspx?ModuleID=" + Request["ModuleID"] + "&ID=" + Request["ID"]);
    }
Exemplo n.º 5
0
    protected void SureButton_Click(object sender, EventArgs e)
    {
        EasyDataProvide Customer = new EasyDataProvide("Customer");

        Customer.AddParameter("username", username.Text);
        Customer.AddParameter("emailAddress", emailAddress.Text);
        DataRow row = Customer.GetSingleRow("username=@username and emailAddress=@emailAddress");

        if (row == null)
        {
            lblMessage.Text = "填入資料與資料庫不符,請恰尋管理者,謝謝";
            return;
        }

        //取得新密碼
        string newPassword = GenerateRandomCode();

        Customer.RemoveParameter("emailAddress");
        Customer.AddParameter("password", newPassword);
        Customer.Update("username=@username");

        //送到信箱


        EasyDataProvide EmailTemplats = new EasyDataProvide("EmailTemplats");

        EmailTemplats.AddParameter("number", "ForgetPassword");
        DataRow rowEmail = EmailTemplats.GetSingleRow("number=@number");

        if (rowEmail != null)
        {
            string subject   = rowEmail["subject"].ToString();
            string EmailTemp = rowEmail["article"].ToString();
            string mailBody  = "";
            mailBody = EmailTemp;
            mailBody = mailBody.Replace("{account}", username.Text).Replace("{password}", newPassword);
            My.WebForm.SystemSendMailCC("*****@*****.**", emailAddress.Text, subject, mailBody);
        }


        My.WebForm.doJavaScript("alert('密碼已經寄到您註冊的信箱!')");
    }
Exemplo n.º 6
0
 protected void btnSure_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow row in gvList.Rows)
     {
         TextBox txtSeatNumber = (TextBox)row.FindControl("txtSeatNumber");
         if (!My.WebForm.IsNumber(txtSeatNumber.Text))
         {
             My.WebForm.doJavaScript("alert('座號請輸入數字')");
             return;
         }
     }
     EasyDataProvide GradeStudent = new EasyDataProvide("GradeStudent");
     foreach (GridViewRow row in gvList.Rows)
     {
         string ID = gvList.DataKeys[row.RowIndex].Value.ToString();
         TextBox txtSeatNumber = (TextBox)row.FindControl("txtSeatNumber");
         GradeStudent.AddParameter("seatNumber", txtSeatNumber.Text);
         GradeStudent.Update("student_id='" + ID + "'");
     }
     My.WebForm.doJavaScript("alert('設定成功');location.href='" + Request.Url.ToString() + "'");
 }
Exemplo n.º 7
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        EasyDataProvide Account = new EasyDataProvide("Account");
        Account.AddParameter("username",txtAccount.Text);
        Account.AddParameter("emailAddress", txtEmail.Text);
        DataRow row = Account.GetSingleRow("username=@username and emailAddress=@emailAddress");
        if(row==null)
        {
            lblMessage.Text = "填入資料與資料庫不符,請恰尋學校管理者,謝謝";
            return;
        }
        //取得新密碼
        string newPassword = GenerateRandomCode();
        Account.RemoveParameter("emailAddress");
        Account.AddParameter("password", FormsAuthentication.HashPasswordForStoringInConfigFile(newPassword, "MD5"));
        Account.Update("username=@username");

        //送到信箱

        My.WebForm.doJavaScript("alert('密碼已經寄到您註冊的信箱!')");
    }
Exemplo n.º 8
0
 protected void InsertButton_Click(object sender, EventArgs e)
 {
     //更新帳號資料
     if (!string.IsNullOrEmpty(password.Text))
     {
         _Customer.AddParameter("password", password.Text);
     }
     _Customer.AddParameter("name", name.Text);
     _Customer.AddParameter("gender", gender.SelectedValue);
     _Customer.AddParameter("emailAddress", emailAddress.Text);
     _Customer.AddParameter("birthday", birthday.Text);
     _Customer.AddParameter("areaCode", areaCode.Value);
     _Customer.AddParameter("numberCode", numberCode.Value);
     _Customer.AddParameter("cellphone", cellphone.Text);
     _Customer.AddParameter("city", Request["city"]);
     _Customer.AddParameter("division", Request["division"]);
     _Customer.AddParameter("zip", Request["zip"]);
     _Customer.AddParameter("address", address.Value);
     _Customer.AddParameter("username", username.Text);
     _Customer.Update("username=@username");
     My.WebForm.doJavaScript("alert('修改成功!');location.href='index.aspx'");
 }
Exemplo n.º 9
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
        _people.SetPlaceHolderFormQuest();
        _people.AddParameter("address_id", telID);
        _people.AddParameter("telephone_id", areaID);
        _people.UpdateById(Request["id"]);

        //更新Student
        _student.AddParameter("studentNumber", studentNumber.Text);
        _student.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");

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

        GradeStudent.AddParameter("student_id", Request["id"]);
        GradeStudent.AddParameter("grade_id", ddlGrade.SelectedValue);
        GradeStudent.Update("student_id=@student_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='Student_List.aspx'");
    }
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"]));
    }
Exemplo n.º 11
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)
    {
        if (string.IsNullOrEmpty(article.Text))
        {
            My.WebForm.doJavaScript("alert('�Բӻ������i�H�ť�.');");
            return;
        }
        if (shortDescription.Text.Length >= 500)
        {
            My.WebForm.doJavaScript("alert('²�满�����i�H�W�L500�Ӧr.');");
            return;
        }

        Person person = new Person();

        EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");
        ModulePublish.SetPlaceHolderFormQuest();
        //�B�z�W���ɮ�
        if (ddlFile.SelectedValue == "�ɮפW��" && fuFile.HasFile)
        {
            //���o���ɦW
            string Extension = fuFile.FileName.Split('.')[fuFile.FileName.Split('.').Length - 1];
            //�s�ɮצW��
            string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);
            fuFile.SaveAs(Server.MapPath(String.Format("~/UploadFiles/Files/{0}", fileName)));
            ModulePublish.AddParameter("fileUrl", fileName);

        }

        //�B�z�W�ǹϤ�

        if (fuPic.HasFile)
        {
            if (fuPic.PostedFile.ContentType.IndexOf("image") == -1)
            {
                My.WebForm.doJavaScript("alert('�ɮ׫��A���~!');");
                return;
            }

            //���o���ɦW
            string Extension = fuPic.FileName.Split('.')[fuPic.FileName.Split('.').Length - 1];
            //�s�ɮצW��
            string fileName = String.Format("{0:yyyyMMddhhmmsss}.{1}", DateTime.Now, Extension);
            fuPic.SaveAs(Server.MapPath(String.Format("~/UploadFiles/Images/{0}", fileName)));
            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());
        //���񵲧����ɡA�]�w�@��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("News_List.aspx?ModuleID={0}&page={1}", Request["ModuleID"], Request["page"]));
    }