예제 #1
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        if (Validate())
        {
            Hashtable tbIn = new Hashtable();
            tbIn.Add("Member_Status", "1");
            tbIn.Add("Member_Phone", phone.Text);
            tbIn.Add("Member_Email", email.Text);
            tbIn.Add("Member_Password", ApplicationUtil.PasswordEncrypt(CMSfunc._Replate(password.Text)));
            var res = UpdateData.Insert("tbl_Member", tbIn);
            if (res)
            {
                dvsuccess.Visible = true;
                lbError.Text      = "Đăng ký thành công! Bạn có thể <a href='/login.htm' class='text-bold'>Đăng nhập.</a>";
                string fromEmail = email.Text;
                string toEmail   = email.Text;
                string Name      = CMSfunc._GetConst("_Name");

                string Subject         = "ĐĂNG KÝ TÀI KHOẢN THÀNH CÔNG TẠI " + CMSfunc._GetConst("_Domain");
                string Host            = CMSfunc._GetConst("_Hostmail");
                string EmailClient     = CMSfunc._GetConst("_EmailClient");
                string PassEmailClient = CMSfunc._GetConst("_PassEmailClient");
                int    Port            = Convert.ToInt32(CMSfunc._GetConst("_Port"));
                string strBody         = "<html><body><p><b>Quý khách đăng ký thành công tài khoản tại website " + CMSfunc._GetConst("_Domain") + "</b></p><p><b>Thông tin tài khoản: </b></p><p>&nbsp;&nbsp;&nbsp;+ Số điện thoại: " + phone.Text + "</p><p>&nbsp;&nbsp;&nbsp;+ Mật khẩu: " + password.Text + "</p><p>Quý khách vui lòng truy cập " + CMSfunc._GetConst("_Domain") + " chọn Đăng nhập để đặt vé xe điện tử. <br>Cảm ơn quý khách đã sử dụng dịch vụ của chúng tôi.</p></body></html>";
                try
                {
                    bool _isSend = SendMailClient.SendGMail(toEmail, fromEmail, Name, "", Subject, Host, Port, EmailClient, PassEmailClient, "Xác thực thành công", strBody);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
        }
    }
예제 #2
0
    private void LoadNews(int pagecurrent, int pagesize, string field, string where, string order)
    {
        phantrang      pt = new phantrang();
        ContentControl ct = new ContentControl();

        pagecurrent = pagecurrent < 1 ? 1 : pagecurrent;
        DataTable         dt   = ct.dt_Contentsearch(pagecurrent, pagesize, field, where, order);
        DataRowCollection rows = dt.Rows;
        StringBuilder     str  = new StringBuilder();

        if (rows.Count > 0)
        {
            int tongso = Convert.ToInt16(dt.Rows[0]["tongso"].ToString());
            int tem    = (tongso >= pagesize) ? pagesize : tongso;
            tem = tongso >= pagesize * pagecurrent ? pagesize : tongso - pagesize * (pagecurrent - 1);
            //str.Append("<div class=\"box-main-left\">");
            for (int i = 0; i < tem; i++)
            {
                int    p     = Convert.ToInt32(rows[i]["Mod_ID"]);
                string n     = rows[i]["Content_Name"].ToString();
                string img   = rows[i]["Content_Img"].ToString();
                string intro = rows[i]["Content_intro"].ToString();
                string url   = ResolveUrl("~/" + ModControl.GetModCode(p) + "/" + rows[i]["Content_Url"] + ".htm");
                str.Append(CMSfunc.LoadNewsItem(url, img, n, intro));
            }
            //str.Append("</div>");
            ltrListNews.Text = str.ToString();
            if ((((tongso - 1) / pagesize) + 1) > 1)
            {
                ltrPhantrang.Text = pt.pagelinkNews(((tongso - 1) / pagesize) + 1, pagecurrent, Request.RawUrl);
            }
        }
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string mod      = String.IsNullOrEmpty(Request["url"]) ? "Home" : Request["url"].ToString();
        string chuyenxe = String.IsNullOrEmpty(Request["url"]) ? "Home" : Request["nurl"].ToString();

        modId = ModControl.GetP_From_Code(mod);
        var res = new ChuyenXeRepository().SearchFor(o => o.url == chuyenxe).SingleOrDefault();

        if (res != null)
        {
            res.Xe        = new XeRepository().Find(res.MaXe.Value);
            res.Xe.NhaXe1 = new NhaxeRepository().Find(res.Xe.Nhaxe.Value);
            cx            = res;
        }
        else
        {
            Response.Redirect("/404.htm");
        }
        CMSfunc.checkURL();
        if (Session["UserID"] != null)
        {
            //var user = UserControls.GetUserByID(int.Parse(Session["UserID"].ToString()));
            //txtAddress.Text = user.User_Address;
            //txtName.Text = user.User_Name;
            //txtTel.Text = user.User_Tel;
            //email.Text = user.User_Email;
        }
    }
예제 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CMSfunc.checkURL();
        string url  = Request.QueryString["url"];
        string nUrl = Request.QueryString["nUrl"];

        p = ModControl.GetP_From_Code(url);
        int op = p;

        if (ModControl.GetLevel(p) == 2)
        {
            op = ModControl.GetOldP(p);
        }
        if (ModControl.GetLevel(p) == 3)
        {
            op = ModControl.GetOldP(ModControl.GetOldP(p));
        }
        //Detail.Visible = false;
        //if (nUrl != null)
        //{
        //    List.Visible = false;
        //    Detail.Visible = true;
        //    int id = ModControl.GetID_From_Url(p, nUrl);
        //    ltrContent.Text = LoadDetail(id, op);
        //}
        //else
        //{
        ltrSubmod.Text      = LoadSubmod(op, url);
        ltrListContent.Text = LoadListContent(p);
        //}
    }
