Exemple #1
0
    void deleteBrickImage(string now_id)
    {
        foreach (RepeaterItem item in Repeater_image.Items)
        {
            CheckBox    chk   = (CheckBox)(item.FindControl("chk_del"));
            HiddenField imgid = (HiddenField)(item.FindControl("img_id"));
            if (chk.Checked)
            {
                string strsql           = "delete from   tbl_article_file  where imgid=@imgid ";
                NameValueCollection nvc = new NameValueCollection();

                nvc.Clear();
                nvc.Add("imgid", imgid.Value);
                int i = DbControl.Data_add(strsql, nvc);
            }
        }

        foreach (RepeaterItem item in Repeater_file.Items)
        {
            CheckBox    chk   = (CheckBox)(item.FindControl("chk_del"));
            HiddenField imgid = (HiddenField)(item.FindControl("file_id"));
            if (chk.Checked)
            {
                string strsql           = "delete from   tbl_article_file  where imgid=@imgid ";
                NameValueCollection nvc = new NameValueCollection();
                nvc.Clear();
                nvc.Add("imgid", imgid.Value);
                int i = DbControl.Data_add(strsql, nvc);
            }
        }
    }
Exemple #2
0
        public static Mmemberdata Add(string email, string password, string account, string username = "", string phone = "")
        {
            Mmemberdata result = new Mmemberdata();

            if (account == "")
            {
                account = email;
            }
            //result = Check_exist(email);
            //if (result.Memberid == 0)
            //{
            string strsql           = @"insert  into tbl_MemberData ( email,password ,AccountId,phone,username)
                values  ( @email,@password,@AccountId,@phone ,@username) ";
            NameValueCollection nvc = new NameValueCollection
            {
                { "email", email },
                { "password", password },
                { "AccountId", account },
                { "username", username },
                { "phone", phone }
            };

            DbControl.Data_add(strsql, nvc);
            result = Login(account, password);
            Mail.Join_member(result.Memberid);
            // }

            return(result);
        }
Exemple #3
0
        public static int Article_item_Update(List <article.ItemData> itemData)
        {
            string strsql           = "delete from tbl_article_item where articleId =@id";
            NameValueCollection nvc = new NameValueCollection();
            int i = 0;

            foreach (article.ItemData idx in itemData)

            {
                if (i == 0)
                {
                    i = DbControl.Data_delete(strsql, idx.Id.ToString());
                }
                i++;
                nvc.Clear();
                strsql = @"insert into tbl_article_item (articleId,secno,subject,contents)
                    values (@articleId,@secno,@subject,@contents)";
                nvc.Add("articleId", idx.Id.ToString());
                nvc.Add("secno", idx.Secno.ToString());
                nvc.Add("subject", idx.Title);
                nvc.Add("contents", idx.Contents);
                i = DbControl.Data_add(strsql, nvc);
            }

            return(i);
        }
Exemple #4
0
        public static Mmemberdata Update(Mmemberdata m)
        {
            string strsql = @"update tbl_MemberData set email=@email,
            username=@username
            ,phone=@phone
            ,mobile=@mobile
            ,cityid=@cityid 
            ,countyid=@countyid
            ,zip=@zip,birthday=@birthday
            ,address=@address,password=@password where  memberid=@memberid";

            NameValueCollection nvc = new NameValueCollection
            {
                { "username", m.Username },
                { "email", m.Email },
                { "phone", m.Phone },
                { "mobile", m.Mobile },
                { "cityid", m.Cityid.ToString() },
                { "countyid", m.Countyid.ToString() },
                { "zip", m.Zip },
                { "address", m.Address },
                { "birthday", m.Birthday.ToString("yyyy/MM/dd") },
                { "password", m.Password },
                { "memberid", m.Memberid.ToString() }
            };

            DbControl.Data_add(strsql, nvc);
            return(m);
        }
Exemple #5
0
        public TradeInfoLog AddCardlog()
        {
            var          cryptoHelper = new CryptoHelper(Key, Vi);
            var          jsonString   = cryptoHelper.DecryptAesString(TradeInfo);
            TradeInfoLog log          = JsonConvert.DeserializeObject <TradeInfoLog>(jsonString);

            try
            {
                string strsql           = @"insert into TradeInfolog (MerchantID, Amt, TradeNo, MerchantOrderNo, 
                RespondType, IP, EscrowBank,PaymentType, RespondCode, Auth, Card6No, Card4No,Exp 
                ,TokenUseStatus, InstFirst, InstEach, Inst, ECI, PayTime,PaymentMethod, status,ord_code ) 
                values  (  @MerchantID, @Amt, @TradeNo, @MerchantOrderNo, 
                @RespondType, @IP, @EscrowBank,@PaymentType, @RespondCode, @Auth, @Card6No, @Card4No,@Exp 
               , @TokenUseStatus, @InstFirst, @InstEach, @Inst, @ECI, @PayTime,@PaymentMethod, @status,@ord_code)";
                NameValueCollection nvc = new NameValueCollection
                {
                    { "MerchantID", MerchantId },
                    { "Amt", log.Result.Amt },
                    { "TradeNo", log.Result.TradeNo },
                    { "MerchantOrderNo", log.Result.MerchantOrderNo },
                    { "RespondType", log.Result.RespondType ?? "" },
                    { "IP", log.Result.IP ?? "" },
                    { "EscrowBank", log.Result.EscrowBank ?? "" },
                    { "PaymentType", log.Result.PaymentType ?? "" },
                    { "RespondCode", log.Result.RespondCode ?? "" },
                    { "Auth", log.Result.Auth ?? "" },
                    { "Card6No", log.Result.Card6No ?? "" },
                    { "Card4No", log.Result.Card4No ?? "" },
                    { "Exp", log.Result.Exp ?? "" },
                    { "TokenUseStatus", log.Result.TokenUseStatus ?? "" },
                    { "InstFirst", log.Result.InstFirst ?? "" },
                    { "InstEach", log.Result.InstEach ?? "" },
                    { "Inst", log.Result.Inst ?? "" },
                    { "ECI", log.Result.ECI ?? "" },
                    { "PayTime", log.Result.PayTime },
                    { "PaymentMethod", log.Result.PaymentMethod ?? "" },
                    { "status", Status },
                    { "ord_code", log.Result.MerchantOrderNo }
                };

                DbControl.Data_add(strsql, nvc);
                if (Status == "SUCCESS")
                {
                    strsql = @"update tbl_OrderData set paid='Y' ,status='2'
                        where ord_code=@ord_code";
                    nvc.Clear();
                    nvc.Add("ord_code", log.Result.MerchantOrderNo);
                    DbControl.Data_add(strsql, nvc);
                }
            }
            catch (Exception e)
            {
                unity.classlib.SendsmtpMail("*****@*****.**", "error", e.Message);
            }
            return(log);
        }
