コード例 #1
0
    /// <summary>
    /// 此方法為Radio擁有2種屬性String,Int 且擁有一個下拉選單
    /// </summary>
    /// <param name="RadioColumn">選擇的欄位名</param>
    /// <param name="RadioColumnSet1">string欄位名</param>
    /// <param name="RadioColumnSet2">Int欄位名</param>
    /// <param name="Txtbox1">TextBox輸入字串</param>
    /// <param name="DropdownValue">下拉值</param>
    /// <param name="DropdownSet1">下拉欄位</param>
    /// <returns></returns>
    public static string SearchWHEREStringObject(string RadioColumn, string RadioColumnSet1, string RadioColumnSet2, string Txtbox1, int DropdownValue, string DropdownSet1, string ORDER)
    {
        StringBuilder sb = new StringBuilder();

        sb.Append("1=1");
        if (Txtbox1.ToLower() != "all" && Txtbox1 != string.Empty)
        {
            if (RadioColumn == RadioColumnSet1)
            {
                sb.Append(" AND " + RadioColumnSet1 + " LIKE '%" + AddMethodSystem.NoHTML(Txtbox1) + "%'");
            }
            else
            {
                if (Tools.TryParseMethod(Txtbox1.ToString()) != 0)
                {
                    sb.Append(" AND " + RadioColumnSet2 + "<=" + int.Parse(Txtbox1));
                }
                else
                {
                    sb.Append(" AND " + RadioColumnSet1 + " LIKE '%" + AddMethodSystem.NoHTML(Txtbox1) + "%'");
                }
            }
        }
        if (DropdownValue != 0)
        {
            sb.Append(" AND " + DropdownSet1 + "=" + DropdownValue);
        }
        //   sb.Append(ORDER);
        return(sb.ToString());
    }
コード例 #2
0
    //支援多型
    /// <summary>
    /// 此方法為Radio擁有2欄位且擁有欄位為:Price
    /// </summary>
    /// <param name="SELECT">SELECT欄位</param>
    /// <param name="Tablename">資料表名稱</param>
    /// <param name="RadioColumn">RadioButton選擇值</param>
    /// <param name="RadioColumnSet1">RadioButton欄位1</param>
    /// <param name="RadioColumnSet2">RadioButton欄位2</param>
    /// <param name="Txtbox1">TextBox輸入字串</param>
    /// <param name="DropdownValue">DropdownList下拉類別</param>
    /// <param name="DropdownSet1">DropdownList下拉欄位</param>
    /// <param name="ORDER">排序字串</param>
    /// <returns></returns>
    public static string SearchWHEREString(string SELECT, string Tablename, string RadioColumn, string RadioColumnSet1, string RadioColumnSet2, string Txtbox1, int DropdownValue, string DropdownSet1, string ORDER)
    {
        int           i  = 0;
        StringBuilder sb = new StringBuilder();

        sb.Append("SELECT " + SELECT + " FROM " + Tablename + " WHERE 1=1");
        if (RadioColumn == RadioColumnSet1)
        {
            if (Txtbox1.ToLower() != "all" && Txtbox1 != string.Empty)
            {
                sb.Append(" AND " + RadioColumnSet1 + " LIKE '%" + AddMethodSystem.NoHTML(Txtbox1) + "%'");
            }
        }
        else
        {
            if (Txtbox1.ToLower() != "all" && Txtbox1 != string.Empty)
            {
                if (int.TryParse(Txtbox1, out i))
                {
                    sb.Append(" AND " + RadioColumnSet2 + "<=" + int.Parse(Txtbox1));
                }
                else
                {
                    sb.Append(" AND " + RadioColumnSet1 + " LIKE '%" + AddMethodSystem.NoHTML(Txtbox1) + "%'");
                }
            }
        }
        if (DropdownValue != 0)
        {
            sb.Append(" AND " + DropdownSet1 + "=" + DropdownValue);
        }
        sb.Append(ORDER);
        return(sb.ToString());
    }
