Exemplo n.º 1
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.º 2
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        EasyDataProvide Member = new EasyDataProvide("Member");

        Member.SetPlaceHolderFormQuest();
        DataRow dataRow = Member.GetSingleRow("account=@account");

        if (dataRow != null)
        {
            My.WebForm.doJavaScript("alert('帳號已使用!');");
            return;
        }
        Member.AddParameter("password", FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "MD5"));
        string premissionString = PermissionUserControl1.permissionString;

        Member.AddParameter("Permission", premissionString);
        string userID = Member.InsertReturnValue();

        if (ddlRole.Items.Count > 0)
        {
            EasyDataProvide RoleUserMapping = new EasyDataProvide("RoleUserMapping");
            RoleUserMapping.AddParameter("roleID", ddlRole.SelectedValue);
            RoleUserMapping.AddParameter("userID", userID);
            RoleUserMapping.Insert();
        }


        Response.Redirect("Account_list.aspx?ModuleID=" + Request["ModuleID"]);
    }
Exemplo n.º 3
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.º 4
0
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        //檢查帳號是否重複
        EasyDataProvide Customer = new EasyDataProvide("Customer");

        Customer.AddParameter("username", username.Text);
        DataRow rowCheck = Customer.GetSingleRow("username=@username");

        if (rowCheck != null)
        {
            My.WebForm.doJavaScript("alert('帳號已經存在')");
            return;
        }

        //驗證手機號碼格式


        //新增會員
        Customer.SetPlaceHolderFormQuest();
        Customer.AddParameter("password", password.Text);
        Customer.AddParameter("city", Request["city"]);
        Customer.AddParameter("division", Request["division"]);
        Customer.AddParameter("zip", Request["zip"]);

        Customer.Insert();
        My.WebForm.doJavaScript("alert('加入成功!');location.href='index.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.º 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()
    {
        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();
    }
Exemplo n.º 8
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.º 9
0
    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 and type is null");

        if (rowArticle != null)
        {
            article.Text           = rowArticle["article"].ToString();
            ViewState["articleID"] = rowArticle["id"].ToString();
        }
    }
Exemplo n.º 10
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        TIN.EasyDataProvide Customer = new EasyDataProvide("Customer");
        Customer.AddParameter("username", account.Text);
        Customer.AddParameter("password", password.Text);
        DataRow row = Customer.GetSingleRow("username=@username and password=@password");

        if (row == null)
        {
            My.WebForm.doJavaScript("alert('登入失敗!')");
            return;
        }
        else
        {
            string UserData = row["aliasName"].ToString();
            SetAuthenTicket(UserData, row["id"].ToString());
            Response.Redirect("index.aspx");
        }
    }
    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.º 12
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.º 13
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        TIN.EasyDataProvide Customer = new EasyDataProvide("Customer");
        Customer.AddParameter("username", account.Text);
        Customer.AddParameter("password", Password.Text);
        DataRow row = Customer.GetSingleRow("username=@username and password=@password");

        if (row == null)
        {
            lblErrer.Visible = true;
            My.WebForm.doJavaScript("alert('登入失敗!')");
            return;
        }
        else
        {
            string UserData = row["aliasName"].ToString();
            SetAuthenTicket(UserData, account.Text);
            Response.Redirect("member_atmbuy.aspx");
        }
    }
Exemplo n.º 14
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.º 15
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";;
        }
    }
Exemplo n.º 16
0
    private void show()
    {
        EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");
        DataRow row = ModulePublish.FillPlaceHolderControlsById(Request["ID"]);
        ddlClass1.SelectedValue = row["classID"].ToString();
        //ddlOrg.SelectedValue = row["OrgID"].ToString();
        if (endDate.Text == "2800/1/1")
        {
            endDate.Text = "";
        }
        picUrlLink.NavigateUrl = "~/UploadFiles/Images/" + row["picUrl"].ToString();
        fileUrlLink.NavigateUrl = "~/UploadFiles/Files/" + row["fileUrl"].ToString();

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

        //if (!DataLayer.IsInRole("admins", User.Identity.Name))
        //{
        //    if (row["beSelect"].ToString() != "0") //不是自己發佈的
        //    {
        //        OrgControl.checkBoxList.Enabled = false;
        //        InsertButton.Visible = false;
        //    }
        //    else
        //    {
        //        string[] strUserData = ((FormsIdentity)(User.Identity)).Ticket.UserData.Split(new Char[] { ';' });
        //        for (int i = OrgControl.checkBoxList.Items.Count - 1; i >= 0; i--)
        //        {
        //            ListItem item = OrgControl.checkBoxList.Items[i];
        //            if (item.Value.IndexOf(strUserData[5]) == -1)
        //            {
        //                OrgControl.checkBoxList.Items.Remove(item);

        //            }
        //        }

        //    }

        //}
    }
Exemplo n.º 17
0
    private void show()
    {
        EasyDataProvide ModulePublish = new EasyDataProvide("ModulePublish");
        DataRow         row           = ModulePublish.FillPlaceHolderControlsById(Request["ID"]);

        ViewState["GUID"]       = Request["ID"];
        ddlClass1.SelectedValue = row["classID"].ToString();
        ddlOrg.SelectedValue    = row["OrgID"].ToString();
        if (endDate.Text == "2800/1/1")
        {
            endDate.Text = "";
        }
        if (string.IsNullOrEmpty(row["picUrl"].ToString()))
        {
            picUrlLink.Visible = false;
        }
        else
        {
            picUrlLink.NavigateUrl = row["picUrl"].ToString().IndexOf("http") == -1 ? "~/UploadFiles/Images/" + row["picUrl"].ToString() : row["picUrl"].ToString();
        }


        if (string.IsNullOrEmpty(row["fileUrl"].ToString()))
        {
            fileUrlLink.Visible = false;
        }
        else
        {
            fileUrlLink.NavigateUrl = row["fileUrl"].ToString().IndexOf("http") == -1
                                          ? "~/UploadFiles/Files/" + row["fileUrl"].ToString()
                                          : row["fileUrl"].ToString();
        }

        EasyDataProvide ModuleContents = new EasyDataProvide("ModuleContents");

        ModuleContents.AddParameter("publishID", Request["ID"]);
        DataRow rowArticle = ModuleContents.GetSingleRow("publishID=@publishID and type is null");

        if (rowArticle != null)
        {
            article.Text           = rowArticle["article"].ToString();
            ViewState["articleID"] = rowArticle["id"].ToString();
        }


        //if (!DataLayer.IsInRole("admins", User.Identity.Name))
        //{
        //    if (row["beSelect"].ToString() != "0") //不是自己發佈的
        //    {
        //        OrgControl.checkBoxList.Enabled = false;
        //        InsertButton.Visible = false;
        //    }
        //    else
        //    {
        //        string[] strUserData = ((FormsIdentity)(User.Identity)).Ticket.UserData.Split(new Char[] { ';' });
        //        for (int i = OrgControl.checkBoxList.Items.Count - 1; i >= 0; i--)
        //        {
        //            ListItem item = OrgControl.checkBoxList.Items[i];
        //            if (item.Value.IndexOf(strUserData[5]) == -1)
        //            {
        //                OrgControl.checkBoxList.Items.Remove(item);

        //            }
        //        }

        //    }

        //}
    }