public void Save()
        {
            if (Mode == EditMode.CREATE)
            {
                iSeedBaseService.InsertSingleSeedBase(Model);
            }
            else if (Mode == EditMode.UPDATE)
            {
                iSeedBaseService.UpdateSingleSeedBase(Model);
            }
            var win = GetView() as System.Windows.Window;

            if (win != null)
            {
                win.DialogResult = true;
                win.Close();
            }
        }
示例#2
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult SaveSeedData(SeedBaseModel model)
        {
            var result = new ResultJson();

            try
            {
                CPRODUCTEPC96 pro96 = new CPRODUCTEPC96();
                //种植场号
                pro96.BusinessCode = "3";
                //批次号
                pro96.BatchNo = model.BatchNO;
                //生成日期
                pro96.TagDate = DateTime.Now.ToString("yyyy年MM月dd日");
                var maxId = _codeMaxService.GetMaxCode("SeedBase");
                //序号
                pro96.SeqNo = maxId;
                //标签类型
                pro96.EpcType  = "3";
                model.SeedCode = pro96.PackEpc();


                var msg = new MessageModel();
                if (model.SeedID == 0)
                {
                    msg = _seedBaseService.InsertSingleSeedBase(model);
                }
                else
                {
                    msg = _seedBaseService.UpdateSingleSeedBase(model);
                }
                if (msg.Status == MessageStatus.Success)
                {
                    result.IsSuccess = true;
                }
            }
            catch (Exception)
            {
            }

            return(Json(result));
        }