Beispiel #1
0
        private WarehouseOwnerInfoVM ConvertOwnerInfoToVM(WarehouseOwnerInfo info)
        {
            WarehouseOwnerInfoVM vm = info.Convert <WarehouseOwnerInfo, WarehouseOwnerInfoVM>((i, v) =>
            {
                v.CreateUserSysNo = i.CreateUser == null ? null : i.CreateUser.SysNo;
                v.EditUserSysNo   = i.EditUser == null ? null : i.EditUser.SysNo;
            });

            return(vm);
        }
Beispiel #2
0
 public void GetWarehouseOwnerInfo(int warehouseOwnerSysNo, Action <WarehouseOwnerInfoVM> action)
 {
     restClient.Query <WarehouseOwnerInfo>(String.Format("/InventoryService/Stock/WarehouseOwner/Get/{0}", warehouseOwnerSysNo.ToString()), (obj, args) =>
     {
         if (!args.FaultsHandle() && action != null)
         {
             WarehouseOwnerInfoVM vm = ConvertOwnerInfoToVM(args.Result);//.Convert<WarehouseOwnerInfo, WarehouseOwnerInfoVM>();
             action(vm);
         }
     });
 }
Beispiel #3
0
        private WarehouseOwnerInfo ConvertOwnerVMToInfo(WarehouseOwnerInfoVM vm)
        {
            WarehouseOwnerInfo info = vm.ConvertVM <WarehouseOwnerInfoVM, WarehouseOwnerInfo>((v, i) =>
            {
                i.CreateUser = new BizEntity.Common.UserInfo {
                    SysNo = v.CreateUserSysNo
                };
                i.EditUser = new BizEntity.Common.UserInfo {
                    SysNo = v.EditUserSysNo
                };
            });

            return(info);
        }
Beispiel #4
0
        public void UpdateWarehouseOwnerInfo(WarehouseOwnerInfoVM vm, Action callback)
        {
            vm.CompanyCode   = CPApplication.Current.CompanyCode;
            vm.EditUserSysNo = CPApplication.Current.LoginUser.UserSysNo;
            WarehouseOwnerInfo info = ConvertOwnerVMToInfo(vm);

            restClient.Query <WarehouseInfo>("/InventoryService/Stock/WarehouseOwner/Update", info, (obj, args) =>
            {
                if (!args.FaultsHandle())
                {
                    Page.Context.Window.Alert("仓库所有者信息修改成功", MessageType.Information);
                }
                if (callback != null)
                {
                    callback();
                }
            });
        }
        void WarehouseOwnerMaintain_Loaded(object sender, RoutedEventArgs e)
        {
            OwnerFacade = new WarehouseOwnerFacade(Page);

            if (OwnerSysNo.HasValue)
            {
                OwnerFacade.GetWarehouseOwnerInfo(OwnerSysNo.Value, (vm) =>
                {
                    if (vm == null || vm.CompanyCode == null || vm.CompanyCode.Trim() != CPApplication.Current.CompanyCode)
                    {
                        vm = null;
                        Page.Context.Window.Alert("没有找到相应的仓库所有者信息,此仓库所有者信息可能已经被删除。");
                    }
                    OwnerVM = vm ?? new WarehouseOwnerInfoVM();
                    IniPageData();
                });
            }
            else
            {
                IniPageData();
            }

            Loaded -= new RoutedEventHandler(WarehouseOwnerMaintain_Loaded);
        }
 private void IniPageData()
 {
     OwnerVM          = OwnerVM ?? new WarehouseOwnerInfoVM();
     this.DataContext = OwnerVM;
 }