Exemple #6
0
        public static string MailCertification(string account)

        {
            string      site_name = "";
            Mmemberdata result    = new Mmemberdata();

            result = Member.Check_exist(account);
            string    filename = HttpContext.Current.Server.MapPath("/templates/letter.html");
            string    mailbody = unity.classlib.GetTextString(filename);
            DataTable dt       = unity.classlib.Get_Message(1);

            unity.classlib.MsgResult m = new unity.classlib.MsgResult();

            if (result.Memberid > 0)
            {
                m.Id = result.AccountId;
                string AccountId = MySecurity.EncryptAES256(result.Memberid + DateTime.Now.ToString("yyyyMMddhhmmss"));
                site_name = HttpContext.Current.Application["site_name"].ToString();
                string textbody = dt.Rows[0]["contents"].ToString().Replace("@site_name@", site_name);
                string subject  = dt.Rows[0]["title"].ToString().Replace("@site_name@", site_name);
                string url      = "https://www.culturelaunch.net/resend?activeid=" + AccountId + "&Certification=mail";
                mailbody = mailbody.Replace("@title@", subject);
                textbody = textbody.Replace("@password@", result.Password);
                textbody = textbody.Replace("@username@", result.Username);
                mailbody = mailbody.Replace("@mailbody@", textbody);

                string strsql           = @"insert into log_Certification (memberid,accountid,ExpiryDate,status)
                values  (@memberid,@accountid,@ExpiryDate,@status) ";
                NameValueCollection nvc = new NameValueCollection();
                nvc.Add("memberid", result.Memberid.ToString());
                nvc.Add("accountid", AccountId);
                nvc.Add("ExpiryDate", DateTime.Now.AddHours(2).ToString("yyyy-MM-dd HH:mm:ss"));
                nvc.Add("status", "");
                DbControl.Data_add(strsql, nvc);

                mailbody = mailbody.Replace("@currenttime@", DateTime.Now.AddHours(2).ToString("yyyy-MM-dd HH:mm:ss"));
                mailbody = mailbody.Replace("@url@", url);

                m.Msg = unity.classlib.SendsmtpMail(result.Email, subject, mailbody, "gmail");
            }
            m.Id = result.Memberid.ToString();
            if (result.Memberid == 0)
            {
                m.Msg = "帳號不存在,請重新輸入";
            }
            else if (result.Email.ToString() == "")
            {
                m.Id  = "0";
                m.Msg = "Email未填寫,請至會員中心";
            }
            else
            {
                m.Msg = "請收取Email以証證";
            }
            return(new JavaScriptSerializer().Serialize(m));;
        }
Exemple #7
0
    protected void btn_del_Click(object sender, System.EventArgs e)
    {
        strsql = "update  " + table_name + " set status = 'D' where id =@id";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("id", Selected_id.Value);
        DbControl.Data_add(strsql, nvc);
        MultiView1.ActiveViewIndex = 0;
        cleaninput();
        selectSQL();
    }
Exemple #8
0
        public static string Join_member(int memberid)

        {
            string      site_name = "";
            Mmemberdata result    = new Mmemberdata();

            result = Member.GetData(memberid.ToString());
            string    filename = HttpContext.Current.Server.MapPath("/templates/letter.html");
            string    mailbody = unity.classlib.GetTextString(filename);
            DataTable dt       = unity.classlib.Get_Message(5);
            string    msg      = "";

            if (dt.Rows.Count > 0)
            {
                site_name = HttpContext.Current.Application["site_name"].ToString();
                string textbody = dt.Rows[0]["contents"].ToString().Replace("@site_name@", site_name);
                string subject  = "【" + site_name + "】" + dt.Rows[0]["title"].ToString();

                string AccountId = MySecurity.EncryptAES256(result.Memberid + DateTime.Now.ToString("yyyyMMddhhmmss"));
                site_name = HttpContext.Current.Application["site_name"].ToString();
                string url = "https://www.culturelaunch.net/resend?activeid=" + AccountId + "&Certification=mail";

                string strsql           = @"insert into log_Certification (memberid,accountid,ExpiryDate,status)
                values  (@memberid,@accountid,@ExpiryDate,@status) ";
                NameValueCollection nvc = new NameValueCollection();
                nvc.Add("memberid", result.Memberid.ToString());
                nvc.Add("accountid", AccountId);
                nvc.Add("ExpiryDate", DateTime.Now.AddHours(2).ToString("yyyy-MM-dd HH:mm:ss"));
                nvc.Add("status", "");
                DbControl.Data_add(strsql, nvc);



                mailbody = mailbody.Replace("@title@", subject);
                textbody = textbody.Replace("@name@", result.Username);
                textbody = textbody.Replace("@email@", result.Email);
                textbody = textbody.Replace("@password@", result.Password);
                textbody = textbody.Replace("@websitename@", site_name);
                textbody = textbody.Replace("@currenttime@", DateTime.Now.AddHours(2).ToString("yyyy-MM-dd HH:mm:ss"));
                mailbody = textbody.Replace("@url@", url);
                mailbody = mailbody.Replace("@mailbody@", textbody);

                msg = unity.classlib.SendsmtpMail(result.Email, subject, mailbody, "gmail");
            }
            if (result.Memberid == 0)
            {
                return("-1");
            }
            else
            {
                return(msg);
            }
        }
