Ejemplo n.º 1
0
        public void CreateFCEntries(FieldConfigurationDataModel data, int?fcModeId, int index, string entityName)
        {
            int?systemEntityTypeId = GetEntityTypeId(entityName);

            var dataFC = new FieldConfigurationDataModel();

            dataFC.SystemEntityTypeId            = systemEntityTypeId;
            dataFC.ApplicationId                 = Convert.ToInt32(ddlApplication.SelectedValue);
            dataFC.FieldConfigurationDisplayName = data.Name;
            dataFC.Name  = data.Name;
            dataFC.Value = data.Name;

            dataFC.Formatting               = "";
            dataFC.ControlType              = "TextBox";
            dataFC.GridViewPriority         = index;
            dataFC.DetailsViewPriority      = index;
            dataFC.FieldConfigurationModeId = fcModeId;
            dataFC.DisplayColumn            = 1;
            dataFC.CellCount = 3;

            if (data.Width == null)
            {
                dataFC.Width = 50;
            }
            else
            {
                dataFC.Width = data.Width;
            }

            if (!string.IsNullOrEmpty(data.HorizontalAlignment))
            {
                dataFC.HorizontalAlignment = data.HorizontalAlignment;
            }
            else
            {
                dataFC.HorizontalAlignment = "Left";
            }

            var dtFC = FieldConfigurationDataManager.DoesExist(dataFC, SessionVariables.RequestProfile);

            if (dtFC.Rows.Count == 0)
            {
                dataFC.FieldConfigurationId = FieldConfigurationDataManager.Create(dataFC, SessionVariables.RequestProfile);

                var dataDisplayName = new FieldConfigurationDisplayNameDataModel();
                dataDisplayName.FieldConfigurationId = dataFC.FieldConfigurationId;
                dataDisplayName.Value      = data.Name;
                dataDisplayName.LanguageId = ApplicationCommon.LanguageId;
                dataDisplayName.IsDefault  = 1;

                FieldConfigurationDisplayNameDataManager.Create(dataDisplayName, SessionVariables.RequestProfile);
            }
        }
Ejemplo n.º 2
0
        public override int?Save(string action)
        {
            var data = new FieldConfigurationDataModel();

            data.FieldConfigurationId          = FieldConfigurationId;
            data.SystemEntityTypeId            = SystemEntityTypeId;
            data.ApplicationId                 = ApplicationId;
            data.FieldConfigurationDisplayName = DisplayName;
            data.Name                     = Name;
            data.Value                    = Value;
            data.Width                    = Width;
            data.Formatting               = Formatting;
            data.ControlType              = ControlType;
            data.HorizontalAlignment      = HorizontalAlignment;
            data.GridViewPriority         = GridViewPriority;
            data.DetailsViewPriority      = DetailsViewPriority;
            data.FieldConfigurationModeId = FieldConfigurationModeId;
            data.DisplayColumn            = DisplayColumn;
            data.CellCount                = CellCount;

            if (action == "Insert")
            {
                var dtFieldConfiguration = FieldConfigurationDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtFieldConfiguration.Rows.Count == 0)
                {
                    data.FieldConfigurationId = FieldConfigurationDataManager.Create(data, SessionVariables.RequestProfile);

                    var dataDisplayName = new FieldConfigurationDisplayNameDataModel();
                    dataDisplayName.FieldConfigurationId = data.FieldConfigurationId;
                    dataDisplayName.Value      = DisplayName;
                    dataDisplayName.LanguageId = ApplicationCommon.LanguageId;
                    dataDisplayName.IsDefault  = 1;

                    FieldConfigurationDisplayNameDataManager.Create(dataDisplayName, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Unique Combination already exists.");
                }
            }
            else
            {
                FieldConfigurationDataManager.Update(data, SessionVariables.RequestProfile);
            }

            FieldConfigurationUtility.SetFieldConfigurations();

            // not correct ... when doing insert, we didn't get/change the value of FieldConfigurationId ?
            return(data.FieldConfigurationId);
        }