예제 #5
0
    protected bool?isRequestTimeOut()
    {
        var MemberID = Session["MemberID"];

        if (MemberID != null)
        {
            TimeSpan time = new TimeSpan(int.Parse(CMSfunc._GetConst("_AutoCancelTime")), 0, 0);
            if (rq != new RequestTravel())
            {
                if (rq.CreateDate.HasValue)
                {
                    TimeSpan timediff = Value.DiffTime(rq.CreateDate.Value.ToString(), DateTime.Now.ToString());
                    return(time > timediff);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
        else
        {
            return(null);
        }
    }
예제 #6
0
 protected override void OnInit(EventArgs e)
 {
     CMSfunc.checkURL();
     if (this.Session["UserID"] == null || this.Session["UserID"].ToString() == "")
     {
         base.Response.Redirect(ApplicationSetting.URLRoot + "admin/login.aspx");
     }
     base.OnInit(e);
 }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CMSfunc.checkURL();
        string u = String.IsNullOrEmpty(Request["url"]) ? "Home" : Request["url"].ToString();
        int    p = ModControl.GetP_From_Code(u);

        ltrAboutService.Text = ModControl.GetModField("Content", p);
        ltrListService.Text  = LoadService(p);
    }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string status = Request["status"] == null ? "" : Request["status"];

        ltrbanner.Text      = LoadSlider(status);
        ltrPioriryFrom.Text = LoadPiorityFrom();
        CMSfunc.checkURL();
        if (IsPostBack)
        {
        }
    }
예제 #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string status = Request["status"] == null ? "" : Request["status"];

        ltrbanner.Text      = LoadSlider(status);
        ltrListRequest.Text = LoadRequestTravel();
        CMSfunc.checkURL();
        if (IsPostBack)
        {
        }
    }
