private void btnOK_Click(object sender, EventArgs e) { //this.DialogResult = DialogResult.OK; //Hide(); //DisCode = txtDishCode.Text; //Qty = txtQty.Text; if (!string.IsNullOrEmpty(txtDishCode.Text)) { if (CommonData.TaMenuItem.Any(s => s.MiDishCode.Equals(txtDishCode.Text))) { //string sWord = fTaMain.iLangStatusId == PubComm.MENU_LANG_DEFAULT // ? CommonData.TaMenuItem.FirstOrDefault(s => s.MiDishCode.Equals(txtDishCode.Text)).MiEngName // : CommonData.TaMenuItem.FirstOrDefault(s => s.MiDishCode.Equals(txtDishCode.Text)).MiOtherName; TaMenuItemInfo taMenuItemInfo = fTaMain.GetMenuItemInfo(txtDishCode.Text, 0, fTaMain.iMenuSetId, true); if (taMenuItemInfo != null) { fTaMain.SetListNode(taMenuItemInfo, Convert.ToInt32(txtQty.Text), true); fTaMain.SetLang(); } txtDishCode.Text = ""; txtQty.Text = @"1"; } } else { Hide(); } }
private void SetCtl() { btnFree[0] = btn1; btnFree[1] = btn2; btnFree[2] = btn3; btnFree[3] = btn4; lblId[0] = lblID1; lblId[1] = lblID2; lblId[2] = lblID3; lblId[3] = lblID4; var lstFreeId = CommonData.TaFreeFood.Where(s => !string.IsNullOrEmpty(s.DishCode)); var lstFree = from fi in lstFreeId join mi in CommonData.TaMenuItem on fi.DishCode equals mi.MiDishCode where mi.MiMenuSetID == iMenuSetID select new { ID = mi.ID, EngName = mi.MiEngName, OtherName = mi.MiOtherName, DishCode = mi.MiDishCode }; int i = 0; int tmpId = 0; foreach (var taFreeFoodInfo in lstFree) { btnFree[i].Text = iLangeStatus == PubComm.MENU_LANG_DEFAULT ? @"(" + taFreeFoodInfo.DishCode + @")" + taFreeFoodInfo.EngName : @"(" + taFreeFoodInfo.DishCode + @")" + taFreeFoodInfo.OtherName; lblId[i].Text = taFreeFoodInfo.ID.ToString(); if (i == 0) { tmpId = taFreeFoodInfo.ID; } i++; } btn1.Click += btnFree_Click; btn2.Click += btnFree_Click; btn3.Click += btnFree_Click; btn4.Click += btnFree_Click; if (tmpId > 0) { btnFree[0].Appearance.BackColor = Color.DarkGreen; taMiFree = CommonData.TaMenuItem.FirstOrDefault(s => s.ID == tmpId); } }
private void btnFree_Click(object sender, EventArgs e) { var btn = (SimpleButton)sender; if (!string.IsNullOrEmpty(btn.Text)) { btn.Appearance.BackColor = Color.DarkGreen; string strBtnId = btn.Name.Replace(@"btn", ""); for (int i = 0; i < 4; i++) { if (!(i + 1).ToString().Equals(strBtnId)) { btnFree[i].Appearance.BackColor = Color.FromArgb(255, 255, 128); } } string strLblId = "0"; if (strBtnId.Equals("1")) { strLblId = lblID1.Text; } else if (strBtnId.Equals("2")) { strLblId = lblID2.Text; } else if (strBtnId.Equals("3")) { strLblId = lblID3.Text; } else if (strBtnId.Equals("4")) { strLblId = lblID4.Text; } taMiFree = CommonData.TaMenuItem.FirstOrDefault(s => s.ID.ToString().Equals(strLblId)); } }
private void btnCancel_Click(object sender, EventArgs e) { taMiFree = null; DialogResult = DialogResult.OK; Close(); }
private void FrmTaChangePrice_Load(object sender, EventArgs e) { #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; #endregion #region 菜品修改后缀 btnMenuAttr[0] = btnAttr1; btnMenuAttr[1] = btnAttr2; btnMenuAttr[2] = btnAttr3; btnMenuAttr[3] = btnAttr4; btnMenuAttr[4] = btnAttr5; btnMenuAttr[5] = btnAttr6; btnMenuAttr[6] = btnAttr7; btnMenuAttr[7] = btnAttr8; btnMenuAttr[8] = btnAttr9; btnMenuAttr[9] = btnAttr10; btnMenuAttr[10] = btnAttr11; btnMenuAttr[11] = btnAttr12; btnMenuAttr[12] = btnAttr13; btnMenuAttr[13] = btnAttr14; btnMenuAttr[14] = btnAttr15; btnMenuAttr[15] = btnAttr16; btnMenuAttr[16] = btnAttr17; btnMenuAttr[17] = btnAttr18; btnMenuAttr[18] = btnAttr19; btnMenuAttr[19] = btnAttr20; new SystemData().GetTaChangeMenuAttr(); int i = 0; //var lstMiAttr = CommonData.TaChangeMenuAttr.Where(s => // !s.MenuAttrEnglishName.Equals(PubComm.MENU_ITEM_LARGE_ENG) && // !s.MenuAttrEnglishName.Equals(PubComm.MENU_ITEM_SMALL_ENG)); var lstMiAttr = CommonData.TaChangeMenuAttr; foreach (var taChangeMenuAttrInfo in lstMiAttr) { hsMenuName.Add(taChangeMenuAttrInfo.MenuAttrEnglishName, string.IsNullOrEmpty(taChangeMenuAttrInfo.MenuAttrOtherName) ? "" : taChangeMenuAttrInfo.MenuAttrOtherName); if (taChangeMenuAttrInfo.MenuAttrEnglishName.Equals(PubComm.MENU_ITEM_LARGE_ENG) || taChangeMenuAttrInfo.MenuAttrEnglishName.Equals(PubComm.MENU_ITEM_SMALL_ENG)) { continue; } if (i < 20) { btnMenuAttr[i].Text = iLange == PubComm.MENU_LANG_DEFAULT ? taChangeMenuAttrInfo.MenuAttrEnglishName : taChangeMenuAttrInfo.MenuAttrOtherName; btnMenuAttr[i].Click += BtnAttr_Click; i++; } } for (int j = i; j < 20; j++) { btnMenuAttr[j].Visible = false; } #endregion var lstMi = CommonData.TaMenuItem.Where(s => s.MiDishCode.Equals(miID)).ToList(); if (lstMi.Any()) { TaMenuItemInfo taMenuItemInfo = lstMi.FirstOrDefault(); txtEngName.Text = sItemEngName; txtOtherName.Text = sItemOtherName; txtOriginalPrice.Text = miOldPrice; //默认价格 txtNewPrice.Text = miOldPrice; miLargePrice = string.IsNullOrEmpty(taMenuItemInfo.MiLargePrice) || Convert.ToDecimal(taMenuItemInfo.MiLargePrice) <= 0m ? miOldPrice : taMenuItemInfo.MiLargePrice; miSmallPrice = string.IsNullOrEmpty(taMenuItemInfo.MiSmallPrice) || Convert.ToDecimal(taMenuItemInfo.MiSmallPrice) <= 0m ? miOldPrice : taMenuItemInfo.MiSmallPrice; miRegPrice = string.IsNullOrEmpty(taMenuItemInfo.MiRegularPrice) || Convert.ToDecimal(taMenuItemInfo.MiRegularPrice) <= 0m ? miOldPrice : taMenuItemInfo.MiRegularPrice; } else { Hide(); } }