Пример #1
0
        private void SetData(string sPagName)
        {
            SystemData systemData = new SystemData();

            systemData.GetTaPaymentType();
            systemData.GetSysValue();
            systemData.GetTaFreeFood();
            systemData.GetTaDiscount();
            systemData.GetTaConfMenuDisplayFont();
            systemData.GetTaDeliverySetDetail();
            systemData.GetTaDeliverySet();

            if (sPagName.Equals("xtpGs"))
            {
                #region Payment Type
                int i = 0;
                foreach (var taPaymentTypeInfo in CommonData.TaPaymentType)
                {
                    txtGsPayType[i].Text = taPaymentTypeInfo.PaymentType;
                    i++;
                }

                for (int j = i; j < 5; j++)
                {
                    txtGsPayType[j].Text = "";
                }
                #endregion

                txtTotalAmountThreshold.Text = CommonDAL.GetSysValue(PubComm.SYS_VALUE_FREE_FOOD_ITEM_AMOUNT, PubComm.SYS_DESC_FREE_FOOD_ITEM_AMOUNT, "");

                #region Freed Food
                i = 0;
                foreach (var freeFood in CommonData.TaFreeFood)
                {
                    txtGsFreeFoodItem[i].Text = freeFood.DishCode;
                    i++;
                }

                for (int j = i; j < 4; j++)
                {
                    txtGsFreeFoodItem[j].Text = "";
                }
                #endregion

                #region Automatic Add

                txtAddTotalAmountThreshold.Text = CommonDAL.GetSysValue(PubComm.SYS_VALUE_ADD_ITEM_AMOUNT, PubComm.SYS_DESC_ADD_ITEM_AMOUNT, "");

                i = 0;
                foreach (var freeFoodAdd in CommonData.TaFreeFoodAdd)
                {
                    txtGsAddFreeFoodItem[i].Text = freeFoodAdd.AddDishCode;
                    i++;
                }

                for (int j = i; j < 4; j++)
                {
                    txtGsAddFreeFoodItem[j].Text = "";
                }
                #endregion

                #region Discount
                foreach (var taDiscountInfo in CommonData.TaDiscount)
                {
                    switch (taDiscountInfo.TaType)
                    {
                    case "DELIVERY":
                        txtDeliveryDiscount.Text          = taDiscountInfo.TaDiscount;
                        txtDeliveryDiscountThreshold.Text = taDiscountInfo.TaDiscThre;
                        break;

                    case "COLLECTION":
                        txtCollectionDiscount.Text          = taDiscountInfo.TaDiscount;
                        txtCollectionDiscountThreshold.Text = taDiscountInfo.TaDiscThre;
                        break;

                    case "SHOP":
                        txtShopDiscount.Text          = taDiscountInfo.TaDiscount;
                        txtShopDiscountThreshold.Text = taDiscountInfo.TaDiscThre;
                        break;
                    }
                }
                #endregion

                #region Menu Display Font
                foreach (var taConfMenuDisplayFontInfo in CommonData.TaConfMenuDisplayFont)
                {
                    txtMenuDishBtnFontSize.Text            = taConfMenuDisplayFontInfo.MenuDisplayBtnFontSize;
                    chkGsMenuDishCodeFontBold.Checked      = taConfMenuDisplayFontInfo.IsMenuDishCodeFontBold.Equals("Y");
                    txtCategoryBtnFontSize.Text            = taConfMenuDisplayFontInfo.CategBtnFontSize;
                    chkGsCategBtnFontBold.Checked          = taConfMenuDisplayFontInfo.IsCategFontBold.Equals("Y");
                    txtMenuDishBtnOtherFontSize.Text       = taConfMenuDisplayFontInfo.OtherMenuDisplayBtnFontSize;
                    chkGsMenuDishCodeOtherFontBold.Checked = taConfMenuDisplayFontInfo.IsOtherMenuDishCodeFontBold.Equals("Y");
                    txtCategoryBtnOtherFontSize.Text       = taConfMenuDisplayFontInfo.OtherCategBtnFontSize;
                    chkGsCategBtnOtherFontBold.Checked     = taConfMenuDisplayFontInfo.IsOtherCategFontBold.Equals("Y");
                }
                #endregion
            }
            else if (sPagName.Equals("xtpChangeSet"))
            {
                #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;

                SetMenuAtt();
                #endregion
            }
            else //xtpDs
            {
                #region Delivery Distance Charge
                int i = 0;
                foreach (var taDeliverySetDetail in CommonData.TaDeliverySetDetail)
                {
                    txtDsDistanceFrom[i].Text = taDeliverySetDetail.DistFrom;
                    txtDsDistanceTo[i].Text   = taDeliverySetDetail.DistTo;
                    txtDsAmountToPay[i].Text  = taDeliverySetDetail.AmountToPay;
                    i++;
                }

                for (int j = i; j < 4; j++)
                {
                    txtDsDistanceFrom[i].Text = "";
                    txtDsDistanceTo[i].Text   = "";
                    txtDsAmountToPay[i].Text  = "";
                }
                #endregion

                #region Delivery Set
                new SystemData().GetTaDeliverySet();

                var lstTds = CommonData.TaDeliverySet.ToList();

                if (lstTds.Any())
                {
                    TaDeliverySetInfo taDeliverySetInfo = lstTds.FirstOrDefault();
                    txtPerMile.Text  = taDeliverySetInfo.PerMile;
                    txtOverMile.Text = taDeliverySetInfo.OverMile;
                    //chkDeliveryChge.Checked = taDeliverySetInfo.IsDeliveryCharge.Equals("Y");
                    chkDeliveryChge.Checked           = true;
                    chkIgnoreDeliveryIfCharge.Checked = taDeliverySetInfo.DeliveryMile.Equals("Y");
                    chkIgnoreDelivery.Checked         = taDeliverySetInfo.IsIgnoreDelivery.Equals("Y");
                    txtOrderThreshold.Text            = taDeliverySetInfo.OrderThreshold;
                    txtSurchargeAmount.Text           = taDeliverySetInfo.SurchargeAmount;
                }
                else
                {
                    txtPerMile.Text                   = "";
                    txtOverMile.Text                  = "";
                    chkDeliveryChge.Checked           = true;
                    chkIgnoreDeliveryIfCharge.Checked = false;
                    chkIgnoreDelivery.Checked         = false;
                    txtOrderThreshold.Text            = "";
                    txtSurchargeAmount.Text           = "";
                }
                #endregion
            }
        }