예제 #10
0
    //protected string LoadTitle(int p, int id)
    //{
    //    StringBuilder str = new StringBuilder();
    //    if (p != 0)
    //    {
    //        if (id != 0)
    //            str.Append(ContentControl.GetContentField("Title", id));
    //        else
    //        {
    //            str.Append(ModControl.GetModField("Title", p));
    //            int cm = ConvertUtil.ReplaceInt(Request["cm"]);
    //            int ck = ConvertUtil.ReplaceInt(Request["ck"]);
    //            if (cm != 0)
    //                str.Append(" - " + ModControl.GetModField("Name", cm));
    //            if (ck != 0)
    //                str.Append(" - " + ModControl.GetModField("Name", ck));
    //        }

    //    }
    //    else
    //    {
    //        str.Append(ModControl.GetModField("Title", ModControl.GetP_From_Code("Home")));
    //    }

    //    return str.ToString();
    //}
    //protected string LoadKey(int p, int id)
    //{
    //    StringBuilder str = new StringBuilder();
    //    str.Append("<meta name=\"keywords\" content=\"");
    //    if (p != 0)
    //    {
    //        if (id != 0)
    //            str.Append(ContentControl.GetContentField("Key", id));
    //        else
    //            str.Append(ModControl.GetModField("Key", p));
    //        int cm = ConvertUtil.ReplaceInt(Request["cm"]);
    //        int ck = ConvertUtil.ReplaceInt(Request["ck"]);
    //        if (cm != 0)
    //            str.Append(" - " + ModControl.GetModField("Name", cm));
    //        if (ck != 0)
    //            str.Append(" - " + ModControl.GetModField("Name", ck));
    //    }
    //    else
    //        str.Append(ModControl.GetModField("Key", ModControl.GetP_From_Code("Home")));

    //    str.Append("\" />");
    //    return str.ToString();
    //}
    //protected string LoadDes(int p, int id)
    //{
    //    StringBuilder str = new StringBuilder();
    //    str.Append("<meta name=\"description\" content=\"");
    //    if (p != 0)
    //    {
    //        if (id != 0)
    //            str.Append(ContentControl.GetContentField("Meta", id));
    //        else
    //            str.Append(ModControl.GetModField("Meta", p));
    //        int cm = ConvertUtil.ReplaceInt(Request["cm"]);
    //        int ck = ConvertUtil.ReplaceInt(Request["ck"]);
    //        if (cm != 0)
    //            str.Append(" - " + ModControl.GetModField("Name", cm));
    //        if (ck != 0)
    //            str.Append(" - " + ModControl.GetModField("Name", ck));
    //    }
    //    else
    //        str.Append(ModControl.GetModField("Meta", ModControl.GetP_From_Code("Home")));

    //    str.Append("\" />");
    //    return str.ToString();
    //}
    protected string LoadSocial()
    {
        StringBuilder str   = new StringBuilder();
        string        uRoot = ApplicationSetting.URLRoot;

        str.Append("<span>Follow us</span>");
        str.Append("<span><a target=\"_blank\" href=\"" + CMSfunc._Title("urlFacebook") + "\"><img border=\"0\" align=\"absmiddle\" title=\"Facebook\" src=\"" + uRoot + "templates/sj_tech/images/icon-fb.png\"></a></span>&nbsp;");
        str.Append("<span><a target=\"_blank\" href=\"" + CMSfunc._Title("urlTwitter") + "\"><img border=\"0\" align=\"absmiddle\" title=\"Twitter\" src=\"" + uRoot + "templates/sj_tech/images/icon-tw.png\"></a></span>&nbsp;");
        str.Append("<span><a target=\"_blank\" href=\"" + CMSfunc._Title("urlGoogle") + "\"><img border=\"0\" align=\"absmiddle\" title=\"google plus\" src=\"" + uRoot + "templates/sj_tech/images/icon-gg.png\"></a></span>&nbsp;");
        str.Append("<span><a target=\"_blank\" href=\"" + CMSfunc._Title("urlYoutube") + "\"><img border=\"0\" align=\"absmiddle\" title=\"Youtube\" src=\"" + uRoot + "templates/sj_tech/images/icon-yt.png\"></a></span>&nbsp;");
        return(str.ToString());
    }
