Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataSet ds = bll.GetList(100, "msn='" + System.DateTime.Now.ToString("yyyyMMdd") + "'", "id");

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            model = bll.GetModel(int.Parse(dr["id"].ToString()));
            try
            {
                string title = "積分清零提醒";
                string str   = "您還有" + dr["point"] + "積分年底到期請注意使用。";
                TWMail.sendMail(siteConfig.emailsmtp, siteConfig.emailssl, siteConfig.emailport, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname,
                                siteConfig.emailfrom, dr["email"].ToString(), title + " - " + siteConfig.webname + "", str);
            }
            catch (Exception eee) { }

            model.msn = System.DateTime.Now.ToString("yyyyMMdd");
            bll.Update(model);
        }

        if (ds.Tables[0].Rows.Count > 0)
        {
            Response.Write("正在發送請勿關閉本頁");
            Response.Redirect("mail.aspx");
        }
        else
        {
            Response.Write("發送完畢可以關閉本頁");
            Response.End();
        }
    }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = TWRequest.GetQueryInt("id");
     if (id != 0)
     {
         model  = bll.GetModel(id);
         weburl = config.weburl;
     }
 }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        data_type.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from shop_article_category where channel_id=7 and call_index='1' order by sort_id desc");
        data_type.DataBind();

        _users = new Tea.Web.UI.ShopPage().GetUserInfo();

        cartModel = Tea.Web.UI.ShopCart.GetTotal(1);
    }
Esempio n. 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _users = new Tea.Web.UI.ShopPage().GetUserInfo();
        data_type.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from shop_article_category where channel_id=7 and call_index='1' order by sort_id desc");
        data_type.DataBind();

        key       = TWRequest.GetQueryString("key");
        this.page = TWRequest.GetQueryInt("page", 1);
        this.tid  = TWRequest.GetQueryInt("tid", 0);
        this.hid  = TWRequest.GetQueryInt("hid", 0);
        this.sort = TWRequest.GetQueryInt("sort", 0);


        if (sort == 1)
        {
            _orderby = "add_time desc,id desc";
        }
        if (sort == 2)
        {
            _orderby = "click desc";
        }
        if (sort == 3)
        {
            _orderby = "market_price,id";
        }
        if (sort == 4)
        {
            _orderby = "market_price desc,id";
        }
        if (tid != 0)
        {
            _sql  = _sql + " and (category_id=" + tid + " or more_type like'%," + tid + ",%')";
            tname = new Tea.BLL.article_category().GetTitle(tid);
            try
            {
                Tea.Model.article_category model = new Tea.BLL.article_category().GetModel(tid);
                title    = model.seo_title;
                keyword  = model.seo_keywords;
                describe = model.seo_description;
            }
            catch (Exception eee) { }
        }
        if (!string.IsNullOrEmpty(key))
        {
            _sql  = _sql + " and title like'%" + key + "%'";
            tname = key;
        }
        Tea.Web.UI.ShopPage bll_view = new Tea.Web.UI.ShopPage();

        data_list.DataSource = bll_view.GetViewList("view_article_product", "", this.pageSize, this.page, _sql, _orderby, out this.totalCount);
        data_list.DataBind();

        string pageUrl = Utils.CombUrlTxt("index.aspx", "tid={0}&key={1}&sort={2}&page={3}", tid.ToString(), key.ToString(), sort.ToString(), "__id__");

        PageContent.InnerHtml = Utils.OutPageListWeb(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id   = TWRequest.GetQueryInt("id");
     code = TWRequest.GetQueryString("code");
     Tea.Model.users model = bll.GetModel(id);
     if (model.password != code)
     {
         Response.Write(ljd.function.LocalHint("郵箱驗證失敗,請重新驗證", "reg.aspx"));
     }
     else
     {
         model.status = 0;
         bll.Update(model);
     }
 }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     pwd = TWRequest.GetQueryString("pwd");
     id  = TWRequest.GetQueryInt("id");
     act = TWRequest.GetFormString("act");
     if (id > 0)
     {
         model = bll.GetModel(id);
         if (model.password != pwd)
         {
             Response.Write(ljd.function.LocalHint("該鏈接已經失效", "login.aspx"));
             Response.End();
         }
     }
     if (act == "act_edit")
     {
         model = bll.GetModel(id);
         //檢查輸入的舊密碼
         string oldpassword = TWRequest.GetFormString("txt_pwd");
         string password    = TWRequest.GetFormString("txt_pwd1");
         if (string.IsNullOrEmpty(oldpassword))
         {
             Response.Write(ljd.function.LocalHint("請輸入您的密碼!", ""));
             return;
         }
         //檢查輸入的新密碼
         if (string.IsNullOrEmpty(password))
         {
             Response.Write(ljd.function.LocalHint("請輸入確認密碼!", ""));
             return;
         }
         //舊密碼是否正確
         if (password != oldpassword)
         {
             Response.Write(ljd.function.LocalHint("對不起,您輸入的密碼不正確!", ""));
             return;
         }
         model.password = DESEncrypt.Encrypt(password, model.salt);
         bll.Update(model);
         Response.Write(ljd.function.LocalHint("重置密碼成功,請用新密碼登入", "login.aspx"));
         Response.End();
     }
 }
Esempio n. 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _users = new Tea.Web.UI.ShopPage().GetUserInfo();
        act    = TWRequest.GetQueryString("act");
        if (act == "send")
        {
            try
            {
                string mailTitle = "驗證郵箱通知信", mailContent = "";
                string url = weburl + "mail/reg.aspx?id=" + _users.id, ss = "";

                //Response.Write(url);
                //Response.End();
                mailContent = ljd.function.GetPage(url, out ss);
                // 發送郵件
                TWMail.sendMail(config.emailsmtp, config.emailssl, config.emailport, config.emailusername, config.emailpassword, config.emailnickname, config.emailfrom, _users.email, mailTitle, mailContent);
            }
            catch (Exception eee) { }
            Response.Write(ljd.function.LocalHint("已發送帳號啟用信至您的電子信箱,請至信箱確認並啟用。", "regno.aspx"));
            Response.End();
        }
    }