Exemple #9
0
    public static OrderLib.OrderData AddOrdData(OrderLib.OrderData o)
    {
        string strsql = @"insert into tbl_OrderData
            (ord_code, memberid, paymode, invoice,  receivetime, contents,  SubPrice, DeliveryPrice, DiscountPrice, 
                TotalPrice, status,ordname,ordphone,ordaddress,shipname,shipphone,shipaddress,companyno,title
            ,ordgender,shipgender,coupon_no,email,zip,cityid,countryid,delivery_kind,ord_date) values 
                (@ord_code,@memberid, @paymode, @invoice, @receivetime, @contents,@SubPrice, @DeliveryPrice, 
                @DiscountPrice,@TotalPrice, @status,@ordname,@ordphone,@ordaddress,@shipname,@shipphone,@shipaddress
                ,@companyno,@title,@ordgender,@shipgender,@coupon_no,@email,@zip,@cityid,@countryid,@delivery_kind,@ord_date)";

        NameValueCollection nvc = new NameValueCollection
        {
            { "ord_code", o.Ord_code },
            { "memberid", o.Memberid },
            { "receivetime", o.ReceiveTime },
            { "contents", o.Contents },
            { "SubPrice", o.SubPrice.ToString() },
            { "DeliveryPrice", o.ShipPrice.ToString() },
            { "DiscountPrice", o.Discount.ToString() },
            { "TotalPrice", o.TotalPrice.ToString() },
            { "status", o.Status },
            { "paymode", o.Paymode },
            { "invoice", o.Invoice },
            { "ordname", o.Ordname },
            { "ordphone", o.Ordphone },
            { "ordaddress", o.Ordaddress },
            { "shipname", o.Shipname },
            { "shipphone", o.Shipphone },
            { "shipaddress", o.Shipaddress },
            { "companyno", o.Companyno },
            { "title", o.Title },
            { "ordgender", o.Ordgender },
            { "shipgender", o.Shipgender },
            { "coupon_no", o.coupon_no },
            { "email", o.Ordemail },
            { "zip", o.Ordzip },
            { "delivery_kind", o.Delivery_kind },
            { "cityid", o.Ordcityid.Id.ToString() },
            { "countryid", o.Ordcountyid.Id.ToString() },
            { "ord_date", DateTime.Today.ToShortDateString() }
        };
        int i = DbControl.Data_add(strsql, nvc);

        nvc.Clear();


        strsql = @"select max(ord_id)   from  tbl_orderdata   ";
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        o.Ord_id = (int)dt.Rows[0][0];
        return(o);
    }
Exemple #10
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Button obj = sender as Button;

        strsql = "update  " + table_name + " set status = 'D' where id =@id";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("id", obj.CommandArgument);
        DbControl.Data_add(strsql, nvc);
        MultiView1.ActiveViewIndex = 0;
        cleaninput();
        selectSQL();
    }
Exemple #11
0
        public static string Add_Socialshare(string id, string kind, string url)
        {
            string value            = "";
            string strsql           = @"insert into tbl_SocialShare (articleId,kind,url) values 
            (@articleId,@kind,@url) ";
            NameValueCollection nvc = new NameValueCollection();

            nvc.Add("articleId", id);
            nvc.Add("kind", kind);
            nvc.Add("url", url);
            DbControl.Data_add(strsql, nvc);
            return(value);
        }
Exemple #12
0
        public static int Add_views(int id)
        {
            string strsql           = @"update  tbl_article  set  Viewcount=Viewcount + 1 
            where  articleid=@id ";
            NameValueCollection nvc = new NameValueCollection
            {
                { "id", id.ToString() }
            };

            id = DbControl.Data_add(strsql, nvc);
            nvc.Clear();
            return(id);
        }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt;
        string    code = Request["code"];

        string[] ary = code.Split('-');
        code = ary[0] + "-" + ary[1] + "-" + ary[2];

        if (code == null || code == "")
        {
            msg = "無編號";
        }

        else
        {
            LessonLib.JoinData l = LessonLib.Web.Get_ord_JoinData(ary[0]);
            if (l.Id == 0)
            {
                msg = "報名資料不存在";
            }
            else
            {
                string strsql           = "select * from  tbl_joindetail where joinid=@joinid ";
                NameValueCollection nvc = new NameValueCollection
                {
                    { "joinid", ary[1] },
                };
                strsql = "select * from tbl_joinlog where checkcode=@checkcode ";
                nvc.Clear();
                nvc = new NameValueCollection
                {
                    { "checkcode", code },
                };
                dt = DbControl.Data_Get(strsql, nvc);
                if (dt.Rows.Count > 0)
                {
                    msg = "已報到過!";
                }
                else
                {
                    strsql = "insert into tbl_joinlog (checkcode) values (@checkcode)";
                    DbControl.Data_add(strsql, nvc);
                    msg = "報到成功!";
                }
                msg += "<br>訂單編號:" + l.Ord_code + "<br>";
                msg += "付款方式:" + OrderLib.getPaymode(l.OrderData.Paymode) + "<br>";
                msg += "訂單狀態:" + OrderLib.get_ord_status(l.OrderData.Status) + "<br>";
            }
        }
    }
