コード例 #1
0
        //Payment
        public bool Payment_cart_rs(Guid _guid, decimal _totalmoney, string _sEmail, string _sName, string _sPhone, string _sAddress, int _iPaymentID, string hinhthuc, string _sDesc, string _nameweb, string _url_web, int quantity)
        {
            try
            {
                int _orderID = Insert_Order(_totalmoney, _sName, Getorder_code(), _sEmail, _sAddress, _iPaymentID, _guid, _sDesc, DateTime.Now, _sPhone);
                //Lấy thông tin sản phẩm trong bảng giỏ hàng
                _idorder = _orderID;
                var _product = db.ESHOP_NEWs.Where(n => n.NEWS_ID == getIdnews());

                //Thêm thông tin vào bảng chi tiết đơn hàng
                string _mailbody = string.Empty;
                foreach (var item in _product)
                {
                    decimal          _subTotal  = Utils.CDecDef(item.NEWS_PRICE2 * quantity);
                    ESHOP_ORDER_ITEM _orderItem = new ESHOP_ORDER_ITEM();
                    _orderItem.NEWS_ID         = Utils.CIntDef(item.NEWS_ID);
                    _orderItem.ITEM_PRICE      = item.NEWS_PRICE2;
                    _orderItem.ITEM_PUBLISDATE = DateTime.Now;
                    _orderItem.ITEM_QUANTITY   = quantity;
                    _orderItem.ITEM_SUBTOTAL   = _subTotal;
                    _orderItem.ORDER_ID        = _orderID;

                    db.ESHOP_ORDER_ITEMs.InsertOnSubmit(_orderItem);
                    db.SubmitChanges();
                    _mailbody += Email_product(item.NEWS_TITLE, FormatMoney(item.NEWS_PRICE2), quantity, FormatMoney(_subTotal));
                }
                string _sMailBody = Email_info_product_customer(_mailbody, FormatMoney(_totalmoney), _sEmail, _sName, _sPhone, _sAddress, hinhthuc, _sDesc, _nameweb, _url_web);
                _Mailbody = _sMailBody;
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        //Payment
        public bool Payment_cart_rs(Guid _guid, decimal _totalmoney, string _sEmail, string _sName, string _sPhone, string _sAddress, int _iPaymentID, string hinhthuc, string _sDesc, string _nameweb, string _url_web, decimal ship)
        {
            try
            {
                string _code    = Getorder_code();
                int    _orderID = Insert_Order(_totalmoney, _sName, _code, _sEmail, _sAddress, _iPaymentID, _guid, _sDesc, DateTime.Now, _sPhone, ship);
                //Lấy thông tin sản phẩm trong bảng giỏ hàng
                _idorder = _orderID;
                var _product = from a in db.ESHOP_BASKETs
                               join b in db.ESHOP_NEWs on a.NEWS_ID equals b.NEWS_ID
                               where a.CUSTOMER_OID == _guid
                               select new
                {
                    a.NEWS_ID,
                    a.BASKET_PRICE,
                    a.BASKET_QUANTITY,
                    b.NEWS_TITLE
                };

                //Thêm thông tin vào bảng chi tiết đơn hàng
                string _mailbody = string.Empty;
                foreach (var item in _product)
                {
                    decimal          _subTotal  = Convert.ToDecimal(double.Parse(item.BASKET_PRICE.ToString()) * double.Parse(item.BASKET_QUANTITY.ToString()));
                    ESHOP_ORDER_ITEM _orderItem = new ESHOP_ORDER_ITEM();
                    _orderItem.NEWS_ID         = Utils.CIntDef(item.NEWS_ID);
                    _orderItem.ITEM_PRICE      = item.BASKET_PRICE;
                    _orderItem.ITEM_PUBLISDATE = DateTime.Now;
                    _orderItem.ITEM_QUANTITY   = item.BASKET_QUANTITY;
                    _orderItem.ITEM_SUBTOTAL   = _subTotal;
                    _orderItem.ORDER_ID        = _orderID;

                    db.ESHOP_ORDER_ITEMs.InsertOnSubmit(_orderItem);
                    db.SubmitChanges();
                    _mailbody += htmlEmailBody(item.NEWS_TITLE, FormatMoney(item.BASKET_PRICE), Utils.CIntDef(item.BASKET_QUANTITY), FormatMoney(_subTotal));
                }
                string noteship     = (ship > 0 ? FormatMoney(ship) : (ship == 0 ? "Miễn phí" : "Liên hệ"));
                string _totalFirst  = FormatMoney(_totalmoney);
                string total_amount = ship > 0 ? FormatMoney(_totalmoney + ship) : FormatMoney(_totalmoney);
                string _htmlHeader  = htmlEmalHeader(_sName, _code);
                string _sMailBody   = _htmlHeader + _mailbody + htmlEmailFooter(_totalFirst, noteship, total_amount, hinhthuc, _sAddress, _sEmail, _sPhone, _sDesc);
                _Mailbody = _sMailBody;
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        //Payment
        public bool Payment_cart_rs(Guid _guid, decimal _totalmoney, string _sEmail, string _sName, string _sPhone, string _sAddress, int _iPaymentID, string hinhthuc, string _sDesc, string _nameweb, string _url_web, int userid)
        {
            try
            {
                int _orderID = Insert_Order(_totalmoney, _sName, Getorder_code(), _sEmail, _sAddress, _iPaymentID, _guid, _sDesc, DateTime.Now, _sPhone, userid);
                //Lấy thông tin sản phẩm trong bảng giỏ hàng
                var _product = from a in db.ESHOP_BASKETs
                               join b in db.ESHOP_NEWs on a.NEWS_ID equals b.NEWS_ID
                               where a.CUSTOMER_OID == _guid
                               select new
                {
                    a.NEWS_ID,
                    a.BASKET_PRICE,
                    a.BASKET_QUANTITY,
                    b.NEWS_TITLE
                };

                //Thêm thông tin vào bảng chi tiết đơn hàng
                string _mailbody = string.Empty;
                foreach (var item in _product)
                {
                    decimal          _subTotal  = Convert.ToDecimal(double.Parse(item.BASKET_PRICE.ToString()) * double.Parse(item.BASKET_QUANTITY.ToString()));
                    ESHOP_ORDER_ITEM _orderItem = new ESHOP_ORDER_ITEM();
                    _orderItem.NEWS_ID         = Utils.CIntDef(item.NEWS_ID);
                    _orderItem.ITEM_PRICE      = item.BASKET_PRICE;
                    _orderItem.ITEM_PUBLISDATE = DateTime.Now;
                    _orderItem.ITEM_QUANTITY   = item.BASKET_QUANTITY;
                    _orderItem.ITEM_SUBTOTAL   = _subTotal;
                    _orderItem.ORDER_ID        = _orderID;

                    db.ESHOP_ORDER_ITEMs.InsertOnSubmit(_orderItem);
                    db.SubmitChanges();
                    _mailbody += Email_product(item.NEWS_TITLE, FormatMoney(item.BASKET_PRICE), Utils.CIntDef(item.BASKET_QUANTITY), FormatMoney(_subTotal));
                }
                string _sMailBody = Email_info_product_customer(_mailbody, FormatMoney(_totalmoney), _sEmail, _sName, _sPhone, _sAddress, hinhthuc, _sDesc, _nameweb, _url_web);
                _Mailbody = _sMailBody;
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #4
0
        //Payment
        public bool Payment_cart_rs(Guid _guid, decimal _totalmoney, string _sEmail, string _sName, string _sPhone, string _sAddress, int _iPaymentID, string hinhthuc, string _sDesc, string _nameweb, string _url_web, int quantity)
        {
            try
            {
                int _orderID = Insert_Order(_totalmoney, _sName, Getorder_code(), _sEmail, _sAddress, _iPaymentID, _guid, _sDesc, DateTime.Now, _sPhone);
                //Lấy thông tin sản phẩm trong bảng giỏ hàng 
                _idorder = _orderID;
                var _product = db.ESHOP_NEWs.Where(n => n.NEWS_ID == getIdnews());

                //Thêm thông tin vào bảng chi tiết đơn hàng
                string _mailbody = string.Empty;
                foreach (var item in _product)
                {
                    decimal _subTotal = Utils.CDecDef(item.NEWS_PRICE2 * quantity);
                    ESHOP_ORDER_ITEM _orderItem = new ESHOP_ORDER_ITEM();
                    _orderItem.NEWS_ID = Utils.CIntDef(item.NEWS_ID);
                    _orderItem.ITEM_PRICE = item.NEWS_PRICE2;
                    _orderItem.ITEM_PUBLISDATE = DateTime.Now;
                    _orderItem.ITEM_QUANTITY = quantity;
                    _orderItem.ITEM_SUBTOTAL = _subTotal;
                    _orderItem.ORDER_ID = _orderID;

                    db.ESHOP_ORDER_ITEMs.InsertOnSubmit(_orderItem);
                    db.SubmitChanges();
                    _mailbody += Email_product(item.NEWS_TITLE, FormatMoney(item.NEWS_PRICE2), quantity, FormatMoney(_subTotal));
                }
                string _sMailBody = Email_info_product_customer(_mailbody, FormatMoney(_totalmoney), _sEmail, _sName, _sPhone, _sAddress, hinhthuc, _sDesc, _nameweb, _url_web);
                _Mailbody = _sMailBody;
                return true;
            }
            catch (Exception)
            {

                throw;
            }
        }