Esempio n. 8
0
    //第三方登入後處理
    protected void multi_login(string id, string name, string email, string source)
    {
        Tea.Model.users model = new Tea.Model.users();
        Tea.BLL.users   bll   = new Tea.BLL.users();
        //自動加入會員
        DataSet ds = bll.GetList(1, "user_name='" + id + "'", "id");

        //Response.Write(ds.Tables[0].Rows.Count);
        if (ds.Tables[0].Rows.Count == 0)
        {
            if (!string.IsNullOrEmpty(email) && email.Length > 5)
            {
                if (new Tea.BLL.users().ExistsEmail(email))
                {
                    Response.Write(ljd.function.LocalHint("此帳號信箱已存在於此網站,請以新mail註冊", "/users/login.aspx"));
                    Response.End();
                }
            }
            model.group_id  = 1;
            model.status    = 0;
            model.user_name = id;
            model.password  = DESEncrypt.Encrypt(ljd.function.getUUIDString(12));
            model.email     = email; // txtEmail.Text;
            //model.birthday = DateTime.Parse("1980-1-1");
            model.nick_name = name;  //txtNickName.Text;
            model.mobile    = "";    //txtTelphone.Text.Trim();
            model.address   = "";    //Request["txtcity"] + "|" + Request["txtcity1"] + "|" + txtZip.Text + "|" + txtAddress.Text.Trim();
            model.reg_time  = DateTime.Now;
            model.reg_ip    = TWRequest.GetIP();
            model.user_hei  = 2;
            int uid = bll.Add(model);

            model = bll.GetModel(uid);

            //model.id = uid;
        }
        else
        {
            model = bll.GetModel(id);
            if (model == null)
            {
                Response.Write(ljd.function.LocalHint("您已更改本站密碼,請用本站密碼登入!", "/users/login.aspx"));
                Response.End();
            }
        }
        //防止Session提前過期
        try
        {
            Session[TWKeys.SESSION_USER_INFO] = model;
            Session.Timeout = 4500;

            //防止Session提前過期
            Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name);
            Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password);

            Tea.Model.cart_total cartModel = Tea.Web.UI.ShopCart.GetTotal(1);
            if (cartModel.total_quantity == 0)
            {
                Response.Redirect("/Default.aspx");
            }
            else
            {
                Response.Redirect("/shop/cart.aspx");
            }
            //寫入登入日誌
            // new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入", TWRequest.GetIP());
        }
        catch { Response.Write("no"); }

        //寫入登入日誌
        //new Tea.BLL.user_login_log().Add(model.id, model.user_name, id + "會員登入", TWRequest.GetIP());
        //Response.Write(model.id+"--"+model.user_name+"--"+model.email);
    }
Esempio n. 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _users = new Tea.Web.UI.ShopPage().GetUserInfo();
 }
Esempio n. 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _users = new Tea.Web.UI.ShopPage().GetUserInfo();

        data_type.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from shop_article_category where channel_id=7  and call_index='1' order by sort_id desc");
        data_type.DataBind();



        gid = TWRequest.GetQueryInt("gid");
        id  = TWRequest.GetQueryInt("id");
        if (id != 0)
        {
            model = bll.GetModel(id);
            if (model.status != 0)
            {
                Response.Redirect("/error.aspx?msg=您查看的商品已下架,若有任何問題可直接與客服聯繫");
            }
            if (model.add_time > System.DateTime.Now)
            {
                Response.Redirect("/error.aspx?msg=您查看的商品已下架,若有任何問題可直接與客服聯繫");
            }
            if (model.xia_date != null && model.xia_date.Value.AddDays(1) < System.DateTime.Now)
            {
                Response.Redirect("/error.aspx?msg=您查看的商品已下架,若有任何問題可直接與客服聯繫");
            }
            try
            {
                if (model.brand_id == 5)
                {
                    if (model.begin_time > System.DateTime.Now || model.end_time.AddDays(1) < System.DateTime.Now)
                    {
                        intshow = 0;
                    }
                }
            }
            catch (Exception eee) { }
            tname    = new Tea.BLL.article_category().GetTitle(model.category_id);
            title    = model.seo_title;
            keyword  = model.seo_keywords;
            describe = model.seo_description;
            bll.UpdateField(id, "click=click+1");

            img_url = model.img_url;

            data_pic.DataSource = model.albums;
            data_pic.DataBind();

            data_pic1.DataSource = model.albums;
            data_pic1.DataBind();

            data_pic2.DataSource = model.albums;
            data_pic2.DataBind();

            showpic = data_pic.Items.Count;
        }



        data_tui.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from view_article_product where (datediff(day,xia_date,getdate())<=0 or xia_date is null) and status=0 and datediff(minute,add_time,getdate())>=0 and  id!=" + id + " and wheresql='tuan' and category_id=" + model.category_id + "");
        data_tui.DataBind();



        if (model.status == 0 && gid == 0)
        {
            DataSet ds = Tea.DBUtility.DbHelperSQL.Query("select * from shop_goods where parent_id=" + id + " order by sell_price");
            data_goods.DataSource = ds;
            data_goods.DataBind();
            goodlist = "";
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                goodlist = goodlist + "\"" + dr["parent_id"].ToString() + "_" + dr["id"].ToString() + "\": { \"cartid\": \"" + dr["parent_id"].ToString() + "_" + dr["id"].ToString() + "\",\"price\": \"" + getyunum(Utils.StrToInt(dr["yu_lock"].ToString(), 0), Utils.StrToDecimal(dr["sell_price"].ToString(), 0), Utils.StrToDecimal(dr["yu_num"].ToString(), 0)).ToString().Replace(".00", "") + "\", \"mktprice\": \"" + dr["market_price"].ToString().Replace(".00", "") + "\" , \"stock_quantity\": \"" + dr["stock_quantity"].ToString() + "\", \"img_url\": \"" + dr["img_url"].ToString() + "\"},";
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                //dr["sell_price"].ToString().Replace(".00", "")
                cartid             = ds.Tables[0].Rows[0]["parent_id"].ToString() + "_" + ds.Tables[0].Rows[0]["id"].ToString();
                stock_quantity     = Utils.StrToInt(ds.Tables[0].Rows[0]["stock_quantity"].ToString(), 0);
                model.sell_price   = getyunum(Utils.StrToInt(ds.Tables[0].Rows[0]["yu_lock"].ToString(), 0), Utils.StrToDecimal(ds.Tables[0].Rows[0]["sell_price"].ToString(), 0), Utils.StrToDecimal(ds.Tables[0].Rows[0]["yu_num"].ToString(), 0));
                model.market_price = Utils.StrToDecimal(ds.Tables[0].Rows[0]["market_price"].ToString(), 0);
                model.img_url      = ds.Tables[0].Rows[0]["img_url"].ToString();
            }
        }
        if (model.status == 0 && gid > 0)
        {
            DataSet ds = Tea.DBUtility.DbHelperSQL.Query("select * from view_user_group_price where parent_id=" + id + " and group_id=" + GetUserInfo().id + " and id=" + gid + "");
            data_goods.DataSource = ds;
            data_goods.DataBind();
            goodlist = "";
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                goodlist = goodlist + "\"" + dr["parent_id"].ToString() + "_" + dr["id"].ToString() + "\": { \"cartid\": \"" + dr["parent_id"].ToString() + "_" + dr["id"].ToString() + "\",\"price\": \"" + dr["price"].ToString().Replace(".00", "") + "\", \"mktprice\": \"" + dr["market_price"].ToString().Replace(".00", "") + "\" , \"stock_quantity\": \"" + dr["stock_quantity"].ToString() + "\", \"img_url\": \"" + dr["img_url"].ToString() + "\"},";
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                cartid             = ds.Tables[0].Rows[0]["parent_id"].ToString() + "_" + ds.Tables[0].Rows[0]["id"].ToString();
                stock_quantity     = Utils.StrToInt(ds.Tables[0].Rows[0]["stock_quantity"].ToString(), 0);
                model.sell_price   = Utils.StrToDecimal(ds.Tables[0].Rows[0]["price"].ToString(), 0);
                model.market_price = Utils.StrToDecimal(ds.Tables[0].Rows[0]["market_price"].ToString(), 0);
                model.img_url      = ds.Tables[0].Rows[0]["img_url"].ToString();
            }
        }
        try
        {
            histroy = Request.Cookies["histroy"].Value.ToString();
        }
        catch (Exception eee) { }
        if (string.IsNullOrEmpty(histroy))
        {
            Response.Cookies["histroy"].Value = id.ToString();

            Response.Cookies["histroy"].Expires = System.DateTime.Now.AddSeconds(30000000);
            histroy = Request.Cookies["histroy"].Value.ToString();
        }
        else
        {
            IList _list = histroy.Split('|');
            if (!_list.Contains(id))
            {
                Response.Cookies["histroy"].Value = histroy + "|" + id;
            }
        }
    }
