Exemple #1
0
        private void gridView1_MasterRowExpanded(object sender, CustomMasterRowEventArgs e)
        {
            PositionViewModel model;

            if (!(sender is GridView gridView))
            {
                return;
            }
            var detailView = (GridView)gridView.GetDetailView(e.RowHandle, e.RelationIndex);

            detailView.ShowingEditor -= gridView1_ShowingEditor;
            detailView.ShowingEditor += gridView1_ShowingEditor;

            detailView.RowUpdated -= detailView_RowUpdated;
            detailView.RowUpdated += detailView_RowUpdated;

            detailView.RowDeleting -= detailView_RowDeleting;
            detailView.RowDeleting += detailView_RowDeleting;

            detailView.ValidateRow -= detailView_ValidateRow;
            detailView.ValidateRow += detailView_ValidateRow;

            detailView.InvalidRowException -= detailView_InvalidRowException;
            detailView.InvalidRowException += detailView_InvalidRowException;

            detailView.Columns[nameof(model.LatestInStockNumber)].Visible = false;

            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.PositionName)]);
            //RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.Total)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.LatestInStockNumber)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.UpdateDate)]); RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.Comment)]);
        }
        //GridView Color
        private void detailView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            PurchaseApplicationViewModel model;
            GridView currentView = sender as GridView;

            if (e.Column.FieldName == nameof(model.AuditStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(model.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(model.ProcessStatus)).ToString(), out ProcessStatusEnum processStatus);
                if (auditStatus == AuditStatusEnum.已审批)
                {
                    e.Appearance.BackColor = Color.GreenYellow;
                }
                if (auditStatus == AuditStatusEnum.未审批)
                {
                    e.Appearance.BackColor = Color.OrangeRed;
                }
            }

            if (e.Column.FieldName == nameof(model.TotalConfirmed))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(model.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);
                double totalConfirm = (double)currentView.GetRowCellValue(e.RowHandle, nameof(model.TotalConfirmed));
                if (totalConfirm <= 0)
                {
                    e.Appearance.BackColor = Color.Red;
                }
            }

            if (e.Column.FieldName == nameof(model.ProcessStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(model.ProcessStatus)).ToString(), out ProcessStatusEnum processStatus);
                RenderCommonHelper.SetStatusColor(processStatus, e);
            }
        }
Exemple #3
0
        //Register detailView
        private void gridControl1_ViewRegistered(object sender, DevExpress.XtraGrid.ViewOperationEventArgs e)
        {
            GridView detailView = e.View as GridView;

            detailView.OptionsSelection.MultiSelect = false;

            detailView.RowCellStyle -= detailView1_RowCellStyle;
            detailView.RowCellStyle += detailView1_RowCellStyle;

            detailView.Columns[nameof(childModel.RequestId)].Visible    = false;
            detailView.Columns[nameof(childModel.PurchaseId)].Visible   = false;
            detailView.Columns[nameof(childModel.PositionName)].Visible = false;
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Name)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Code)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Brand)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Model)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Specification)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Dimension)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Unit)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Price)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Total)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.TotalPrice)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.PositionName)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.ProcessStatus)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.UpdateDate)]);

            detailView.Columns[nameof(childModel.Price)].DisplayFormat.FormatType        = FormatType.Numeric;
            detailView.Columns[nameof(childModel.Price)].DisplayFormat.FormatString      = "c2";
            detailView.Columns[nameof(childModel.TotalPrice)].DisplayFormat.FormatType   = FormatType.Numeric;
            detailView.Columns[nameof(childModel.TotalPrice)].DisplayFormat.FormatString = "c2";
        }
        private void gridView_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            GridView currentView = sender as GridView;

            if (e.Column.FieldName == nameof(parentModel.AuditStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);
                if (auditStatus == AuditStatusEnum.已审批)
                {
                    e.Appearance.BackColor = Color.GreenYellow;
                }
                if (auditStatus == AuditStatusEnum.未审批)
                {
                    e.Appearance.BackColor = Color.OrangeRed;
                }
            }

            if (e.Column.FieldName == nameof(parentModel.Status))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.Status)).ToString(), out ProcessStatusEnum processStatus);
                RenderCommonHelper.SetStatusColor(processStatus, e);
            }
            if (e.Column.FieldName == nameof(parentModel.CompletePercentage))
            {
                decimal CompletePercentage = (decimal)currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.CompletePercentage));
                if (CompletePercentage == 1)
                {
                    e.Appearance.BackColor = Color.LawnGreen;
                }
                else
                {
                    e.Appearance.BackColor = Color.DarkOrange;
                }
            }
        }
        public PurchaseCtrl(IPurchaseService purchaseService, IManagementService managementService)
        {
            _purchaseService   = purchaseService;
            _managementService = managementService;

            InitializeComponent();
            this.Dock = DockStyle.Fill;
            SetCurrentRequestCategory(RequestCategoriesEnum.材料需求);
            //this.gridControl1.DataSource = _purchaseService.GetAllPurchaseViewModels();
            //RefreshData();

            colApplicationNumber.Visible = false;
            colAuditDepart.Visible       = false;
            RenderCommonHelper.SetColNotEditable(colPurchaseNumber);
            RenderCommonHelper.SetColNotEditable(colApplicationNumber);
            RenderCommonHelper.SetColNotEditable(colPONumber);
            RenderCommonHelper.SetColNotEditable(colSupplierName);
            RenderCommonHelper.SetColNotEditable(colPriority);
            RenderCommonHelper.SetColNotEditable(colPurchaseType);
            RenderCommonHelper.SetColNotEditable(colTotalPrice);
            RenderCommonHelper.SetColNotEditable(colCompletePercentage);
            RenderCommonHelper.SetColNotEditable(colDeliveryDate);
            RenderCommonHelper.SetColNotEditable(colCreateDate);
            RenderCommonHelper.SetColNotEditable(colUpdateDate);

            colCompletePercentage.DisplayFormat.FormatType   = FormatType.Numeric;
            colCompletePercentage.DisplayFormat.FormatString = "P";
            //_positionRepItem = new RepositoryItemLookUpEdit();
            _refreshHelper = new RefreshHelper(gridView1, nameof(parentModel.PurchaseNumber).ToString());
        }
        protected virtual void detailView_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
        {
            GridView detailView = sender as GridView;

            Enum.TryParse(detailView.GetRowCellValue(e.RowHandle, nameof(childModel.Status)).ToString(), out ProcessStatusEnum processStatus);
            if (e.Column.FieldName == nameof(childModel.Price))
            {
                switch (processStatus)
                {
                case ProcessStatusEnum.采购入库:
                    RenderCommonHelper.SetColNotEditable(e.Column);
                    break;

                default:
                    RenderCommonHelper.SetColEditable(e.Column);
                    break;
                }
            }
            else if (e.Column.FieldName == nameof(childModel.ReadyForInStock))
            {
                switch (processStatus)
                {
                case ProcessStatusEnum.采购入库:
                    RenderCommonHelper.SetColNotEditable(e.Column);
                    break;

                default:
                    RenderCommonHelper.SetColEditable(e.Column);
                    break;
                }
            }
        }
        protected override void detailView_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
        {
            base.detailView_CustomRowCellEdit(sender, e);

            GridView detailView = sender as GridView;

            Enum.TryParse(detailView.GetRowCellValue(e.RowHandle, nameof(parentModel.Status)).ToString(), out ProcessStatusEnum processStatus);
            Enum.TryParse(detailView.GetRowCellValue(e.RowHandle, nameof(parentModel.RequestCategory)).ToString(), out RequestCategoriesEnum requestCategory);


            if (e.Column.FieldName == nameof(childModel.ToOutStockTotal))
            {
                RenderCommonHelper.SetColNotEditable(e.Column);
            }
            if (e.Column.FieldName == nameof(childModel.ToInStockTotal))
            {
                switch (processStatus)
                {
                case ProcessStatusEnum.借出出库:
                    RenderCommonHelper.SetColEditable(e.Column);
                    break;

                default:
                    RenderCommonHelper.SetColNotEditable(e.Column);
                    break;
                }
            }
        }