コード例 #3
0
ファイル: SMTPclass.cs プロジェクト: nieo7/chienyehtsai
    //帳號申請URL驗證專用SMTP
    public void RegistAccountURL(ArrayList UserSmtp)
    {
        MailAddress mailFromUser = new MailAddress(UserSmtp[0].ToString(), UserSmtp[1].ToString(), Encoding.UTF8);
        MailMessage mailUser     = new MailMessage();

        mailUser.From = mailFromUser;
        mailUser.To.Add(UserSmtp[10].ToString());
        mailUser.IsBodyHtml = true;
        mailUser.Body       = "<table><tr><td>申請人姓名:" + AddMethodSystem.NoHTML(UserSmtp[6].ToString()) + "</td></tr>";
        if (smtp[3].ToString() != string.Empty)
        {
            mailUser.Body += "<tr><td>您申請的7000GO帳號名稱:" + AddMethodSystem.NoHTML(smtp[3].ToString()) + "</td></tr>";
        }
        if (smtp[4].ToString() != string.Empty)
        {
            mailUser.Body += "<tr><td>您註冊的7000GO網站名稱:" + AddMethodSystem.NoHTML(smtp[4].ToString()) + "</td></tr>";
        }
        mailUser.Body += "<tr><td>請點擊下面網址通過帳戶驗證</td></tr>";
        mailUser.Body += "<tr><td>" + UserSmtp[16].ToString() + "</td></tr>";
        mailUser.Body += "</table><br/>";
        //在此加入信件Footer設定
        mailUser.Body           += FooterSet();
        mailUser.Subject         = AddMethodSystem.NoHTML(smtp[17].ToString());
        mailUser.SubjectEncoding = Encoding.UTF8;
        mailUser.Priority        = MailPriority.Normal;
        SmtpClient SMTP = new SmtpClient(smtp[15].ToString(), int.Parse(smtp[14].ToString())); //主機位置與port

        SMTP.Credentials = new NetworkCredential(smtp[0].ToString(), smtp[2].ToString());      //server@domainname
        SMTP.Send(mailUser);
    }
コード例 #4
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    ClickNowSort  = 0;
        int    RdyChangeSort = 0;
        int    i             = 0;
        Button btnClick;
        Button btnRdyChange;

        if (e.CommandName == "btnSortUp")
        {
            if (int.Parse(e.CommandArgument.ToString()) > 0)
            {
                btnClick     = (Button)GridView1.Rows[int.Parse(e.CommandArgument.ToString())].FindControl("Button2");
                btnRdyChange = (Button)GridView1.Rows[int.Parse(e.CommandArgument.ToString()) - 1].FindControl("Button2");
                QnaInfo pdClick  = qBLL.GetDataById(int.Parse(btnClick.CommandArgument.ToString()));
                QnaInfo pdChange = qBLL.GetDataById(int.Parse(btnRdyChange.CommandArgument.ToString()));
                ClickNowSort    = pdClick.q_sort;
                RdyChangeSort   = pdChange.q_sort;
                pdClick.q_sort  = RdyChangeSort;
                pdChange.q_sort = ClickNowSort;
                if ((i = qBLL.Update(pdClick) + qBLL.Update(pdChange)) > 1)
                {
                    ShowMessage("排序成功");
                    ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("f_title", txtKeyWord.Text, ""));
                }
            }
            else
            {
                ShowMessage("此項目排序已是第一位");
            }
        }
        if (e.CommandName == "btnSortDown")
        {
            if (int.Parse(e.CommandArgument.ToString()) < GridView1.Rows.Count - 1)
            {
                btnClick     = (Button)GridView1.Rows[int.Parse(e.CommandArgument.ToString())].FindControl("Button2");
                btnRdyChange = (Button)GridView1.Rows[int.Parse(e.CommandArgument.ToString()) + 1].FindControl("Button2");
                QnaInfo pdClick  = qBLL.GetDataById(int.Parse(btnClick.CommandArgument.ToString()));
                QnaInfo pdChange = qBLL.GetDataById(int.Parse(btnRdyChange.CommandArgument.ToString()));
                ClickNowSort    = pdClick.q_sort;
                RdyChangeSort   = pdChange.q_sort;
                pdClick.q_sort  = RdyChangeSort;
                pdChange.q_sort = ClickNowSort;
                if ((i = qBLL.Update(pdClick) + qBLL.Update(pdChange)) > 1)
                {
                    ShowMessage("排序成功");
                    ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("f_title", txtKeyWord.Text, ""));
                }
            }
            else
            {
                ShowMessage("此項目排序已是最後一位");
            }
        }
    }