Exemple #14
0
    protected void Button1_Click(object sender, System.EventArgs e)
    {
        int    i;
        string strFileName = "";
        string FIleExt;
        string DirName = "upload";
        string albumid = "";

        DirName = "../upload/pic/";
        NameValueCollection nvc = new NameValueCollection();
        DataTable           dt  = new DataTable();

        System.IO.Directory.CreateDirectory(Server.MapPath(DirName));
        for (i = 0; i <= Request.Files.Count - 1; i++)
        {
            HttpPostedFile filUpFile    = Request.Files[i];
            string[]       arrFileSplit = filUpFile.FileName.Split('/');
            strFileName = arrFileSplit[(arrFileSplit.Length - 1)];

            if ((strFileName != ""))
            {
                FIleExt     = unity.classlib.GetFileExt(strFileName);
                strFileName = (Guid.NewGuid().ToString() + FIleExt);
                filUpFile.SaveAs(Server.MapPath((DirName + ("\\" + strFileName))));

                if ((catalogue.Text == ""))
                {
                    catalogue.Text = (Request.QueryString["catalogue"]);
                }

                strsql = "insert into uploadfile (filename,status,catalogue,filekind) values ('"
                         + strFileName + "','Y','" + catalogue.Text + "','A' )";

                DbControl.Data_add(strsql, nvc);
            }
        }

        strsql = "SELECT * from uploadfile  where  status <> 'D' and filekind='A' ";
        if (Request.QueryString["catalogue"] != "")
        {
            strsql += " and catalogue ='" + catalogue.Text + "' ";
        }


        catalogue.Text = "";
        dt             = DbControl.Data_Get(strsql, nvc);

        dbinit(dt, DataList1);
    }
Exemple #15
0
    protected void Btn_save_Click(object sender, EventArgs e)
    {
        deleteBrickImage(Session["uploadid"].ToString());

        NameValueCollection nvc = new NameValueCollection();

        string[] Hidden_id;
        int      j;
        string   strsql = "";

        if (Request.QueryString["type"] == "image")
        {
            Hidden_id = Request.Form["img_id"].Split(',');
            j         = Request.Form.GetValues("img_id").Length;
            for (j = 0; j < Request.Form.GetValues("img_id").Length; j++)
            {
                TextBox tx = (TextBox)Repeater_image.Items[j].FindControl("TextBox1");
                strsql = "update tbl_article_file set sort=@sort,link =@link  where imgid=@imgid ;";
                nvc.Clear();
                nvc.Add("sort", j.ToString());
                nvc.Add("link", tx.Text);
                nvc.Add("imgid", Hidden_id[j]);
                int i = DbControl.Data_add(strsql, nvc);
            }
        }
        if (Request.QueryString["type"] == "file")
        {
            Hidden_id = Request.Form["file_id"].Split(',');
            j         = Request.Form.GetValues("file_id").Length;
            for (j = 0; j < Request.Form.GetValues("file_id").Length; j++)
            {
                TextBox tx = (TextBox)Repeater_file.Items[j].FindControl("TextBox1");
                strsql = "update tbl_article_file set sort=@sort,link =@link  where imgid=@imgid ;";
                nvc.Clear();
                nvc.Add("sort", j.ToString());
                nvc.Add("link", tx.Text);
                nvc.Add("imgid", Hidden_id[j]);
                int i = DbControl.Data_add(strsql, nvc);
            }
        }


        selectSQL();
        //  Response.Redirect("editBrick.aspx?unitid=" + Request.QueryString["fromUnitid"]);
    }
Exemple #16
0
    public static int Article_Add()
    {
        int    id               = 0;
        string strsql           = "insert into tbl_article ( Viewcount) values (0);SELECT SCOPE_IDENTITY();";
        NameValueCollection nvc = new NameValueCollection();

        id = DbControl.Data_add(strsql, nvc);
        nvc.Clear();
        strsql = "select max(articleId) from  tbl_article ";
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        if (dt.Rows.Count > 0)
        {
            id = (int)dt.Rows[0][0];
        }
        dt.Dispose();
        return(id);
    }
Exemple #17
0
        public static ItemData Add(ItemData item)
        {
            string strsql           = @"insert into  tbl_ContactUs (username,email,phone,Contents) values   
                (@username,@email,@phone,@Contents) ";
            NameValueCollection nvc = new NameValueCollection
            {
                { "username", item.Usermame },
                { "email", item.Email },
                { "phone", item.Phone },
                { "Contents", item.Contents },
                { "status", item.Status }
                //{ "endday",ad.EndDay.ToString("yyyy/MM/dd") },
            };

            DbControl.Data_add(strsql, nvc);

            return(item);
        }