Exemple #8
0
        public RequestHeadersCtrl(IRequestService requestService, IManagementService managementService)
        {
            _requestService    = requestService;
            _managementService = managementService;
            InitializeComponent();
            this.Dock = DockStyle.Fill;

            gridView1.OptionsSelection.MultiSelect     = true;
            gridView1.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect;

            colCreateDate.Visible      = false;
            colRequestCategory.Visible = false;
            RenderCommonHelper.SetColNotEditable(colRequestHeaderNumber);
            RenderCommonHelper.SetColNotEditable(colRequestCategory);
            RenderCommonHelper.SetColNotEditable(colPONumber);
            //RenderCommonHelper.SetColNotEditable(colContractId);
            //RenderCommonHelper.SetColNotEditable(colContractAddress);
            RenderCommonHelper.SetColNotEditable(colTotal);
            RenderCommonHelper.SetColNotEditable(colStatus);
            RenderCommonHelper.SetColNotEditable(colLockStatus);
            RenderCommonHelper.SetColNotEditable(colCreateDate);
            RenderCommonHelper.SetColNotEditable(colUpdateDate);

            colCompletePercentage.DisplayFormat.FormatType = FormatType.Numeric; colCompletePercentage.DisplayFormat.FormatString = "P";

            _refreshHelper = new RefreshHelper(gridView1, nameof(parentModel.RequestHeaderNumber).ToString());
        }
Exemple #9
0
        private void gridView_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            GridView currentView = sender as GridView;

            if (e.Column.FieldName == nameof(parentModel.InStockCategory))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.InStockCategory)).ToString(), out RequestCategoriesEnum requestCategories);
                RenderCommonHelper.SetCategoryColor(requestCategories, e);
            }
        }
Exemple #10
0
        protected void detailView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            GridView currentView = sender as GridView;

            e.Appearance.BackColor = Color.Beige;
            if (e.Column.FieldName == nameof(childModel.ProcessStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.ProcessStatus)).ToString(), out ProcessStatusEnum processStatus);
                RenderCommonHelper.SetStatusColor(processStatus, e);
            }
        }
Exemple #11
0
        public ContractManagementCtrl(IManagementService managemntService)
        {
            _managemntService = managemntService;
            InitializeComponent();
            this.Dock = DockStyle.Fill;
            this.gridControl1.DataSource = _managemntService.GetAllPoNumbers();

            colPOId.Visible = false;
            RenderCommonHelper.SetColNotEditable(colCreateDate);
            RenderCommonHelper.SetColNotEditable(colUpdateDate);

            _refreshHelper = new RefreshHelper(gridView1, nameof(parentModel.PoNumber).ToString());
        }
