void dGrid_ToolBarItemClick(object sender, ToolBarItemClickEventArgs e) { if (e.Action != Actions.Add) { return; } e.Action = Actions.Cancel; string perm = "3"; string entity = typeof(T_FB_PERSONMONEYASSIGNMASTER).Name; if (this.EditForm.OperationType == OperationTypes.Edit) { perm = ((int)Permissions.Edit).ToString(); } else if (this.EditForm.OperationType == OperationTypes.Add) { perm = ((int)Permissions.Add).ToString(); } else { perm = ((int)Permissions.Browse).ToString(); } string userID = DataCore.CurrentUser.Value.ToString(); OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity); ogzLookup.SelectedObjType = OrgTreeItemTypes.Company; FrameworkElement plRoot = CommonFunction.ParentLayoutRoot; ogzLookup.SelectedClick += (o, ea) => { if (ogzLookup.SelectedObj.Count > 0) { var assignDetail = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_SUMSETTINGSDETAIL).Name); var selectedObjects = ogzLookup.SelectedObj; selectedObjects.ForEach(obj => { ITextValueItem cdata = DataCore.FindReferencedData <CompanyData>(obj.ObjectID); T_FB_SUMSETTINGSDETAIL detail = new T_FB_SUMSETTINGSDETAIL(); detail.SUMSETTINGSDETAILID = Guid.NewGuid().ToString(); detail.T_FB_SUMSETTINGSMASTER = this.OrderEntity.Entity as T_FB_SUMSETTINGSMASTER; detail.EDITSTATES = 1; detail.OWNERCOMPANYID = cdata.Value.ToString(); detail.OWNERCOMPANYNAME = cdata.Text; detail.CREATEDATE = DateTime.Now; detail.CREATEUSERID = DataCore.CurrentUser.ID.ToString(); detail.CREATEUSERNAME = DataCore.CurrentUser.Text.ToString(); FBEntity fbEntity = detail.ToFBEntity(); fbEntity.FBEntityState = FBEntityState.Added; assignDetail.Add(fbEntity); }); } }; ogzLookup.Show <string>(DialogMode.ApplicationModal, plRoot, "", (result) => { }); }
void dGrid_ToolBarItemClick(object sender, ToolBarItemClickEventArgs e) { if (e.Action != Actions.Add) { return; } e.Action = Actions.Cancel; string perm = "3"; string entity = typeof(T_FB_PERSONMONEYASSIGNMASTER).Name; if (this.EditForm.OperationType == OperationTypes.Edit) { perm = ((int)Permissions.Edit).ToString(); } else if (this.EditForm.OperationType == OperationTypes.Add) { perm = ((int)Permissions.Add).ToString(); } else { perm = ((int)Permissions.Browse).ToString(); } string userID = DataCore.CurrentUser.Value.ToString(); OrganizationLookup ogzLookup = new OrganizationLookup(userID, perm, entity); ogzLookup.SelectedObjType = OrgTreeItemTypes.Company; FrameworkElement plRoot = CommonFunction.ParentLayoutRoot; ogzLookup.SelectedClick += (o, ea) => { if (ogzLookup.SelectedObj.Count > 0) { var assignDetail = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_SUMSETTINGSDETAIL).Name); var selectedObjects = ogzLookup.SelectedObj; selectedObjects.ForEach(obj => { ITextValueItem cdata = DataCore.FindReferencedData<CompanyData>(obj.ObjectID); T_FB_SUMSETTINGSDETAIL detail = new T_FB_SUMSETTINGSDETAIL(); detail.SUMSETTINGSDETAILID = Guid.NewGuid().ToString(); detail.T_FB_SUMSETTINGSMASTER = this.OrderEntity.Entity as T_FB_SUMSETTINGSMASTER; detail.EDITSTATES =1; detail.OWNERCOMPANYID = cdata.Value.ToString(); detail.OWNERCOMPANYNAME = cdata.Text; detail.CREATEDATE = DateTime.Now; detail.CREATEUSERID = DataCore.CurrentUser.ID.ToString(); detail.CREATEUSERNAME = DataCore.CurrentUser.Text.ToString(); FBEntity fbEntity = detail.ToFBEntity(); fbEntity.FBEntityState = FBEntityState.Added; assignDetail.Add(fbEntity); }); } }; ogzLookup.Show<string>(DialogMode.ApplicationModal, plRoot, "", (result) => { }); }