예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <int> ids    = GetSelectedDataKeyIDs(Grid2);
            decimal?   Amount = 0;

            foreach (int id in ids)
            {
                tm_Dishes          entity = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(id);
                tm_TabieDishesInfo sb     = new tm_TabieDishesInfo();
                sb.DishesID     = entity.ID;
                sb.DishesCount  = 1;
                sb.Price        = entity.SellPrice;
                sb.Moneys       = 1 * entity.SellPrice;
                sb.DishesType   = "1";
                sb.IsFree       = "1";
                sb.TabieUsingID = _id;
                sb.DishesName   = entity.DishesName;
                sb.UnitName     = GetSystemEnumValue("CPDW", entity.DishesUnit.ToString());
                sb.IsPrint      = 0;
                sb.PrintID      = entity.PrinterID;
                Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Create(sb);
                Amount += sb.Moneys;
            }
            tm_TabieUsingInfo taieusing = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(_id);

            taieusing.Moneys    += Amount;
            taieusing.FactPrice += Amount;
            Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(taieusing);
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
예제 #2
0
        private void SaveItem()
        {
            // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames)
            List <int>        ids         = GetSelectedDataKeyIDs(Grid1);
            tm_Goods          goodsEntity = new tm_Goods();
            tm_DishesBatching dbEntity    = new tm_DishesBatching();
            tm_Dishes         dishesInfo  = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(DishesID);

            // 执行数据库操作
            foreach (int ID in ids)
            {
                goodsEntity = Core.Container.Instance.Resolve <IServiceGoods>().GetEntity(ID);
                //判断是否已经添加改配料物品
                if (!IsExists(ID))
                {
                    dbEntity = new tm_DishesBatching();
                    dbEntity.BatchingName   = goodsEntity.GoodsName;
                    dbEntity.DishesInfo     = dishesInfo;
                    dbEntity.GoodsCode      = goodsEntity.GoodsCode.ToString();
                    dbEntity.GoodsID        = goodsEntity.ID;
                    dbEntity.IsOffset       = int.Parse(rbtnIsStock.SelectedValue);
                    dbEntity.UsingUnit      = goodsEntity.ConsumeUnit;
                    dbEntity.UsingCount     = 1;
                    dbEntity.UsingUnitPrice = goodsEntity.GoodsPrice / goodsEntity.ConsumeNum;
                    dbEntity.CostPrice      = goodsEntity.GoodsPrice / goodsEntity.ConsumeNum;
                    dbEntity.WareHouseID    = int.Parse(ddlWH.SelectedValue);
                    Core.Container.Instance.Resolve <IServiceDishesBatching>().Create(dbEntity);
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //获取退菜菜品信息
            tm_TabieDishesInfo tabieDishesInfo = Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().GetEntity(DishesID);

            if (tabieDishesInfo != null)
            {
                //获取开台信息
                tm_TabieUsingInfo usingEnitty = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(tabieDishesInfo.TabieUsingID);
                tm_Tabie          objTabie    = Core.Container.Instance.Resolve <IServiceTabie>().GetEntity(usingEnitty.TabieID);
                //获取菜品信息
                tm_Dishes dish = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity((int)tabieDishesInfo.DishesID);
                //创建退菜菜品信息
                tm_TabieDishesInfo backEntity = new tm_TabieDishesInfo();
                backEntity.DishesID     = tabieDishesInfo.DishesID;
                backEntity.DishesCount  = -decimal.Parse(numCount.Text);
                backEntity.Price        = dish.SellPrice;
                backEntity.Moneys       = backEntity.DishesCount * tabieDishesInfo.Price;
                backEntity.DishesType   = "2";
                backEntity.IsFree       = "0";
                backEntity.IsDiscount   = dish.IsDiscount;
                backEntity.TabieUsingID = tabieDishesInfo.TabieUsingID;
                backEntity.UnitName     = GetSystemEnumValue("CPDW", dish.DishesUnit.ToString());
                backEntity.DishesName   = dish.DishesName;
                backEntity.PrintID      = dish.PrinterID;
                backEntity.IsPrint      = 1;
                Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Create(backEntity);
                //更新开台总价
                usingEnitty.Moneys    += backEntity.Moneys;
                usingEnitty.FactPrice += backEntity.Moneys;
                Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(usingEnitty);
                //打印退菜单据
                tm_Printer objPrinter = Core.Container.Instance.Resolve <IServicePrinter>().GetEntity(tabieDishesInfo.PrintID);
                bool       isPrint    = bool.Parse(ConfigurationManager.AppSettings["IsPrint"]);

                if (isPrint)
                {
                    //判断是否是后厨打印单据
                    if (objPrinter.PrinterType.Equals("2"))
                    {
                        //后厨打印单据
                        new NetPrintHelper().Printeg(backEntity.DishesName, backEntity.DishesCount, backEntity.UnitName, (int)usingEnitty.Population, objPrinter, 3, objTabie.TabieName);
                    }
                    //前台打印单据
                    LocalPrint(backEntity, usingEnitty);//默认打印机
                }
            }
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                btnClose.OnClientClick = ActiveWindow.GetHidePostBackReference();
                numCount.Text          = "1";

                tm_TabieDishesInfo entity = Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().GetEntity(DishesID);
                if (entity != null)
                {
                    //获取菜品信息
                    tm_Dishes dish = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity((int)entity.DishesID);
                    lblName.Text = dish.DishesName;
                }
            }
        }
예제 #5
0
        private void SetSelectedUsersEnableStatus(bool enabled)
        {
            string isUsed = enabled ? "1" : "0";
            // 从每个选中的行中获取ID(在Grid1中定义的DataKeyNames)
            List <int> ids = GetSelectedDataKeyIDs(Grid2);

            // 执行数据库操作
            foreach (int ID in ids)
            {
                tm_Dishes entity = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(ID);
                entity.IsUsed = int.Parse(isUsed);
                Core.Container.Instance.Resolve <IServiceDishes>().Update(entity);
            }
            // 重新绑定表格
            BindGrid2();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            List <int> ids = GetSelectedDataKeyIDs(Grid2);

            foreach (int id in ids)
            {
                tm_Dishes entity = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(id);
                if (entity.ID == 3)
                {
                    IList <ICriterion> qrylist = new List <ICriterion>();
                    qrylist.Add(Expression.Eq("DishID", id));
                    qrylist.Add(Expression.Eq("SetMealID", _setmealid));
                    IList <tm_SetMealDetail> lst = Core.Container.Instance.Resolve <IServiceSetMealDetail>().Query(qrylist);
                    if (lst.Count > 0)
                    {
                        Alert.ShowInTop("已添加菜品,请直接修改数量!", "错误操作", MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        tm_SetMealDetail sb = new tm_SetMealDetail();
                        sb.DishID     = id;
                        sb.DishCount  = 1;
                        sb.Price      = entity.SellPrice;
                        sb.TotalPrice = entity.SellPrice;
                        sb.SetMealID  = _setmealid;
                        Core.Container.Instance.Resolve <IServiceSetMealDetail>().Create(sb);
                    }
                }
                else
                {
                    tm_SetMealDetail sb = new tm_SetMealDetail();
                    sb.DishID     = id;
                    sb.DishCount  = 1;
                    sb.Price      = entity.SellPrice;
                    sb.TotalPrice = entity.SellPrice;
                    sb.SetMealID  = _setmealid;
                    Core.Container.Instance.Resolve <IServiceSetMealDetail>().Create(sb);
                }
            }
            Alert.ShowInTop("已添加菜品!", "操作成功", MessageBoxIcon.Success);
            LoadData();
            //PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
예제 #7
0
        public void Bind()
        {
            if (InfoID > 0)
            {
                tm_Dishes objInfo = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(InfoID);

                if (objInfo == null)
                {
                    // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                    Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                    return;
                }
                ddlPType.SelectedValue     = objInfo.ClassID.ToString();
                tbxName.Text               = objInfo.DishesName;
                lblCode.Text               = objInfo.DishesCode.ToString();
                lblPY.Text                 = objInfo.DishesPY;
                ddlIsUsed.SelectedValue    = objInfo.IsUsed.ToString();
                ddlUnit.SelectedValue      = objInfo.DishesUnit.ToString();
                txtIndex.Text              = objInfo.ShowIndex.ToString();
                txtPrice.Text              = objInfo.SellPrice.ToString();
                txtMemberPrice.Text        = objInfo.MemberPrice.ToString();
                rbtnWeigh.SelectedValue    = objInfo.IsWeigh.ToString();
                rbtnRanking.SelectedValue  = objInfo.IsRanking.ToString();
                rbtnDiscount.SelectedValue = objInfo.IsDiscount.ToString();
                rbntScore.SelectedValue    = objInfo.IsScore.ToString();
                imgPhoto.ImageUrl          = objInfo.DishesPicture;
                ddlPrint.SelectedValue     = objInfo.PrinterID.ToString();
            }
            else
            {
                //获取当前最大编号
                IList <tm_Dishes> list = Core.Container.Instance.Resolve <IServiceDishes>().GetAll();
                if (list.Count > 0)
                {
                    tm_Dishes maxGoods = list.ToList().OrderByDescending(objs => objs.DishesCode).First();
                    lblCode.Text = (maxGoods.DishesCode + 1).ToString();
                }
                else
                {
                    lblCode.Text = "100";
                }
            }
        }
예제 #8
0
        private void SaveItem()
        {
            tm_Dishes objInfo = new tm_Dishes();

            if (InfoID > 0)
            {
                objInfo = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(InfoID);
            }
            objInfo.ClassID     = int.Parse(ddlPType.SelectedValue);
            objInfo.DishesName  = tbxName.Text;
            objInfo.DishesCode  = int.Parse(lblCode.Text);
            objInfo.DishesPY    = GetChinesePY(tbxName.Text.Trim());
            objInfo.IsUsed      = int.Parse(ddlIsUsed.SelectedValue);
            objInfo.DishesUnit  = int.Parse(ddlUnit.SelectedValue);
            objInfo.ShowIndex   = int.Parse(txtIndex.Text);
            objInfo.SellPrice   = !string.IsNullOrEmpty(txtPrice.Text) ? decimal.Parse(txtPrice.Text) : 0;
            objInfo.MemberPrice = !string.IsNullOrEmpty(txtMemberPrice.Text) ? decimal.Parse(txtMemberPrice.Text) : 0;
            objInfo.IsWeigh     = int.Parse(rbtnWeigh.SelectedValue);
            objInfo.IsRanking   = int.Parse(rbtnRanking.SelectedValue);
            objInfo.IsDiscount  = int.Parse(rbtnDiscount.SelectedValue);
            objInfo.IsScore     = int.Parse(rbntScore.SelectedValue);
            if (!string.IsNullOrEmpty(PicFilePath))
            {
                objInfo.DishesPicture = PicFilePath;
            }
            objInfo.PrinterID = int.Parse(ddlPrint.SelectedValue);

            if (InfoID > 0)
            {
                Core.Container.Instance.Resolve <IServiceDishes>().Update(objInfo);
            }
            else
            {
                if (string.IsNullOrEmpty(PicFilePath))
                {
                    objInfo.DishesPicture = Helpers.PicHelper.GetEmptyPicPath();
                }
                Core.Container.Instance.Resolve <IServiceDishes>().Create(objInfo);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            tm_TabieUsingInfo  usingenitty = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(_usingid);
            tm_Dishes          dish        = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(_id);
            tm_TabieDishesInfo entity      = new tm_TabieDishesInfo();

            entity.DishesID     = _id;
            entity.DishesCount  = decimal.Parse(numCount.Text);
            entity.Price        = dish.SellPrice;
            entity.Moneys       = entity.DishesCount * entity.Price;
            entity.DishesType   = "1";
            entity.IsFree       = "0";
            entity.IsDiscount   = dish.IsDiscount;
            entity.TabieUsingID = _usingid;
            entity.UnitName     = GetSystemEnumValue("CPDW", dish.DishesUnit.ToString());
            entity.DishesName   = dish.DishesName;
            entity.PrintID      = dish.PrinterID;
            entity.IsPrint      = 0;
            Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Create(entity);
            usingenitty.Moneys    += entity.Moneys;
            usingenitty.FactPrice += entity.Moneys;
            Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(usingenitty);
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
예제 #10
0
        /// <summary>
        /// 获取菜品名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetDishesNmae(string id)
        {
            tm_Dishes entity = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(Int32.Parse(id));

            return(entity == null ? "" : entity.DishesName);
        }
예제 #11
0
        public string GetPrice(string id)
        {
            tm_Dishes entity = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(Int32.Parse(id));

            return(entity == null ? "" : entity.SellPrice.ToString());
        }
예제 #12
0
        /// <summary>
        /// 团购信息修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            tm_TabieUsingInfo entity = Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().GetEntity(TabieUsingID);

            //加入团购菜品前删除原团购菜品信息
            List <ICriterion> qryDishesList = new List <ICriterion>();

            qryDishesList.Add(Expression.Eq("TabieUsingID", entity.ID) && Expression.Eq("DishesType", "3"));
            IList <tm_TabieDishesInfo> disheslist = Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Query(qryDishesList);

            foreach (tm_TabieDishesInfo item in disheslist)
            {
                //删除原团购菜品信息
                Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Delete(item.ID);
            }

            if (!ddlGroup.SelectedValue.Equals("0"))
            {
                entity.GroupName   = ddlGroup.SelectedText;
                entity.GroupMoneys = decimal.Parse(ddlGroup.SelectedValue);

                #region 加入选择的团购菜品

                //根据套餐名称获取团餐信息
                List <ICriterion> qrysetMealList = new List <ICriterion>();
                qrysetMealList.Add(Expression.Eq("SetMealName", ddlGroup.SelectedText));
                tm_SetMealInfo setMealInfo = Core.Container.Instance.Resolve <IServiceSetMealInfo>().GetEntityByFields(qrysetMealList);
                if (setMealInfo != null)
                {
                    //查询出团购餐下的菜品信息
                    List <ICriterion> qrysetMealdetailList = new List <ICriterion>();
                    qrysetMealdetailList.Add(Expression.Eq("SetMealID", setMealInfo.ID));
                    IList <tm_SetMealDetail> setMealDetailList = Core.Container.Instance.Resolve <IServiceSetMealDetail>().Query(qrysetMealdetailList);

                    //遍历团购菜品信息添加餐台菜品信息
                    foreach (tm_SetMealDetail item in setMealDetailList)
                    {
                        tm_TabieDishesInfo Dishentity = new tm_TabieDishesInfo();
                        Dishentity.DishesID     = item.DishID;
                        Dishentity.DishesCount  = item.DishCount;
                        Dishentity.Price        = item.Price ?? 0;
                        Dishentity.Moneys       = item.TotalPrice ?? 0;
                        Dishentity.DishesType   = "3";
                        Dishentity.IsFree       = "0";
                        Dishentity.TabieUsingID = entity.ID;
                        //获取菜品信息
                        tm_Dishes _Dishes = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(Dishentity.DishesID);
                        Dishentity.UnitName   = GetSystemEnumValue("CPDW", _Dishes.DishesUnit.ToString());
                        Dishentity.DishesName = _Dishes.DishesName;
                        Dishentity.PrintID    = _Dishes.PrinterID;
                        Dishentity.IsPrint    = 0;
                        Dishentity.IsDiscount = 0;
                        //创建点菜信息
                        Core.Container.Instance.Resolve <IServiceTabieDishesInfo>().Create(Dishentity);
                    }
                }

                #endregion 加入选择的团购菜品
            }
            else
            {
                entity.GroupName   = "";
                entity.GroupMoneys = 0;
                entity.GroupCardNO = "";
            }
            Core.Container.Instance.Resolve <IServiceTabieUsingInfo>().Update(entity);
            //绑定菜品信息
            BindTabieDishesInfo();
        }
예제 #13
0
        private void BindDishesInfo()
        {
            tm_Dishes DishesInfo = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(DishesID);

            Grid1.Title = string.Format("菜品名称:{0}(点击消耗数量直接修改数量)", DishesInfo != null ? DishesInfo.DishesName : "");
        }
예제 #14
0
        private void BindDishesInfo()
        {
            tm_Dishes DishesInfo = Core.Container.Instance.Resolve <IServiceDishes>().GetEntity(DishesID);

            lblTitle.Text = string.Format("菜品名称:{0}", DishesInfo != null ? DishesInfo.DishesName : "");
        }