Exemple #12
0
        public InDeliveryCtrl(IStockService stockService)
        {
            _stockService  = stockService;
            _refreshHelper = new RefreshHelper(gridView1, nameof(parentModel.OutStockNumber).ToString());

            InitializeComponent();
            this.Dock = DockStyle.Fill;
            //this.gridControl1.DataSource = _stockService.GetAllOutInstock();

            RenderCommonHelper.SetColNotEditable(colOutStockCategory);
            RenderCommonHelper.SetColNotEditable(colRequestNumber);
            RenderCommonHelper.SetColNotEditable(colAddress);
            RenderCommonHelper.SetColNotEditable(colContractNumber);
        }
Exemple #13
0
        public InStockCtrl(IStockService stockService)
        {
            _stockService  = stockService;
            _refreshHelper = new RefreshHelper(gridView1, nameof(parentModel.InStockNumber).ToString());

            InitializeComponent();
            this.Dock = DockStyle.Fill;
            //this.gridControl1.DataSource = _stockService.GetAllInstock();

            RenderCommonHelper.SetColNotEditable(colInStockNumber);
            RenderCommonHelper.SetColNotEditable(colPoNumber);
            RenderCommonHelper.SetColNotEditable(colPurchaseNumber);
            RenderCommonHelper.SetColNotEditable(colRequestNumber);
            RenderCommonHelper.SetColNotEditable(colContractNumber);
            RenderCommonHelper.SetColNotEditable(colSupplierName);
            RenderCommonHelper.SetColNotEditable(colInStockCategory);
            RenderCommonHelper.SetColNotEditable(colCreateDate);
        }
        protected virtual void detailView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
        {
            GridView currentView = sender as GridView;

            if (e.Column.FieldName == nameof(childModel.SupplierName))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);
                if (auditStatus == AuditStatusEnum.已审批)
                {
                    RenderCommonHelper.SetColNotEditable(e.Column);
                }
                if (auditStatus == AuditStatusEnum.未审批)
                {
                    RenderCommonHelper.SetColEditable(e.Column);
                }
            }

            if (e.Column.FieldName == nameof(childModel.TotalConfirmed))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);
                if (auditStatus == AuditStatusEnum.已审批)
                {
                    RenderCommonHelper.SetColNotEditable(e.Column);
                }
                if (auditStatus == AuditStatusEnum.未审批)
                {
                    RenderCommonHelper.SetColEditable(e.Column);
                }
            }

            if (e.Column.FieldName == nameof(childModel.AuditStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.ProcessStatus)).ToString(), out ProcessStatusEnum processStatus);
                if (processStatus == ProcessStatusEnum.申请审核中)
                {
                    RenderCommonHelper.SetColEditable(e.Column);
                }
                if (processStatus != ProcessStatusEnum.申请审核中)
                {
                    RenderCommonHelper.SetColNotEditable(e.Column);
                }
            }
        }
        protected override void gridView1_MasterRowExpanded(object sender, CustomMasterRowEventArgs e)
        {
            base.gridView1_MasterRowExpanded(sender, e);

            GridView gridView   = sender as GridView;
            GridView detailView = (GridView)gridView.GetDetailView(e.RowHandle, e.RelationIndex);

            gridView.Columns[nameof(parentModel.PoNumber)].Visible        = false;
            gridView.Columns[nameof(parentModel.ContractId)].Visible      = false;
            gridView.Columns[nameof(parentModel.ContractAddress)].Visible = false;

            detailView.Columns[nameof(childModel.RequestId)].Visible    = false;
            detailView.Columns[nameof(childModel.ItemId)].Visible       = false;
            detailView.Columns[nameof(childModel.ToApplyTotal)].Visible = false;
            detailView.Columns[nameof(childModel.ToDestroy)].Visible    = false;


            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(subChildModel.PositionName)]);
        }