Esempio n. 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        id   = Request["id"];
        name = Request["name"];
        if (!string.IsNullOrEmpty(id))
        {
            Tea.Model.users model = new Tea.Model.users();
            Tea.BLL.users   bll   = new Tea.BLL.users();
            //自動加入會員
            DataSet ds = bll.GetList(1, "user_name='" + id + "'", "id");

            if (ds.Tables[0].Rows.Count == 0)
            {
                model.group_id  = 1;
                model.status    = 0;
                model.user_name = id;
                model.password  = DESEncrypt.Encrypt(ljd.function.getUUIDString(12));
                //model.birthday = DateTime.Parse("1980-1-1");
                if (!string.IsNullOrEmpty(name))
                {
                    model.nick_name = name;
                }
                else
                {
                    model.nick_name = "暱名";
                }
                model.mobile   = "";
                model.address  = "";
                model.reg_time = DateTime.Now;
                model.reg_ip   = TWRequest.GetIP();
                model.user_hei = 1;
                model.point    = 0;
                model.avatar   = "https://graph.facebook.com/" + id + "/picture";
                try
                {
                    string tcode = Utils.GetCookie("tcode");
                    model.company = Utils.StrToInt(tcode, 0);
                }
                catch (Exception eee) { }
                int uid = bll.Add(model);

                model.id = uid;
                Session[TWKeys.SESSION_USER_INFO] = model;
                Session.Timeout = 4500;

                //防止Session提前過期
                Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name);
                Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password);



                //寫入登入日誌
                //new Tea.BLL.user_login_log().Add();
                if (model.email.Length < 2)
                {
                    Response.Write("2");
                    Response.End();
                }
                Response.Write("1");
                Response.End();
            }
            else
            {
                model        = bll.GetModel(id);
                model.avatar = "https://graph.facebook.com/" + id + "/picture";

                bll.Update(model);
                if (model == null)
                {
                    //Response.Write(Tea.Common.Utils.LocalHint("您已更改本站密碼,請用本站密碼登入!", "/login.aspx"));
                    //Response.End();
                }
            }
            //防止Session提前過期
            try
            {
                Session[TWKeys.SESSION_USER_INFO] = model;
                Session.Timeout = 4500;

                //防止Session提前過期
                Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name);
                Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password);


                //寫入登入日誌
                //new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入", TWRequest.GetIP());
                if (model.email.Length < 2)
                {
                    Response.Write("2");
                    Response.End();
                }
                Response.Write("1");
                Response.End();

                Tea.Model.cart_total cartModel = Tea.Web.UI.ShopCart.GetTotal(1);
                if (cartModel.total_quantity == 0)
                {
                    Response.Write("3");
                    Response.End();
                }
                else
                {
                    Response.Write("4");
                    Response.End();
                }
            }
            catch {// Response.Write("no"); Response.End();
            }
        }
    }