コード例 #5
0
 protected void Search()
 {
     if (rbTitle.Checked)
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("b_title", "b_title", "b_price", txtKeyWord.Text, Tools.TryParseMethod(ddrBannerCategory.SelectedValue), "bc_id", Tools.TryParseMethod(ddrBannerCustomer.SelectedValue), "bcs_id", Tools.TryParseMethod(ddrBannerLocation.SelectedValue), "bl_id", ""));
     }
     else
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("b_price", "b_title", "b_price", txtKeyWord.Text, Tools.TryParseMethod(ddrBannerCategory.SelectedValue), "bc_id", Tools.TryParseMethod(ddrBannerCustomer.SelectedValue), "bcs_id", Tools.TryParseMethod(ddrBannerLocation.SelectedValue), "bl_id", ""));
     }
 }
コード例 #6
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (rbProductName.Checked)
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("o_name", txtKeyWord.Text, ""));
     }
     else
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("o_number", txtKeyWord.Text, ""));
     }
 }
コード例 #7
0
ファイル: contact.aspx.cs プロジェクト: nieo7/chienyehtsai
 //電話號碼驗證
 protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
 {
     if (txtPhone.Text.Length >= 9 && txtPhone.Text.Length <= 20)
     {
         args.IsValid = true;
     }
     else
     {
         args.IsValid = false;
         AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "insertContact", "alert('At least input 9~20 numbers');");
     }
 }
コード例 #8
0
    //支援多型

    /// <summary>
    /// 此方法為:單一TextBox搜尋-控制項:1
    /// </summary>
    /// <param name="SELECT"></param>
    /// <param name="Tablename"></param>
    /// <param name="RadioColumn">欄位名</param>
    /// <param name="Txtbox1">欄位值</param>
    /// <returns></returns>
    public static string SearchWHEREStringObject(string RadioColumn, string Txtbox1, string ORDER)
    {
        StringBuilder sb3 = new StringBuilder();

        sb3.Append("1=1");
        if (Txtbox1.ToLower() != "all" && Txtbox1 != string.Empty)
        {
            sb3.Append(" AND " + RadioColumn + " LIKE '%" + AddMethodSystem.NoHTML(Txtbox1) + "%'");
        }
        //  sb3.Append(ORDER);
        return(sb3.ToString());
    }
コード例 #9
0
    /// <summary>
    /// 此方法為無Dropdown與Radio分別欄位
    /// </summary>
    /// <param name="SELECT"></param>
    /// <param name="Tablename"></param>
    /// <param name="RadioColumn"></param>
    /// <param name="Txtbox1"></param>
    /// <param name="ORDER"></param>
    /// <returns></returns>
    public static string SearchWHEREString(string SELECT, string Tablename, string RadioColumn, string Txtbox1, string ORDER)
    {
        StringBuilder sb3 = new StringBuilder();

        sb3.Append("SELECT " + SELECT + " FROM " + Tablename + " WHERE 1=1");
        if (Txtbox1.ToLower() != "all" && Txtbox1 != string.Empty)
        {
            sb3.Append(" AND " + RadioColumn + " LIKE '%" + AddMethodSystem.NoHTML(Txtbox1) + "%'");
        }
        sb3.Append(ORDER);
        return(sb3.ToString());
    }
コード例 #10
0
ファイル: List.aspx.cs プロジェクト: nieo7/chienyehtsai
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (rbCompanyName.Checked)
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("bcs_company_name", txtKeyWord.Text, ""));
     }
     else if (rbName.Checked)
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("bcs_name", txtKeyWord.Text, ""));
     }
     else
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("bcs_key", txtKeyWord.Text, ""));
     }
 }
コード例 #11
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (rbAccount.Checked)
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("m_account", txtKeyWord.Text, ""));
     }
     else if (rbNickname.Checked)
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("m_nickname", txtKeyWord.Text, ""));
     }
     else
     {
         ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("m_name", txtKeyWord.Text, ""));
     }
 }