예제 #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     url  = string.IsNullOrEmpty(Request["url"]) ? "Home" : Request["url"].ToString();
     nUrl = string.IsNullOrEmpty(Request["nUrl"]) ? "" : Request["nUrl"].ToString();
     p    = ModControl.GetP_From_Code(url);
     CMSfunc.checkURL();
     op = ModControl.GetOldP(p);
     ltrSidebar.Text = LoadSidebar(p);
     if (nUrl != "")
     {
         ltrContent.Text   = LoadNLSX(p);
         lbNavigation.Text = "<a href=\"/\"><i class=\"fa fa-home fa-2x\"></i></a> >> <a href=\"/" + url + ".htm \">" + ModControl.GetName_From_Code(url) + "</a> >> " + ContentControl.GetFieldByCode("Name", nUrl);
     }
     else
     {
         ltrEnterprise.Text = LoadEnterprise(p);
         lbNavigation.Text  = "<a href =\"/\"><i class=\"fa fa-home fa-2x\"></i></a> >> <a href=\"/" + url + ".htm \">" + ModControl.GetName_From_Code(url);
     }
 }
예제 #12
0
    public void LoadHeadTag(int p, int id)
    {
        StringBuilder str        = new StringBuilder();
        string        CurrentURL = "http://apec.com.vn" + System.Web.HttpContext.Current.Request.CurrentExecutionFilePath.Replace("Default.aspx", string.Empty);
        string        sql        = "";

        if (p != 0)
        {
            if (id != 0)
            {
                sql += "SELECT Content_Name,Content_Title,Content_Key,Content_Des,Content_Img FROM tbl_Content Where Mod_ID=" + p + " AND Content_ID=" + id + " AND Content_Status=1";
            }
            else
            {
                sql += "SELECT Mod_Name,Mod_Title,Mod_Key,Mod_Des,Mod_Img FROM tbl_Mod Where Mod_ID=" + p + " AND Mod_Status=1";
            }
            DataTable         ds   = UpdateData.UpdateBySql(sql).Tables[0];
            DataRowCollection rows = ds.Rows;
            if (rows.Count > 0)
            {
                int    cm   = ConvertUtil.ReplaceInt(Request["cm"]);
                int    ck   = ConvertUtil.ReplaceInt(Request["ck"]);
                string str1 = (cm != 0) ? " - " + ModControl.GetModField("Name", cm) : "";
                string str2 = (ck != 0) ? " - " + ModControl.GetModField("Name", ck) : "";
                ltrTitle.Text          = rows[0][1].ToString() + str1 + str2;
                this.ltrHeadTags.Text += string.Format("<meta name='keywords' content='{0}' />", rows[0][2] + str1 + str2);
                this.ltrHeadTags.Text += string.Format("<meta name='description' content='{0}' />", rows[0][3] + str1 + str2);
                this.ltrHeadTags.Text += string.Format("<meta property='og:image' content='{0}' />", rows[0][4]);
                this.ltrHeadTags.Text += string.Format("<meta property='og:title' content='{0}' />", rows[0][1]);
                this.ltrHeadTags.Text += string.Format("<meta property='og:description' content='{0}' />", rows[0][3]);
                this.ltrHeadTags.Text += string.Format("<meta property='og:site_name' content='{0}' />", rows[0][0]);
                this.ltrHeadTags.Text += string.Format("<meta property='og:url' content='{0}' />", CurrentURL);
            }
        }
        else
        {
            this.ltrHeadTags.Text += CMSfunc.LoadOther("Head-Tag-Home");
            ltrTitle.Text          = CMSfunc._Title("title-home");
        }
        this.ltrHeadTags.Text += "<link rel=\"canonical\" href=\"" + CurrentURL + "\" />";
        //this.ltrHeadTags.Text += CMSfunc.LoadOther("HeadContent");
    }