Esempio n. 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Tea.BLL.users bll = new Tea.BLL.users();
        act = Request["act"];
        if (act == "act_find")
        {
            user = TWRequest.GetFormString("txt_email");
            string remember = TWRequest.GetFormString("txt_code");
            if (Session[TWKeys.SESSION_CODE] == null)
            {
                Response.Write(ljd.function.LocalHint("系統找不到驗證碼", "find.aspx"));
                return;
            }
            if (remember.ToLower() != Session[TWKeys.SESSION_CODE].ToString().ToLower())
            {
                Response.Write(ljd.function.LocalHint("驗證碼輸入不正確", "find.aspx"));
                return;
            }



            Tea.Model.users model = bll.GetModel(user);
            if (model == null)
            {
                model = bll.GetEModel(user);
            }
            if (model == null)
            {
                Response.Write(ljd.function.LocalHint("對不起,您輸入的用戶名不存在!", "find.aspx"));
                return;
            }
            if (model.user_hei > 0)
            {
                Response.Write(ljd.function.LocalHint("您非一般註冊用戶,無法使用取回密碼功能!", "find.aspx"));
                return;
            }
            if (string.IsNullOrEmpty(model.email))
            {
                Response.Write(ljd.function.LocalHint("您尚未設定郵箱地址,無法使用取回密碼功能!", "find.aspx"));
                return;
            }

            //生成隨機碼
            string strcode = Utils.GetCheckCode(8);
            try
            {
                string mailTitle = "找回密碼通知信", mailContent = "";
                string url = weburl + "mail/find.aspx?id=" + model.id, ss = "";
                mailContent = ljd.function.GetPage(url, out ss);
                //發送郵件
                TWMail.sendMail(config.emailsmtp, config.emailssl, config.emailport, config.emailusername, config.emailpassword, config.emailnickname, config.emailfrom, model.email, mailTitle, mailContent);

                //model.password = DESEncrypt.Encrypt(strcode, model.salt);
                //new Tea.BLL.users().Update(model);
            }
            catch (Exception eee)
            {
                Response.Write(ljd.function.LocalHint("發送失敗!", "find.aspx"));
                Response.End();
            }
            Response.Write(ljd.function.LocalHint("已發送密碼至您的信箱!", "login.aspx"));
            Response.End();
        }
    }
