void setUserFields(TableHeader thMaster) { var userType = thMaster.UserType; if (userType == null) { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("UserTypeMasterError"), Uniconta.ClientTools.Localization.lookup("Error")); return; } var row = Activator.CreateInstance(userType) as BaseUserTable; var UserFieldDef = row.UserFieldDef(); localMenu.UserFields = UserFieldDef; if (dgTabledataGrid.Columns.Count == 0) { if (thMaster._HasPrimaryKey) { UserFieldControl.CreateKeyFieldsOnGrid(dgTabledataGrid, thMaster._PKprompt); } if (thMaster._TableType == TableBaseType.Transaction) { UserFieldControl.CreateDateFieldOnGrid(dgTabledataGrid); } if (UserFieldDef != null) { UserFieldControl.CreateUserFieldOnGrid(dgTabledataGrid, UserFieldDef, (RowIndexConverter)this.Resources["RowIndexConverter"], api, !dgTabledataGrid.IsEditable, useBinding: false); } Layout._SubId = api.CompanyId; } else { SetColBinding(UserFieldDef); } detailControl.CreateUserField(UserFieldDef, thMaster._HasPrimaryKey, this.api, thMaster._PKprompt); if (thMaster._MasterTable != null) { var masterColumn = new CorasauDataGridTemplateColumnClient(); masterColumn.FieldName = "MasterKey"; masterColumn.RefType = row.MasterType; if (masterColumn.RefType == null) { masterColumn.RefType = typeof(Uniconta.DataModel.TableDataWithKey); masterColumn.TableId = row.MasterTableId; } if (dgTabledataGrid.IsEditable) { masterColumn.AllowEditing = DevExpress.Utils.DefaultBoolean.True; } else { masterColumn.AllowEditing = DevExpress.Utils.DefaultBoolean.False; } dgTabledataGrid.Columns.Add(masterColumn); dgTabledataGrid.LookupFieldsAdded = true; } }
void RemoveMenuItem() { RibbonBase rb = (RibbonBase)localMenu.DataContext; if (!this.thMaster._Attachment) { UtilDisplay.RemoveMenuCommand(rb, new string[] { "AddDoc", "AddNote" }); } if (dgTabledataGrid.IsEditable) { UtilDisplay.RemoveMenuCommand(rb, new string[] { "AddItem", "EditItem" }); } else { UtilDisplay.RemoveMenuCommand(rb, new string[] { "AddRow", "CopyRow", "DeleteRow", "SaveGrid" }); } dtlTables = Utilities.Utility.GetDefaultCompany().UserTables.Where(x => x._MasterTable == thMaster._Name).ToList(); if (dtlTables.Count > 0) { var childList = new List <TreeRibbon>(); var childRibbon = new TreeRibbon(); string nodeText = string.Empty; string tblName = string.Empty; if (dtlTables.Count > 1) { nodeText = Uniconta.ClientTools.Localization.lookup("UserTableData"); } else { var tbl = dtlTables[0]; tblName = tbl._Name; nodeText = tbl._Prompt != null?UserFieldControl.LocalizePrompt(tbl._Prompt) : tbl._Name; } childRibbon.Name = nodeText; childRibbon.ActionName = dtlTables.Count > 1 ? "" : string.Concat("UserTableData;", tblName); childRibbon.Child = childList; childRibbon.Glyph = "UserFieldData_32x32.png"; childRibbon.LargeGlyph = "UserFieldData_32x32.png"; var userRbnList = new List <TreeRibbon>(); userRbnList.Add(childRibbon); var treeRibbon = new TreeRibbon(); treeRibbon.Child = userRbnList; rb.rbnlist.Add(treeRibbon); if (dtlTables.Count > 1) { foreach (var ur in dtlTables) { var ribbonNode = new TreeRibbon(); ribbonNode.Name = !string.IsNullOrEmpty(ur._Prompt) ? UserFieldControl.LocalizePrompt(ur._Prompt) : ur._Name; ribbonNode.ActionName = string.Concat("UserTableData;", ur._Name); ribbonNode.LargeGlyph = "CopyUserTable_16x16.png"; ribbonNode.Glyph = "CopyUserTable_16x16.png"; ribbonNode.Child = new List <TreeRibbon>(); childList.Add(ribbonNode); } } rb.RefreshMenuItem(userRbnList); } }
private void EditAll() { RibbonBase rb = (RibbonBase)localMenu.DataContext; var iBase = UtilDisplay.GetMenuCommandByName(rb, "EditAll"); if (iBase == null) { return; } if (dgDebtorOffers.Readonly) { dgDebtorOffers.MakeEditable(); UserFieldControl.MakeEditable(dgDebtorOffers); iBase.Caption = Uniconta.ClientTools.Localization.lookup("LeaveEditAll"); ribbonControl.EnableButtons(new string[] { "AddLine", "CopyRow", "DeleteRow", "SaveGrid" }); editAllChecked = false; } else { if (IsDataChaged) { string message = Uniconta.ClientTools.Localization.lookup("SaveChangesPrompt"); CWConfirmationBox confirmationDialog = new CWConfirmationBox(message); confirmationDialog.Closing += async delegate { if (confirmationDialog.DialogResult == null) { return; } switch (confirmationDialog.ConfirmationResult) { case CWConfirmationBox.ConfirmationResultEnum.Yes: await dgDebtorOffers.SaveData(); break; case CWConfirmationBox.ConfirmationResultEnum.No: break; } editAllChecked = true; dgDebtorOffers.Readonly = true; dgDebtorOffers.tableView.CloseEditor(); iBase.Caption = Uniconta.ClientTools.Localization.lookup("EditAll"); ribbonControl.DisableButtons(new string[] { "AddLine", "CopyRow", "DeleteRow", "SaveGrid" }); }; confirmationDialog.Show(); } else { dgDebtorOffers.Readonly = true; dgDebtorOffers.tableView.CloseEditor(); iBase.Caption = Uniconta.ClientTools.Localization.lookup("EditAll"); ribbonControl.DisableButtons(new string[] { "AddLine", "CopyRow", "DeleteRow", "SaveGrid" }); } } }
public void CreateUserField(TableField[] UserFieldDef, bool hasKeyFields, CrudAPI api, string pkPromptHeaderKey) { if (hasKeyFields) { UserFieldControl.CreateKeyFieldsGroupOnPage2(layoutItems, pkPromptHeaderKey, true); } if (UserFieldDef != null) { UserFieldControl.CreateUserFieldOnPage2(layoutItems, UserFieldDef, (RowIndexConverter)this.Resources["RowIndexConverter"], api, this, true); } }
void setUserFields() { var row = new InvItemClient(); row.SetMaster(api.CompanyEntity); var UserFieldDef = row.UserFieldDef(); if (UserFieldDef != null) { UserFieldControl.CreateUserFieldOnPage2(layoutItems, UserFieldDef, (RowIndexConverter)this.Resources["RowIndexConverter"], this.api, this, true, invDtlLastGroup); } }
void setUserFields() { var row = new DebtorClient(); row.SetMaster(api.CompanyEntity); var UserFieldDef = row.UserFieldDef(); if (UserFieldDef != null) { UserFieldControl.CreateUserFieldOnPage2(layoutItems, UserFieldDef, (RowIndexConverter)this.Resources["RowIndexConverter"], this.api, true, lastGroup); } var Comp = api.CompanyEntity; if (Comp.CRM) { crmGroup.Visibility = Visibility.Visible; GetInterestAndProduct(); } if (!Comp._UseVatOperation) { itmVatOpr.Visibility = Visibility.Collapsed; } if (!Comp.InvPrice) { priceListLayoutItem.Visibility = Visibility.Collapsed; } if (!Comp.InvClientName) { itemNameGrpLayoutItem.Visibility = Visibility.Collapsed; } if (!Comp.Shipments) { shipmentItem.Visibility = Visibility.Collapsed; } if (Comp.NumberOfDimensions == 0) { usedim.Visibility = Visibility.Collapsed; } if (!Comp.DeliveryAddress) { dAddress.Visibility = Visibility.Collapsed; } }
void CreateUserField() { if (tableheadermaster._HasPrimaryKey) { UserFieldControl.CreateKeyFieldsGroupOnPage2(layoutItems, tableheadermaster._PKprompt); } if (tableheadermaster._TableType == TableBaseType.Transaction) { UserFieldControl.CreateDateFieldGroupOnPage2(layoutItems); } var UserFieldDef = editrow.UserFieldDef(); if (UserFieldDef != null) { UserFieldControl.CreateUserFieldOnPage2(layoutItems, UserFieldDef, (RowIndexConverter)this.Resources["RowIndexConverter"], this.api, this); } if (tableheadermaster._MasterTable != null) { int _tableId = editrow.MasterTableId; var RefType = editrow.MasterType; if (RefType == null && _tableId != 0) { RefType = typeof(Uniconta.DataModel.TableDataWithKey); liMasterKey.FieldName = Uniconta.ClientTools.Localization.lookup(tableheadermaster._MasterTable); liMasterName.FieldName = Uniconta.ClientTools.Localization.lookup("Name"); } lookupMasterKey.api = this.api; lookupMasterKey.SetForeignKeyRef(RefType, _tableId); } else { lookupMasterKey.IsEnabled = false; grpMaster.Visibility = System.Windows.Visibility.Collapsed; } }
public override void SetParameter(IEnumerable <ValuePair> Parameters) { string tablename = null; foreach (var param in Parameters) { var paramName = param.Name; var paramValue = param.Value; if (string.IsNullOrEmpty(paramName) || string.Compare(param.Name, "table", StringComparison.OrdinalIgnoreCase) == 0) { tablename = paramValue; break; } } if (tablename != null) { foreach (var master in api.CompanyEntity.UserTables) { if (master._Name == tablename) { string header = master._Prompt != null?UserFieldControl.LocalizePrompt(master._Prompt) : master._Name; this.SetHeader(header); this.thMaster = master; Layout._SubId = api.CompanyId; this.layoutname = header; if (!isInitialized) { Initialize(thMaster, null); } break; } } } base.SetParameter(Parameters); }
private void EditAll() { RibbonBase rb = (RibbonBase)localMenu.DataContext; var ibase = UtilDisplay.GetMenuCommandByName(rb, "EditAll"); if (ibase == null) { return; } if (dgDebtorTransOpen.Readonly) { api.AllowBackgroundCrud = false; dgDebtorTransOpen.MakeEditable(); UserFieldControl.MakeEditable(dgDebtorTransOpen); ibase.Caption = Uniconta.ClientTools.Localization.lookup("LeaveEditAll"); ribbonControl.EnableButtons("SaveGrid"); copyRowIsEnabled = true; editAllChecked = false; #if !SILVERLIGHT OnHold.ShowCheckBoxInHeader = Paid.ShowCheckBoxInHeader = true; #endif } else { #if !SILVERLIGHT OnHold.ShowCheckBoxInHeader = Paid.ShowCheckBoxInHeader = false; #endif if (IsDataChaged) { string message = Uniconta.ClientTools.Localization.lookup("SaveChangesPrompt"); CWConfirmationBox confirmationDialog = new CWConfirmationBox(message); confirmationDialog.Closing += async delegate { if (confirmationDialog.DialogResult == null) { return; } switch (confirmationDialog.ConfirmationResult) { case CWConfirmationBox.ConfirmationResultEnum.Yes: var err = await dgDebtorTransOpen.SaveData(); if (err != 0) { api.AllowBackgroundCrud = true; return; } break; case CWConfirmationBox.ConfirmationResultEnum.No: break; } editAllChecked = true; dgDebtorTransOpen.Readonly = true; dgDebtorTransOpen.tableView.CloseEditor(); ibase.Caption = Uniconta.ClientTools.Localization.lookup("EditAll"); ribbonControl.DisableButtons("SaveGrid"); copyRowIsEnabled = false; }; confirmationDialog.Show(); } else { dgDebtorTransOpen.Readonly = true; dgDebtorTransOpen.tableView.CloseEditor(); ibase.Caption = Uniconta.ClientTools.Localization.lookup("EditAll"); ribbonControl.DisableButtons("SaveGrid"); copyRowIsEnabled = false; } } }
private void localMenu_OnItemClicked(string ActionType) { var selectedItem = dgUserTable.SelectedItem as TableHeaderClient; switch (ActionType) { case "AddRow": object[] param = new object[2]; param[0] = api; param[1] = null; AddDockItem(TabControls.UserTablePage2, param, Uniconta.ClientTools.Localization.lookup("UserTables"), "Add_16x16.png"); break; case "EditRow": if (selectedItem != null && selectedItem._SharedFromCompanyId == 0) { AddDockItem(TabControls.UserTablePage2, selectedItem, string.Format("{0}:{1}", Localization.lookup("UserTables"), selectedItem.Name)); } break; case "Fields": if (selectedItem != null && selectedItem._SharedFromCompanyId == 0) { AddDockItem(TabControls.TablesUserFields, selectedItem, string.Format("{0}:{1}", Localization.lookup("UserFields"), selectedItem.Name)); } break; case "Data": if (selectedItem == null) { return; } var tablePrompt = !string.IsNullOrEmpty(selectedItem._Prompt) ? UserFieldControl.LocalizePrompt(selectedItem._Prompt) : selectedItem._Name; AddDockItem(TabControls.UserTableData, selectedItem, string.Format("{0}:{1}", Localization.lookup("Data"), tablePrompt)); break; case "CalculatedFields": if (selectedItem == null) { return; } var tablePromp = !string.IsNullOrEmpty(selectedItem._Prompt) ? UserFieldControl.LocalizePrompt(selectedItem._Prompt) : selectedItem._Name; if (selectedItem.UserType != null) { var rec = (TableData)Activator.CreateInstance(selectedItem.UserType); rec.SetMaster(api.CompanyEntity); AddDockItem(TabControls.TablePropertyPage, rec, string.Format("{0}:{1}", Localization.lookup("CalculatedFields"), tablePromp)); } break; case "CopyUserTable": CWCopyUserFields winUserFields = new CWCopyUserFields(api); winUserFields.Closed += async delegate { if (winUserFields.DialogResult == true) { await session.OpenCompany(api.CompanyEntity.CompanyId, false); InitQuery(); } }; winUserFields.Show(); break; case "BaseClass": if (selectedItem != null) { GenerateClass(selectedItem, true); } break; case "ClientClass": if (selectedItem != null) { GenerateClass(selectedItem, false); } break; case "SharedToCompany": if (selectedItem != null && selectedItem._SharedFromCompanyId == 0) { AddDockItem(TabControls.TableHeaderSharePage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("SharedToCompany"), selectedItem._Name)); } break; default: gridRibbon_BaseActions(ActionType); break; } }