コード例 #1
0
        public bool ShowTypePropertyControlValue(DP_DataRepository dataItem, SimpleColumnControl typePropertyControl, string value)
        {
            //ColumnSetting columnSetting = new ColumnSetting();

            //if (typePropertyControl.Column.PrimaryKey == true && (dataItem != null && !dataItem.IsNewItem))
            //{
            //    columnSetting.IsReadOnly = true;
            //}
            //else
            //    columnSetting.IsReadOnly = typePropertyControl.ColumnSetting.IsReadOnly;
            //بهتره جور دیگه نوشته بشه
            //if (typePropertyControl.ControlPackage != null)
            return(typePropertyControl.SimpleControlManager.SetValue(dataItem, value));
            //else
            //    return typePropertyControl.SetValue(value);
            //AgentUICoreMediator.UIManager.ShowControlValue(typePropertyControl.ControlPackage, typePropertyControl.Column, value, columnSetting);
        }
コード例 #2
0
        //private void CheckRelationshipReadonlyEnablity()
        //{

        //}
        //اونی که کلید نداره قتی اول میشه موقع آپدیت اونی که کلید داره مقدار موجود اولیو نمیگیره؟؟

        //تنها یکبار و برای نمایش مقادیر در کنترلهای ساده و غیر فرمی صدا زده میشود
        //public bool ShowTypePropertyControlValue(DP_DataRepository dataItem, SimpleColumnControl typePropertyControl, string value)
        //{
        //    return typePropertyControl.SetValue(value);

        //}
        public void SetBinding(DP_DataRepository dataItem, SimpleColumnControl typePropertyControl, EntityInstanceProperty property)
        {
            typePropertyControl.SimpleControlManager.SetBinding(dataItem, property);
        }
コード例 #3
0
        public object FetchTypePropertyControlValue(DP_DataRepository dataRepository, SimpleColumnControl SimpleColumnControlMultipleData)
        {
            //if (AreaInitializer.DataMode == DataMode.Multiple)
            return(SimpleColumnControlMultipleData.SimpleControlManager.GetValue(dataRepository));
            //else
            //    return SimpleColumnControlMultipleData.GetValue();


            //////if (typePropertyControl.EditNdTypeArea != null)
            //////{
            //////    //var relationSourceControl = (typePropertyControl as RelationSourceControl);
            //////    if (typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl != null)
            //////    {
            //////        if (typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.ManyToOne
            //////            || typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.ExplicitOneToOne
            //////            || typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.SubToSuper
            //////            || (typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.UnionToSubUnion_UnionHoldsKeys)
            //////            || (typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.SubUnionToUnion_SubUnionHoldsKeys))
            //////        {
            //////            var data = typePropertyControl.EditNdTypeArea.AreaInitializer.Data.FirstOrDefault(x => x.SourceRelatedData == dataRepository);
            //////            //AreaInitializer.DataMode == DataMode.Multiple
            //////            //&&
            //////            if (data == null)
            //////                return "";
            //////            else
            //////                return typePropertyControl.EditNdTypeArea.FetchTypePorpertyValue(data, typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipColumns.First().SecondSideColumn1);
            //////        }
            //////        else if (typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.OneToMany
            //////            || typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.ImplicitOneToOne
            //////              || typePropertyControl.EditNdTypeArea.AreaInitializer.SourceRelationColumnControl.RelationshipType == Enum_RelationshipType.SuperToSub)
            //////        {
            //////            //return FetchTypePorpertyValue(dataRepository, typePropertyControl.Column);
            //////            throw (new Exception("asfsdf"));
            //////        }
            //////    }
            //////    return "";


            //////}
            //////else
            //////{

            //////}


            //if (typePropertyControl is RelationSourceControl)
            //{
            //    var relationSourceControl = (typePropertyControl as RelationSourceControl);
            //    //////return relationSourceControl.EditNdTypeArea.FetchTypePorpertyValue(dataRepository, AgentHelper.GetRelationOperand(relationSourceControl.Relation, relationSourceControl.RelationSide == Enum_DP_RelationSide.FirstSide ? Enum_DP_RelationSide.SecondSide : Enum_DP_RelationSide.FirstSide));
            //    return "";
            //    // return FetchTypePropertyRelationSourceControl(typePropertyControl as RelationSourceControl);
            //}
            //else
            //    return SpecializedDataView.FetchTypePropertyControlValue(dataRepository, typePropertyControl);
        }