Esempio n. 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        uid  = TWRequest.GetQueryInt("uid");
        cart = TWRequest.GetQueryString("cart");
        if (string.IsNullOrEmpty(cart))
        {
            cart = "3";
        }
        if (uid > 0)
        {
            userModel = new Tea.BLL.users().GetModel(uid);
        }
        cbquan = TWRequest.GetFormString("cbquan");

        if (cart == "3")
        {
            cartModel = Tea.Web.UI.AdminCart.GetTotal(-3, uid);
        }
        if (cartModel.total_point > userModel.point)
        {
            Response.Write(ljd.function.LocalHint("紅利不足,請重新選擇商品!", "adminorder.aspx"));
            Response.End();
            return;
        }
        try
        {
            guo  = userModel.area.Split(',')[0].ToString();
            area = userModel.area.Split(',')[1].ToString();
            city = userModel.area.Split(',')[2].ToString();
            zip  = userModel.qq;
        }
        catch (Exception eee) { }

        DataSet ds_guo = Tea.DBUtility.DbHelperSQL.Query("select * from shop_basic where basic_where='city' order by basic_sort");

        data_guo.DataSource = ds_guo;
        data_guo.DataBind();

        dataguo.DataSource = ds_guo;
        dataguo.DataBind();

        data_fp_guo.DataSource = ds_guo;
        data_fp_guo.DataBind();

        data_invo_guo.DataSource = ds_guo;
        data_invo_guo.DataBind();

        try
        {
            Tea.Model.express expModel = new Tea.BLL.express().GetModel(express_id);
            if (decimal.Parse(expModel.maxmoney.ToString()) > cartModel.real_amount)
            {
                yun = expModel.express_fee;
            }
            else
            {
                yun = 0;
            }
        }
        catch (Exception eee) { }

        if (cart == "3")
        {
            data_cart.DataSource = Tea.Web.UI.AdminCart.GetList(-3, uid);
            data_cart.DataBind();
        }



        data_pay.DataSource = new Tea.BLL.payment().GetList(0, "is_lock=0", "sort_id desc,id desc");
        data_pay.DataBind();


        act = Request["act"];

        if (act == "act_add")
        {
            if (TWRequest.GetFormString("txtguo") != "台灣")
            {
                string  ycity = "";
                DataSet yds   = Tea.DBUtility.DbHelperSQL.Query("select basic_value,basic_type from  shop_basic where basic_label='" + TWRequest.GetFormString("txtguo") + "' and basic_where='city'");
                if (yds.Tables[0].Rows.Count > 0)
                {
                    ycity = yds.Tables[0].Rows[0]["basic_type"].ToString();
                    DataSet yd_s = Tea.DBUtility.DbHelperSQL.Query("select top 1 basic_sort from shop_basic where basic_money>" + cartModel.total_num_zhe.ToString("0.") + " and basic_where='yunfei' and basic_type='" + ycity + "' order by basic_money");
                    if (yd_s.Tables[0].Rows.Count == 0)
                    {
                        Response.Write(ljd.function.LocalHint("材積重超出寄送限制,請調整訂單內容", "adminorder.aspx?uid=" + uid));
                        Response.End();
                    }
                }
            }
            //////檢查物流方式
            if (data_cart.Items.Count == 0)
            {
                Response.Write(ljd.function.LocalHint("購物車為空,請選購商品!", "adminorder.aspx?uid=" + uid));
                Response.End();
                return;
            }

            yun = TWRequest.GetFormInt("yun");

            //券
            quan = TWRequest.GetFormString("txt_quan");
            if (!string.IsNullOrEmpty(quan) && cbquan == "1")
            {
                Tea.Model.quan modelquan = new Tea.BLL.quan().GetModel(quan);
                if (modelquan != null)
                {
                    if (modelquan.quan_show > 0 || int.Parse(modelquan.quan_end_date.Value.ToString("yyyyMMdd")) < int.Parse(System.DateTime.Now.ToString("yyyyMMdd")))
                    {
                        Response.Write(ljd.function.LocalHint("優惠券無效", "adminorder.aspx?uid=" + uid));
                        Response.End();
                    }
                    fee = modelquan.quan_num.Value;
                }
                else
                {
                    Response.Write(ljd.function.LocalHint("優惠券無效", "adminorder.aspx?uid=" + uid));
                    Response.End();
                }
            }
            //紅利
            //hong = TWRequest.GetFormInt("cb_point");
            //int txt_point = TWRequest.GetFormInt("txt_point");
            //if (hong > 0 && txt_point > 0)
            //{



            //    int zuida = Utils.StrToInt((cartModel.real_amount * uconfig.pint_yong / 100).ToString(), 0);
            //    if (cartModel.real_amount < uconfig.pint_mane && userModel.point > zuida)
            //    {
            //        Response.Write(ljd.function.LocalHint("紅利超出限制!", "adminorder.aspx?uid="+uid));
            //        return;
            //    }
            //    else
            //    {
            //        back = Utils.StrToInt((userModel.point / uconfig.pint_money).ToString(), 0);
            //    }

            //}


            payment_id = TWRequest.GetFormInt("txt_pay");



            //獲得傳參信息


            string accept_name = Utils.ToHtml(TWRequest.GetFormString("txt_name"));
            string post_code   = Utils.ToHtml(TWRequest.GetFormString("txt_zip"));
            string mobile      = Utils.ToHtml(TWRequest.GetFormString("txt_mobile"));
            string address     = Utils.ToHtml(TWRequest.GetFormString("txt_address"));
            string email       = Utils.ToHtml(TWRequest.GetFormString("txt_email"));
            string guo         = Utils.ToHtml(TWRequest.GetFormString("txt_guo").Trim());
            string selcity     = Utils.ToHtml(TWRequest.GetFormString("txt_state"));
            string selarea     = Utils.ToHtml(TWRequest.GetFormString("txt_city"));
            string selcity1    = Utils.ToHtml(TWRequest.GetFormString("txt_state1"));
            string selarea1    = Utils.ToHtml(TWRequest.GetFormString("txt_city1"));
            string telphone    = Utils.ToHtml(TWRequest.GetFormString("txt_tel"));


            //獲取訂單配置資料
            Tea.Model.orderconfig orderConfig = new Tea.BLL.orderconfig().loadConfig();



            //檢查付款方式
            if (payment_id == 0)
            {
                Response.Write(ljd.function.LocalHint("對不起,請選擇付款方式!", ""));
                Response.End();
                return;
            }
            Tea.Model.payment payModel = new Tea.BLL.payment().GetModel(payment_id);
            if (payModel == null)
            {
                Response.Write(ljd.function.LocalHint("對不起,付款方式不存在或已刪除!", ""));
                Response.End();
                return;
            }
            //檢查收貨人
            if (string.IsNullOrEmpty(accept_name))
            {
                Response.Write(ljd.function.LocalHint("對不起,請輸入收貨人姓名!", ""));
                Response.End();
                return;
            }
            //檢查手機和電話
            if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile))
            {
                Response.Write(ljd.function.LocalHint("對不起,請輸入收貨人聯絡電話或手機!", ""));
                Response.End();
                return;
            }
            if (string.IsNullOrEmpty(selarea) && string.IsNullOrEmpty(selarea1))
            {
                Response.Write(ljd.function.LocalHint("對不起,請選擇收貨區域!", ""));
                Response.End();
                return;
            }
            //檢查地址
            if (string.IsNullOrEmpty(address) && string.IsNullOrEmpty(address))
            {
                Response.Write(ljd.function.LocalHint("對不起,請輸入詳細的收貨地址!", ""));
                Response.End();
                return;
            }
            ////檢查郵箱
            if (string.IsNullOrEmpty(email))
            {
                Response.Write(ljd.function.LocalHint("對不起,請輸入郵箱!", ""));
                Response.End();
                return;
            }
            //如果開啟暱名購物則不檢查會員是否登入
            int    user_id       = 0;
            int    user_group_id = 0;
            string user_name     = string.Empty;
            //檢查用戶是否登入

            if (userModel != null)
            {
                user_id       = userModel.id;
                user_group_id = userModel.group_id;
                user_name     = userModel.user_name;
            }
            if (orderConfig.maned == 0 && userModel == null)
            {
                Response.Write(ljd.function.LocalHint("對不起,用戶尚未登入或已超時!", ""));
                Response.End();
                return;
            }
            //檢查購物車商品
            IList <Tea.Model.cart_items> iList = Tea.Web.UI.AdminCart.GetList(-3, uid);
            if (iList == null)
            {
                Response.Write(ljd.function.LocalHint("對不起,購物車為空,無法結帳!", ""));
                Response.End();
                return;
            }
            //統計購物車

            //儲存訂單=======================================================================
            Tea.Model.orders model = new Tea.Model.orders();
            model.order_no    = "M" + Utils.GetOrderNumber(); //訂單號B開頭為商品訂單
            model.user_id     = user_id;
            model.user_name   = user_name;
            model.payment_id  = 0;
            model.express_id  = express_id;
            model.accept_name = accept_name;
            model.post_code   = post_code;
            model.telphone    = telphone;
            model.mobile      = mobile;
            model.email       = email;
            if (guo == "台灣")
            {
                model.area = guo + "," + selcity + "," + selarea;
            }
            else
            {
                model.area = guo + "," + selcity1 + "," + selarea1;
            }
            model.address        = address;
            model.payable_amount = cartModel.payable_amount;
            model.real_amount    = cartModel.real_amount;
            model.express_status = 1;
            model.express_fee    = yun; //物流費用
            model.payment_id     = payment_id;
            model.message        = TWRequest.GetFormString("txtcontent");
            if (TWRequest.GetFormString("txtguo") == "台灣")
            {
                model.user_add = TWRequest.GetFormString("txtname") + "|" + TWRequest.GetFormString("txtsex") + "|" + TWRequest.GetFormString("txtmobile") + "|" + TWRequest.GetFormString("txttel") + "|" + TWRequest.GetFormString("txtemail") + "|" + TWRequest.GetFormString("txtguo") + "|" + TWRequest.GetFormString("txtstate") + "|" + TWRequest.GetFormString("txtcity") + "|" + TWRequest.GetFormString("txtaddress") + "|" + TWRequest.GetFormString("txtzip");
            }
            else
            {
                model.user_add = TWRequest.GetFormString("txtname") + "|" + TWRequest.GetFormString("txtsex") + "|" + TWRequest.GetFormString("txtmobile") + "|" + TWRequest.GetFormString("txttel") + "|" + TWRequest.GetFormString("txtemail") + "|" + TWRequest.GetFormString("txtguo") + "|" + TWRequest.GetFormString("txtstate1") + "|" + TWRequest.GetFormString("txtcity1") + "|" + TWRequest.GetFormString("txtaddress") + "|" + TWRequest.GetFormString("txtzip");
            }
            model.point      = -cartModel.total_point;
            model.is_invoice = TWRequest.GetFormInt("txtinvoice");
            if (model.is_invoice == 1)
            {
                model.invoice_title = TWRequest.GetFormString("txt_invoice1");
            }
            if (model.is_invoice == 2)
            {
                model.invoice_title = TWRequest.GetFormString("txt_invoice2");
            }
            if (model.is_invoice == 3)
            {
                if (TWRequest.GetFormString("txtfaaddress_guo") == "台灣")
                {
                    model.invoice_title = TWRequest.GetFormString("txt_invoice3") + "," + TWRequest.GetFormString("txtfaaddress") + "," + TWRequest.GetFormString("txtfaaddress_guo") + "," + TWRequest.GetFormString("txtfaaddress_state") + "," + TWRequest.GetFormString("txtfaaddress_city") + "," + TWRequest.GetFormString("txtfaaddress_zip") + "," + TWRequest.GetFormString("txtfa_address");
                }
                else
                {
                    model.invoice_title = TWRequest.GetFormString("txt_invoice3") + "," + TWRequest.GetFormString("txtfaaddress") + "," + TWRequest.GetFormString("txtfaaddress_guo") + "," + TWRequest.GetFormString("txtfaaddress_state1") + "," + TWRequest.GetFormString("txtfaaddress_city1") + "," + TWRequest.GetFormString("txtfaaddress_zip") + "," + TWRequest.GetFormString("txtfa_address");
                }
            }
            if (model.is_invoice == 4)
            {
                if (TWRequest.GetFormString("txt_invoiceaddress_guo") == "台灣")
                {
                    model.invoice_title = TWRequest.GetFormString("txt_invoice_4") + "," + TWRequest.GetFormString("txt_invoiceaddress") + "," + TWRequest.GetFormString("txt_invoiceaddress_guo") + "," + TWRequest.GetFormString("txt_invoiceaddress_state") + "," + TWRequest.GetFormString("txt_invoiceaddress_city") + "," + TWRequest.GetFormString("txt_invoiceaddress_zip") + "," + TWRequest.GetFormString("txt_invoice_address");
                }
                else
                {
                    model.invoice_title = TWRequest.GetFormString("txt_invoice_4") + "," + TWRequest.GetFormString("txt_invoiceaddress") + "," + TWRequest.GetFormString("txt_invoiceaddress_guo") + "," + TWRequest.GetFormString("txt_invoiceaddress_state1") + "," + TWRequest.GetFormString("txt_invoiceaddress_city1") + "," + TWRequest.GetFormString("txt_invoiceaddress_zip") + "," + TWRequest.GetFormString("txt_invoice_address");
                }
            }



            if (!string.IsNullOrEmpty(quan))
            {
                Tea.Model.quan modelquan1 = new Tea.BLL.quan().GetModel(quan);
                if (modelquan1 != null)
                {
                    model.zhe_code = modelquan1.quan_code;
                }
            }
            //model.zhe_else = cartModel.sales_str;
            // model.point = -cartModel.total_point;//紅利兌換
            //model.express_fee = yun;//運費
            //model.payment_fee = -fee;//優惠券
            //model.tuid = -back;//紅利折扣
            //model.zhe = -cartModel.total_moneyback; //折價金額
            model.num = 0;// Utils.StrToInt((cartModel.real_amount / uconfig.money_pint).ToString("0."), 0); //獲得紅利

            //訂單總金額=實付商品金額+運費+支付手續費-回饋金

            if (model.order_amount < 0)
            {
                model.order_amount = 0;
            }

            model.add_time = DateTime.Now;
            //商品詳細列表
            List <Tea.Model.order_goods> gls = new List <Tea.Model.order_goods>();
            foreach (Tea.Model.cart_items item in iList)
            {
                gls.Add(new Tea.Model.order_goods {
                    article_id = item.id, goods_title = item.title, goods_price = item.price, real_price = item.user_price, quantity = item.quantity, point = item.point, goods_where = item.by, goods_code = item.goods_code, goods_no = item.goods_code, goods_img = item.img_url, spec_text = item.goods_color, img_url = item.img_url, goodsid = item.goodsid
                });
            }
            model.order_goods    = gls;
            model.order_amount   = model.real_amount + model.express_fee + model.payment_fee + model.tuid + model.zhe;
            model.order_pay_code = model.order_no + Utils.Number(4);
            int result = new Tea.BLL.orders().Add(model);



            if (result < 1)
            {
                Response.Write(ljd.function.LocalHint("訂單儲存過程中發生錯誤,請重新送出!", ""));
                Response.End();
                return;
            }

            try
            {
                string mailTitle = "待付款訂單通知信", mailContent = "";
                string url = weburl + "mail/payorder.aspx?id=" + result, ss = "";
                mailContent = ljd.function.GetPage(url, out ss);
                //發送郵件
                TWMail.sendMail(siteConfig.emailsmtp, siteConfig.emailssl, siteConfig.emailport, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, model.email, mailTitle, mailContent);
            }
            catch (Exception eee) { }

            //if (email != TWRequest.GetFormString("txtemail"))
            //{
            //    try
            //    {
            //        string mailTitle = "待付款訂單通知信", mailContent = "";
            //        string url = weburl + "mail/payorder.aspx?id=" + result, ss = "";
            //        mailContent = ljd.function.GetPage(url, out ss);
            //        //發送郵件
            //        TWMail.sendMail(siteConfig.emailsmtp, siteConfig.emailssl, siteConfig.emailport, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom,TWRequest.GetFormString("txtemail"), mailTitle, mailContent);
            //    }
            //    catch (Exception eee) { }
            //}
            //扣除紅利
            if (model.point < 0)
            {
                new Tea.BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "紅利兌換商品:" + model.order_no, false, 0, 0);
            }

            //if (!string.IsNullOrEmpty(quan))
            //{
            //    Tea.Model.quan modelquan = new Tea.BLL.quan().GetModel(quan);
            //    if (modelquan != null)
            //    {
            //        modelquan.quan_lock = 1;
            //        modelquan.quan_date = System.DateTime.Now;
            //        new Tea.BLL.quan().Update(modelquan);
            //    }
            //}
            //userModel.point = userModel.point + model.point;
            //new Tea.BLL.users().Update(userModel);

            //清空購物車
            Tea.Web.UI.AdminCart.ClearShop(cart, uid);
            // Tea.Web.UI.AdminCart.Clear("0");
            //送出成功,返回URL
            if (model.payment_id != 1)
            {
                Response.Write(ljd.function.LocalHint("訂單已成功送出!", "/admin/index.aspx"));
                Response.End();
                return;
            }
            else
            {
                Response.Write(ljd.function.LocalHint("訂單已成功送出!", "/admin/index.aspx"));
                Response.End();
                return;
            }
        }
    }