Exemple #18
0
    protected void LinkButton7_Click(object sender, EventArgs e)
    {
        string[] bannerid = Request["bannerid"].Split(',');

        for (int i = 0; i <= bannerid.GetLength(0) - 1; i++)
        {
            string id               = bannerid[i].ToString();
            int    sort             = bannerid.GetLength(0) - i;
            string strsql           = "update tbl_banner set sort = @sort where bannerid =@bannerid";
            NameValueCollection nvc = new NameValueCollection();
            nvc.Add("sort", sort.ToString());
            nvc.Add("bannerid", id);
            //     Response.Write(id + "-" + sort + "<br>");
            DbControl.Data_add(strsql, nvc);
            nvc.Clear();
        }
        MultiView1.ActiveViewIndex = 0;
    }
Exemple #19
0
        public static object  JoinAdd(JoinData item)
        {
            string strsql = @"INSERT  into Tbl_Joindata( status,ticketkind, Articleid,ord_code)   values
                ( @status,@ticketkind, @Articleid ,@ord_code) ";

            NameValueCollection nvc = new NameValueCollection            {
                { "status", "1" },
                { "ticketkind", item.TicketKind },
                { "Articleid", item.Articleid.ToString() },
                { "ord_code", item.Ord_code }
            };

            DbControl.Data_add(strsql, nvc);
            int joinid = 0;

            strsql = "select max (joinid) from  Tbl_Joindata";
            nvc.Clear();
            DataTable dt = DbControl.Data_Get(strsql, nvc);

            joinid  = (int)dt.Rows[0][0];
            item.Id = joinid;
            foreach (JoinDetail j in item.JoinDetail)
            {
                strsql = @"INSERT INTO tbl_joindetail( username, phone, email,
                    lessonid,amount,status,postion,unitname,joinid)
                        VALUES ( @username, @phone, @email, @lessonid,@amount,'Y',
                    @postion,@unitname,@joinid)";
                nvc.Clear();
                nvc.Add("joinid", joinid.ToString());
                nvc.Add("username", j.Name);
                nvc.Add("phone", j.Phone);
                nvc.Add("email", j.Email);
                nvc.Add("amount", j.Amount.ToString());
                nvc.Add("lessonid", j.LessonId.ToString());
                nvc.Add("postion", j.Postion);
                nvc.Add("unitname", j.Unitname);

                DbControl.Data_add(strsql, nvc);
            }
            ;

            return(item);
        }
Exemple #20
0
        public static string CheckCertification(string activeid)

        {
            unity.classlib.MsgResult m = new unity.classlib.MsgResult();
            if (activeid != null && activeid != "")
            {
                Mmemberdata         result = new Mmemberdata();
                string              strsql = @"select * from Log_Certification  where accountid =@accountid and 
                getdate() <= ExpiryDate ";
                NameValueCollection nvc    = new NameValueCollection();
                nvc.Add("accountid", activeid);
                DataTable dt = DbControl.Data_Get(strsql, nvc);
                if (dt.Rows.Count == 0)
                {
                    m.Id  = "0";
                    m.Msg = "証認碼不存在或已過期!請重新認証";
                }
                else
                {
                    m.Id   = dt.Rows[0]["memberid"].ToString();
                    strsql = "update tbl_MemberData set status='Y' where memberid = @memberid";
                    nvc.Clear();
                    nvc.Add("memberid", m.Id);
                    DbControl.Data_add(strsql, nvc);
                    strsql = @"update Log_Certification set status='Y' ,CertificationDate=getdate() 
                         where accountid = @accountid";
                    nvc.Clear();
                    nvc.Add("accountid", activeid);
                    DbControl.Data_add(strsql, nvc);

                    m.Msg = "會員認証通過";
                }
            }
            else
            {
                m.Id  = "0";
                m.Msg = "証認碼不存在";
            }

            return(new JavaScriptSerializer().Serialize(m));;
        }
Exemple #21
0
        public static string Add_Collection(string articleId, string memberid, string flag)
        {
            string value  = "";
            string strsql = @"delete from  tbl_articleCollection where articleId =@articleId 
                and memberid =@memberid";

            NameValueCollection nvc = new NameValueCollection
            {
                { "memberid", memberid },
                { "articleId", articleId }
            };

            DbControl.Data_add(strsql, nvc);
            if (flag == "add")
            {
                strsql = @"insert into tbl_articleCollection (articleId,memberid) values 
                (@articleId,@memberid) ";
                DbControl.Data_add(strsql, nvc);
            }
            return(value);
        }
Exemple #22
0
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        o = OrderLib.Get_ordData(Selected_id.Value);
        string    ord_code = o.Ord_code;
        DataTable dt       = unity.classlib.Get_Message(17);

        LessonLib.JoinData l       = LessonLib.Web.Get_ord_JoinData(o.Ord_code);
        string             smsbody = dt.Rows[0]["contents"].ToString();

        smsbody = smsbody.Replace("@username@", l.OrderData.Ordname);
        // smsbody = smsbody.Replace("@date@", l.LessonData.StartDay.ToString ("MM月dd日") );
        smsbody = smsbody.Replace("@classtime@", l.LessonData.Lessontime);
        smsbody = smsbody.Replace("@classname@", l.LessonData.MainData.Subject);
        classlib.Log_Sms    log    = classlib.Sendsms(l.OrderData.Ordphone, smsbody);
        string              strsql = "update log_SMS set ord_code= @ord_code where msgid=@msgid";
        NameValueCollection nvc    = new NameValueCollection();

        nvc.Add("msgid", log.Msgid);
        nvc.Add("ord_code", o.Ord_code);
        DbControl.Data_add(strsql, nvc);
        outfile = "<script>alert('己送出');</script>";
    }
