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

            if (result == MessageBoxResult.Yes)
            {
                var message = iShadowBaseService.DeleteSingleShadowBase(model.ShadowID);
                if (message.Status == MessageStatus.Success)
                {
                    LoadData(string.Empty);
                }
            }
        }
        public MessageModel InsertSingleEntity(ShadowBaseModel model)
        {
            Func <IEntityContext, string> operation = delegate(IEntityContext context)
            {
                model.ModifyID   = UserManagement.CurrentUser.UserID;
                model.ModifyName = UserManagement.CurrentUser.UserName;
                model.ModifyTime = DateTime.Now;
                context.ShadowBase.Add(model);
                context.SaveChanges();
                return(string.Empty);
            };

            return(base.DbOperation(operation));
        }
Example #3
0
        public void EditRow(ShadowBaseModel model)
        {
            var vm = IoC.Get <ShadowBaseEditViewModel>();

            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);
            }
        }
        public MessageModel UpdateSingleEntity(ShadowBaseModel model)
        {
            Func <IEntityContext, string> operation = delegate(IEntityContext context)
            {
                var data = context.ShadowBase.FirstOrDefault(m => m.ShadowID == model.ShadowID && m.ModifyTime == model.ModifyTime);
                if (data == null)
                {
                    return("当前数据不存在或被更新,请刷新后再次操作!");
                }

                data.CompanyID     = model.CompanyID;
                data.ProductID     = model.ProductID;
                data.ProductName   = model.ProductName;
                data.ProductTypeID = model.ProductTypeID;
                data.Price         = model.Price;
                data.ProductCode   = model.ProductCode;
                data.ShadowEPC     = model.ShadowEPC;
                data.ORCode        = model.ORCode;
                data.ChipCode      = model.ChipCode;
                data.ProcessBatch  = model.ProcessBatch;
                data.Method        = model.Method;
                data.ProcessTime   = model.ProcessTime;
                data.Temp          = model.Temp;
                data.Dry           = model.Dry;
                data.DryTime       = model.DryTime;
                data.RawBatch      = model.RawBatch;
                data.Flow          = model.Flow;
                data.Remark        = model.Remark;
                data.IsLocked      = model.IsLocked;
                data.IsShow        = model.IsShow;
                data.ModifyID      = UserManagement.CurrentUser.UserID;
                data.ModifyName    = UserManagement.CurrentUser.UserName;
                data.ModifyTime    = DateTime.Now;
                context.SaveChanges();
                return(string.Empty);
            };

            return(base.DbOperation(operation));
        }
Example #5
0
        // GET: api/Default/5
        /// <summary>
        /// 皮影
        /// </summary>
        /// <param name="Epc"></param>
        /// <param name="OrCode"></param>
        /// <returns></returns>
        public string Get(string Epc, string OrCode)
        {
            if (!string.IsNullOrEmpty(Epc))
            {
                if (Epc.Length > 8)
                {
                    return("3");
                }
                TidService tidService = new TidService();
                TIDModel   tidModel   = tidService.GetTidChipCode(Epc);
                if (tidModel == null)
                {
                    return("2");
                }
            }

            IShadowBaseService shadowBaseService = new ShadowBaseService();
            ShadowBaseModel    model             = shadowBaseService.GetShawInfoByEPCOrORCode(Epc, OrCode);

            if (model == null)
            {
                return("1");
            }
            return(JsonConvert.SerializeObject(new
            {
                ProductName = model.ProductName,
                ProductType = model.ProductType == null ? string.Empty : model.ProductType.ProductTypeEN,
                CompanyName = model.Company.CompanyName,
                AreaCode = model.Company.AreaCode,
                Address = model.Company.Address,
                Leader = model.Company.Leader,
                Logo = model.Company.Logo,
                Location = model.Company.Location,
                Code = model.Company.Code,
                ZipCode = model.Company.ZipCode,
                TaxCard = model.Company.TaxCard,
                Fax = model.Company.Fax,
                Mobile = model.Company.Mobile,
                Email = model.Company.Email,
                Info = model.Company.Info,
                Demand = model.Company.Demand,
                Price = model.Price,
                ProductCode = model.ProductCode,
                ShadowEPC = model.ShadowEPC,
                ORCode = model.ORCode,
                ChipCode = model.ChipCode,
                ProcessBatch = model.ProcessBatch,
                Method = model.Method,
                ProcessTime = model.ProcessTime,
                Temp = model.Temp,
                Dry = model.Dry,
                DryTime = model.DryTime,
                RawBatch = model.RawBatch,
                Flow = model.Flow,
                Reamrk = model.Remark,
                ShadowProcess = model.ShadowProcess == null?null: model.ShadowProcess.Select(m => new
                {
                    m.ProcessBase.ProcessCode,
                    m.ProcessBase.ProcessName
                })
            }));
        }
 /// <summary>
 /// 编辑单条ShadowBase
 /// </summary>
 /// <param name="model">地块信息实体</param>
 /// <returns></returns>
 public MessageModel UpdateSingleShadowBase(ShadowBaseModel model)
 {
     return(shadowBaseAccess.UpdateSingleEntity(model));
 }
 /// <summary>
 /// 新增单条ShadowBase
 /// </summary>
 /// <param name="model">地块信息实体</param>
 /// <returns></returns>
 public MessageModel InsertSingleShadowBase(ShadowBaseModel model)
 {
     return(shadowBaseAccess.InsertSingleEntity(model));
 }