예제 #1
0
		private void detach_ESHOP_ORDER_ITEMs(ESHOP_ORDER_ITEM entity)
		{
			this.SendPropertyChanging();
			entity.ESHOP_NEW = null;
		}
        //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)
        {
            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 
                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;
            }
        }
예제 #3
0
 partial void DeleteESHOP_ORDER_ITEM(ESHOP_ORDER_ITEM instance);
예제 #4
0
 partial void UpdateESHOP_ORDER_ITEM(ESHOP_ORDER_ITEM instance);
예제 #5
0
 partial void InsertESHOP_ORDER_ITEM(ESHOP_ORDER_ITEM instance);
예제 #6
0
		private void attach_ESHOP_ORDER_ITEMs(ESHOP_ORDER_ITEM entity)
		{
			this.SendPropertyChanging();
			entity.ESHOP_ORDER = this;
		}
        //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;
            }
        }