Exemple #23
0
        public static Log_Sms Sendsms(string dstanumber, string smsbody)
        {
            string   result = "";
            Log_Sms  log    = new Log_Sms();
            Encoding myenc  = Encoding.GetEncoding("big5");
            string   smsurl =
                string.Format(@"http://smexpress.mitake.com.tw:9600/SmSendGet.asp?username=55053613&password=xnet2635&dstaddr={0}&smbody={1}&response=http://192.168.1.200/smreply.asp"
                              , dstanumber, HttpUtility.UrlEncode(classlib.RemoveHTMLTag(smsbody), myenc));
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(smsurl);

            req.Method = "GET";
            using (WebResponse wr = req.GetResponse())
            {
                using (StreamReader sr = new StreamReader(wr.GetResponseStream(), myenc))
                {
                    result = sr.ReadToEnd();
                }
            }
            string[]            stringSeparators = new string[] { "\r\n" };
            string[]            msg    = result.Split(stringSeparators, StringSplitOptions.None);
            string              strsql = @"insert into log_sms (msgid,statuscode,AccountPoint,dstanumber,smsbody)
                values (@msgid,@statuscode,@AccountPoint,@dstanumber,@smsbody) ";
            NameValueCollection nvc    = new NameValueCollection();

            log.Msgid        = msg[1].Replace("msgid=", "");
            log.Statuscode   = msg[2].Replace("statuscode=", "");
            log.AccountPoint = msg[3].Replace("AccountPoint=", "");
            log.Dstanumber   = dstanumber;
            log.Smsbody      = classlib.RemoveHTMLTag(smsbody);

            nvc.Add("msgid", log.Msgid);
            nvc.Add("statuscode", log.Statuscode);
            nvc.Add("AccountPoint", log.AccountPoint);
            nvc.Add("dstanumber", dstanumber);
            nvc.Add("smsbody", log.Smsbody);
            DbControl.Data_add(strsql, nvc);

            return(log);
        }
Exemple #24
0
    protected void Btn_save_Click(object sender, System.EventArgs e)
    {
        //-----------------------------------------------------------------------

        if (Btn_save.CommandArgument == "add")
        {
            strsql  = " insert into  " + table_name + "( name,status) values ";
            strsql += "(@name, @status) ";
        }
        else
        {
            strsql = "update   " + table_name + " set name=@name,status=@status where id=@id";
        }
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("id", Selected_id.Value);
        nvc.Add("name", class_name.Text);
        nvc.Add("status", status.SelectedValue);
        DbControl.Data_add(strsql, nvc);
        MultiView1.ActiveViewIndex = 0;
        cleaninput();
        selectSQL();
    }
Exemple #25
0
    public static string Get_ord_code(string ord_date)
    {
        string ord_code = "";


        string ord_code1 = DateTime.Parse(ord_date).ToString("yyyyMMdd");
        string ord_code2 = "";


        int    secno = 1;
        string strsql;

        strsql = @"SELECT  * FROM Tbl_OrderNo WHERE orddate = CONVERT(VARCHAR(10), getdate(), 111)";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("orddate", ord_date);
        DataTable dt = DbControl.Data_Get(strsql, nvc);

        if (dt.Rows.Count == 0)
        {
            ord_code2 = "1";
            strsql    = @"insert into  Tbl_OrderNo  (orddate,secno) values (@orddate,@secno) ";
        }
        else
        {
            secno  = (int)dt.Rows[0]["secno"] + 1;
            strsql = @"update Tbl_OrderNo  set secno=@secno where orddate=@orddate ";
        }
        dt.Dispose();
        ord_code2 = (secno).ToString().PadLeft(5, '0');
        nvc.Clear();
        nvc.Add("secno", secno.ToString());
        nvc.Add("orddate", ord_date);
        DbControl.Data_add(strsql, nvc);
        ord_code = ord_code1 + ord_code2;
        return(ord_code);
    }
Exemple #26
0
        public TradeInfoLog AddAtmlog()
        {
            var                 cryptoHelper = new CryptoHelper(Key, Vi);
            var                 jsonString   = cryptoHelper.DecryptAesString(TradeInfo);
            TradeInfoLog        log          = JsonConvert.DeserializeObject <TradeInfoLog>(jsonString);
            string              strsql       = @"insert into TradeInfolog (MerchantID, Amt, TradeNo, MerchantOrderNo, 
                RespondType, PaymentType, ExpireDate,ExpireTime, BankCode,CodeNo,status,ord_code ) 
                values  (  @MerchantID, @Amt, @TradeNo, @MerchantOrderNo, 
                @RespondType, @PaymentType, @ExpireDate,@ExpireTime, @BankCode,@CodeNo,@status
                ,@ord_code)";
            NameValueCollection nvc          = new NameValueCollection
            {
                { "MerchantID", MerchantId },
                { "Amt", log.Result.Amt },
                { "TradeNo", log.Result.TradeNo },
                { "MerchantOrderNo", log.Result.MerchantOrderNo },
                { "PaymentType", log.Result.PaymentType },
                { "RespondType", log.Result.RespondType },
                { "ExpireDate", log.Result.ExpireDate ?? "" },
                { "ExpireTime", log.Result.ExpireTime ?? "" },
                { "BankCode", log.Result.BankCode ?? "" },
                { "CodeNo", log.Result.CodeNo ?? "" },
                { "status", Status },
                { "ord_code", log.Result.MerchantOrderNo }
            };

            try
            {
                DbControl.Data_add(strsql, nvc);
            }
            catch (Exception e)
            {
                unity.classlib.SendsmtpMail("*****@*****.**", "error", e.Message);
            }
            return(log);
        }
