Beispiel #1
0
 //convert HtmlRole kepada ASPNETROLESHTML
 //Update/Edit dalam Oracle DB
 public static int EditList(List <HtmlRole> output)
 {
     try
     {
         List <ASPNETROLESHTML> roles = new List <ASPNETROLESHTML>();
         foreach (HtmlRole single in output)
         {
             ASPNETROLESHTML role = new ASPNETROLESHTML();
             role.ROLEID   = single.RoleId;
             role.MODULEID = single.ModuleId;
             role.HTMLNAME = single.HtmlName;
             role.CSSCLASS = single.CSSClass;
             role.ISVIEW   = single.IsView ? 1 : 0;
             role.ISADD    = single.IsAdd ? 1 : 0;
             role.ISEDIT   = single.IsEdit ? 1 : 0;
             role.ISDELETE = single.IsDelete ? 1 : 0;
             role.TABID    = single.TabId;
             roles.Add(role);
         }
         ASPNETROLESHTML.EditList(roles);
         return(0);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.ToString());
         return(1);
     }
 }
Beispiel #2
0
        //convert HtmlRole kepada ASPNETROLESHTML
        //Update/Edit dalam Oracle DB
        public static int EditList(List <HtmlRoleWithTab> output, int tabId)
        {
            try
            {
                //sepatutnya output ni dapat 1 je sebab tabId ada 1 je utk setiap output
                output = output
                         .Where(s => s.TabHeader.TabId == tabId).ToList();

                //sebenarnya edit 1 je. 1 tab daripada semua tab yang tersenarai
                foreach (HtmlRoleWithTab single in output)
                {
                    List <ASPNETROLESHTML> roles = new List <ASPNETROLESHTML>();

                    ASPNETROLESHTML tabHeader = new ASPNETROLESHTML();
                    tabHeader.ROLEID   = single.TabHeader.RoleId;
                    tabHeader.MODULEID = single.TabHeader.ModuleId;
                    tabHeader.HTMLNAME = single.TabHeader.HtmlName;
                    tabHeader.CSSCLASS = single.TabHeader.CSSClass;
                    tabHeader.ISVIEW   = single.TabHeader.IsView ? 1 : 0;
                    tabHeader.ISADD    = single.TabHeader.IsAdd ? 1 : 0;
                    tabHeader.ISEDIT   = single.TabHeader.IsEdit ? 1 : 0;
                    tabHeader.ISDELETE = single.TabHeader.IsDelete ? 1 : 0;
                    tabHeader.TABID    = single.TabHeader.TabId;

                    //add header to TOEDIT list;
                    roles.Add(tabHeader);

                    foreach (HtmlRole inSingle in single.HtmlRoles)
                    {
                        ASPNETROLESHTML role = new ASPNETROLESHTML();
                        role.ROLEID   = inSingle.RoleId;
                        role.MODULEID = inSingle.ModuleId;
                        role.HTMLNAME = inSingle.HtmlName;
                        role.CSSCLASS = inSingle.CSSClass;
                        role.ISVIEW   = inSingle.IsView ? 1 : 0;
                        role.ISADD    = inSingle.IsAdd ? 1 : 0;
                        role.ISEDIT   = inSingle.IsEdit ? 1 : 0;
                        role.ISDELETE = inSingle.IsDelete ? 1 : 0;
                        role.TABID    = inSingle.TabId;
                        //add others to roles
                        roles.Add(role);
                    }
                    //Edit all the htmlRoles
                    ASPNETROLESHTML.EditList(roles);
                }



                return(0);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                return(1);
            }
        }