コード例 #1
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        /// API 전달용 DTOPurchasesRequest 객체 데이터 만들기
        /// </summary>
        /// <returns></returns>
        private DTOPurchasesRequest GetDTOPurchaseRequest()
        {
            //-------------------------------------------------------------------------------------
            DTOPurchasesRequest _req = new DTOPurchasesRequest();

            _req.purchase_type = (int)XPayType;
            _req.purchases     = new List <VOMenu>();

            //-------------------------------------------------------------------------------------
            int count = this.flowLayoutPanel_OrderCartLayout.Controls.Count;

            for (int index = 1; index < count; index++)
            {
                UCOrderItem _obj = this.flowLayoutPanel_OrderCartLayout.Controls[index] as UCOrderItem;

                //---------------------------------------------------------------------------------
                VOMenu _menu = new VOMenu();
                {
                    _menu.category = _obj.XMenuButtonObject.XCategoryCode;
                    _menu.code     = _obj.XMenuButtonObject.XMenuCode;
                    _menu.price    = _obj.XMenuButtonObject.XMenuPrice;
                    _menu.type     = _obj.XMenuType;
                    _menu.size     = _obj.XMenuButtonObject.XMenuSize;
                    _menu.count    = _obj.XMenuAmount;
                }
                _req.purchases.Add(_menu);
            }
            return(_req);
        }
コード例 #2
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UcOrderItem_OnPlusButtonClicked(object sender, EventArgs e)
        {
            UCOrderItem obj = sender as UCOrderItem;

            // 총액 업데이트
            OrderCartUpdateTotalPrice();
        }
コード例 #3
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        /// NAME, SIZE, TYPE 조합으로 주문 카트 내역 삭제
        /// CartOrderItem.Name = aItemName+aItemSize+aItemType 으로 CartOrderItem 객체 식별
        /// </summary>
        private void OrderCartRemove(string aMenuNameKR, string aMenuSize, string aMenuType)
        {
            string keyName = string.Format("{0}{1}{2}", aMenuNameKR, aMenuSize, aMenuType);

            UCOrderItem obj = this.flowLayoutPanel_OrderCartLayout.Controls[keyName] as UCOrderItem;

            this.flowLayoutPanel_OrderCartLayout.Controls.RemoveByKey(keyName);
            obj.Dispose();
        }
コード例 #4
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UcOrderItem_OnMinusButtonClicked(object sender, EventArgs e)
        {
            UCOrderItem obj = sender as UCOrderItem;

            if (obj.XMenuAmount <= 0)
            {
                OrderCartRemove(obj.XMenuNameKR, obj.XMenuSize, obj.XMenuType);
            }

            // 총액 업데이트
            OrderCartUpdateTotalPrice();
        }
コード例 #5
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        /// 주문 내역 전체 지우기
        /// </summary>
        private void OrderCartClearAll()
        {
            int count = this.flowLayoutPanel_OrderCartLayout.Controls.Count;

            // UCOrderItem 객체만 제거
            for (int index = 1; index < count; index++)
            {
                UCOrderItem obj = this.flowLayoutPanel_OrderCartLayout.Controls[1] as UCOrderItem;
                this.flowLayoutPanel_OrderCartLayout.Controls.RemoveAt(1);
                obj.Dispose();
            }
        }
コード例 #6
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        /// 구매 목록의 총액을 계산한다.
        /// </summary>
        private void OrderCartUpdateTotalPrice()
        {
            int _totalPrice = 0;

            int count = this.flowLayoutPanel_OrderCartLayout.Controls.Count;

            // UCOrderItem 객체의 가격 합산
            for (int index = 1; index < count; index++)
            {
                UCOrderItem obj = this.flowLayoutPanel_OrderCartLayout.Controls[index] as UCOrderItem;
                _totalPrice += obj.XMenuTotalAmount;
            }

            this.label_TotalPrice.Text = string.Format("{0:n0} 원", _totalPrice); //or .ToString("N0");
        }