Exemple #27
0
    protected void Btn_save_Click(object sender, System.EventArgs e)
    {
        string strsql           = @"update tbl_OrderData set 
       
        invoice=@invoice,
        receivetime=@receivetime,
        shipname=@shipname,
        shipphone=@shipphone,
        shipaddress=@shipaddress,     
        contents=@contents,
        companyno=@companyno,paymode=@paymode,
        status =@status,coupon_no=@coupon_no,
        title=@title
        where ord_code=@ord_code";
        NameValueCollection nvc = new NameValueCollection();

        nvc.Add("invoice", invoice.SelectedValue);
        nvc.Add("receivetime", receivetime.SelectedValue);
        nvc.Add("status", payStatus.SelectedValue);
        nvc.Add("shipname", shipname.Text);
        nvc.Add("shipphone", shipphone.Text);
        nvc.Add("shipaddress", shipaddress.Text);
        nvc.Add("contents", contents.Text);
        nvc.Add("paymode", paymode.SelectedValue);

        nvc.Add("ord_code", Selected_id.Value);
        nvc.Add("companyno", companyno.Text);
        nvc.Add("coupon_no", coupon_no.Text);
        nvc.Add("title", title.Text);
        DbControl.Data_add(strsql, nvc);

        strsql = @"update  tbl_Joindata set      
            status=@status
            where ord_code=@ord_code";
        DbControl.Data_add(strsql, nvc);

        string jstatus = Lstatus.SelectedValue;

        if (payStatus.SelectedValue == "2")
        {
            jstatus = "Y";
        }
        else if (payStatus.SelectedValue == "10")
        {
            jstatus = "N";
        }
        else if (payStatus.SelectedValue == "7")
        {
            jstatus = "N";
        }
        else if (payStatus.SelectedValue == "0")
        {
            jstatus = "D";
        }

        strsql = @"UPDATE  tbl_joindetail
                SET        tbl_joindetail.status =@jstatus           
                FROM              tbl_Joindata INNER JOIN
                                            tbl_joindetail ON tbl_Joindata.joinid = tbl_joindetail.joinid
                WHERE          tbl_Joindata.ord_code = @ord_code";

        nvc.Add("jstatus", jstatus);
        DbControl.Data_add(strsql, nvc);



        LinkButton obj = sender as LinkButton;

        selectSQL();
        MultiView1.ActiveViewIndex = 0;
    }
Exemple #28
0
    protected void Btn_save_Click(object sender, System.EventArgs e)
    {
        int                 i      = 0;
        LinkButton          obj    = sender as LinkButton;
        NameValueCollection nvc    = new NameValueCollection();
        string              strsql = "";

        if (Btn_save.CommandArgument == "copy" || Btn_save.CommandArgument == "add")
        {
            strsql = "insert into Tbl_package (viewcount) values (@viewcount ) ";
            nvc.Add("viewcount", "0");
            i      = DbControl.Data_add(strsql, nvc);
            strsql = "select max(packageid ) from Tbl_package  ";
            nvc.Clear();

            DataTable dt = DbControl.Data_Get(strsql, nvc);
            packageid.Text = dt.Rows[0][0].ToString();
        }


        if (sort.Text == "")
        {
            sort.Text = "0";
        }

        strsql = @"UPDATE  Tbl_package  SET packagename=@packagename,
                status = @status,sort=@sort,shippingfee=@shippingfee
                ,shippingKind=@shippingKind,freeship=@freeship
               ,supplierid=@supplierid ,description=@description
                ,ReMark=@ReMark,Refunds=@Refunds
                where packageid=@packageid ";
        nvc.Clear();
        nvc.Add("packageid", packageid.Text);
        nvc.Add("packagename", packagename.Text);
        nvc.Add("description", Server.HtmlDecode(description.Text));
        nvc.Add("status", status.SelectedValue);
        nvc.Add("sort", sort.Text);
        nvc.Add("shippingfee", shippingfee.Text);
        nvc.Add("freeship", freeship.Text);
        nvc.Add("shippingKind", shippingKind.Text);
        nvc.Add("supplierid", supplierid.SelectedValue);
        nvc.Add("ReMark", ReMark.Text);
        nvc.Add("Refunds", Refunds.Text);
        i = DbControl.Data_add(strsql, nvc);

        strsql = @"delete from tbl_package_product where packageid =@packageid";
        i      = DbControl.Data_Update(strsql, nvc, packageid.Text);
        foreach (RepeaterItem r in Repeater1.Items)
        {
            CheckBox cb = (CheckBox)r.FindControl("CheckBox1");
            if (cb.Checked)
            {
                HiddenField v1 = (HiddenField)r.FindControl("HiddenField1");
                TextBox     t1 = (TextBox)r.FindControl("price");
                TextBox     t2 = (TextBox)r.FindControl("storage");
                strsql = @"insert into tbl_package_product (packageid,p_id,price,storage)
                values (@packageid,@p_id,@price,@storage) ";
                nvc.Clear();
                nvc.Add("packageid", packageid.Text);
                nvc.Add("p_id", v1.Value);
                nvc.Add("price", t1.Text);
                nvc.Add("storage", t2.Text);
                i = DbControl.Data_add(strsql, nvc);
            }
        }

        selectSQL();
        MultiView1.ActiveViewIndex = 0;
    }
