예제 #1
0
파일: svchms.cs 프로젝트: iamwsx05/hms
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="dietTemplate"></param>
 /// <returns></returns>
 public int SaveDietTemplate(EntityDietTemplate dietTemplate, out string templateId)
 {
     using (Biz206 biz = new Biz206())
     {
         return(biz.SaveDietTemplate(dietTemplate, out templateId));
     }
 }
예제 #2
0
파일: svchms.cs 프로젝트: iamwsx05/hms
 /// <summary>
 /// 另存为模板
 /// </summary>
 /// <param name="dietTemplate"></param>
 /// <param name="lstDietDetails"></param>
 /// <param name="templateId"></param>
 /// <returns></returns>
 public int SaveDietTemplateDetails(EntityDietTemplate dietTemplate, List <EntityDietTemplateDetails> lstDietDetails, out string templateId)
 {
     using (Biz206 biz = new Biz206())
     {
         return(biz.SaveDietTemplateDetails(dietTemplate, lstDietDetails, out templateId));
     }
 }
예제 #3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.gvData.FocusedRowHandle >= 0)
            {
                EntityDietTemplate temp = this.gvData.GetRow(this.gvData.FocusedRowHandle) as EntityDietTemplate;

                if (temp != null)
                {
                    using (ProxyHms proxy = new ProxyHms())
                    {
                        lstDietTemplateDetails = proxy.Service.GetDietTemplateDetails(temp.templateId);
                    }
                }
            }

            if (lstDietTemplateDetails != null)
            {
                isRefresh = true;
                this.Close();
            }
        }
예제 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (lstDietDetails == null)
            {
                return;
            }

            foreach (var diet in lstDietDetails)
            {
                if (diet.lstDetailsCai != null)
                {
                    foreach (var detail in diet.lstDetailsCai)
                    {
                        if (detail.lstDietdetailsIngrediet != null)
                        {
                            foreach (var ingrediet in detail.lstDietdetailsIngrediet)
                            {
                                EntityDietTemplateDetails vo = new EntityDietTemplateDetails();
                                vo.caiId          = ingrediet.caiId;
                                vo.caiIngrediet   = ingrediet.caiIngrediet;
                                vo.caiIngredietId = ingrediet.caiIngredietId;
                                vo.caiName        = ingrediet.caiName;
                                vo.caiWeight      = ingrediet.caiWeight;
                                vo.day            = ingrediet.day;
                                vo.mealId         = ingrediet.mealId;
                                vo.mealType       = ingrediet.mealType;
                                vo.realWeight     = ingrediet.realWeight;
                                vo.weight         = ingrediet.weight;
                                vo.per            = ingrediet.per;
                                lstDietTemplateDetails.Add(vo);
                            }
                        }
                    }
                }
            }

            int    affect     = -1;
            string templateId = string.Empty;

            if (dietTemplate == null)
            {
                dietTemplate = new EntityDietTemplate();
            }
            else if (string.IsNullOrEmpty(dietTemplate.templateId))
            {
                dietTemplate = new EntityDietTemplate();
            }

            dietTemplate.templateName = this.txtName.Text;
            dietTemplate.descriptions = memDescriptions.Text;
            dietTemplate.typeid       = lstDietTemplatetype.FindAll(r => r.typeName == cboType.Text).FirstOrDefault().typeId;
            dietTemplate.creator      = "00";
            dietTemplate.createName   = "系统管理员";

            using (ProxyHms proxy = new ProxyHms())
            {
                affect = proxy.Service.SaveDietTemplateDetails(dietTemplate, lstDietTemplateDetails, out templateId);
            }

            if (affect < 0)
            {
                dietTemplate.templateId = "";
                DialogBox.Msg("保存失败 !");
            }
            else
            {
                dietTemplate.templateId = templateId;
                this.IsRequireRefresh   = true;
                DialogBox.Msg("保存成功 !");
                this.Close();
            }
        }
예제 #5
0
 public frmPopup2060301(EntityDietTemplate _dietTemplate = null)
 {
     InitializeComponent();
     dietTemplate = _dietTemplate;
 }