コード例 #7
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        private List <VOPrintMenu> GetPurchasePrintObject()
        {
            // 영수증 출력 데이터 객체
            //List<VOPrintList> list = new List<VOPrintList>
            //{
            //    new VOPrintList{
            //        name ="아메리카노",
            //        size ="Regular",
            //        type="Hot",
            //        amount="3"
            //    },
            //    new VOPrintList{
            //        name ="아메리카노",
            //        size ="Regular",
            //        type="Iced",
            //        amount="2"
            //    },
            //    new VOPrintList{
            //        name ="까페라떼",
            //        size ="Regular",
            //        type="Hot",
            //        amount="1"
            //    },
            //};

            List <VOPrintMenu> list = new List <VOPrintMenu>();

            //-------------------------------------------------------------------------------------
            int count = this.flowLayoutPanel_OrderCartLayout.Controls.Count;

            for (int index = 1; index < count; index++)
            {
                UCOrderItem _obj = this.flowLayoutPanel_OrderCartLayout.Controls[index] as UCOrderItem;

                //---------------------------------------------------------------------------------
                VOPrintMenu menu = new VOPrintMenu();
                {
                    menu.name   = _obj.XMenuNameKR;
                    menu.size   = _obj.XMenuSize;
                    menu.type   = _obj.XMenuType;
                    menu.amount = _obj.XMenuAmount.ToString();
                }
                list.Add(menu);
            }

            return(list);
        }
コード例 #8
0
ファイル: FormMenuBoard.cs プロジェクト: isaveu/DCCaffeKiosk
        /// <summary>
        /// NAME, SIZE, TYPE 조합으로 주문 카트 내역 추가
        /// CartOrderItem.Name = aItemName+aItemSize+aItemType 으로 CartOrderItem 객체 식별
        /// </summary>
        /// <param name="aMenuButtonObj"></param>
        /// <param name="aMenuNameKR"></param>
        /// <param name="aMenuSize"></param>
        /// <param name="aMenuType"></param>
        /// <param name="aMenuUnitPrice"></param>
        /// <param name="aMenuAmount"></param>
        private void OrderCartAdd(UCMenuButton aMenuButtonObj, string aMenuNameKR, string aMenuSize, string aMenuType, int aMenuUnitPrice, int aMenuAmount = 1)
        {
            // 타입이 "BOTH"이면 "메시지 박스 출력 선택
            if ((aMenuType.ToUpper()).CompareTo("BOTH") == 0)
            {
                using (FormMessageBox dlg = new FormMessageBox())
                {
                    {
                        dlg.Left = 450;
                        dlg.Top  = this.Location.X + (ClientSize.Height / 2) - 100;
                    }

                    DialogResult dlgResult = dlg.ShowDialog("추가 옵션을 선택하세요.", "추가 옵션 선택", CustomMessageBoxButtons.HotIced);
                    {
                        if (dlgResult == DialogResult.OK)
                        {
                            aMenuType = "HOT";
                        }
                        else if (dlgResult == DialogResult.Cancel)
                        {
                            aMenuType = "ICED";
                        }
                    }
                }
            }

            // 카트 콘트롤 이름
            string keyName = string.Format("{0}{1}{2}", aMenuNameKR, aMenuSize, aMenuType);

            // 카트에 주문이 있으면 추가 하지 않고, 주문 개수 증가 시킴
            if (this.flowLayoutPanel_OrderCartLayout.Controls.ContainsKey(keyName) == true)
            {
                UCOrderItem control = this.flowLayoutPanel_OrderCartLayout.Controls[keyName] as UCOrderItem;
                control.XMenuAmount++;

                // 총액 업데이트
                OrderCartUpdateTotalPrice();
                return;
            }

            // 주문 추가
            UCOrderItem _OrderItem = new UCOrderItem();

            {
                _OrderItem.Name = keyName;

                //----------------------------------------------------------
                _OrderItem.BackColor      = System.Drawing.Color.Transparent;
                _OrderItem.Font           = new System.Drawing.Font("SpoqaHanSans-Regular", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
                _OrderItem.Size           = new System.Drawing.Size(539, 50);
                _OrderItem.XForeTextColor = System.Drawing.Color.White;

                //----------------------------------------------------------
                _OrderItem.XMenuNameKR    = aMenuNameKR;
                _OrderItem.XMenuSize      = aMenuSize;
                _OrderItem.XMenuType      = aMenuType;
                _OrderItem.XMenuUnitPrice = aMenuUnitPrice;

                //----------------------------------------------------------
                _OrderItem.XMenuAmount      = aMenuAmount;
                _OrderItem.XMenuTotalAmount = aMenuUnitPrice * aMenuAmount;

                //----------------------------------------------------------
                _OrderItem.XMenuButtonObject = aMenuButtonObj;

                //----------------------------------------------------------
                _OrderItem.OnMinusButtonClicked += UcOrderItem_OnMinusButtonClicked;
                _OrderItem.OnPlusButtonClicked  += UcOrderItem_OnPlusButtonClicked;
            }

            this.flowLayoutPanel_OrderCartLayout.Controls.Add(_OrderItem);

            // 총액 업데이트
            OrderCartUpdateTotalPrice();
        }