Esempio n. 1
0
        public static string ProcessIT(string value,string newval,string delval)
        {
            ACLRoleBL aclRoleBL = new ACLRoleBL();
            string result = "Welcome Mr. " + value;
            string sroleid = Convert.ToString(HttpContext.Current.Session["EditRoleID"]);
            int qroleid = Convert.ToInt32(HttpContext.Current.Session["EditRoleID"]);
            string test = "";
            string access = "0";

            //string s = "123";
            //int byParsing = int.Parse(s);
            //int re;
            //int.TryParse(s, out re);

            // *********** Insert ACL Action and Role //

            string[] roles = { "" };
            roles = value.Split(':');
            string rolename = "";
            string description = "";
            int roleid = 0;
             rolename = roles[0];
             description = roles[1];

            if(rolename != "")
            {

                if (qroleid == 0 )
                {
                    roleid = aclRoleBL.InsertRole(rolename,description);
                    aclRoleBL.InsertACLAction(roleid,0);

                    qroleid = roleid;
                }

               //************Edit Role ***********************//

                    else if (qroleid > 0)
                    {
                        aclRoleBL.EditRole(rolename, description, qroleid);
                    }

              // *********** Edit ACL Action True ************* //

                    string aid = newval.TrimEnd('#');
                    string[] mid = { "" };
                    mid = aid.Split('#');
                    int moduleId = 0;
                    int functionId = 0;
                    Int64 re = 0;

                    if (newval != string.Empty)
                    {
                        for (int x = 0; x < mid.Length; x++)
                        {
                            string[] fid = { "" };
                            fid = mid[x].Split(':');

                            moduleId = int.Parse(fid[0]);
                            functionId = int.Parse(fid[1]);
                            access = "1";
                            //test += fid[0] + fid[1] + "#";
                            re = aclRoleBL.EditACLAction(moduleId, functionId, access, qroleid);

                        }
                    }

                //********* Edit ACL Action False ********************//

                    string did = delval.TrimEnd('#');
                    string[] tid = { "" };
                    tid = did.Split('#');
                    int delmodule = 0;
                    int delfunction = 0;
                    Int64 rep = 0;
                    //string tested = "";
                    if(delval != string.Empty)
                    {
                            for (int x = 0; x < tid.Length; x++)
                            {
                                string[] gid = { "" };
                                gid = tid[x].Split(':');

                                delmodule = int.Parse(gid[0]);
                                delfunction = int.Parse(gid[1]);
                                access = "0";
                                // tested += gid[0] + gid[1] + "#";
                                rep = aclRoleBL.EditACLAction(delmodule, delfunction, access, qroleid);
                            }
                    }

            test += "value" + value + " delval" + delval + " newval" + newval + "roleid" + qroleid + "re" + re + "rep"+ rep + "roles" + roleid ;

            }

            test = "RoleName Field can not be Empty!!";

               HttpContext.Current.Session["EditRoleID"] = 0;

            return test;
        }