Exemplo n.º 1
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                base.OnInit(e);

                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();
                var detailsControlPath = "~/Shared/Configuration/ApplicationEntityFieldLabel/Controls/Details.ascx";

                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var data = new Framework.Components.Core.SuperKeyDetail.Data();
                    data.SuperKeyId = Convert.ToInt32(SuperKey);

                    // Change System Entity Type
                    data.SystemEntityTypeId = (int)Framework.Components.DataAccess.SystemEntity.ApplicationEntityFieldLabel;
                    var dt = Framework.Components.Core.SuperKeyDetail.Search(data, SessionVariables.AuditId);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (System.Data.DataRow dr in dt.Rows)
                        {
                            var key = Convert.ToInt32(dr[Framework.Components.Core.SuperKeyDetail.DataColumns.EntityKey]);
                            if (string.IsNullOrEmpty(DeleteIds))
                            {
                                DeleteIds = key.ToString();
                            }
                            else
                            {
                                DeleteIds += "," + key.ToString();
                            }
                            var detailsControl = (Controls.Details)Page.LoadControl(detailsControlPath);
                            detailsControl.SetId       = key;
                            detailsControl.BorderClass = ApplicationCommon.DetailsBorderClassName;

                            plcDetailsList.Controls.Add(detailsControl);
                            plcDetailsList.Controls.Add(new LiteralControl("<br />"));

                            chkVisible.Checked = detailsControl.IsHistoryVisible;
                        }
                    }
                }
                else if (SetId != 0)
                {
                    DeleteIds = SetId.ToString();

                    var detailsControl = (Controls.Details)Page.LoadControl(detailsControlPath);
                    detailsControl.SetId = SetId;
                    plcDetailsList.Controls.Add(detailsControl);
                    chkVisible.Checked = detailsControl.IsHistoryVisible;
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Exemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                base.OnInit(e);

                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();
                var path = "~/Shared/Configuration/ApplicationEntityFieldLabelMode/Controls/Details.ascx";
                var genericcontrolpath = "~/Shared/Configuration/ApplicationEntityFieldLabelMode/Controls/Generic.ascx";

                if (!string.IsNullOrEmpty(SuperKey))
                {
                    btnCancel.Visible      = true;
                    btnUpdate.Visible      = true;
                    btnClone.Visible       = false;
                    showMultipleUpdateView = true;
                }
                else if (SetId != 0)
                {
                    btnUpdate.Visible = true;
                    btnCancel.Visible = true;
                    btnClone.Visible  = false;
                }
                if (showMultipleUpdateView)
                {
                    var data = new Framework.Components.Core.SuperKeyDetail.Data();
                    data.SuperKeyId = Convert.ToInt32(SuperKey);
                    // Change System Entity Type
                    data.SystemEntityTypeId = (int)Framework.Components.DataAccess.SystemEntity.ApplicationEntityFieldLabelMode;
                    var dt = Framework.Components.Core.SuperKeyDetail.Search(data, SessionVariables.AuditId);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (System.Data.DataRow dr in dt.Rows)
                        {
                            var key = Convert.ToInt32(dr[Framework.Components.Core.SuperKeyDetail.DataColumns.EntityKey]);

                            var ApplicationEntityFieldLabelupdatecontrol = (Controls.Generic)Page.LoadControl(genericcontrolpath);
                            ApplicationEntityFieldLabelupdatecontrol.SetId(key, false);
                            plcUpdateList.Controls.Add(ApplicationEntityFieldLabelupdatecontrol);
                            if (dt.Rows.Count > 1)
                            {
                                ApplicationEntityFieldLabelupdatecontrol.BorderClass = ApplicationCommon.DetailsBorderClassName;
                                ApplicationEntityFieldLabelupdatecontrol.Controls.Add(new LiteralControl("<br />"));
                            }
                            chkVisible.Checked = ApplicationEntityFieldLabelupdatecontrol.IsHistoryVisible;
                        }
                    }
                }
                else
                {
                    var key = SetId;

                    var ApplicationEntityFieldLabelupdatecontrol = (Controls.Generic)Page.LoadControl(genericcontrolpath);
                    ApplicationEntityFieldLabelupdatecontrol.SetId(key, false);
                    plcUpdateList.Controls.Add(ApplicationEntityFieldLabelupdatecontrol);
                    chkVisible.Checked = ApplicationEntityFieldLabelupdatecontrol.IsHistoryVisible;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                //throw
            }
        }