public void DeleteRow(KillCullModel model)
        {
            var result = MessageBox.Show("是否删除", "提示", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                var message = iKillCullService.DeleteSingleKillCull(model.KillCullID);
                if (message.Status == MessageStatus.Success)
                {
                    LoadData(string.Empty);
                }
            }
        }
        public void EditRow(KillCullModel model)
        {
            var vm = IoC.Get <KillCullEditViewModel>();

            vm.Model = model;
            vm.Mode  = Models.EditMode.UPDATE;
            var result = IoC.Get <IWindowManager>().ShowDialog(vm, null, new Dictionary <string, object> {
                { "Title", "编辑" }, { "ResizeMode", System.Windows.ResizeMode.NoResize },
                { "Width", 450 },
                { "Height", 600 }
            });

            if (result ?? false)
            {
                LoadData(string.Empty);
            }
        }
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult SaveKillCullData(KillCullModel model)
        {
            var result = new ResultJson();

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

                model.CompanyID = UserManagement.CurrentUser.CompanyId;
                var msg = new MessageModel();
                if (model.KillCullID == 0)
                {
                    msg = _killCullService.InsertSingleKillCull(model);
                }
                else
                {
                    msg = _killCullService.UpdateSingleKillCull(model);
                }
                if (msg.Status == MessageStatus.Success)
                {
                    result.IsSuccess = true;
                }
            }
            catch (Exception)
            {
            }

            return(Json(result));
        }
Ejemplo n.º 4
0
        private void AddKillCull()
        {
            KillCullModel data = new KillCullModel();

            data.CompanyID      = 2;
            data.KillBatchID    = 2;
            data.CultivationID  = 2;
            data.CultivationEpc = "test";
            data.KillEpc        = "test";
            data.ProductID      = 2;
            data.ProductName    = "test";
            data.Weight         = 10;
            data.Flow           = "test";
            data.KillTime       = DateTime.Now;
            data.Remark         = "test";
            data.IsLocked       = false;
            data.IsShow         = true;

            IKillCullService cs = new KillCullService();
            var result          = cs.InsertSingleKillCull(data);
        }
 /// <summary>
 /// 编辑单条KillCull
 /// </summary>
 /// <param name="model">地块信息实体</param>
 /// <returns></returns>
 public MessageModel UpdateSingleKillCull(KillCullModel model)
 {
     return(killCullAccess.UpdateSingleEntity(model));
 }
 /// <summary>
 /// 新增单条KillCull
 /// </summary>
 /// <param name="model">地块信息实体</param>
 /// <returns></returns>
 public MessageModel InsertSingleKillCull(KillCullModel model)
 {
     return(killCullAccess.InsertSingleEntity(model));
 }