public List<ScreenFunctionsBO> LoadGrantedScreenFunctionsbyScreenIDandUserName(int screenId, string userName)
        {
            DBEgine dbEgine = new DBEgine();

            List<ScreenBO> screenList = new List<ScreenBO>();

            try
            {
                dbEgine.DBOpen();

                SqlParameter[] parms = new SqlParameter[2];

                SqlParameter p1 = new SqlParameter();
                p1.ParameterName = "UserName";
                p1.SqlDbType = SqlDbType.NVarChar;
                p1.Size = 256;
                p1.Direction = ParameterDirection.Input;
                p1.Value = userName;
                parms[0] = p1;

                SqlParameter p2 = new SqlParameter();
                p2.ParameterName = "ScreenId";
                p2.SqlDbType = SqlDbType.Int;
                p2.Direction = ParameterDirection.Input;
                p2.Value = screenId;
                parms[1] = p2;

                SqlDataReader drScreenFunctionList = dbEgine.ExecuteReader("UM_LoadGrantedScreenFunctionsbyScreenIDandUserName", parms);

                List<ScreenFunctionsBO> screenFunctionsList = new List<ScreenFunctionsBO>();

                while (drScreenFunctionList.Read())
                {
                    ScreenFunctionsBO screenFunction = new ScreenFunctionsBO();

                    screenFunction.ScreenFunctionCode = drScreenFunctionList.GetValue(drScreenFunctionList.GetOrdinal("ScreenFunctionCode")).ToString();
                    screenFunction.FunctionName = drScreenFunctionList.GetValue(drScreenFunctionList.GetOrdinal("FunctionName")).ToString();
                    screenFunction.IsActive = drScreenFunctionList.GetBoolean(drScreenFunctionList.GetOrdinal("IsActive"));
                    screenFunction.IsGranted = drScreenFunctionList.GetBoolean(drScreenFunctionList.GetOrdinal("IsGranted"));

                    screenFunctionsList.Add(screenFunction);

                }

                dbEgine.DBClose();

                return screenFunctionsList;

            }
            catch
            {
                throw;
            }

            finally
            {
                dbEgine.DBClose();
            }
        }
Esempio n. 2
0
        private void buttonAddFunction_Click(object sender, EventArgs e)
        {
            var screenFuntion = new ScreenFunctionsBO();

            screenFuntion.FunctionName = textBoxFunctionName.Text.Trim();
            screenFuntion.ScreenFunctionCode = textBoxFunctionCode.Text.Trim();
            screenFuntion.IsActive = true;
            screenFuntion.IsGranted = true;

            if (ScreenFuntions.Equals(null))
            {
                ScreenFuntions = new List<ScreenFunctionsBO>();
            }
            ScreenFuntions.Add(screenFuntion);
        }
Esempio n. 3
0
        private void visitChildNodes(TreeNode node)
        {
            string b = node.Text;
            string[] nodeValues = node.Name.Split('_');

            ScreenBO screen = new ScreenBO();

            if (nodeValues.Length > 0 && nodeValues[0] == Common.PARENT_OF_FUNCTIONS)
            {
                screen.ScreenId = Convert.ToInt32(nodeValues[1]);

                List<ScreenFunctionsBO> ScreenFunList = new List<ScreenFunctionsBO>();

                foreach (TreeNode childNode in node.Nodes)
                {
                    ScreenFunctionsBO Screenfun = new ScreenFunctionsBO();

                    Screenfun.ScreenFunctionCode = childNode.Name;
                    if (childNode.Checked)
                    {
                        Screenfun.IsGranted = true;
                    }
                    else
                    {
                        Screenfun.IsGranted = false;
                    }
                    ScreenFunList.Add(Screenfun);
                }

                screen.ScreenFunctions = ScreenFunList;

                screenList.Add(screen);

            }
            else
            {

                for (int j = 0; j < node.Nodes.Count; j++)
                {
                    visitChildNodes(node.Nodes[j]);
                }
            }
        }