Exemple #16
0
        protected virtual void detailView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            GridView currentView = sender as GridView;

            e.Appearance.BackColor = Color.Beige;
            if (e.Column.FieldName == nameof(childModel.Status))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.Status)).ToString(), out ProcessStatusEnum processStatus);
                RenderCommonHelper.SetStatusColor(processStatus, e);
            }
            if (e.Column.FieldName == nameof(childModel.ToOutStockTotal))
            {
                var toOutStockTotal = (double)currentView.GetRowCellValue(e.RowHandle, nameof(childModel.ToOutStockTotal));
                e.Appearance.BackColor = toOutStockTotal > 0 ? Color.LawnGreen : Color.DarkOrange;
            }
            if (e.Column.FieldName == nameof(childModel.AvailableInStorage))
            {
                var maxDisplay = (double)currentView.GetRowCellValue(e.RowHandle, nameof(childModel.AvailableInStorage));
                //e.Appearance.BackColor = maxDisplay.Contains("+") ? Color.LawnGreen : Color.DarkOrange;
                e.Appearance.BackColor = maxDisplay > 0? Color.LawnGreen : Color.DarkOrange;
            }
            if (e.Column.FieldName == nameof(childModel.DestoriedTotal))
            {
                var destoriedTotal = (double)currentView.GetRowCellValue(e.RowHandle, nameof(childModel.DestoriedTotal));
                if (destoriedTotal > 0)
                {
                    e.Appearance.BackColor = Color.Red;
                }
            }

            if (e.Column.FieldName == nameof(childModel.LockStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.LockStatus)).ToString(), out LockStatusEnum lockStatus);
                if (lockStatus == LockStatusEnum.已准备)
                {
                    e.Appearance.BackColor = Color.LightGreen;
                }
                else
                {
                    e.Appearance.BackColor = Color.LightYellow;
                }
            }
        }
        private void detailView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            GridView currentView = sender as GridView;

            e.Appearance.BackColor = Color.Beige;
            ProcessStatusEnum status = (ProcessStatusEnum)currentView.GetRowCellValue(e.RowHandle, nameof(childModel.Status));

            if (e.Column.FieldName == nameof(childModel.Status))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.Status)).ToString(), out ProcessStatusEnum processStatus);
                RenderCommonHelper.SetStatusColor(processStatus, e);
            }

            if (e.Column.FieldName == nameof(childModel.Price))
            {
                bool isPriceChange = (bool)currentView.GetRowCellValue(e.RowHandle, nameof(childModel.IsPriceChange));
                if (isPriceChange)
                {
                    e.Appearance.BackColor = Color.OrangeRed;
                }
            }
        }
        public PurchaseApplicationCtrl(IPurchaseService purchaseService, IManagementService managementService)
        {
            _purchaseService   = purchaseService;
            _managementService = managementService;
            InitializeComponent();
            this.Dock = DockStyle.Fill;
            SetCurrentRequestCategory(RequestCategoriesEnum.材料需求);

            RenderCommonHelper.SetColNotEditable(colApplicationNumber);
            RenderCommonHelper.SetColNotEditable(colRequestHeaderNumber);
            RenderCommonHelper.SetColNotEditable(colPoNumber);
            RenderCommonHelper.SetColNotEditable(colTotalApplied);
            RenderCommonHelper.SetColNotEditable(colTotalConfirmed);
            RenderCommonHelper.SetColNotEditable(colAuditStatus);
            RenderCommonHelper.SetColNotEditable(colStatus);
            RenderCommonHelper.SetColNotEditable(colCompletePercentage);
            RenderCommonHelper.SetColNotEditable(colCreateDate);
            RenderCommonHelper.SetColNotEditable(colUpdateDate);

            colCompletePercentage.DisplayFormat.FormatType = FormatType.Numeric; colCompletePercentage.DisplayFormat.FormatString = "P";
            _refreshHelper = new RefreshHelper(gridView1, nameof(parentModel.ApplicationNumber));
        }
Exemple #19
0
        private void gridView_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            GridView currentView = sender as GridView;

            if (e.Column.FieldName == nameof(parentModel.Status))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.Status)).ToString(), out ProcessStatusEnum processStatus);
                RenderCommonHelper.SetStatusColor(processStatus, e);
            }
            if (e.Column.FieldName == nameof(parentModel.RequestCategory))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.RequestCategory)).ToString(), out RequestCategoriesEnum requestCategories);
                RenderCommonHelper.SetCategoryColor(requestCategories, e);
            }
            if (e.Column.FieldName == nameof(parentModel.CompletePercentage))
            {
                decimal CompletePercentage = (decimal)currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.CompletePercentage));
                if (CompletePercentage == 1)
                {
                    e.Appearance.BackColor = Color.LawnGreen;
                }
                else
                {
                    e.Appearance.BackColor = Color.DarkOrange;
                }
            }
            if (e.Column.FieldName == nameof(parentModel.LockStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.LockStatus)).ToString(), out LockStatusEnum lockStatus);
                if (lockStatus == LockStatusEnum.已准备)
                {
                    e.Appearance.BackColor = Color.LightGreen;
                }
                else
                {
                    e.Appearance.BackColor = Color.LightYellow;
                }
            }
        }
Exemple #20
0
        protected override void gridControl1_ViewRegistered(object sender, DevExpress.XtraGrid.ViewOperationEventArgs e)
        {
            base.gridControl1_ViewRegistered(sender, e);

            GridView detailView = e.View as GridView;

            if (detailView.Columns[0].Name != "colPositionName")
            {
                detailView.Columns[nameof(childModel.ToInStockTotal)].Visible   = false;
                detailView.Columns[nameof(childModel.ToDestoryTotal)].Visible   = false;
                detailView.Columns[nameof(childModel.DestoriedTotal)].Visible   = false;
                detailView.Columns[nameof(childModel.FixAddress)].Visible       = false;
                detailView.Columns[nameof(childModel.Phone)].Visible            = false;
                detailView.Columns[nameof(childModel.Contact)].Visible          = false;
                detailView.Columns[nameof(childModel.FixingPrice)].Visible      = false;
                detailView.Columns[nameof(childModel.FixingDays)].Visible       = false;
                detailView.Columns[nameof(childModel.FixingFinishDate)].Visible = false;
                detailView.Columns[nameof(childModel.ToDestroy)].Visible        = false;

                RenderCommonHelper.SetColEditable(detailView.Columns[nameof(childModel.PositionName)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.ToInStockTotal)]);
            }
        }
Exemple #21
0
        private void gridView1_MasterRowExpanded(object sender, CustomMasterRowEventArgs e)
        {
            ContractViewModel model;
            GridView          gridView   = sender as GridView;
            GridView          detailView = (GridView)gridView.GetDetailView(e.RowHandle, e.RelationIndex);

            detailView.MasterRowExpanding -= detailView_MasterRowExpanding;
            detailView.MasterRowExpanding += detailView_MasterRowExpanding;

            detailView.MasterRowExpanded -= detailView_MasterRowExpanded;
            detailView.MasterRowExpanded += detailView_MasterRowExpanded;

            detailView.RowUpdated -= detailView1_RowUpdated;
            detailView.RowUpdated += detailView1_RowUpdated;

            detailView.Columns[nameof(model.Id)].Visible = false;

            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.Id)]);
            RenderCommonHelper.SetColEditable(detailView.Columns[nameof(model.ContractNumber)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.CreateDate)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(model.UpdateDate)]);

            SplashScreenManager.CloseDefaultWaitForm();
        }