예제 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CMSfunc.checkURL();
        string act   = Request.QueryString["act"];
        string uname = Session["uname"] == null ? "" : Session["uname"].ToString();

        if (!IsPostBack)
        {
            txtUsername.Text = uname;
            txtPass.Focus();
        }
        if (act == "logout")
        {
            System.Web.HttpContext.Current.Session.Clear();
            System.Web.HttpContext.Current.Session.Abandon();
            Response.Redirect("Login.aspx");
        }
        Response.CacheControl = "no-cache";
        Response.AddHeader("Pragma", "no-cache");
    }
예제 #14
0
    //protected override void Render(HtmlTextWriter writer)
    //{
    //    //html minifier & JS at bottom
    //    // not tested
    //    if (this.Request.Headers["X-MicrosoftAjax"] != "Delta=true")
    //    {
    //        System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"<script[^>]*>[\w|\t|\r|\W]*?</script>");
    //        System.Text.StringBuilder sb = new System.Text.StringBuilder();
    //        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
    //        HtmlTextWriter hw = new HtmlTextWriter(sw);
    //        base.Render(hw);
    //        string html = sb.ToString();
    //        System.Text.RegularExpressions.MatchCollection mymatch = reg.Matches(html);
    //        html = reg.Replace(html, string.Empty);
    //        reg = new System.Text.RegularExpressions.Regex(@"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}|(?=[\r])\s{2,}");
    //        html = reg.Replace(html, string.Empty);
    //        reg = new System.Text.RegularExpressions.Regex(@"</body>");
    //        string str = string.Empty;
    //        foreach (System.Text.RegularExpressions.Match match in mymatch)
    //        {
    //            str += match.ToString();
    //        }
    //        html = reg.Replace(html, str + "</body>");
    //        writer.Write(html);
    //    }
    //    else
    //        base.Render(writer);
    //}
    protected void Page_Load(object sender, EventArgs e)
    {
        CMSfunc.checkURL();
        string lang = Request.QueryString["lang"];

        if (!String.IsNullOrEmpty(lang) && lang != "1")
        {
            Session["vlang"] = lang;
        }
        if (Session["vlang"] == null || lang == "1")
        {
            Session["vlang"] = "1";
        }
        string url  = String.IsNullOrEmpty(Request["url"]) ? "Home" : Request["url"].ToString();
        string nUrl = String.IsNullOrEmpty(Request["nUrl"]) ? "" : Request["nUrl"].ToString();

        p  = ModControl.GetP_From_Code(url);
        id = ModControl.GetID_From_Url(p, nUrl);
        string page     = ConvertUtil.Nullcheck(Request.QueryString.Get("page"), "1");
        string pagesize = ConvertUtil.Nullcheck(Request.Form.Get("pagesizechange"), "10");

        LoadHeadTag(p, id);
        ltrMenutop.Text    = LoadMenutop(0);
        ltrMenufooter.Text = GetMnFooter();
        string field = "Mod_ID,Content_Name,Content_Img,Content_Intro,Content_Url";

        string where = " lang=" + Session["vlang"] + " AND Content_Status=1 AND Mod_ID in(SELECT Mod_ID FROM tbl_Mod WHERE Mod_Status=1 AND Modtype_ID=1)";
        string k = ApplicationUtil.FormatSqlString(Request["k"]);

        if (k != "")
        {
            where += " AND Content_Name like N'%" + k + "%'";
        }
        string sqlorder = " ORDER BY Content_ID DESC";

        LoadNews(Convert.ToInt16(page), Convert.ToInt16(pagesize), field, where, sqlorder);
        VisitorCounter();
        lrtPath.Text = CMSfunc.LoadPath(ModControl.GetP_From_Code("tim-kiem"), 0);
    }
