Esempio n. 1
0
        private void SetupDropdown()
        {
            var isTesting = SessionVariables.IsTesting;

            drpParentMenu.ClearSelection();

            var parentMenudata = MenuDataManager.GetList(null, SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(parentMenudata, drpParentMenu, MenuDataModel.DataColumns.MenuDisplayName,
                                  MenuDataModel.DataColumns.MenuId);

            if (isTesting)
            {
                drpParentMenu.AutoPostBack = true;
                if (drpParentMenu.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtParentMenuId.Text.Trim()))
                    {
                        drpParentMenu.SelectedValue = txtParentMenuId.Text;
                    }
                    else
                    {
                        txtParentMenuId.Text = drpParentMenu.SelectedItem.Value;
                    }
                }
                txtParentMenuId.Visible = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtParentMenuId.Text.Trim()))
                {
                    drpParentMenu.SelectedValue = txtParentMenuId.Text;
                }
            }
        }
Esempio n. 2
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            var dataFES = new FunctionalityEntityStatusDataModel();

            dataFES.FunctionalityId = FunctionalityId;

            var fesData = FunctionalityEntityStatusDataManager.Search(dataFES, SessionVariables.RequestProfile);

            if (fesData.Rows.Count == 0)
            {
                var dtMenu = MenuDataManager.GetList(SessionVariables.RequestProfile);

                var entitydt = SystemEntityTypeDataManager.GetList(SessionVariables.RequestProfile);

                //get data based on Entity Name from Menu and SystemEntity table to get the Primary Developer value

                var assignedTo = from tblMenu in dtMenu.AsEnumerable()
                                 join tblEntity in entitydt.AsEnumerable() on tblMenu.Field <string>(MenuDataModel.DataColumns.Name) equals tblEntity.Field <string>(SystemEntityTypeDataModel.DataColumns.EntityName)
                                 select tblEntity;

                //get data from SystemEntity table which doesnt have matching entries in Menu table

                var assignedToAdmin = from tblEntity in entitydt.AsEnumerable()
                                      where !assignedTo.Contains(tblEntity)
                                      select tblEntity;

                string assignedToValue = string.Empty;

                //data inserted to FES with AssignedTo value as PrimaryDeveloper value

                for (int i = 0; i < assignedTo.Count(); i++)
                {
                    var primaryDeveloper = from tblMenu in dtMenu.AsEnumerable()
                                           join tblEntity in entitydt.AsEnumerable() on tblMenu.Field <string>(MenuDataModel.DataColumns.Name) equals tblEntity.Field <string>(SystemEntityTypeDataModel.DataColumns.EntityName)
                                               where tblMenu.Field <string>(MenuDataModel.DataColumns.Name) == assignedTo.CopyToDataTable().Rows[i][SystemEntityTypeDataModel.DataColumns.EntityName].ToString()
                                           select tblMenu[MenuDataModel.DataColumns.PrimaryDeveloper];

                    assignedToValue = primaryDeveloper.First().ToString();

                    Insert(assignedTo.CopyToDataTable().Rows[i], assignedToValue);
                }

                //data inserted to FES with AssignedTo value as "Admin"

                for (int j = 0; j < assignedToAdmin.Count(); j++)
                {
                    assignedToValue = "Admin";

                    Insert(assignedToAdmin.CopyToDataTable().Rows[j], assignedToValue);
                }
            }
        }