Esempio n. 1
0
        /// <summary>
        /// 导入数据到数据库Menu Item
        /// </summary>
        /// <param name="outFile">文件</param>
        /// <returns></returns>
        public static bool ImportMenuItem(string importFile, string SheetName)
        {
            DataTable dt = GetExcelFileData(importFile, SheetName).Tables[0];

            try
            {
                //清除Menu中的数据
                new OnLoadSystemCommonData().GetTAMenuItemList();
                foreach (var taMenuItem in CommonData.TaMenuItemList)
                {
                    _control.DeleteEntity(taMenuItem);
                }

                //添加数据
                foreach (DataRow item in dt.Rows)
                {
                    if (!string.IsNullOrEmpty(item[0].ToString()) &&
                        !string.IsNullOrEmpty(item[1].ToString()) &&
                        !string.IsNullOrEmpty(item[2].ToString()) &&
                        !string.IsNullOrEmpty(item[3].ToString()) &&
                        !string.IsNullOrEmpty(item[4].ToString()) &&
                        !string.IsNullOrEmpty(item[5].ToString()))
                    {
                        new OnLoadSystemCommonData().GetTAMenuCategory();
                        var qList = CommonData.TaMenuCategoryList.Where(
                            s => s.Remark.Equals(item[0].ToString()));
                        if (qList.Any())
                        {
                            TAMenuItemInfo taMenuItemInfo = new TAMenuItemInfo();
                            taMenuItemInfo.SystemKey       = Guid.NewGuid();
                            taMenuItemInfo.DisplayPosition = item[1].ToString();
                            taMenuItemInfo.DishCode        = item[2].ToString();
                            taMenuItemInfo.EnglishName     = item[3].ToString();
                            taMenuItemInfo.OtherName       = item[4].ToString();
                            taMenuItemInfo.wRegular        = item[5].ToString();
                            taMenuItemInfo.MenuCateID      = qList.FirstOrDefault().EnglishName + ",";
                            _control.AddEntity(taMenuItemInfo);
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                // MessBox.Show("");
                string aa = ex.Message;
                return(false);
            }
        }
Esempio n. 2
0
        private void FrmTAFreeItem_Load(object sender, EventArgs e)
        {
            btnFreeItem[0] = btnFreeItem1;
            btnFreeItem[1] = btnFreeItem2;
            btnFreeItem[2] = btnFreeItem3;
            btnFreeItem[3] = btnFreeItem4;

            btnFreeItem1.Click += BtnFreeItem_Click;
            btnFreeItem2.Click += BtnFreeItem_Click;
            btnFreeItem3.Click += BtnFreeItem_Click;
            btnFreeItem4.Click += BtnFreeItem_Click;

            new OnLoadSystemCommonData().GetTAFreeFoodItemsList();
            new OnLoadSystemCommonData().GetTAMenuItemList();

            int i = 0;

            foreach (var taFreeFoodItemsInfo in CommonData.TAFreeFoodItems)
            {
                if (i >= 4)
                {
                    break;
                }

                if (!string.IsNullOrEmpty(taFreeFoodItemsInfo.FreeCode))
                {
                    if (CommonData.TaMenuItemList.Any(s => s.DishCode.Equals(taFreeFoodItemsInfo.FreeCode)))
                    {
                        TAMenuItemInfo taMenuItemInfo = CommonData.TaMenuItemList.FirstOrDefault(s => s.DishCode.Equals(taFreeFoodItemsInfo.FreeCode));
                        btnFreeItem[i].Text = taMenuItemInfo.EnglishName;
                        strDishCode[i]      = taFreeFoodItemsInfo.FreeCode;
                    }
                }

                i++;
            }

            for (int j = i; j < 4; j++)
            {
                btnFreeItem[i].Visible = false;
                strDishCode[i]         = "";
            }
        }
Esempio n. 3
0
        private void FrmTAChangePrice_Load(object sender, EventArgs e)
        {
            #region 查询初始值

            new OnLoadSystemCommonData().GetTAMenuItemList();
            var lstMI = CommonData.TaMenuItemList.Where(s => s.DishCode.Equals(strDishCode));

            if (lstMI.Any())
            {
                TAMenuItemInfo miMenuItem = lstMI.FirstOrDefault();

                taMenuItemInfo = lstMI.FirstOrDefault();

                txtEngName.Text   = miMenuItem.EnglishName;
                txtOtherName.Text = miMenuItem.OtherName;
                //txtOrigPrice.Text = miMenuItem.wRegular;
                txtOrigPrice.Text = strOriPrice;

                txtDiscount.Text = "0.0";
                txtIncre.Text    = "0.0";
                //txtNewPrice.Text = miMenuItem.wRegular;
                txtNewPrice.Text = txtOrigPrice.Text;
            }

            #endregion

            #region 控件数组赋值

            btn0.Click     += BtnNum_Click;
            btn1.Click     += BtnNum_Click;
            btn2.Click     += BtnNum_Click;
            btn3.Click     += BtnNum_Click;
            btn4.Click     += BtnNum_Click;
            btn5.Click     += BtnNum_Click;
            btn6.Click     += BtnNum_Click;
            btn7.Click     += BtnNum_Click;
            btn8.Click     += BtnNum_Click;
            btn9.Click     += BtnNum_Click;
            btnPoint.Click += BtnNum_Click;

            btnP1.Click += BtnDisPer_Click;
            btnP2.Click += BtnDisPer_Click;
            btnP3.Click += BtnDisPer_Click;
            btnP4.Click += BtnDisPer_Click;
            btnP5.Click += BtnDisPer_Click;
            btnP6.Click += BtnDisPer_Click;
            btnP7.Click += BtnDisPer_Click;
            btnP8.Click += BtnDisPer_Click;
            btnP9.Click += BtnDisPer_Click;

            btnNum[0] = btn0;
            btnNum[1] = btn1;
            btnNum[2] = btn2;
            btnNum[3] = btn3;
            btnNum[4] = btn4;
            btnNum[5] = btn5;
            btnNum[6] = btn6;
            btnNum[7] = btn7;
            btnNum[8] = btn8;
            btnNum[9] = btn9;

            btnDP[0] = btnP1;
            btnDP[1] = btnP2;
            btnDP[2] = btnP3;
            btnDP[3] = btnP4;
            btnDP[4] = btnP5;
            btnDP[5] = btnP6;
            btnDP[6] = btnP7;
            btnDP[7] = btnP8;
            btnDP[8] = btnP9;

            #endregion
        }