コード例 #12
0
    protected void GoToPage_TextChanged(object sender, EventArgs e)
    {
        TextBox txtgotopage = (TextBox)sender;
        int     pageNumber;

        if (int.TryParse(txtgotopage.Text.Trim(), out pageNumber) && pageNumber > 0 && pageNumber <= this.GridView1.PageCount)
        {
            this.GridView1.PageIndex = pageNumber - 1;
        }
        else
        {
            this.GridView1.PageIndex = GridView1.PageCount - 1;
            AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "valuebig", "alert('超出分頁最大值');window.location.href");
            ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("pc_name", txtKeyWord.Text, int.Parse(ddrCategory.SelectedValue), "pc_fatherid", lid, "l_id", ""));
        }
    }
コード例 #13
0
    /// <summary>
    /// 此種方法用在Radio有N欄位且搭配一個Int值Dropdown-控制項:2
    /// </summary>
    /// <param name="RadioColumn">欄位名</param>
    /// <param name="Txtbox1">欄位值</param>
    /// <param name="DropdownValue">Int下拉值</param>
    /// <param name="DropdownSet1">欄位名</param>
    /// <returns></returns>
    public static string SearchWHEREStringObject(string RadioColumn, string Txtbox1, int DropdownValue, string DropdownSet1, string ORDER)
    {
        StringBuilder sb2 = new StringBuilder();

        sb2.Append("1=1");
        if (Txtbox1.ToLower() != "all" && Txtbox1 != string.Empty)
        {
            sb2.Append(" AND " + RadioColumn + " LIKE '%" + AddMethodSystem.NoHTML(Txtbox1) + "%'");
        }

        if (DropdownValue != 0)
        {
            sb2.Append(" AND " + DropdownSet1 + "=" + DropdownValue);
        }
        //   sb2.Append(ORDER);
        return(sb2.ToString());
    }
コード例 #14
0
ファイル: contact.aspx.cs プロジェクト: nieo7/chienyehtsai
 protected void ImgbtnSubmit_Click(object sender, ImageClickEventArgs e)
 {
     if (Page.IsValid)
     {
         ContactInfo info = new ContactInfo();
         info.c_name      = txtName.Text;
         info.c_subject   = txtSubject.Text;
         info.c_detail    = txtDetail.Text;
         info.c_mail      = txtEmail.Text;
         info.c_phone1    = txtPhone.Text;
         info.c_phone2    = txtFax.Text;
         info.c_pose_date = DateTime.Now;
         info.l_id        = 2;//英文
         if (cBLL.Insert(info) > 0)
         {
             AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "insertContact", "alert('Thanks for your message! We will contact you soon...');document.location.href='index.aspx'");
         }
     }
 }
コード例 #15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["name"] != null && Request.QueryString["checkcode"] != null)
     {
         MemberInfo info = mBLL.GetDataByAccountAndCheckcode(Request.QueryString["name"].ToString(), Request.QueryString["checkcode"].ToString());
         if (info.m_id != 0)
         {
             mBLL.Update(info);
             AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "CheckSuccess", "alert('驗證成功');window.location.href='List.aspx';");
         }
         else
         {
             AddMethodSystem.ShowBox(UpdatePanel1, this.GetType(), "fail", "alert('查無此人');");
         }
     }
     else
     {
         Response.Redirect("List.aspx");
         Response.End();
     }
 }
コード例 #16
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("pc_name", txtKeyWord.Text, int.Parse(ddrCategory.SelectedValue), "pc_fatherid", lid, "l_id", ""));
 }