Exemple #22
0
        //Register detailView
        protected virtual void gridControl1_ViewRegistered(object sender, DevExpress.XtraGrid.ViewOperationEventArgs e)
        {
            GridView detailView = e.View as GridView;

            if (detailView.Columns[0].Name == "colPositionName")
            {
                detailView.OptionsSelection.MultiSelect = false;
                if (detailView != null)
                {
                    detailView.RowUpdated -= positionView_RowUpdated;
                    detailView.RowUpdated += positionView_RowUpdated;

                    detailView.ShowingEditor -= gridView1_ShowingEditor;
                    detailView.ShowingEditor += gridView1_ShowingEditor;

                    detailView.ValidateRow -= positionView_ValidateRow;
                    detailView.ValidateRow += positionView_ValidateRow;
                }

                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(subChildModel.PositionName)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(subChildModel.UpdateDate)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(subChildModel.LatestInStockNumber)]);
            }

            else
            {
                detailView.OptionsSelection.MultiSelect     = true;
                detailView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect;

                detailView.MasterRowGetRelationDisplayCaption -= detailView1_MasterRowGetRelationDisplayCaption;
                detailView.MasterRowGetRelationDisplayCaption += detailView1_MasterRowGetRelationDisplayCaption;

                detailView.RowCellStyle -= detailView1_RowCellStyle;
                detailView.RowCellStyle += detailView1_RowCellStyle;

                detailView.CustomRowCellEdit -= detailView_CustomRowCellEdit;
                detailView.CustomRowCellEdit += detailView_CustomRowCellEdit;

                detailView.SelectionChanged -= detailView_SelectionChanged;
                detailView.SelectionChanged += detailView_SelectionChanged;

                detailView.RowUpdated -= detailView_RowUpdated;
                detailView.RowUpdated += detailView_RowUpdated;

                detailView.MasterRowExpanding -= detailView_MasterRowExpanding;
                detailView.MasterRowExpanding += detailView_MasterRowExpanding;

                detailView.MasterRowExpanded -= detailView_MasterRowExpanded;
                detailView.MasterRowExpanded += detailView_MasterRowExpanded;

                detailView.ValidateRow -= detailView_ValidateRow;
                detailView.ValidateRow += detailView_ValidateRow;

                detailView.InvalidRowException -= detailView_InvalidRowException;
                detailView.InvalidRowException += detailView_InvalidRowException;


                //Invisable
                detailView.Columns[nameof(childModel.RequestId)].Visible       = false;
                detailView.Columns[nameof(childModel.ItemId)].Visible          = false;
                detailView.Columns[nameof(childModel.PoNumber)].Visible        = false;
                detailView.Columns[nameof(childModel.RequestNumber)].Visible   = false;
                detailView.Columns[nameof(childModel.RequestCategory)].Visible = false;
                detailView.Columns[nameof(childModel.Max)].Visible             = false;
                detailView.Columns[nameof(childModel.AvailableInStorage)].AppearanceCell.TextOptions.HAlignment = HorzAlignment.Far;
                detailView.Columns[nameof(childModel.SerialNumber)].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;

                ////Editable
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.SerialNumber)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.RequestNumber)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.RequestCategory)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.TotalInStorage)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.AvailableInStorage)]);


                RenderCommonHelper.SetColEditable(detailView.Columns[nameof(childModel.ToInStockTotal)]);
                RenderCommonHelper.SetColEditable(detailView.Columns[nameof(childModel.ToOutStockTotal)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.OutStockTotal)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.InStockTotal)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.ToDestoryTotal)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.DestoriedTotal)]);

                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.ToApplyTotal)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Name)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Code)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Unit)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Status)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.UpdateDate)]);
                RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.PoNumber)]);



                detailView.Columns.ForEach(x => x.OptionsFilter.AllowFilter = false);
            }
        }
        protected override void detailView1_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
        {
            GridView currentView = sender as GridView;

            if (e.Column.FieldName == nameof(childModel.SelectedPurchaseNumber))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);

                if (auditStatus == AuditStatusEnum.未审批)
                {
                    PurchaseApplicationViewModel model           = (PurchaseApplicationViewModel)currentView.GetRow(e.RowHandle);
                    RepositoryItemLookUpEdit     purchaseRepItem = new RepositoryItemLookUpEdit();
                    purchaseRepItem.Name          = "DropDownForPurchaseNumber";
                    purchaseRepItem.NullText      = "";
                    purchaseRepItem.ValueMember   = nameof(PurchaseModel.PurchaseNumber);
                    purchaseRepItem.DisplayMember = nameof(PurchaseModel.PurchaseNumber);
                    purchaseRepItem.DataSource    = listOfPurchaseViewModels.Where(x => x.Code == model.Code);
                    purchaseRepItem.PopulateColumns();
                    purchaseRepItem.PopupWidth = 500;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.PurchaseId)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.RequestId)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.ApplicationNumber)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.PoNumber)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Category)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Name)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Code)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Brand)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Model)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Specification)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Dimension)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Unit)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.DefaultPrice)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Price)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.TotalPrice)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.ReadyForInStock)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Status)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.IsDeleted)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.AlreadyInStock)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Position)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.Note)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.DeliveryDate)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.UpdateDate)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.IsPriceChange)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.ItemId)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.LastDeliveryDate)].Visible = false;
                    //purchaseRepItem.Columns[nameof(PurchaseModel.CorrectionTotal)].Visible = false;

                    //gridControl1.RepositoryItems.Add(positionRepItem);
                    e.RepositoryItem = purchaseRepItem;
                    purchaseRepItem.EditValueChanged -= RepositoryItemLookUpEdit1_EditValueChanged;
                    purchaseRepItem.EditValueChanged += RepositoryItemLookUpEdit1_EditValueChanged;

                    RenderCommonHelper.SetColEditable(e.Column);
                }
                else if (auditStatus == AuditStatusEnum.已审批)
                {
                    RenderCommonHelper.SetColNotEditable(e.Column);
                }
            }
            if (e.Column.FieldName == nameof(parentModel.TotalConfirmed))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(parentModel.AuditStatus)).ToString(), out AuditStatusEnum auditStatus);
                if (auditStatus == AuditStatusEnum.已审批)
                {
                    RenderCommonHelper.SetColNotEditable(e.Column);
                }
                if (auditStatus == AuditStatusEnum.未审批)
                {
                    RenderCommonHelper.SetColEditable(e.Column);
                }
            }

            if (e.Column.FieldName == nameof(parentModel.AuditStatus))
            {
                Enum.TryParse(currentView.GetRowCellValue(e.RowHandle, nameof(childModel.ProcessStatus)).ToString(), out ProcessStatusEnum processStatus);
                if (processStatus == ProcessStatusEnum.申请审核中)
                {
                    RenderCommonHelper.SetColEditable(e.Column);
                }
                if (processStatus != ProcessStatusEnum.申请审核中)
                {
                    RenderCommonHelper.SetColNotEditable(e.Column);
                }
            }
        }
        private void gridControl1_ViewRegistered(object sender, ViewOperationEventArgs e)
        {
            GridView detailView = e.View as GridView;

            detailView.OptionsSelection.MultiSelect     = true;
            detailView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect;

            detailView.RowUpdated -= detailView1_RowUpdated;
            detailView.RowUpdated += detailView1_RowUpdated;

            detailView.RowCellStyle -= detailView1_RowCellStyle;
            detailView.RowCellStyle += detailView1_RowCellStyle;

            detailView.RowDeleted -= detailView1_RowDeleted;
            detailView.RowDeleted += detailView1_RowDeleted;

            detailView.RowDeleting -= detailView1_RowDeleting;
            detailView.RowDeleting += detailView1_RowDeleting;

            detailView.CustomRowCellEdit -= detailView1_CustomRowCellEdit;
            detailView.CustomRowCellEdit += detailView1_CustomRowCellEdit;

            detailView.ValidateRow -= gridView1_ValidateRow;
            detailView.ValidateRow += gridView1_ValidateRow;

            detailView.InvalidRowException -= detailView1_InvalidRowException;
            detailView.InvalidRowException += detailView1_InvalidRowException;

            detailView.MouseDown -= detailView1_MouseDown;
            detailView.MouseDown += detailView1_MouseDown;

            detailView.SelectionChanged -= detailView1_SelectionChanged;
            detailView.SelectionChanged += detailView1_SelectionChanged;

            var colCopy = new GridColumn()
            {
                Name         = "Action",
                Visible      = true,
                VisibleIndex = 26,
                ColumnEdit   = this.repositoryItemButtonEdit1
            };


            //初始化供应商dropdownlist
            supplierRepItem          = new RepositoryItemLookUpEdit();
            supplierRepItem.Name     = "DropDownForSupplier";
            supplierRepItem.NullText = string.Empty;

            this.supplierRepItem.DataSource = _managementService.GetAllSuppliers().Select(x => x.Name);
            gridControl1.RepositoryItems.Add(supplierRepItem);;
            GridColumn aColumn = detailView.Columns[nameof(childModel.SupplierName)];

            aColumn.ColumnEdit = supplierRepItem;

            detailView.Columns.Add(colCopy);
            detailView.Columns[nameof(childModel.SelectedPurchaseNumber)].Visible = false;
            detailView.Columns[nameof(childModel.PurchaseApplicationId)].Visible  = false;
            detailView.Columns[nameof(childModel.RequestId)].Visible         = false;
            detailView.Columns[nameof(childModel.RequestNumber)].Visible     = false;
            detailView.Columns[nameof(childModel.ApplicationNumber)].Visible = false;
            detailView.Columns[nameof(childModel.RequestCategory)].Visible   = false;
            detailView.Columns[nameof(childModel.ContractNo)].Visible        = false;
            detailView.Columns[nameof(childModel.PoNumber)].Visible          = false;
            detailView.Columns[nameof(childModel.Category)].Visible          = false;
            detailView.Columns[nameof(childModel.ItemId)].Visible            = false;
            detailView.Columns[nameof(childModel.ItemId)].Visible            = false;

            detailView.Columns[nameof(childModel.SerialNumber)].SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.SerialNumber)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.PurchaseApplicationId)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.RequestCategory)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.ContractNo)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Name)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Code)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Category)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Brand)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Model)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Specification)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Dimension)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Unit)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.CurrentPurchasePrice)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Priority)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.ProcessStatus)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.TotalApplied)]);

            detailView.Columns[nameof(childModel.CurrentPurchasePrice)].DisplayFormat.FormatType   = FormatType.Numeric;
            detailView.Columns[nameof(childModel.CurrentPurchasePrice)].DisplayFormat.FormatString = "c2";
        }
        private void gridControl1_ViewRegistered(object sender, DevExpress.XtraGrid.ViewOperationEventArgs e)
        {
            GridView detailView = e.View as GridView;

            detailView.OptionsSelection.MultiSelect     = true;
            detailView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect;

            if (detailView != null)
            {
                detailView.CustomRowCellEdit -= detailView_CustomRowCellEdit;
                detailView.CustomRowCellEdit += detailView_CustomRowCellEdit;

                detailView.RowCellStyle -= detailView1_RowCellStyle;
                detailView.RowCellStyle += detailView1_RowCellStyle;

                detailView.ShownEditor -= detailView_ShownEditor;
                detailView.ShownEditor += detailView_ShownEditor;

                detailView.SelectionChanged -= detailView_SelectionChanged;
                detailView.SelectionChanged += detailView_SelectionChanged;

                detailView.RowUpdated -= detailView_RowUpdated;
                detailView.RowUpdated += detailView_RowUpdated;

                detailView.MouseDown -= gridView1_MouseDown;
                detailView.MouseDown += gridView1_MouseDown;

                detailView.ValidateRow -= detailView_ValidateRow;
                detailView.ValidateRow += detailView_ValidateRow;

                detailView.InvalidRowException -= detailView_InvalidRowException;
                detailView.InvalidRowException += detailView_InvalidRowException;

                detailView.RowDeleting -= detailView1_RowDeleting;
                detailView.RowDeleting += detailView1_RowDeleting;

                detailView.RowDeleted -= detailView1_RowDeleted;
                detailView.RowDeleted += detailView1_RowDeleted;
            }

            //初始化供应商dropdownlist

            //_positionRepItem.Name = "DropDownForPosition";

            //_positionRepItem.DataSource = _managementService.GetPositionNameByCode(null);
            //gridControl1.RepositoryItems.Add(_positionRepItem);
            //GridColumn aColumn = detailView.Columns[nameof(model.Position)];
            //aColumn.ColumnEdit = _positionRepItem;

            var colReApplication = new GridColumn()
            {
                Name         = "Action",
                Visible      = true,
                VisibleIndex = 26,
                ColumnEdit   = this.repositoryItemButtonEdit1
            };

            detailView.Columns.Add(colReApplication);
            detailView.Columns[nameof(childModel.PurchaseId)].Visible     = false;
            detailView.Columns[nameof(childModel.SupplierCode)].Visible   = false;
            detailView.Columns[nameof(childModel.PurchaseNumber)].Visible = false;
            detailView.Columns[nameof(childModel.ItemId)].Visible         = false;
            detailView.Columns[nameof(childModel.IsPriceChange)].Visible  = false;
            detailView.Columns[nameof(childModel.PoNumber)].Visible       = false;
            detailView.Columns[nameof(childModel.IsDeleted)].Visible      = false;
            detailView.Columns[nameof(childModel.RequestId)].Visible      = false;
            detailView.Columns[nameof(childModel.Position)].Visible       = false;

            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.SupplierCode)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.ApplicationNumber)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Name)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Category)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Code)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Brand)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Model)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Specification)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Dimension)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Unit)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.DefaultPrice)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.PurchaseTotal)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.TotalPrice)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.AlreadyInStock)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Status)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.Position)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.LastDeliveryDate)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.UpdateDate)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.PoNumber)]);
            RenderCommonHelper.SetColNotEditable(detailView.Columns[nameof(childModel.IsDeleted)]);

            detailView.Columns[nameof(childModel.DefaultPrice)].DisplayFormat.FormatType   = FormatType.Numeric;
            detailView.Columns[nameof(childModel.DefaultPrice)].DisplayFormat.FormatString = "c2";
            detailView.Columns[nameof(childModel.Price)].DisplayFormat.FormatType          = FormatType.Numeric;
            detailView.Columns[nameof(childModel.Price)].DisplayFormat.FormatString        = "c2";
            detailView.Columns[nameof(childModel.TotalPrice)].DisplayFormat.FormatType     = FormatType.Numeric;
            detailView.Columns[nameof(childModel.TotalPrice)].DisplayFormat.FormatString   = "c2";

            detailView.Columns.ForEach(x => x.OptionsFilter.AllowFilter = false);
        }
