Exemple #1
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);
        }
Exemple #2
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new FieldConfigurationDataModel();

            data.FieldConfigurationId     = int.Parse(values[FieldConfigurationDataModel.DataColumns.FieldConfigurationId].ToString());
            data.FieldConfigurationModeId = int.Parse(values[FieldConfigurationDataModel.DataColumns.FieldConfigurationModeId].ToString());
            data.Name  = values[FieldConfigurationDataModel.DataColumns.Name].ToString();
            data.Value = values[FieldConfigurationDataModel.DataColumns.Value].ToString();
            data.HorizontalAlignment = values[FieldConfigurationDataModel.DataColumns.HorizontalAlignment].ToString();
            data.Formatting          = values[FieldConfigurationDataModel.DataColumns.Formatting].ToString();
            data.GridViewPriority    = int.Parse(values[FieldConfigurationDataModel.DataColumns.GridViewPriority].ToString());
            data.DetailsViewPriority = int.Parse(values[FieldConfigurationDataModel.DataColumns.DetailsViewPriority].ToString());
            data.SystemEntityTypeId  = int.Parse(values[FieldConfigurationDataModel.DataColumns.SystemEntityTypeId].ToString());
            data.DisplayColumn       = int.Parse(values[FieldConfigurationDataModel.DataColumns.DisplayColumn].ToString());

            FieldConfigurationDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Exemple #3
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new FieldConfigurationDataModel();

            UpdatedData = FieldConfigurationDataManager.Search(data, SessionVariables.RequestProfile).Clone();

            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.FieldConfigurationId =
                    Convert.ToInt32(SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.FieldConfigurationId].ToString());
                data.Name = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.Name))
                                        ? CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.Name).ToString()
                                        : SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.Name].ToString();

                data.Value =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.Value))
                                        ? CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.Value).ToString()
                                        : SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.Value].ToString();

                data.ControlType =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.ControlType))
                                        ? CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.ControlType).ToString()
                                        : SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.ControlType].ToString();

                data.Formatting =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.Formatting))
                                        ? CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.Formatting).ToString()
                                        : SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.Formatting].ToString();

                data.HorizontalAlignment =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.HorizontalAlignment))
                                        ? CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.HorizontalAlignment).ToString()
                                        : SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.HorizontalAlignment].ToString();

                data.FieldConfigurationModeId =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.FieldConfigurationModeId))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.FieldConfigurationModeId).ToString())
                                        : int.Parse(SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.FieldConfigurationModeId].ToString());

                data.SystemEntityTypeId =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.SystemEntityTypeId))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.SystemEntityTypeId).ToString())
                                        : int.Parse(SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.SystemEntityTypeId].ToString());

                data.GridViewPriority =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.GridViewPriority))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.GridViewPriority).ToString())
                                        : int.Parse(SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.GridViewPriority].ToString());

                data.DetailsViewPriority =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.DetailsViewPriority))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.DetailsViewPriority).ToString())
                                        : int.Parse(SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.DetailsViewPriority].ToString());

                data.DisplayColumn =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.DisplayColumn))
                    ? int.Parse(CheckAndGetRepeaterTextBoxValue(FieldConfigurationDataModel.DataColumns.DisplayColumn).ToString())
                    : int.Parse(SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.DisplayColumn].ToString());

                FieldConfigurationDataManager.Update(data, SessionVariables.RequestProfile);
                data = new FieldConfigurationDataModel();
                data.FieldConfigurationId = Convert.ToInt32(SelectedData.Rows[i][FieldConfigurationDataModel.DataColumns.FieldConfigurationId].ToString());
                var dt = FieldConfigurationDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Exemple #4