Esempio n. 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _users    = new Tea.Web.UI.ShopPage().GetUserInfo();
        key       = TWRequest.GetQueryString("key");
        this.page = TWRequest.GetQueryInt("page", 1);
        this.tid  = TWRequest.GetQueryInt("tid", 0);
        this.hid  = TWRequest.GetQueryInt("hid", 0);
        this.sort = TWRequest.GetQueryInt("sort", 0);


        if (sort == 1)
        {
            _orderby = "add_time desc,id desc";
        }
        if (sort == 2)
        {
            _orderby = "click desc";
        }
        if (sort == 3)
        {
            _orderby = "market_price,id";
        }
        if (sort == 4)
        {
            _orderby = "market_price desc,id";
        }
        if (tid != 0)
        {
            _sql  = _sql + " and (category_id=" + tid + " or more_type like'%," + tid + ",%')";
            tname = new Tea.BLL.article_category().GetTitle(tid);
        }
        if (!string.IsNullOrEmpty(key))
        {
            _sql   = _sql + " and (title like'%" + key + "%' or sub_title like'%" + key + "%')";
            sqlkey = sqlkey + " and (title like'%" + key + "%' or sub_title like'%" + key + "%')";

            tname = key;

            IList   _list = new ArrayList();
            DataSet ds    = Tea.DBUtility.DbHelperSQL.Query("select category_id,more_type from view_article_product where " + sqlkey);
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (!_list.Contains(dr["category_id"].ToString()))
                {
                    _list.Add(dr["category_id"].ToString());
                }
                string more_type = dr["more_type"].ToString();
                IList  __list    = more_type.Split(',');
                foreach (object ob in __list)
                {
                    if (!_list.Contains(ob.ToString()))
                    {
                        _list.Add(ob.ToString());
                    }
                }
            }
            sql = "0";
            foreach (object ob in _list)
            {
                if (!string.IsNullOrEmpty(ob.ToString()))
                {
                    sql = sql + "," + ob.ToString();
                }
            }
        }


        //Response.Write(sql);
        //Response.End();
        if (!string.IsNullOrEmpty(sql))
        {
            data_type.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from shop_article_category where channel_id=7 and id in(" + sql + ") and call_index='1' order by sort_id desc");
            data_type.DataBind();
        }

        Tea.Web.UI.ShopPage bll_view = new Tea.Web.UI.ShopPage();

        data_list.DataSource = bll_view.GetViewList("view_article_product", "", this.pageSize, this.page, _sql, _orderby, out this.totalCount);
        data_list.DataBind();

        string pageUrl = Utils.CombUrlTxt("search.aspx", "tid={0}&key={1}&sort={2}&page={3}", tid.ToString(), key.ToString(), sort.ToString(), "__id__");

        PageContent.InnerHtml = Utils.OutPageListWeb(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
Esempio n. 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Tea.Model.users _users = GetUserInfo();
        if (_users != null && _users.status == 0)
        {
            Response.Redirect("edituser.aspx");
        }
        url = TWRequest.GetQueryString("url");
        try
        {
            num = Convert.ToInt32(Session["LoginSun"]);
        }
        catch (Exception eee) { }

        try
        {
            strurl = Request.UrlReferrer.AbsoluteUri.ToString();

            if (strurl.Contains("tea.") && !strurl.Contains("login.aspx") && !strurl.Contains("out.aspx") && !strurl.Contains("reg"))
            {
                Utils.WriteCookie("url", strurl);
            }
        }
        catch (Exception eee)
        { }

        if (url == "cart")
        {
            Utils.WriteCookie("url", "/shop/cart.aspx");
        }


        act = TWRequest.GetFormString("act");
        Tea.BLL.users bll = new Tea.BLL.users();
        if (act == "act_login")
        {
            string remember = TWRequest.GetFormString("txt_code");
            if (Session[TWKeys.SESSION_CODE] == null)
            {
                Response.Write(ljd.function.LocalHint("系統找不到驗證碼", "login.aspx"));
                return;
            }
            if (remember.ToLower() != Session[TWKeys.SESSION_CODE].ToString().ToLower())
            {
                Response.Write(ljd.function.LocalHint("驗證碼輸入不正確", "login.aspx"));
                return;
            }
            string username = TWRequest.GetFormString("email");
            string password = TWRequest.GetFormString("password");

            //檢查用戶名密碼
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                Response.Write(ljd.function.LocalHint("檢查用戶名密碼", "login.aspx"));
                return;
            }


            Tea.Model.users model = bll.GetModel(username, password, 1, 1, true);
            if (model == null)
            {
                Response.Write(ljd.function.LocalHint("檢查用戶名密碼", "login.aspx"));
                return;
            }


            else if (model.status == 2) //待審核
            {
                Response.Write(ljd.function.LocalHint("此帳號因未同意隱私條款或其他因素,已被系統限制登入,若有需要重新啟用,請連絡網站管理人員。", "login.aspx"));
                return;
            }
            Session[TWKeys.SESSION_USER_INFO] = model;
            Session.Timeout = 45;

            //防止Session提前過期
            Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name);
            Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password);

            //寫入登入日誌
            new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入");
            //返回URL
            //檢查用戶是否通過驗證
            if (model.status == 1) //待驗證
            {
                Response.Write(ljd.function.LocalHint("已發送帳號啟用信至您的電子信箱,請至信箱確認並啟用", "regno.aspx"));
                return;
            }
            //strurl = Utils.GetCookie("url");
            //if (strurl.Contains("tea.") || strurl.Contains("cart."))
            //{
            //    Response.Redirect(strurl);
            //}
            //else
            //{
            //    Response.Redirect("/users/index.aspx");
            //}
            Tea.Model.cart_total cartModel = Tea.Web.UI.ShopCart.GetTotal(1);
            if (cartModel.total_quantity == 0)
            {
                Response.Redirect("/Default.aspx");
            }
            else
            {
                Response.Redirect("/shop/cart.aspx");
            }
        }
    }