Exemple #26
0
        public ItemManagementCtrl(IManagementService managemntService) : base()
        {
            _managementService = managemntService;
            InitializeComponent();
            this.Dock = DockStyle.Fill;

            colPackage.Visible         = false;
            colDetailCategory.Visible  = false;
            colAdjustCategory.Visible  = false;
            colAttribute.Visible       = false;
            colProperty.Visible        = false;
            colMax.Visible             = false;
            colMin.Visible             = false;
            colCostCategory.Visible    = false;
            colArrangeOrder.Visible    = false;
            colArrangePosition.Visible = false;

            RenderCommonHelper.SetColNotEditable(colSerialNumber);
            RenderCommonHelper.SetColNotEditable(colCode);
            RenderCommonHelper.SetColNotEditable(colStatus);
            RenderCommonHelper.SetColNotEditable(colCategory);
            RenderCommonHelper.SetColNotEditable(colProjectCategory);
            RenderCommonHelper.SetColNotEditable(colSubCategory);
            RenderCommonHelper.SetColNotEditable(colBigCategory);
            RenderCommonHelper.SetColNotEditable(colSmallCategory);
            RenderCommonHelper.SetColNotEditable(colDetailCategory);
            RenderCommonHelper.SetColNotEditable(colAdjustCategory);
            RenderCommonHelper.SetColNotEditable(colAttribute);
            RenderCommonHelper.SetColNotEditable(colProperty);
            RenderCommonHelper.SetColNotEditable(colChineseName);
            RenderCommonHelper.SetColNotEditable(colEnglishName);
            RenderCommonHelper.SetColNotEditable(colBrand);
            RenderCommonHelper.SetColNotEditable(colModel);
            RenderCommonHelper.SetColNotEditable(colSpecification);
            RenderCommonHelper.SetColNotEditable(colDimension);
            RenderCommonHelper.SetColNotEditable(colUnit);
            RenderCommonHelper.SetColNotEditable(colPrice);
            RenderCommonHelper.SetColNotEditable(colTotalInStorage);
            RenderCommonHelper.SetColNotEditable(colDetail);
            RenderCommonHelper.SetColNotEditable(colMax);
            RenderCommonHelper.SetColNotEditable(colMin);
            RenderCommonHelper.SetColEditable(colFirstSupplier);
            RenderCommonHelper.SetColEditable(colSecondSupplier);
            RenderCommonHelper.SetColEditable(colThirdSupplier);
            RenderCommonHelper.SetColNotEditable(colCostCategory);
            RenderCommonHelper.SetColNotEditable(colComments);
            RenderCommonHelper.SetColNotEditable(colUpdateDate);

            colPrice.DisplayFormat.FormatType   = FormatType.Numeric;
            colPrice.DisplayFormat.FormatString = "c2";


            //初始化供应商dropdownlist
            _supplierRepItem = new RepositoryItemLookUpEdit {
                Name = "DropDownForSupplier"
            };

            gridControl1.RepositoryItems.Add(_supplierRepItem);
            GridColumn aColumn1 = gridView1.Columns[nameof(parentModel.FirstSupplier)];
            GridColumn aColumn2 = gridView1.Columns[nameof(parentModel.SecondSupplier)];
            GridColumn aColumn3 = gridView1.Columns[nameof(parentModel.ThirdSupplier)];

            aColumn1.ColumnEdit = _supplierRepItem;
            aColumn2.ColumnEdit = _supplierRepItem;
            aColumn3.ColumnEdit = _supplierRepItem;


            _refreshHelper = new RefreshHelper(gridView1, nameof(parentModel.ItemId).ToString());
        }
