示例#1
0
        /// <summary>
        /// 销售
        /// </summary>
        /// <param name="Epc"></param>
        /// <param name="OrCode"></param>
        /// <returns></returns>
        public string GetSale(string Epc, string OrCode)
        {
            ISaleBaseService saleBaseService = new SaleBaseService();
            SaleBaseModel    model           = saleBaseService.GetSaleBaseByEPCOrORCode(Epc, OrCode);

            if (model == null)
            {
                return("");
            }
            return(JsonConvert.SerializeObject(new
            {
                CompanyName = model.Company == null ? string.Empty : model.Company.CompanyName,
                WareHouseEPC = model.WareHouseEPC,
                SaleEPC = model.SaleEPC,
                ORCode = model.ORCode,
                ChipCode = model.ChipCode,
                ProductName = model.ProductName,
                ClassName = model.ClassName,
                ProductCode = model.ProductCode,
                Weight = model.Weight,
                Price = model.Price,
                PinYingCode = model.PinYingCode,
                SaleTime = model.SaleTime
            }));
        }
示例#2
0
        public MessageModel InsertSingleEntity(SaleBaseModel model)
        {
            Func <IEntityContext, string> operation = (context => {
                model.ModifyID = UserManagement.CurrentUser.UserID;
                model.ModifyName = UserManagement.CurrentUser.UserName;
                model.ModifyTime = DateTime.Now;
                context.SaleBase.Add(model);
                context.SaveChanges();
                return(string.Empty);
            });

            return(base.DbOperation(operation));
        }
示例#3
0
        public MessageModel UpdateSingleSaleBase(SaleBaseModel model)
        {
            var data = saleBaseAccess.GetOriEntity(model.SaleID, model.ModifyTime);

            if (data == null)
            {
                return new MessageModel()
                       {
                           Message = "当前数据不存在或被更新,请刷新后再次操作!", Status = MessageStatus.Error
                       }
            }
            ;
            return(saleBaseAccess.UpdateSingleEntity(model));
        }
示例#4
0
        public void DeleteRow(SaleBaseModel model)
        {
            var result = MessageBox.Show("是否删除", "提示", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                //var model = (SaleBaseModel)dg.SelectedItem;
                var message = SaleBaseService.DeleteSingleEntity(model.SaleID);
                if (message.Status == MessageStatus.Success)
                {
                    LoadData(string.Empty);
                }
            }
        }
示例#5
0
        public void EditRow(SaleBaseModel model)
        {
            var vm = IoC.Get <SaleBaseEditViewModel>();

            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);
            }
        }
示例#6
0
        public MessageModel UpdateSingleEntity(SaleBaseModel model)
        {
            Func <IEntityContext, string> operation = (context =>
            {
                var data = context.SaleBase.FirstOrDefault(m => m.SaleID == model.SaleID && m.ModifyTime == model.ModifyTime);
                if (data == null)
                {
                    return("当前数据不存在或被更新,请刷新后再次操作!");
                }
                data.SaleID = model.SaleID;
                data.CompanyID = model.CompanyID;
                data.WareHouseEPC = model.WareHouseEPC;
                data.SaleEPC = model.SaleEPC;
                data.ORCode = model.ORCode;
                data.ChipCode = model.ChipCode;
                data.ProductName = model.ProductName;
                data.ClassID = model.ClassID;
                data.ClassName = model.ClassName;
                data.ProductCode = model.ProductCode;
                data.ProductSpcID = model.ProductSpcID;
                data.ProductTypeID = model.ProductTypeID;
                data.Weight = model.Weight;
                data.Price = model.Price;
                data.PinYingCode = model.PinYingCode;
                data.SaleTime = model.SaleTime;
                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));
        }
示例#7
0
 /// <summary>
 /// 插入单条saleBase数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public MessageModel InsertSingleSaleBase(SaleBaseModel model)
 {
     return(saleBaseAccess.InsertSingleEntity(model));
 }