Esempio n. 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        act = Request["act"];
        Tea.BLL.users bll = new Tea.BLL.users();

        data_guo.DataSource = Tea.DBUtility.DbHelperSQL.Query("select * from shop_basic where basic_where='city' order by basic_sort");
        data_guo.DataBind();


        if (act == "act_reg")
        {
            string remember = TWRequest.GetFormString("txt_code");
            if (Session[TWKeys.SESSION_CODE] == null)
            {
                Response.Write(ljd.function.LocalHint("系統找不到驗證碼", "reg.aspx"));
                return;
            }
            if (remember.ToLower() != Session[TWKeys.SESSION_CODE].ToString().ToLower())
            {
                Response.Write(ljd.function.LocalHint("驗證碼輸入不正確", "reg.aspx"));
                return;
            }

            string username = Utils.ToHtml(TWRequest.GetFormString("email").Trim());
            string password = TWRequest.GetFormString("loginPwd").Trim();
            string email    = Utils.ToHtml(TWRequest.GetFormString("email").Trim());
            string mobile   = Utils.ToHtml(TWRequest.GetFormString("cellPhone").Trim());
            string address  = Utils.ToHtml(TWRequest.GetFormString("address").Trim());
            string area     = Utils.ToHtml(TWRequest.GetFormString("txt_state").Trim());
            string city     = Utils.ToHtml(TWRequest.GetFormString("txt_city").Trim());
            string area1    = Utils.ToHtml(TWRequest.GetFormString("txt_state1").Trim());
            string city1    = Utils.ToHtml(TWRequest.GetFormString("txt_city1").Trim());
            string guo      = Utils.ToHtml(TWRequest.GetFormString("txt_guo").Trim());
            string sex      = TWRequest.GetFormString("rblSex").Trim();
            string birthday = TWRequest.GetFormString("birthdayY").Trim() + "-" + TWRequest.GetFormString("birthdayM").Trim() + "-" + TWRequest.GetFormString("birthdayD").Trim();
            string nickname = TWRequest.GetFormString("userName").Trim();
            int    rss      = TWRequest.GetFormInt("rss", 0);
            string userip   = TWRequest.GetIP();


            //檢查用戶輸入資料是否為空
            if (username == "" || password == "")
            {
                Response.Write(ljd.function.LocalHint("用戶名和密碼不能為空!", ""));
                return;
            }


            //檢查用戶名

            Tea.Model.users model = new Tea.Model.users();

            if (new Tea.BLL.users().ExistsEmail(email))
            {
                Response.Write(ljd.function.LocalHint("此帳號信箱已存在於此網站,請以新mail註冊", ""));
                Response.End();
                return;
            }
            if (bll.Exists(username))
            {
                Response.Write(ljd.function.LocalHint("對不起,該用戶名已經存在!", ""));
                Response.End();
                return;
            }



            //儲存註冊資料
            model.group_id  = 1;
            model.user_name = username;
            model.salt      = Utils.GetCheckCode(6);
            model.status    = 1;
            model.password  = DESEncrypt.Encrypt(password, model.salt);
            model.email     = email;
            model.mobile    = mobile;
            if (guo == "台灣")
            {
                model.area = guo + "," + area + "," + city;
            }
            else
            {
                model.area = guo + "," + area1 + "," + city1;
            }
            model.qq      = TWRequest.GetFormString("txt_zip");
            model.sex     = sex;
            model.address = address;

            try
            {
                model.birthday = System.DateTime.Parse(birthday);
            }
            catch (Exception eee)
            {
                Response.Write(ljd.function.LocalHint("請輸入正確的日期!", ""));
                return;
            }
            if (TWRequest.GetFormInt("birthdayY") < 1900 || TWRequest.GetFormInt("birthdayY") > System.DateTime.Now.Year)
            {
                Response.Write(ljd.function.LocalHint("請輸入正確的日期!", ""));
                Response.End();
                return;
            }
            model.nick_name = nickname;
            model.reg_ip    = userip;
            model.reg_time  = DateTime.Now;
            model.exp       = rss;
            model.user_hei  = 0;

            int newId = bll.Add(model);
            if (newId < 1)
            {
                Response.Write(ljd.function.LocalHint("系統故障,請聯絡網站管理員!", ""));
                return;
            }

            model = bll.GetModel(newId);

            try
            {
                string mailTitle = "驗證郵箱通知信", mailContent = "";
                string url = weburl + "mail/reg.aspx?id=" + newId, ss = "";
                mailContent = ljd.function.GetPage(url, out ss);
                //發送郵件
                TWMail.sendMail(config.emailsmtp, config.emailssl, config.emailport, config.emailusername, config.emailpassword, config.emailnickname, config.emailfrom, model.email, mailTitle, mailContent);
            }
            catch (Exception eee) { }

            if (model != null)
            {
                Session[TWKeys.SESSION_USER_INFO] = model;
                Session.Timeout = 45;

                //防止Session提前過期
                Utils.WriteCookie(TWKeys.COOKIE_USER_NAME_REMEMBER, "Tea", model.user_name);
                Utils.WriteCookie(TWKeys.COOKIE_USER_PWD_REMEMBER, "Tea", model.password);

                //寫入登入日誌
                new Tea.BLL.user_login_log().Add(model.id, model.user_name, "會員登入");


                Response.Write(ljd.function.LocalHint("已發送帳號啟用信至您的電子信箱,請至信箱確認並啟用。", "regno.aspx"));
                Response.End();
            }
        }
    }