Exemple #27
0
        protected virtual void detailView_CustomRowCellEdit(object sender, CustomRowCellEditEventArgs e)
        {
            GridView detailView = sender as GridView;

            Enum.TryParse(detailView.GetRowCellValue(e.RowHandle, nameof(parentModel.Status)).ToString(), out ProcessStatusEnum processStatus);
            Enum.TryParse(detailView.GetRowCellValue(e.RowHandle, nameof(parentModel.RequestCategory)).ToString(), out RequestCategoriesEnum requestCategory);
            if (e.Column.FieldName == nameof(childModel.Total))
            {
                switch (processStatus)
                {
                case ProcessStatusEnum.需求建立:
                    RenderCommonHelper.SetColEditable(e.Column);
                    break;

                //根据5月2 号的讨论, 当状态为 采购入库 或 已出库 需要修改需求数量
                case ProcessStatusEnum.采购入库:
                    RenderCommonHelper.SetColEditable(e.Column);
                    break;

                case ProcessStatusEnum.已出库:
                    RenderCommonHelper.SetColEditable(e.Column);
                    break;

                default:
                    RenderCommonHelper.SetColNotEditable(e.Column);
                    break;
                }
            }

            if (e.Column.FieldName == nameof(childModel.LockStatus))
            {
                switch (processStatus)
                {
                case ProcessStatusEnum.需求建立:
                    RenderCommonHelper.SetColEditable(e.Column);
                    break;

                default:
                    RenderCommonHelper.SetColNotEditable(e.Column);
                    break;
                }
            }


            if (e.Column.FieldName == nameof(childModel.PositionName))
            {
                RequestViewModel         model           = (RequestViewModel)detailView.GetRow(e.RowHandle);
                RepositoryItemLookUpEdit positionRepItem = new RepositoryItemLookUpEdit();
                positionRepItem.Name          = "DropDownForPosition";
                positionRepItem.NullText      = "";
                positionRepItem.ValueMember   = nameof(childModel.PositionName);
                positionRepItem.DisplayMember = nameof(childModel.PositionName);
                positionRepItem.DataSource    = model.PositionViewModels.ToList();
                positionRepItem.PopupWidth    = 610;
                //positionRepItem.PopulateColumns();
                //positionRepItem.Columns[nameof(subChildModel.UpdateDate)].Visible = false;
                //positionRepItem.Columns[nameof(subChildModel.LatestInStockNumber)].Visible = false;
                e.RepositoryItem = positionRepItem;
                //positionRepItem.EditValueChanged -= RepositoryItemLookUpEdit1_EditValueChanged;
                //positionRepItem.EditValueChanged += RepositoryItemLookUpEdit1_EditValueChanged;
            }
        }