Exemple #29
0
    protected void Btn_save_Click(object sender, System.EventArgs e)
    {
        LinkButton obj = sender as LinkButton;


        //-----------------------------------------------------------------------
        string uploadPath = Server.MapPath("~/webimages/banner/");
        string Filename   = "";

        string[] allowedExtensions = { ".jpg", ".jpeg", ".png", ".gif" };

        string fileExtension;

        if (FileUpload1.HasFile)
        {
            fileExtension = Path.GetExtension(FileUpload1.FileName.ToLower());
            if (Array.IndexOf(allowedExtensions, fileExtension) >= 0)
            {
                Filename = DateTime.Now.ToString("yyyyMMddhhmmssfff") + fileExtension;
                FileUpload1.PostedFile.SaveAs(uploadPath + Filename);
                HiddenField1.Value = Filename;
            }
            else
            {
                Response.Write("檔案格式有誤");
            }
        }

        NameValueCollection nvc = new NameValueCollection();
        string strsql           = "";

        if (Btn_save.CommandArgument == "add")
        {
            strsql = @"INSERT  INTO tbl_banner(filename, path, url, targetblank, sort, enabledate, disabledate, 
                status, title, createdate, createuserid,  classId,viewcount,contents,categoryid,articleId
                ) VALUES (@filename, @path, @url, @targetblank,
                @sort, @enabledate, @disabledate, @status, @title, @createdate
                , @createuserid,  @classId,0,@contents, @categoryid, @articleId) ";
            nvc.Add("createdate", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
            nvc.Add("createuserid", Session["userid"].ToString());
        }
        else
        {
            strsql = @"UPDATE  tbl_banner SET filename =@filename, path =@path, url =@url, targetblank =@targetblank, 
            sort =@sort, enabledate =@enabledate, disabledate =@disabledate, status =@status, title =@title, 
             classId =@classId ,contents=@contents,categoryid=@categoryid,articleId=@articleId where bannerid=@bannerid";
            nvc.Add("bannerid", Selected_id.Value);
        }


        nvc.Add("filename", HiddenField1.Value);
        nvc.Add("path", "webimages/banner/");
        nvc.Add("url", t_url.Text);
        nvc.Add("targetblank", t_targetblank.Text);
        nvc.Add("sort", t_sort.Text);
        nvc.Add("enabledate", sdate.Text + " " + stime.SelectedValue + ":00:00");
        nvc.Add("status", t_status.SelectedValue);
        nvc.Add("title", t_title.Text);
        nvc.Add("classId", DropDownList1.SelectedValue);
        nvc.Add("categoryid", DropDownList2.SelectedValue);
        nvc.Add("articleId", DropDownList3.SelectedValue);
        if (edate.Text != "")
        {
            nvc.Add("disabledate", edate.Text + " " + etime.SelectedValue + ":00:00");
        }
        else
        {
            nvc.Add("disabledate", "DBNull");
        }
        nvc.Add("contents", contents.Text);
        int i = DbControl.Data_add(strsql, nvc);

        selectSQL();
        MultiView1.ActiveViewIndex = 0;
        cleaninput();
    }
Exemple #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["ord_code"] != null)
        {
            ord_code = Session["ord_code"].ToString();
        }
        if (Request.QueryString["ord_code"] != null)
        {
            ord_code = Request.QueryString["ord_code"];
        }
        if (ord_code == "")
        {
            Response.End();
        }
        ord_code = classlib.RemoveBadSymbol(ord_code);
        o        = OrderLib.Get_ordData(ord_code);
        SpGatewayHelper.Models.TradeInfoLog log = OrderLib.Get_Tradelog(ord_code);
        string strsql = "";
        string ord_id = o.Ord_id.ToString();

        temp_product.DataSource = o.OrderDetail;
        temp_product.DataBind();


        if (o.Paymode == "1")
        {
            NameValueCollection nvc = new NameValueCollection
            {
                { "ord_code", ord_code }
            };
            DataTable dt = new DataTable();
            if (log.Status == "SUCCESS")
            {
                strsql = @"update   tbl_OrderData   set paid= 'Y', status =2  where ord_code=@ord_code";
                DbControl.Data_add(strsql, nvc);
                dt.Dispose();
            }
            else
            {
                Response.Redirect("/cardpayfiled");
            }

            ord_status = log.Status;

            string site_name = HttpContext.Current.Application["site_name"].ToString();
            string filename  = HttpContext.Current.Server.MapPath("/templates/letter.html");
            string mailbody  = unity.classlib.GetTextString(filename);
            string atmmode   = "<table><Tr><td colspan=2>您於「" + site_name + "」進行了信用卡交易,以下為您付款完成資訊</td></tr>";
            atmmode += "<tr><td>訂單編號</td><td >" + ord_code + "</td></tr>";
            atmmode += "<tr><td>訂單金額</td><td >NT$" + o.TotalPrice + "</td></tr>";
            atmmode += "<tr><td>支付方式</td><td >信用卡一次付清</td></tr>";
            atmmode += "<tr><td>刷卡結果</td><td >付款成功</td></tr></table>";

            unity.classlib.SendsmtpMail(o.Ordemail, "信用卡付款完成通知信", mailbody.Replace("@mailbody@", atmmode), "gmail");
        }
        LessonLib.JoinData L = LessonLib.Web.Get_ord_JoinData(Session["ord_code"].ToString());

        if (L.JoinDetail != null)
        {
            Response.Redirect("/process-step4.aspx");
        }
    }