Ejemplo n.º 1
0
        protected void uoButtonSave_Click(object sender, EventArgs e)
        {
            string strLogDescription;
            string strFunction;

            Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), uoDropDownListMenu.SelectedValue, GlobalCode.Field2String(Session["UserName"]));

            //Insert log audit trail (Gabriel Oquialda - 17/11/2011)
            strLogDescription = "User menu added.";
            strFunction       = "uoButtonSave_Click";

            DateTime dateNow = CommonFunctions.GetCurrentDateTime();

            BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                  CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"]));

            OpenParentPage();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Date Created:   22/08/2011
        /// Created By:     Josephine Gad
        /// (description)   Save submenus
        /// </summary>
        protected void uoButtonSave_Click(object sender, EventArgs e)
        {
            string UserString = GlobalCode.Field2String(Session["UserName"]);
            bool   WithChildNodeBool;

            string strLogDescription;
            string strFunction;

            foreach (TreeNode Node in uoTreeViewSubmenu.Nodes)
            {
                if (Node.ChildNodes.Count > 0)
                {
                    WithChildNodeBool = false;
                    foreach (TreeNode ChildNode in Node.ChildNodes)
                    {
                        if (ChildNode.Checked)
                        {
                            Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), ChildNode.Value, UserString);
                            WithChildNodeBool = true;

                            if (MenuID > 0)
                            {
                                //Insert log audit trail (Gabriel Oquialda - 19/03/2012)
                                strLogDescription = "User menu added.";
                                strFunction       = "uoButtonSave_Click";

                                DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                                BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                                      CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString);
                            }
                        }
                        else
                        {
                            Int32 MenuID = UserRightsBLL.DeleteMenuByRoleId(GlobalCode.Field2String(Session["SelectedRoleKey"]), ChildNode.Value, UserString);

                            if (MenuID > 0)
                            {
                                //Insert log audit trail (Gabriel Oquialda - 19/03/2012)
                                strLogDescription = "User menu deleted. (flagged as inactive)";
                                strFunction       = "uoButtonSave_Click";

                                DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                                BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                                      CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString);
                            }
                        }
                    }
                    if (WithChildNodeBool)
                    {
                        Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString);
                        if (MenuID > 0)
                        {
                            //Insert log audit trail (Gabriel Oquialda - 17/11/2011)
                            strLogDescription = "User menu added.";
                            strFunction       = "uoButtonSave_Click";

                            DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                            BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                                  CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString);
                        }
                    }
                    else
                    {
                        Int32 MenuID = UserRightsBLL.DeleteMenuByRoleId(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString);

                        if (MenuID > 0)
                        {
                            //Insert log audit trail (Gabriel Oquialda - 17/11/2011)
                            strLogDescription = "User menu deleted. (flagged as inactive)";
                            strFunction       = "uoButtonSave_Click";

                            DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                            BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                                  CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString);
                        }
                    }
                }
                else
                {
                    if (Node.Checked)
                    {
                        Int32 MenuID = UserRightsBLL.InsertMenu(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString);

                        if (MenuID > 0)
                        {
                            //Insert log audit trail (Gabriel Oquialda - 17/11/2011)
                            strLogDescription = "User menu added.";
                            strFunction       = "uoButtonSave_Click";

                            DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                            BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                                  CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, UserString);
                        }
                    }
                    else
                    {
                        Int32 MenuID = UserRightsBLL.DeleteMenuByRoleId(GlobalCode.Field2String(Session["SelectedRoleKey"]), Node.Value, UserString);
                        if (MenuID > 0)
                        {
                            //Insert log audit trail (Gabriel Oquialda - 17/11/2011)
                            strLogDescription = "User menu deleted. (flagged as inactive)";
                            strFunction       = "uoButtonSave_Click";

                            DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                            BLL.AuditTrailBLL.InsertLogAuditTrail(MenuID, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                                  CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"]));
                        }
                    }
                }
            }

            //if ()
            //{
            //    //Insert log audit trail (Gabriel Oquialda - 18/11/2011)
            //    strLogDescription = "User menu added.";
            //    strFunction = "uoButtonSave_Click";

            //    DateTime dateNow = CommonFunctions.GetCurrentDateTime();

            //    BLL.AuditTrailBLL.InsertLogAuditTrail(strLogDescription, strFunction, Path.GetFileName(Request.Path),
            //                                          CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"]));
            //}
            //else
            //{
            //    //Insert log audit trail (Gabriel Oquialda - 18/11/2011)
            //    strLogDescription = "User menu deleted. (flagged as inactive)";
            //    strFunction = "uoButtonSave_Click";

            //    DateTime dateNow = CommonFunctions.GetCurrentDateTime();

            //    BLL.AuditTrailBLL.InsertLogAuditTrail(strLogDescription, strFunction, Path.GetFileName(Request.Path),
            //                                          CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, GlobalCode.Field2String(Session["UserName"]));
            //}

            OpenParentPage();
        }