Пример #1
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="dicDientIngredient"></param>
 /// <returns></returns>
 public int SaveDicIngredient(ref EntityDicDientIngredient dicDientIngredient)
 {
     using (Biz206 biz = new Biz206())
     {
         return(biz.SaveDicIngredient(ref dicDientIngredient));
     }
 }
Пример #2
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="dicDientIngredienti"></param>
 /// <returns></returns>
 public int DeleteDicIngredient(EntityDicDientIngredient dicDientIngredienti)
 {
     using (Biz206 biz = new Biz206())
     {
         return(biz.DeleteDicIngredient(dicDientIngredienti));
     }
 }
Пример #3
0
 private void gvData_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (gvData.RowCount > 0 && e.RowHandle >= 0)
     {
         if (gvData.FocusedColumn.FieldName == "weight")
         {
             EntityDicDientIngredient vo = GetRowObject();
             vo.weight = Function.Dec(gvData.GetRowCellValue(gvData.FocusedRowHandle, "weight"));
         }
     }
 }
Пример #4
0
        /// <summary>
        /// 编辑
        /// </summary>
        public override void Edit()
        {
            EntityDicDientIngredient vo  = GetIngredientRowObject();
            frmPopup2060501          frm = new frmPopup2060501(vo);

            frm.ShowDialog();
            if (frm.IsRequireRefresh)
            {
                RefreshData();
                Search();
            }
        }
Пример #5
0
        private void repBtnDientIngredDel_Click(object sender, EventArgs e)
        {
            EntityDicDientIngredient vo = GetRowObject();

            if (vo != null)
            {
                lstCaiDientIngredient = gcData.DataSource as List <EntityDicDientIngredient>;
                int idx = lstCaiDientIngredient.FindIndex(r => r.id == vo.id);
                if (idx >= 0)
                {
                    lstCaiDientIngredient.RemoveAt(idx);
                    gcData.DataSource = lstCaiDientIngredient;
                    gcData.RefreshDataSource();
                }
            }
        }
Пример #6
0
 /// <summary>
 /// 删除
 /// </summary>
 public override void Delete()
 {
     if (this.gvData.SelectedRowsCount > 0)
     {
         if (DialogBox.Msg("是否删除所选行记录?", MessageBoxIcon.Question) != DialogResult.Yes)
         {
             return;
         }
         EntityDicDientIngredient vo = GetIngredientRowObject();
         using (ProxyHms proxy = new ProxyHms())
         {
             if (proxy.Service.DeleteDicIngredient(vo) > 0)
             {
                 RefreshData();
             }
         }
     }
 }
Пример #7
0
 public frmPopup2060501(EntityDicDientIngredient _dicDientIngredient = null)
 {
     InitializeComponent();
     dicDientIngredient = _dicDientIngredient;
 }