0
        private void UpdateData()
        {
            if (rbtnList.SelectedValue.Equals("GridView"))
            {
                foreach (GridViewRow row in EditableGridView.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        var data = new FieldConfigurationDataModel();

                        var lblFieldConfigurationId = (Label)row.FindControl("lblFieldConfigurationId");
                        var txtName  = (TextBox)row.FindControl("txtName");
                        var txtValue = (TextBox)row.FindControl("txtValue");
                        var txtWidth = (TextBox)row.FindControl("txtWidth");
                        var txtHorizontalAlignment = (TextBox)row.FindControl("txtHorizontalAlignment");
                        var txtFormatting          = (TextBox)row.FindControl("txtFormatting");
                        var txtControlType         = (TextBox)row.FindControl("txtControlType");
                        var txtGridViewPriority    = (TextBox)row.FindControl("txtGridViewPriority");
                        var txtDetailsViewPriority = (TextBox)row.FindControl("txtDetailsViewPriority");
                        var txtAEFLModeId          = (TextBox)row.FindControl("txtFieldConfigurationModeId");

                        try
                        {
                            data.FieldConfigurationId = int.Parse(lblFieldConfigurationId.Text);

                            data.Name  = txtName.Text;
                            data.Value = txtValue.Text;
                            data.Width = decimal.Parse(txtWidth.Text);
                            data.SystemEntityTypeId       = SystemEntityTypeId;
                            data.Formatting               = txtFormatting.Text;
                            data.ControlType              = txtControlType.Text;
                            data.HorizontalAlignment      = txtHorizontalAlignment.Text;
                            data.GridViewPriority         = int.Parse(txtGridViewPriority.Text);
                            data.DetailsViewPriority      = int.Parse(txtDetailsViewPriority.Text);
                            data.FieldConfigurationModeId = int.Parse(txtAEFLModeId.Text);

                            FieldConfigurationDataManager.Update(data, AuditId);
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                }

                EditableGridView.Visible = false;
                ReadOnlyGridView.Visible = true;
            }
            else
            {
                foreach (RepeaterItem item in EditableRepeater.Items)
                {
                    var data = new FieldConfigurationDataModel();

                    var hdnFieldConfigurationId = (HiddenField)item.FindControl("hdnFieldConfigurationId");
                    var txtName  = (TextBox)item.FindControl("txtName");
                    var txtValue = (TextBox)item.FindControl("txtValue");
                    var txtWidth = (TextBox)item.FindControl("txtWidth");
                    var txtHorizontalAlignment = (TextBox)item.FindControl("txtHorizontalAlignment");
                    var txtFormatting          = (TextBox)item.FindControl("txtFormatting");
                    var txtControlType         = (TextBox)item.FindControl("txtControlType");
                    var txtGridViewPriority    = (TextBox)item.FindControl("txtGridViewPriority");
                    var txtDetailsViewPriority = (TextBox)item.FindControl("txtDetailsViewPriority");
                    var txtAEFLModeId          = (TextBox)item.FindControl("txtAEFLModeId");

                    try
                    {
                        data.FieldConfigurationId = int.Parse(hdnFieldConfigurationId.Value);

                        data.Name  = txtName.Text;
                        data.Value = txtValue.Text;
                        data.Width = decimal.Parse(txtWidth.Text);
                        data.SystemEntityTypeId       = SystemEntityTypeId;
                        data.Formatting               = txtFormatting.Text;
                        data.ControlType              = txtControlType.Text;
                        data.HorizontalAlignment      = txtHorizontalAlignment.Text;
                        data.GridViewPriority         = int.Parse(txtGridViewPriority.Text);
                        data.DetailsViewPriority      = int.Parse(txtDetailsViewPriority.Text);
                        data.FieldConfigurationModeId = int.Parse(txtAEFLModeId.Text);

                        FieldConfigurationDataManager.Update(data, AuditId);
                    }
                    catch (Exception)
                    {
                        continue;
                        ;
                    }
                }

                EditableRepeater.Visible = false;
                ReadOnlyRepeater.Visible = true;
            }

            UpdateGridTableInCache(SystemEntityTypeId, AuditId);
            BindData(ApplicationId);

            btnEdit.Visible   = true;
            btnUpdate.Visible = false;
        }