예제 #15
0
    public string pagelinkNews(int tongsotrang, int pagecurrent, string pagelinkfull)
    {
        if (pagelinkfull.Contains("/page/"))
        {
            pagelinkfull = pagelinkfull.Substring(0, pagelinkfull.LastIndexOf("page/"));
        }
        string text  = "<ul class=\"pagination\">";
        string text2 = CMSfunc._Title("First");
        string text3 = CMSfunc._Title("Preview");
        string text4 = CMSfunc._Title("Next");
        string text5 = CMSfunc._Title("Last");

        if (pagecurrent <= 1)
        {
            string text6 = text;
            text = string.Concat(new string[]
            {
                text6,
                "<li><a title=\"",
                text2,
                "\">",
                text2,
                "</a></li><li class=\"first2_end\"><a title=\"",
                text3,
                "\">‹</a></li>"
            });
        }
        else
        {
            string text6 = text;
            text = string.Concat(new string[]
            {
                text6,
                "<li><a title=\"",
                text2,
                "\" href=\"",
                pagelinkfull,
                "\">",
                text2,
                "</a></li><li class=\"first2\"><a title=\"",
                text3,
                "\" href=\"",
                pagelinkfull,
                "page/",
                (pagecurrent - 1).ToString(),
                "/\">‹</a></li>"
            });
        }
        if (tongsotrang <= 5)
        {
            for (int i = 1; i <= tongsotrang; i++)
            {
                string text7 = (i == 1) ? pagelinkfull : string.Concat(new object[]
                {
                    pagelinkfull,
                    "page/",
                    i,
                    "/"
                });
                if (i == pagecurrent)
                {
                    object obj = text;
                    text = string.Concat(new object[]
                    {
                        obj,
                        "<li><a>",
                        i,
                        "</a></li>"
                    });
                }
                else
                {
                    object obj = text;
                    text = string.Concat(new object[]
                    {
                        obj,
                        "<li><a href=\"",
                        text7,
                        "\">",
                        i,
                        "</a></li>"
                    });
                }
            }
        }
        else if (pagecurrent < tongsotrang - 2)
        {
            int num = pagecurrent - 2;
            if (num < 1)
            {
                num = 1;
            }
            for (int i = num; i <= pagecurrent + 2; i++)
            {
                string text7 = (i == 1) ? pagelinkfull : string.Concat(new object[]
                {
                    pagelinkfull,
                    "page/",
                    i,
                    "/"
                });
                if (i == pagecurrent)
                {
                    text = text + "<li><a>" + i.ToString() + "</a></li>";
                }
                else
                {
                    object obj = text;
                    text = string.Concat(new object[]
                    {
                        obj,
                        "<li><a href=\"",
                        text7,
                        "\">",
                        i,
                        "</a></li>"
                    });
                }
            }
        }
        else
        {
            for (int i = tongsotrang - 5; i <= tongsotrang; i++)
            {
                string text7 = (i == 1) ? pagelinkfull : string.Concat(new object[]
                {
                    pagelinkfull,
                    "page/",
                    i,
                    "/"
                });
                if (i == pagecurrent)
                {
                    text = text + "<li><a>" + i.ToString() + "</a></li>";
                }
                else
                {
                    string text6 = text;
                    text = string.Concat(new string[]
                    {
                        text6,
                        "<li><a href=\"",
                        text7,
                        "\">",
                        i.ToString(),
                        "</a></li>"
                    });
                }
            }
        }
        if (pagecurrent == tongsotrang)
        {
            string text6 = text;
            text = string.Concat(new string[]
            {
                text6,
                "<li><a title=\"",
                text4,
                "\">›</a></li><li><a title=\"",
                text5,
                "\">",
                text5,
                "</a></li>"
            });
        }
        else
        {
            string text6 = text;
            text = string.Concat(new string[]
            {
                text6,
                "<li><a title=\"",
                text4,
                "\" href=\"",
                pagelinkfull,
                "page/",
                (pagecurrent + 1).ToString(),
                "/\">›</a></li><li class=\"end2\"><a title=\"",
                text5,
                "\" href=\"",
                pagelinkfull,
                "page/",
                tongsotrang.ToString(),
                "/\">",
                text5,
                "</a></li>"
            });
        }
        return(text + "</ul>");
    }
