예제 #1
0
        private void copyMandatoryFieldsToEntity(PartNumberConfigurationModel mandatoryFields)
        {
            if (!ActiveEntity.IsNotNullOrEmpty() || !mandatoryFields.IsNotNullOrEmpty())
            {
                return;
            }


            ActiveEntity.Code          = mandatoryFields.Code;
            ActiveEntity.Description   = mandatoryFields.Description;
            ActiveEntity.Location_code = mandatoryFields.Location_code;
            ActiveEntity.Prefix        = mandatoryFields.Prefix;
            ActiveEntity.BeginningNo   = mandatoryFields.BeginningNo;
            ActiveEntity.EndingNo      = mandatoryFields.EndingNo;
        }
예제 #2
0
        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();
            }
        }