public void CallCreateUserTabPage()
        {
            var tab  = WindowMgr.CreateTabPage("创建新用户", "创建新用户", false);
            var form = CallCreateUserControl((u) =>
            {
                WindowMgr.SendNotification("用户创建成功", NotificationLevel.Information);
                WindowMgr.CloseTabPage(tab);
            });

            tab.Content = form;
        }
        public void CallWarehouseInboundtPage()
        {
            WarehouseContext dbcontext;
            var tab         = WindowMgr.CreateTabPageWithDBContext("入库单", "入库单", false, out dbcontext);
            var formControl = FormControlHelper.CreateFormControl();

            formControl.CreateControlCallback = (cx, ctl) =>
            {
                if (cx.ControlType == ControlType.Label &&
                    cx.PropertyInfo.Name == "InboundGoods")
                {
                    ctl.VerticalAlignment = VerticalAlignment.Top;
                    return(ctl);
                }
                if (cx.ControlType == ControlType.Editable ||
                    cx.ControlType == ControlType.Readonly)
                {
                    switch (cx.PropertyInfo.Name)
                    {
                    case "Operator":
                        return(RenderSelectUserControl(cx, dbcontext));

                    case "InboundGoods":
                        return(new GoodsList(dbcontext));
                    }
                }
                return(ctl);
            };

            //form submit callback
            formControl.SubmitCallback = d =>
            {
                try
                {
                    dbcontext.WarehouseInbounds.Add((WarehouseInbound)d);
                    dbcontext.SaveChanges();
                    WindowMgr.SendNotification("入库成功", NotificationLevel.Information);
                    WindowMgr.CloseTabPage(tab);
                    dbcontext.Dispose();
                }
                catch (Exception ex)
                {
                    //TODO: handle exception
                    WindowMgr.SendNotification("入库操作失败", NotificationLevel.Error);
                }
            };

            var newinbound = new WarehouseInbound();

            newinbound.Name = string.Format("入库 - {0}", DateTime.Now);
            formControl.RenderForm(newinbound, false);
            formControl.ConfirmButton.Content = "入库";
            tab.Content = formControl;
        }
        public void CallAddProductPage()
        {
            var dbcontext = new WarehouseContext();
            var tab       = WindowMgr.CreateTabPage("添加产品信息", "添加产品信息", false);
            var form      = CallAddProductControl(null, dbcontext, (u) =>
            {
                WindowMgr.SendNotification("添加产品信息成功", NotificationLevel.Information);
                WindowMgr.CloseTabPage(tab);
                dbcontext.Dispose();
            });

            tab.Content = form;
        }