예제 #16
0
    public string pagelinkNews0(int tongsotrang, int pagecurrent, string pagelinkfull)
    {
        if (pagelinkfull.Contains("&page="))
        {
            string[] separator = new string[]
            {
                "&"
            };
            string[] array = pagelinkfull.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            pagelinkfull = "";
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (!text.Contains("page="))
                {
                    pagelinkfull = pagelinkfull + text + "&";
                }
            }
            if (pagelinkfull != "")
            {
                pagelinkfull = pagelinkfull.Substring(0, pagelinkfull.Length - 1);
            }
        }
        if (pagelinkfull.Contains("?page="))
        {
            string[] separator = new string[]
            {
                "?"
            };
            string[] array = pagelinkfull.Split(separator, StringSplitOptions.RemoveEmptyEntries);
            pagelinkfull = "";
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (!text.Contains("page="))
                {
                    pagelinkfull = pagelinkfull + text + "?";
                }
            }
            if (pagelinkfull != "")
            {
                pagelinkfull = pagelinkfull.Substring(0, pagelinkfull.Length - 1);
            }
        }
        string str = pagelinkfull.Contains("?") ? "&page=" : "?page=";

        pagelinkfull += str;
        string text2 = "<ul class=\"phantrang0 clearfix\">";
        string text3 = CMSfunc._Title("First");
        string text4 = CMSfunc._Title("Preview");
        string text5 = CMSfunc._Title("Next");
        string text6 = CMSfunc._Title("Last");

        if (pagecurrent <= 1)
        {
            string text7 = text2;
            text2 = string.Concat(new string[]
            {
                text7,
                "<li class=\"first_end\"><a title=\"",
                text3,
                "\">",
                text3,
                "</a></li><li class=\"first2_end\"><a title=\"",
                text4,
                "\">‹</a></li>"
            });
        }
        else
        {
            string text7 = text2;
            text2 = string.Concat(new string[]
            {
                text7,
                "<li class=\"first\"><a title=\"",
                text3,
                "\" href=\"",
                pagelinkfull,
                "\">",
                text3,
                "</a></li><li class=\"first2\"><a title=\"",
                text4,
                "\" href=\"",
                pagelinkfull,
                (pagecurrent - 1).ToString(),
                "\">‹</a></li>"
            });
        }
        if (tongsotrang <= 5)
        {
            for (int j = 1; j <= tongsotrang; j++)
            {
                if (j == pagecurrent)
                {
                    text2 = text2 + "<li class=\"act\"><a>" + j.ToString() + "</a></li>";
                }
                else
                {
                    string text7 = text2;
                    text2 = string.Concat(new string[]
                    {
                        text7,
                        "<li><a href=\"",
                        pagelinkfull,
                        j.ToString(),
                        "\">",
                        j.ToString(),
                        "</a></li>"
                    });
                }
            }
        }
        else if (pagecurrent < tongsotrang - 2)
        {
            int num = pagecurrent - 2;
            if (num < 1)
            {
                num = 1;
            }
            for (int j = num; j <= pagecurrent + 2; j++)
            {
                if (j == pagecurrent)
                {
                    text2 = text2 + "<li class=\"act\"><a>" + j.ToString() + "</a></li>";
                }
                else
                {
                    string text7 = text2;
                    text2 = string.Concat(new string[]
                    {
                        text7,
                        "<li><a href=\"",
                        pagelinkfull,
                        j.ToString(),
                        "\">",
                        j.ToString(),
                        "</a></li>"
                    });
                }
            }
        }
        else
        {
            for (int j = tongsotrang - 5; j <= tongsotrang; j++)
            {
                if (j == pagecurrent)
                {
                    text2 = text2 + "<li class=\"act\"><a>" + j.ToString() + "</a></li>";
                }
                else
                {
                    string text7 = text2;
                    text2 = string.Concat(new string[]
                    {
                        text7,
                        "<li><a href=\"",
                        pagelinkfull,
                        j.ToString(),
                        "\">",
                        j.ToString(),
                        "</a></li>"
                    });
                }
            }
        }
        if (pagecurrent == tongsotrang)
        {
            string text7 = text2;
            text2 = string.Concat(new string[]
            {
                text7,
                "<li class=\"end_end\"><a title=\"",
                text5,
                "\">›</a></li><li class=\"end2_end\"><a title=\"",
                text6,
                "\">",
                text6,
                "</a></li>"
            });
        }
        else
        {
            string text7 = text2;
            text2 = string.Concat(new string[]
            {
                text7,
                "<li class=\"end\"><a title=\"",
                text5,
                "\" href=\"",
                pagelinkfull,
                (pagecurrent + 1).ToString(),
                "\">›</a></li><li class=\"end2\"><a title=\"",
                text6,
                "\" href=\"",
                pagelinkfull,
                tongsotrang.ToString(),
                "\">",
                text6,
                "</a></li>"
            });
        }
        return(text2 + "</ul>");
    }