Пример #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cboClassify.Text.Trim()))
            {
                DialogBox.Msg("请选择食物分类!");
                cboClassify.Focus();
                return;
            }

            int affect = -1;

            if (dicDientIngredient == null)
            {
                dicDientIngredient = new EntityDicDientIngredient();
            }
            else if (string.IsNullOrEmpty(dicDientIngredient.id))
            {
                dicDientIngredient = new EntityDicDientIngredient();
            }
            dicDientIngredient.names       = txtName.Text;
            dicDientIngredient.lstClassify = new List <int>();
            dicDientIngredient.lstClassify.Add(lstDicIngredientClassify.FindAll(r => r.classifyName == cboClassify.Text.Trim()).FirstOrDefault().classifyId);
            dicDientIngredient.otherName   = txtOtherName.Text;
            dicDientIngredient.remaks      = txtRemaks.Text;
            dicDientIngredient.eatPercent  = Function.Dec(txtEatPercent.Text);
            dicDientIngredient.water       = Function.Dec(txtWater.Text);
            dicDientIngredient.kCal        = Function.Dec(txtKCal.Text);
            dicDientIngredient.kj          = Function.Dec(txtkj.Text);
            dicDientIngredient.proteint    = Function.Dec(txtProteint.Text);
            dicDientIngredient.fat         = Function.Dec(txtFat.Text);
            dicDientIngredient.cho         = Function.Dec(txtCho.Text);
            dicDientIngredient.brxxw       = Function.Dec(txtBrxxw.Text);
            dicDientIngredient.dgc         = Function.Dec(txtDgc.Text);
            dicDientIngredient.ash         = Function.Dec(txtAsh.Text);
            dicDientIngredient.vitaminsA   = Function.Dec(txtVitaminsA.Text);
            dicDientIngredient.thiamin     = Function.Dec(txtThiamin.Text);
            dicDientIngredient.riboflavin  = Function.Dec(txtRiboflavin.Text);
            dicDientIngredient.niacin      = Function.Dec(txtNiacin.Text);
            dicDientIngredient.vitaminsC   = Function.Dec(txtVitaminsC.Text);
            dicDientIngredient.vitaminsE   = Function.Dec(txtVitaminsE.Text);
            dicDientIngredient.ca          = Function.Dec(txtCa.Text);
            dicDientIngredient.p           = Function.Dec(txtP.Text);
            dicDientIngredient.k           = Function.Dec(txtK.Text);
            dicDientIngredient.na          = Function.Dec(txtNa.Text);
            dicDientIngredient.mg          = Function.Dec(txtMg.Text);
            dicDientIngredient.fe          = Function.Dec(txtFe.Text);
            dicDientIngredient.zn          = Function.Dec(txtZn.Text);
            dicDientIngredient.se          = Function.Dec(txtSe.Text);
            dicDientIngredient.cu          = Function.Dec(txtCu.Text);
            dicDientIngredient.mn          = Function.Dec(txtMn.Text);
            dicDientIngredient.i           = Function.Dec(txtI.Text);
            dicDientIngredient.f           = Function.Dec(txtF.Text);
            dicDientIngredient.cr          = Function.Dec(txtCr.Text);
            dicDientIngredient.mu          = Function.Dec(txtMu.Text);
            dicDientIngredient.vitaminsD   = Function.Dec(txtVitaminsD.Text);
            dicDientIngredient.vitaminsB6  = Function.Dec(txtVitaminsB6.Text);
            dicDientIngredient.vitaminsB12 = Function.Dec(txtVitaminsB12.Text);
            dicDientIngredient.vitaminsB5  = Function.Dec(txtVitaminsB5.Text);
            dicDientIngredient.vitaminsB9  = Function.Dec(txtVitaminsB9.Text);
            dicDientIngredient.vitaminsH   = Function.Dec(txtVitaminsH.Text);
            dicDientIngredient.vitaminsB12 = Function.Dec(txtDanjian.Text);
            using (ProxyHms proxy = new ProxyHms())
            {
                affect = proxy.Service.SaveDicIngredient(ref dicDientIngredient);
            }
            if (affect < 0)
            {
                DialogBox.Msg("保存失败 !");
            }
            else
            {
                this.IsRequireRefresh = true;
            }
        }
Пример #9
0
        /// <summary>
        ///
        /// </summary>
        void Init()
        {
            using (ProxyHms proxy = new ProxyHms())
            {
                lstDicDientIngredient = proxy.Service.GetDicDietIngredient();
                lstDicCaiRecipe       = proxy.Service.GetDicCaiRecipe();
                gdlueCaiRecipe.Properties.DataSource = lstDicCaiRecipe;
                if (cai != null)
                {
                    txtName.Text    = cai.names;
                    memMethods.Text = cai.methods;
                    if (cai.breakfast == "1")
                    {
                        chkMeals.Items[0].CheckState = CheckState.Checked;
                    }
                    if (cai.lunch == "1")
                    {
                        chkMeals.Items[1].CheckState = CheckState.Checked;
                    }
                    if (cai.dinner == "1")
                    {
                        chkMeals.Items[2].CheckState = CheckState.Checked;
                    }
                    if (cai.other == "1")
                    {
                        chkMeals.Items[3].CheckState = CheckState.Checked;
                    }

                    //菜分类
                    if (cai.lstCaiSlaveId != null)
                    {
                        string slaveName = string.Empty;
                        foreach (var strId in cai.lstCaiSlaveId)
                        {
                            slaveName += lstDicCaiRecipe.FindAll(r => r.caiSlaveId == strId).FirstOrDefault().caiSlaveName + "、";
                        }
                        if (!string.IsNullOrEmpty(slaveName))
                        {
                            slaveName = slaveName.TrimEnd('、');
                        }
                        txtSlaveName.Text = slaveName;
                    }

                    //菜原料
                    cai.lstCaiIngredient = proxy.Service.GetCaiIngredient(cai.id);
                    if (cai.lstCaiIngredient != null && cai.lstCaiIngredient.Count > 0)
                    {
                        lstCaiDientIngredient = new List <EntityDicDientIngredient>();
                        foreach (var vo in cai.lstCaiIngredient)
                        {
                            EntityDicDientIngredient dientIngredient = lstDicDientIngredient.FindAll(r => r.ingredientId == vo.ingredietId).FirstOrDefault();
                            dientIngredient.weight = vo.weight;
                            lstCaiDientIngredient.Add(dientIngredient);
                        }
                    }

                    this.gcData.DataSource = lstCaiDientIngredient;
                    this.gcData.RefreshDataSource();
                }
            }
        }