コード例 #17
0
ファイル: SMTPclass.cs プロジェクト: nieo7/chienyehtsai
    public void SendMail(ArrayList SmtpList)
    {
        //發件者信箱,名稱,編碼
        MailAddress mailFrom = new MailAddress(smtp[0].ToString(), smtp[1].ToString(), Encoding.UTF8);
        MailMessage mail     = new MailMessage();

        mail.From = mailFrom;  //發件者
        try
        {
            for (int i = 0; i < AL.Count; i++)
            {
                if (AL[i].ToString().Trim() != string.Empty)
                {
                    mail.To.Add(AL[i].ToString()); //收件者
                }
            }
        }
        catch
        {
            mail.To.Add("*****@*****.**");
        }
        mail.IsBodyHtml = true;
        //異動變數區
        mail.Body = "<table><tr><td>訪客姓名:" + AddMethodSystem.NoHTML(SmtpList[6].ToString()) + "</td></tr>";
        if (smtp[11].ToString() != string.Empty)
        {
            mail.Body += "<tr><td>主   旨:" + AddMethodSystem.NoHTML(smtp[11].ToString()) + "</td></tr>";
        }
        if (smtp[9].ToString() != string.Empty)
        {
            mail.Body += "<tr><td>地   址:" + AddMethodSystem.NoHTML(smtp[9].ToString()) + "</td></tr>";
        }
        if (smtp[7].ToString() != string.Empty)
        {
            mail.Body += "<tr><td>聯絡電話:" + AddMethodSystem.NoHTML(smtp[7].ToString()) + "</td></tr>";
        }
        if (smtp[8].ToString() != string.Empty)
        {
            mail.Body += "<tr><td>手  機:" + AddMethodSystem.NoHTML(smtp[8].ToString()) + "</td></tr>";
        }
        if (smtp[10].ToString() != string.Empty)
        {
            mail.Body += "<tr><td>電子信箱:" + AddMethodSystem.NoHTML(smtp[10].ToString()) + "</td></tr>";
        }
        if (smtp[12].ToString() != string.Empty)
        {
            mail.Body += "<br/>內容:<br/><div style='width:600px;height:300px'><textarea id='Contents' name='Contents' style='width:600px;height:300px'>" + AddMethodSystem.NoHTML(smtp[12].ToString()) + "</textarea></div>";
        }
        if (smtp[3].ToString() != string.Empty)
        {
            mail.Body += "<tr><td>申請帳號:" + AddMethodSystem.NoHTML(smtp[3].ToString()) + "</td></tr>";
        }
        if (smtp[4].ToString() != string.Empty)
        {
            mail.Body += "<tr><td>網站名稱:" + AddMethodSystem.NoHTML(smtp[4].ToString()) + "</td></tr>";
        }
        //異動變數區
        mail.Body += "</table>";
        if (smtp[18].ToString() != string.Empty)
        {
            mail.Subject = AddMethodSystem.NoHTML(smtp[18].ToString());
        }
        else
        {
            mail.Subject = AddMethodSystem.NoHTML(smtp[13].ToString());
        }
        mail.SubjectEncoding = Encoding.UTF8;
        mail.Priority        = MailPriority.Normal;
        SmtpClient SMTP = new SmtpClient(smtp[15].ToString(), int.Parse(smtp[14].ToString())); //主機位置與port

        //發送者驗證
        SMTP.Credentials = new NetworkCredential(smtp[0].ToString(), smtp[2].ToString()); //server@domainname
        SMTP.Send(mail);
        if (smtp[16].ToString() != string.Empty)
        {
            RegistAccountURL(smtp);
        }
    }
コード例 #18
0
ファイル: List.aspx.cs プロジェクト: nieo7/chienyehtsai
    //public string getTitle(int id)
    //{
    //    if (id == 0)
    //    {
    //        return "";
    //    }

    //    return info.nc_name;
    //}
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("n_title", txtKeyWord.Text, int.Parse(ddrCategory.SelectedValue), "nc_id", lid, "l_id", ""));
    }
コード例 #19
0
ファイル: List.aspx.cs プロジェクト: nieo7/chienyehtsai
 protected void Button1_Click(object sender, EventArgs e)
 {
     ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("gb_title", txtKeyWord.Text, ""));
 }
コード例 #20
0
ファイル: List.aspx.cs プロジェクト: nieo7/chienyehtsai
 protected void GridView1_PageIndexChanged(object sender, EventArgs e)
 {
     ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("bl_title", txtKeyWord.Text, Tools.TryParseMethod(ddlCategory.SelectedValue), "bl_father_id", ""));
 }
コード例 #21
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     ObjectDataSource1.FilterExpression = AddMethodSystem.DecodeHtml2(AddMethodSystem.SearchWHEREStringObject("sc_Name", txtKeyWord.Text, ddrCategory.SelectedValue, "sc_Class", ""));
 }