コード例 #4
0
        private void ValidateSimpleColumn(DP_DataRepository dataItem, EntityInstanceProperty dataColumn, SimpleColumnControl simplePropertyControl)
        {
            if (simplePropertyControl.Column.IsMandatory == true)
            {
                if (dataColumn.Value == null || dataColumn.Value.ToString() == "")
                {
                    if (dataItem.IsNewItem == false || simplePropertyControl.Column.IsIdentity == false)
                    {
                        AddColumnControlValidationMessage(simplePropertyControl, "مقدار دهی این خصوصیت اجباری می باشد", dataItem);
                    }
                }
            }
            if (dataColumn.Value != null && dataColumn.Value.ToString() != "")
            {
                if (simplePropertyControl.Column.StringColumnType != null)
                {
                    if (simplePropertyControl.Column.StringColumnType.MaxLength != 0 &&
                        simplePropertyControl.Column.StringColumnType.MaxLength != -1)
                    {
                        if (dataColumn.Value.ToString().Length > simplePropertyControl.Column.StringColumnType.MaxLength)
                        {
                            string message = "حداکثر طول این خصوصیت" + " " + simplePropertyControl.Column.StringColumnType.MaxLength + " " + "کاراکتر می باشد";
                            AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                        }
                    }
                    if (simplePropertyControl.Column.StringColumnType.MinLength != 0 &&
                        simplePropertyControl.Column.StringColumnType.MinLength != null)
                    {
                        if (dataColumn.Value.ToString().Length < simplePropertyControl.Column.StringColumnType.MinLength)
                        {
                            string message = "حداقل طول این خصوصیت" + " " + simplePropertyControl.Column.StringColumnType.MinLength + " " + "کاراکتر می باشد";
                            AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                        }
                    }
                }

                if (simplePropertyControl.Column.NumericColumnType != null)
                {
                    if (simplePropertyControl.Column.NumericColumnType.MinValue != null)
                    {
                        var value = Convert.ToDouble(dataColumn.Value);
                        if (value < simplePropertyControl.Column.NumericColumnType.MinValue.Value)
                        {
                            string message = "حداقل مقدار این خصوصیت" + " " + simplePropertyControl.Column.NumericColumnType.MinValue.Value + " " + "می باشد";
                            AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                        }
                    }
                    if (simplePropertyControl.Column.NumericColumnType.MaxValue != null)
                    {
                        var value = Convert.ToDouble(dataColumn.Value);
                        if (value > simplePropertyControl.Column.NumericColumnType.MaxValue.Value)
                        {
                            string message = "حداکثر مقدار این خصوصیت" + " " + simplePropertyControl.Column.NumericColumnType.MaxValue.Value + " " + "می باشد";
                            AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                        }
                    }
                    if (simplePropertyControl.Column.NumericColumnType.Precision != 0)
                    {
                        var value = Convert.ToDouble(dataColumn.Value);
                        if (value.ToString().Replace(".", "").Length > simplePropertyControl.Column.NumericColumnType.Precision)
                        {
                            string message = "تعداد اعداد این خصوصیت از مقدار تعیین شده" + " " + simplePropertyControl.Column.NumericColumnType.Precision + " " + "بیشتر می باشد";
                            AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                        }
                    }
                    if (simplePropertyControl.Column.NumericColumnType.Scale != 0)
                    {
                        var value = Convert.ToDouble(dataColumn.Value);
                        if (value.ToString().Contains("."))
                        {
                            var splt = value.ToString().Split('.')[1];
                            if (splt.Length > simplePropertyControl.Column.NumericColumnType.Scale)
                            {
                                string message = "تعداد اعشار این خصوصیت از مقدار تعیین شده" + " " + simplePropertyControl.Column.NumericColumnType.Scale + " " + "بیشتر می باشد";
                                AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                            }
                        }
                    }
                }
                if (simplePropertyControl.Column.StringColumnType != null)
                {
                    if (!string.IsNullOrEmpty(simplePropertyControl.Column.StringColumnType.Format))
                    {
                        Regex regex = new Regex(simplePropertyControl.Column.StringColumnType.Format);
                        if (!regex.IsMatch(dataColumn.Value.ToString()))
                        {
                            string message = "فرمت این خصوصیت صحیح نمی باشد";
                            AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                        }
                    }
                }



                if (simplePropertyControl.Column.ColumnValueRange != null &&
                    simplePropertyControl.Column.ColumnValueRange.Details.Any())
                {
                    List <ColumnValueRangeDetailsDTO> validValueRange = null;
                    if (dataItem.ColumnKeyValueRanges.Any(x => x.Key == simplePropertyControl.Column.ID && x.Value.Any()))
                    {
                        validValueRange = dataItem.ColumnKeyValueRanges.First(x => x.Key == simplePropertyControl.Column.ID && x.Value.Any()).Value;
                    }
                    else
                    {
                        validValueRange = simplePropertyControl.Column.ColumnValueRange.Details;
                    }
                    //if (simplePropertyControl.Column.ColumnValueRange.ValueFromTitleOrValue)
                    //{
                    //    if (!validValueRange.Any(x => x.KeyTitle == dataColumn.Value))
                    //    {
                    //        string message = "مقدار این خصوصیت در لیست مقادیر مجاز نمی باشد";
                    //        AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                    //    }
                    //}
                    //else
                    //{
                    if (!validValueRange.Any(x => x.Value == dataColumn.Value.ToString()))
                    {
                        string message = "مقدار این خصوصیت در لیست مقادیر مجاز نمی باشد";
                        AddColumnControlValidationMessage(simplePropertyControl, message, dataItem);
                    }
                    //}
                }
            }
        }
コード例 #5
0
        private void CpMenuFormulaCalculation_MenuClicked(object sender, ConrolPackageMenuArg e, SimpleColumnControl columnControl)
        {
            DP_DataRepository dataItem = null;

            if (EditArea is I_EditEntityAreaOneData)
            {
                dataItem = EditArea.GetDataList().First();
            }
            else
            {
                dataItem = e.data as DP_DataRepository;
            }
            FormulaCalculationAreaInitializer initializer = new FormulaCalculationAreaInitializer();

            initializer.DataItem            = dataItem;
            initializer.FomulaManager       = this;
            initializer.ColumnCustomFormula = columnControl.Column.ColumnCustomFormula;
            initializer.ColumnControl       = columnControl;
            var formulaCalculationArea = new FormulaCalculationArea(initializer);

            if (formulaCalculationArea.View != null)
            {
                var window = AgentUICoreMediator.GetAgentUICoreMediator.UIManager.GetDialogWindow();
                window.ShowDialog(formulaCalculationArea.View, "محاسبه فرمول", Enum_WindowSize.Big);
            }
        }