//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);
            }
        }
        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;
                }
            }
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
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;
                }
            }
        }
Esempio n. 5
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;
                }
            }
        }
Esempio n. 6
0
        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;
                }
            }
        }