예제 #17
0
    protected void btnPassword_Click(object sender, EventArgs e)
    {
        Div1.Visible = false;
        if (string.IsNullOrEmpty(email.Text))
        {
            display            = "";
            alertType          = "danger";
            lberror_email.Text = "Bạn phải nhập email";
        }
        else
        {
            var members = new MemberRepository().SearchFor(o => o.Member_Email == email.Text);
            if (members == null || members.Count() == 0)
            {
                dverror_email.Visible = true;
                lberror_email.Text    = "Email không thuộc về bất kỳ tài khoản nào, vui lòng kiểm tra lại.";
            }
            else
            {
                var        newpass = Value.CreatePassword(6);
                tbl_Member member  = members.SingleOrDefault();
                Hashtable  tb      = new Hashtable();
                tb.Add("Member_Password", ApplicationUtil.PasswordEncrypt(newpass));
                if (UpdateData.Update("tbl_Member", tb, "Member_ID=" + member.Member_ID))
                {
                    #region Send Mail
                    //send mail
                    string strBody = "<html><body>\n";
                    strBody += "<h2>Chào mừng đến với " + CMSfunc._GetConst("_Domain") + "</h1><br>\n";
                    strBody += "Mật khẩu mới của quý khách là: <strong style='color: red'>" + newpass + "</strong><br>\n";
                    strBody += "</body></html>";

                    string fromEmail = CMSfunc._GetConst("_EmailClient");
                    string toEmail   = email.Text;
                    string Name      = CMSfunc._GetConst("_Name");

                    string Subject         = "THAY ĐỔI MẬT KHẨU ĐĂNG NHẬP";
                    string Host            = CMSfunc._GetConst("_Hostmail");
                    string EmailClient     = CMSfunc._GetConst("_EmailClient");
                    string PassEmailClient = CMSfunc._GetConst("_PassEmailClient");
                    int    Port            = Convert.ToInt32(CMSfunc._GetConst("_Port"));
                    try
                    {
                        bool _isSend = SendMailClient.SendGMail(toEmail, fromEmail, Name, "", Subject, Host, Port, EmailClient, PassEmailClient, "Xác thực thành công", strBody);
                        if (_isSend)
                        {
                            Div1.Visible   = false;
                            Div2.Visible   = true;
                            lbSuccess.Text = "Thay đổi mật khẩu thành công, mật khẩu mới đã được gửi về Email của bạn. Vui lòng kiểm tra email và đăng nhập lại.";
                        }
                        else
                        {
                            Div2.Visible = false;
                            Div1.Visible = true;
                            lbError.Text = "Thay đổi mật khẩu không thành công, vui lòng thử lại.";
                        }
                    }
                    catch (Exception ex)
                    {
                        Div2.Visible = false;
                        Div1.Visible = true;
                        lbError.Text = "Thay đổi mật khẩu không thành công, vui lòng thử lại.";
                    }
                    #endregion
                }
            }
        }
    }