private void bindGrid() { var data = new FieldConfigurationDisplayNameDataModel(); data.FieldConfigurationId = FieldConfigurationId; var dt = FieldConfigurationDisplayNameDataManager.Search(data, SessionVariables.RequestProfile, SessionVariables.ApplicationMode); dgvDisplayNames.DataSource = dt; dgvDisplayNames.DataBind(); }
protected void lnkSave_Click(object sender, EventArgs e) { var data = new FieldConfigurationDisplayNameDataModel(); data.FieldConfigurationId = FieldConfigurationId; data.LanguageId = Convert.ToInt32(drpLanguage.SelectedValue); data.Value = txtValue.Text.Trim(); data.IsDefault = chkIsDefault.Checked ? 1 : 0; FieldConfigurationDisplayNameDataManager.Create(data, SessionVariables.RequestProfile); bindGrid(); formContainer.Visible = false; }
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); } }
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); }
protected void lnkDelete_Click(object sender, EventArgs e) { if (dgvDisplayNames.Rows.Count > 0) { foreach (GridViewRow dr in dgvDisplayNames.Rows) { var chkSelected = (CheckBox)dr.FindControl("chkSelected"); if (chkSelected != null) { if (chkSelected.Checked) { var data = new FieldConfigurationDisplayNameDataModel(); data.FieldConfigurationDisplayNameId = Convert.ToInt32(dgvDisplayNames.DataKeys[dr.DataItemIndex].Value); FieldConfigurationDisplayNameDataManager.Delete(data, SessionVariables.RequestProfile); } } } } bindGrid(); }
protected void lnkUpdate_Click(object sender, EventArgs e) { if (dgvDisplayNames.Rows.Count > 0) { foreach (GridViewRow dr in dgvDisplayNames.Rows) { var data = new FieldConfigurationDisplayNameDataModel(); data.FieldConfigurationDisplayNameId = Convert.ToInt32(dgvDisplayNames.DataKeys[dr.DataItemIndex].Value); var chkIsDefault1 = (CheckBox)dr.FindControl("chkIsDefault"); var drpLanguage1 = (DropDownList)dr.FindControl("drpLanguage"); var txtValue1 = (TextBox)dr.FindControl("txtValue"); data.FieldConfigurationId = FieldConfigurationId; data.LanguageId = Convert.ToInt32(drpLanguage1.SelectedValue); data.Value = txtValue1.Text.Trim(); data.IsDefault = chkIsDefault1.Checked ? 1 : 0; FieldConfigurationDisplayNameDataManager.Update(data, SessionVariables.RequestProfile); } } bindGrid(); }
protected void btnDelete_Click(object sender, EventArgs e) { try { var notDeletableIds = new List <int>(); string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new FieldConfigurationDataModel(); data.FieldConfigurationId = int.Parse(index); if (!FieldConfigurationDataManager.IsDeletable(data, SessionVariables.RequestProfile)) { notDeletableIds.Add(Convert.ToInt32(data.FieldConfigurationId)); } } if (notDeletableIds.Count == 0) { foreach (string index in deleteIndexList) { var data = new FieldConfigurationDataModel(); data.FieldConfigurationId = int.Parse(index); FieldConfigurationDataManager.Delete(data, SessionVariables.RequestProfile); } Framework.Components.Audit.AuditHistoryDataManager.DeleteDataBySystemEntity(DeleteIds, (int)Framework.Components.DataAccess.SystemEntity.FieldConfiguration, SessionVariables.RequestProfile); Response.Redirect(Page.GetRouteUrl("FieldConfigurationEntityRoute", new { Action = "Default", SetId = true }), false); } else { var msg = String.Empty; foreach (var id in notDeletableIds) { if (!string.IsNullOrEmpty(msg)) { msg += ", <br/>"; } msg += "FieldConfigurationId: " + id + " has detail records"; var data = new FieldConfigurationDisplayNameDataModel(); data.FieldConfigurationId = id; var dt = FieldConfigurationDisplayNameDataManager.Search(data, SessionVariables.RequestProfile, SessionVariables.ApplicationMode); foreach (DataRow dr in dt.Rows) { var fcdnid = int.Parse(dr[FieldConfigurationDisplayNameDataModel.DataColumns.FieldConfigurationDisplayNameId].ToString()); data.FieldConfigurationDisplayNameId = fcdnid; FieldConfigurationDisplayNameDataManager.Delete(data, SessionVariables.RequestProfile); } var fcdata = new FieldConfigurationDataModel(); fcdata.FieldConfigurationId = id; FieldConfigurationDataManager.Delete(fcdata, SessionVariables.RequestProfile); Framework.Components.Audit.AuditHistoryDataManager.DeleteDataBySystemEntity(id.ToString(), (int)Framework.Components.DataAccess.SystemEntity.FieldConfiguration, SessionVariables.RequestProfile); Response.Redirect(Page.GetRouteUrl("FieldConfigurationEntityRoute", new { Action = "Default", SetId = true }), false); } Response.Write(msg); } } catch (Exception ex) { Response.Write(ex.Message); } }