public frmPartNumberConfig(UserInformation userInformation, System.Windows.Window window, int entityPrimaryKey, OperationMode operationMode, string title = "Part Number Configuration") { try { InitializeComponent(); CustPartNoDescription.Focus(); PartNumberCode = entityPrimaryKey; PartNumberConfigViewModel vm = new PartNumberConfigViewModel(userInformation, PartNumberCode, operationMode); this.DataContext = vm; window.Closing += vm.CloseMethodWindow; if (vm.CloseAction == null && window.IsNotNullOrEmpty()) { vm.CloseAction = new Action(() => window.Close()); } bll = new PartNumberConfiguration(userInformation); List <ProcessDesigner.Model.V_TABLE_DESCRIPTION> lstTableDescription = bll.GetTableColumnsSize("PartNumberConfig"); this.SetColumnLength <TextBox>(lstTableDescription); } catch (Exception ex) { throw ex.LogException(); } }
public frmPartNumberConfig(UserInformation userInformation, WPF.MDI.MdiChild mdiChild) { try { InitializeComponent(); CustPartNoDescription.Focus(); PartNumberCode = 0; PartNumberConfigViewModel vm = new PartNumberConfigViewModel(userInformation, PartNumberCode, OperationMode.AddNew); this.DataContext = vm; mdiChild.Closing += vm.CloseMethod; if (vm.CloseAction == null) { vm.CloseAction = new Action(() => mdiChild.Close()); } bll = new PartNumberConfiguration(userInformation); List <ProcessDesigner.Model.V_TABLE_DESCRIPTION> lstTableDescription = bll.GetTableColumnsSize("PartNumberConfig"); this.SetColumnLength <TextBox>(lstTableDescription); } catch (Exception ex) { throw ex.LogException(); } }
public PartNumberConfigViewModel(UserInformation userInformation, int entityPrimaryKey, OperationMode operationMode) { try { bll = new PartNumberConfiguration(userInformation); ActiveEntity = new PartNumberConfig(); MandatoryFields = new PartNumberConfigurationModel(); OldMandatoryFields = new PartNumberConfigurationModel(); DropDownItems = new ObservableCollection <DropdownColumns>() { //new DropdownColumns() { ColumnName = "Code", ColumnDesc = "Code", ColumnWidth = "1*" }, new DropdownColumns() { ColumnName = "Location_code", ColumnDesc = "Location", ColumnWidth = 76 }, new DropdownColumns() { ColumnName = "Description", ColumnDesc = "Category", ColumnWidth = 125 }, new DropdownColumns() { ColumnName = "IsObsolete", ColumnDesc = "Mark as Obsolete", ColumnWidth = 81 }, new DropdownColumns() { ColumnName = "Prefix", ColumnDesc = "Prefix", ColumnWidth = 67 }, new DropdownColumns() { ColumnName = "BeginningNo", ColumnDesc = "Starting No.", ColumnWidth = 85 }, new DropdownColumns() { ColumnName = "EndingNo", ColumnDesc = "Ending No.", ColumnWidth = 74 } }; LocationdropDownItems = new ObservableCollection <DropdownColumns>() { new DropdownColumns() { ColumnName = "LOC_CODE", ColumnDesc = "Loc. Code", ColumnWidth = 90 }, new DropdownColumns() { ColumnName = "LOCATION", ColumnDesc = "Loc. Name", ColumnWidth = "1*" } }; ActiveEntity.ID = entityPrimaryKey; ActionPermission = bll.GetUserRights(RIGHTS_NAME); ActionPermission.AddNew = true; ActionPermission.Edit = true; ActionPermission.Save = true; ActionPermission.Close = true; LocationCustomDropDownDataSource = bll.GetLocationsByCode().ToDataTable <DDLOC_MAST>().DefaultView; this.selectedItemChangedCommand = new DelegateCommand(this.SelectDataRow); this.addNewCommand = new DelegateCommand(this.AddNewSubmitCommand); this.editCommand = new DelegateCommand(this.EditSubmitCommand); this.viewCommand = new DelegateCommand(this.ViewSubmitCommand); this.deleteCommand = new DelegateCommand(this.DeleteSubmitCommand); this.saveCommand = new DelegateCommand(this.SaveSubmitCommand); this.printCommand = new DelegateCommand(this.PrintSubmitCommand); this._closeCommand = new DelegateCommand(this.Close); ActionMode = operationMode; switch (ActionMode) { case OperationMode.AddNew: AddNewSubmitCommand(); break; case OperationMode.Edit: EditSubmitCommand(); break; case OperationMode.Delete: DeleteSubmitCommand(); break; case OperationMode.View: ViewSubmitCommand(); break; case OperationMode.Print: PrintSubmitCommand(); break; case OperationMode.Save: SaveSubmitCommand(); break; //case OperationMode.Close: CloseSubmitCommand(); break; } GetRights(); setRights(); } catch (Exception ex) { throw ex.LogException(); } }