| @ -0,0 +1,67 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using System.Web.UI; | |||
| using System.Web.UI.WebControls; | |||
| using BWP.B3Frameworks.Utils; | |||
| using BWP.B3QingDaoWanFu.BL; | |||
| using BWP.B3QingDaoWanFu.BO; | |||
| using BWP.B3Sale.BO; | |||
| using BWP.B3Sale.Utils; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.Utils.Collections; | |||
| using TSingSoft.WebControls2; | |||
| namespace BWP.Web.Pages.B3QingDaoWanFu.CustomerDeviceSet_ | |||
| { | |||
| class CustomerDeviceSetEdit: SingletonDmoEditPage<CustomerDeviceSet, ICustomerDeviceSetBL> | |||
| { | |||
| private DFEditGrid _grid; | |||
| protected override void BuildBody(VLayoutPanel vPanel) | |||
| { | |||
| var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Center)); | |||
| hPanel.Add(new SimpleLabel("结账客户")); | |||
| var chb = hPanel.Add(new ChoiceBox(B3SaleDataSources.结账客户)); | |||
| chb.Width = 150; | |||
| chb.EnableInputArgument = true; | |||
| chb.EnableTopItem = true; | |||
| var bt = hPanel.Add(new TSButton("新增")); | |||
| bt.Click += delegate { | |||
| if (chb.IsEmpty) | |||
| throw new ApplicationException("结账客户"); | |||
| if (Dmo.Details.Any(x => x.AccountCustomer_ID == short.Parse(chb.Value))) | |||
| return; | |||
| _grid.GetFromUI(); | |||
| var detail = new CustomerDeviceSet_Detail(); | |||
| detail.AccountCustomer_ID = short.Parse(chb.Value); | |||
| DmoUtil.RefreshDependency(detail, "AccountCustomer_ID"); | |||
| Dmo.Details.Add(detail); | |||
| _grid.DataBind(); | |||
| }; | |||
| var detailEditor = new DFCollectionEditor<CustomerDeviceSet_Detail>(() => Dmo.Details); | |||
| detailEditor.AllowDeletionFunc = () => CanSave; | |||
| detailEditor.CanDeleteFunc = (detail) => CanSave; | |||
| detailEditor.IsEditableFunc = (field, detail) => CanSave; | |||
| _grid = vPanel.Add(new DFEditGrid(detailEditor) { Width = Unit.Percentage(50) }, new VLayoutOption(HorizontalAlign.Center)); | |||
| _grid.Columns.Add(new DFEditGridColumn<DFValueLabel>("AccountCustomer_Name")); | |||
| _grid.Columns.EAdd(new DFEditGridColumn<DFTextBox>("DeviceCode")).InitEditControl += (send, e) => { | |||
| e.Control.Width=Unit.Percentage(100); | |||
| }; | |||
| } | |||
| public override void AppToUI() | |||
| { | |||
| base.AppToUI(); | |||
| _grid.DataBind(); | |||
| } | |||
| public override void GetFromUI() | |||
| { | |||
| base.GetFromUI(); | |||
| _grid.GetFromUI(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,33 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks.BL; | |||
| using BWP.B3QingDaoWanFu.BO; | |||
| using BWP.B3Sale.BO; | |||
| using Forks.EnterpriseServices.BusinessInterfaces; | |||
| namespace BWP.B3QingDaoWanFu.BL | |||
| { | |||
| [BusinessInterface(typeof(CustomerDeviceSetBL))] | |||
| public interface ICustomerDeviceSetBL : ISingletonDmoBL<CustomerDeviceSet> | |||
| { | |||
| long GetAccountCustomer_ID(string outcode); | |||
| } | |||
| public class CustomerDeviceSetBL:DomainSingletonDmoBL<CustomerDeviceSet>, ICustomerDeviceSetBL | |||
| { | |||
| public long GetAccountCustomer_ID(string outcode) | |||
| { | |||
| var dmo = Load(); | |||
| var fd = dmo.Details.FirstOrDefault(x => x.DeviceCode == outcode); | |||
| if (fd == null) | |||
| { | |||
| return 0; | |||
| } | |||
| return fd.AccountCustomer_ID??0; | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,55 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Text; | |||
| using BWP.B3Frameworks; | |||
| using BWP.B3Frameworks.BO; | |||
| using BWP.B3Sale.BO; | |||
| using BWP.B3Sale.Utils; | |||
| using Forks.EnterpriseServices; | |||
| using Forks.EnterpriseServices.DataForm; | |||
| using Forks.EnterpriseServices.DomainObjects2; | |||
| namespace BWP.B3QingDaoWanFu.BO | |||
| { | |||
| [DFClass,Serializable,LogicName("结账客户设备配置")] | |||
| public class CustomerDeviceSet:DomainSingletonDmo | |||
| { | |||
| readonly CustomerDeviceSet_DetailCollection _details = new CustomerDeviceSet_DetailCollection(); | |||
| [OneToMany(typeof(CustomerDeviceSet_Detail), "ID")] | |||
| [Join("ID", "CustomerDeviceSet_ID")] | |||
| public CustomerDeviceSet_DetailCollection Details | |||
| { | |||
| get { return _details; } | |||
| } | |||
| } | |||
| [DFClass, Serializable, LogicName("结账客户设备配置")] | |||
| public class CustomerDeviceSet_Detail : Base | |||
| { | |||
| public long CustomerDeviceSet_ID { get; set; } | |||
| [LogicName("结账客户")] | |||
| [DFDataKind(B3SaleDataSources.结账客户)] | |||
| [DFExtProperty(B3FrameworksConsts.DFExtProperties.DisplayField, "AccountCustomer_Name")] | |||
| public long? AccountCustomer_ID { get; set; } | |||
| [LogicName("结账客户")] | |||
| [ReferenceTo(typeof(Customer), "Name")] | |||
| [Join("AccountCustomer_ID", "ID")] | |||
| public string AccountCustomer_Name { get; set; } | |||
| [LogicName("设备号")] | |||
| public string DeviceCode { get; set; } | |||
| } | |||
| [Serializable] | |||
| public class CustomerDeviceSet_DetailCollection : DmoCollection<CustomerDeviceSet_Detail> | |||
| { | |||
| } | |||
| } | |||