Esempio n. 1
0
        public static bool IsModuleViewAllowed(int atmsId, int userId, int moduleId)
        {
            bool isAllowed = false;

            //Admin and superUser has all the rights
            if (userId == 1)
            {
                return(true);
            }

            //Check module right
            foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.UserModuleRightCBE userModuleRight in userModuleRights)
            {
                if (userModuleRight.UserId == userId)
                {
                    foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.ModuleActivityCBE moduleActivity in moduleActivities)
                    {
                        if (userModuleRight.ModuleActivityEntryId == moduleActivity.EntryId && moduleActivity.ModuleId == moduleId &&
                            moduleActivity.ActivityId == (int)VaaaN.MLFF.Libraries.CommonLibrary.Constants.Activity.View)
                        {
                            isAllowed = true;

                            break;
                        }
                    }
                }

                if (isAllowed)
                {
                    break;
                }
            }

            if (isAllowed)
            {
                //Check if there is any submodule if multiple submodule and there is no rights for at leat one submodule then module right should be denied
                VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection subModules = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetAll();
                ArrayList alSubModules = new ArrayList();
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCBE subModule in subModules)
                {
                    if (subModule.ModuleId == moduleId)
                    {
                        if (IsSubModuleViewAllowed(userId, subModule.SubModuleId))
                        {
                            alSubModules.Add(subModule);
                        }
                    }
                }

                if (alSubModules.Count == 0)
                {
                    isAllowed = false;
                }
            }

            return(isAllowed);
        }
        public JsonResult GetAllReports()
        {
            VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection subModules = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection();
            subModules = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetByUserId(Convert.ToInt16(Session["LoggedUserId"]), 7);  // only for report submodules
            List <SelectListItem> reports = new List <SelectListItem>();

            foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCBE submodule in subModules)
            {
                reports.Add(new SelectListItem
                {
                    Value = Convert.ToString(submodule.SubModuleId),
                    Text  = submodule.SubModuleName
                });
            }

            return(Json(reports));
        }
Esempio n. 3
0
        public static string NewMenu(int userId)
        {
            StringBuilder sb = new StringBuilder();

            //string path = Server.MapPath("");
            try
            {
                VaaaN.MLFF.Libraries.CommonLibrary.CBE.ModuleCollection modules = null;
                // Get all modules which are authorized to this user.
                if (userId == 1)// super admin
                {
                    modules = VaaaN.MLFF.Libraries.CommonLibrary.DAL.ModuleDAL.GetAll();
                }
                else
                {
                    modules = VaaaN.MLFF.Libraries.CommonLibrary.DAL.ModuleDAL.GetByUserId(userId);
                }

                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.ModuleCBE module in modules)
                {
                    string link = "";

                    // Get all submodules which are authorized to this user
                    VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection subModules = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection();

                    if (userId == 1)// super admin
                    {
                        VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection subModulesTemp = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetAll();

                        foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCBE subModule in subModulesTemp)
                        {
                            if (subModule.ModuleId == module.ModuleId)
                            {
                                subModules.Add(subModule);
                            }
                        }
                    }
                    else
                    {
                        subModules = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetByUserId(userId, module.ModuleId);
                    }

                    link = string.Empty;
                    ResourceManager rm         = new ResourceManager(typeof(VaaaN.MLFF.Libraries.CommonLibrary.Resource.Resourceen));
                    string          someString = rm.GetString(module.ModuleName);

                    if ((subModules.Count == 0) || module.ModuleId == 7) //7 for reports
                    {
                        if (module.IsGuiVisible != 0)
                        {
                            sb.Append("<a id=\"module_" + module.ModuleId + "\" class=\"parent list-group-item list-group-item-info\"   data-parent=\"#MainMenu\" href=\"" + module.ModuleUrl.ToLower() + "\">");//module.Url
                            //// sb.Append("<i  style=\"padding-right:10%; padding-left:1%;\" class=\"" + "" + "\"></i>"+ module.ModuleName + "</a>");
                            sb.Append("<i  style=\"padding-right:10%; padding-left:1%;\" class=\"" + "" + "\"></i>" + someString + "</a>");
                        }
                    }
                    else
                    {
                        sb.Append("<a id=\"module_" + module.ModuleId + "\" class=\"parent list-group-item list-group-item-info\"  data-toggle=\"collapse\"  data-Parent=\"#MainMenu\" href=\"#" + someString + "subMenu\">");

                        sb.Append("<i  style=\"padding-right:10%; padding-left:1%;\" class=\"" + "" + "\"></i>" + someString + "");
                        sb.Append("<i  style=\"float:right\" class=\"fa fa-caret-down\"></i></a>");
                        sb.Append("<div class=\"collapse list-group-submenu\"  id=\"" + someString + "subMenu\">");
                        foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCBE subModule in subModules)
                        {
                            if (subModule.IsGuiVisible != 0)
                            {
                                string substring = rm.GetString(subModule.SubModuleName);
                                sb.Append("<a id=\"submodule_" + subModule.SubModuleId + "\" class=\"list-group-item list-group-item-info\" data-parent=\"#" + module.ModuleName + "subMenu\" href=\"" + subModule.SubmoduleUrl.ToLower() + "\">");//Submodule.Url
                                sb.Append("<i  style=\"padding-right:10%; padding-left:1%;\" class=\"fa fa-caret-right\"></i>" + substring + "</a>");
                            }
                        }
                        sb.Append("</div>");
                    }
                }
            }
            catch (Exception)
            {
                //VaaaN.ATMS.Libraries.CCHLibrary.ErrorLogger.LogMessage("Failed to create menu." + ex.Message);
            }

            return(sb.ToString());
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string startDate             = Convert.ToString(Session["startDate"]);
                string endDate               = Convert.ToString(Session["endDate"]);
                Int32  rptnameid             = Convert.ToInt32(Session["rptname"]);
                Int32  GantryId              = 0;
                Int32  VehicleClassId        = 0;
                Int32  TransactionCategoryId = 0;

                if (Session["GantryId"] != null)
                {
                    GantryId = Convert.ToInt32(Session["GantryId"]);
                }

                if (Session["VehicleClassId"] != null)
                {
                    VehicleClassId = Convert.ToInt32(Session["VehicleClassId"]);
                }

                if (Session["TransactionCategoryId"] != null)
                {
                    VehicleClassId = Convert.ToInt32(Session["TransactionCategoryId"]);
                }

                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                Microsoft.Reporting.WebForms.LocalReport rvReportViewer1 = ReportViewer1.LocalReport;

                string rptname = "";
                if (rptnameid > 0)
                {
                    VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection subModules = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection();
                    subModules = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetByUserId(Convert.ToInt16(Session["LoggedUserId"]), 7);
                    foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCBE submodule in subModules)
                    {
                        if (submodule.SubModuleId == rptnameid)
                        {
                            rptname = submodule.SubModuleName;
                            break;
                        }
                    }

                    if (rptname != "")
                    {
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportViewer1.ServerReport.Refresh();
                        DataSet lds = new DataSet();

                        switch (rptname)
                        {
                            #region Transaction Details Report
                        case "Transaction Details":
                        {
                            string strQuery = " WHERE 1=1 ";
                            if (startDate != null && endDate != null)
                            {
                                strQuery += " AND  TRANSACTION_DATETIME BETWEEN TO_DATE('" + startDate + "','DD/MM/YYYY HH24:MI:SS') AND  TO_DATE('" + endDate + "','DD/MM/YYYY HH24:MI:SS')";
                            }
                            else if (startDate != null)
                            {
                                strQuery += " AND  TRANSACTION_DATETIME >= TO_DATE('" + startDate + "','DD/MM/YYYY HH24:MI:SS')";
                            }
                            else if (endDate != null)
                            {
                                strQuery += " AND  TRANSACTION_DATETIME <= TO_DATE('" + endDate + "','DD/MM/YYYY HH24:MI:SS')";
                            }
                            if (GantryId > 0)
                            {
                                strQuery += " AND T.PLAZA_ID = " + GantryId;
                            }
                            if (VehicleClassId > 0)
                            {
                                strQuery += " AND (CV_CTP.VEHICLE_CLASS_ID = " + VehicleClassId + " OR  NFPF.VEHICLE_CLASS_ID = " + VehicleClassId + " OR  NFPR.VEHICLE_CLASS_ID = " + VehicleClassId + ")";
                            }
                            if (TransactionCategoryId == 0)
                            {
                                strQuery += " AND NVL(IS_BALANCE_UPDATED,0) <> 1";
                            }
                            else if (TransactionCategoryId == 1)
                            {
                                strQuery += " AND T.CT_ENTRY_ID IS NOT NULL ";
                            }
                            else if (TransactionCategoryId == 2)
                            {
                                strQuery += " AND T.NF_ENTRY_ID_FRONT IS NOT NULL ";
                            }
                            else if (TransactionCategoryId == 3)
                            {
                                strQuery += " AND T.NF_ENTRY_ID_REAR IS NOT NULL ";
                            }

                            dt = VaaaN.MLFF.Libraries.CommonLibrary.BLL.TransactionBLL.GetDataTableFilteredRecords(strQuery);
                            rvReportViewer1.ReportPath = Server.MapPath("~/Reports/TranscationReport.rdlc");
                            rvReportViewer1.DataSources.Add(new ReportDataSource("ReportDataSet", dt));
                            rvReportViewer1.DataSources.Add(new ReportDataSource("CommonDataSet", CreateCommonDataTable(rptname)));
                            break;
                        }
                            #endregion
                        }


                        ReportViewer1.ShowRefreshButton = false;

                        // Section 2
                        ReportViewer1.DataBind();
                        ReportViewer1.LocalReport.Refresh();
                        ReportViewer1.ServerReport.Refresh();
                    }
                }
            }
        }
Esempio n. 5
0
        public static string NewMenu(int userId, string MenuName, string ChildMenuName)
        {
            StringBuilder sb = new StringBuilder();

            //string path = Server.MapPath("");
            try
            {
                VaaaN.MLFF.Libraries.CommonLibrary.CBE.ModuleCollection modules = null;
                // Get all modules which are authorized to this user.
                if (userId == 1)// super admin
                {
                    modules = VaaaN.MLFF.Libraries.CommonLibrary.DAL.ModuleDAL.GetAll();
                }
                else
                {
                    modules = VaaaN.MLFF.Libraries.CommonLibrary.DAL.ModuleDAL.GetByUserId(userId);
                }
                int i = 0;
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.ModuleCBE module in modules)
                {
                    string link = "";

                    // Get all submodules which are authorized to this user
                    VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection subModules = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection();

                    if (userId == 1)// super admin
                    {
                        subModules = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetByModuleId(module.ModuleId);
                    }
                    else
                    {
                        subModules = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetByUserId(userId, module.ModuleId);
                    }

                    link = string.Empty;
                    ResourceManager rm         = new ResourceManager(typeof(VaaaN.MLFF.Libraries.CommonLibrary.Resource.Resourceen));
                    string          someString = rm.GetString(module.ModuleName);
                    if (!string.IsNullOrEmpty(module.ModuleUrl) && (subModules.Count == 0))
                    {
                        if (MenuName.ToLower() == module.ModuleName.ToLower())
                        {
                            if (i == 0)
                            {
                                sb.Append("<li class='nav-item  mT-30 dropdown'>");
                            }
                            else
                            {
                                sb.Append("<li class='nav-item active'>");
                            }
                        }
                        else
                        {
                            if (i == 0)
                            {
                                sb.Append("<li class='nav-item mT-30'>");
                            }
                            else
                            {
                                sb.Append("<li class='nav-item'>");
                            }
                        }
                        sb.Append(" <a class='sidebar-link' href='" + module.ModuleUrl.ToLower() + "'>");
                        sb.Append("  <span class='icon-holder'>");
                        sb.Append("   <i class='c-blue-500 " + module.Icon + "'></i>");
                        sb.Append("  </span>");
                        sb.Append("   <span class='title'>" + someString + "</span>");
                        sb.Append(" </a>");
                        sb.Append("</li>");
                    }
                    else
                    {
                        if (subModules.Count != 0)
                        {
                            if (MenuName.ToLower() == module.ModuleName.ToLower())
                            {
                                if (i == 0)
                                {
                                    sb.Append("<li class='nav-item dropdown'>");
                                }
                                else
                                {
                                    sb.Append("<li class='nav-item dropdown open'>");
                                }
                            }
                            else
                            {
                                sb.Append("<li class='nav-item dropdown'>");
                            }

                            sb.Append(" <a class='dropdown-toggle' href='javascript:void(0);'>");
                            sb.Append("  <span class='icon-holder'>");
                            sb.Append("   <i class='c-blue-500 " + module.Icon + "'></i>");
                            sb.Append("  </span>");
                            sb.Append("   <span class='title'>" + someString + "</span>");
                            sb.Append("   <span class='arrow'>");
                            sb.Append("     <i class='ti-angle-right'></i>");
                            sb.Append("   </span>");
                            sb.Append(" </a>");
                            if (MenuName.ToLower() == module.ModuleName.ToLower())
                            {
                                sb.Append(" <ul class='dropdown-menu' style='display: block;'>");
                            }
                            else
                            {
                                sb.Append(" <ul class='dropdown-menu'>");
                            }

                            foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCBE submodule in subModules)
                            {
                                someString = rm.GetString(submodule.SubModuleName);
                                if (ChildMenuName.ToLower() == submodule.SubModuleName.ToLower())
                                {
                                    sb.Append("<li class='active'>");
                                }
                                else
                                {
                                    sb.Append("<li>");
                                }

                                sb.Append(" <a class='dropdown-toggle' href='" + submodule.SubmoduleUrl.ToLower() + "'>");
                                //sb.Append("  <span class='icon-holder'>");
                                //sb.Append("   <i class='c-indigo-500 " + submodule.Icon + "'></i>");
                                //sb.Append("  </span>");
                                sb.Append("   <span class='title'>" + someString + "</span>");
                                sb.Append(" </a>");
                                sb.Append("</li>");
                            }
                            sb.Append(" </ul>");
                            sb.Append("</li>");
                        }
                    }
                    i++;
                }
            }
            catch (Exception)
            {
                //VaaaN.ATMS.Libraries.CCHLibrary.ErrorLogger.LogMessage("Failed to create menu." + ex.Message);
            }

            return(sb.ToString());
        }
        // GET: Report
        public ActionResult ReportSelection()
        {
            if (Session["LoggedUserId"] == null)
            {
                return(Redirect("Login"));
            }
            try
            {
                ViewBag.MainMenu = HelperClass.NewMenu(Convert.ToInt16(Session["LoggedUserId"]));

                #region Report Filter
                VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection subModules = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCollection();
                subModules = VaaaN.MLFF.Libraries.CommonLibrary.BLL.SubModuleBLL.GetByUserId(Convert.ToInt16(Session["LoggedUserId"]), 7);  // only for report submodules
                List <SelectListItem> reports = new List <SelectListItem>();
                reports.Add(new SelectListItem()
                {
                    Text = "--Select Report--", Value = "0"
                });
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.SubmoduleCBE submodule in subModules)
                {
                    reports.Add(new SelectListItem
                    {
                        Value = Convert.ToString(submodule.SubModuleId),
                        Text  = submodule.SubModuleName
                    });
                }
                ViewBag.ReportType = reports;
                #endregion

                #region Gantry Class Dropdown
                List <SelectListItem> gantryList = new List <SelectListItem>();
                List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.PlazaCBE> plaza = VaaaN.MLFF.Libraries.CommonLibrary.BLL.PlazaBLL.GetAllAsList();

                gantryList.Add(new SelectListItem()
                {
                    Text = "--Select All--", Value = "0"
                });
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.PlazaCBE cr in plaza)
                {
                    gantryList.Add(new SelectListItem()
                    {
                        Text = cr.PlazaName, Value = System.Convert.ToString(cr.PlazaId)
                    });
                }

                ViewBag.Gantry = gantryList;

                #endregion

                #region Lane Class Dropdown
                List <SelectListItem> laneList = new List <SelectListItem>();
                List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE> Lane = new List <Libraries.CommonLibrary.CBE.LaneCBE>();
                Lane = VaaaN.MLFF.Libraries.CommonLibrary.BLL.LaneBLL.GetAll().Cast <VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE>().ToList();

                laneList.Add(new SelectListItem()
                {
                    Text = "--Select All--", Value = "0"
                });
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.LaneCBE cr in Lane)
                {
                    laneList.Add(new SelectListItem()
                    {
                        Text = cr.LaneName, Value = System.Convert.ToString(cr.LaneId)
                    });
                }

                ViewBag.Lane = laneList;

                #endregion

                #region Vehicle Class Dropdown
                List <SelectListItem> vehicleClass = new List <SelectListItem>();
                List <VaaaN.MLFF.Libraries.CommonLibrary.CBE.VehicleClassCBE> vehicle = VaaaN.MLFF.Libraries.CommonLibrary.BLL.VehicleClassBLL.GetAll();

                vehicleClass.Add(new SelectListItem()
                {
                    Text = "--Select All--", Value = "0"
                });
                foreach (VaaaN.MLFF.Libraries.CommonLibrary.CBE.VehicleClassCBE vc in vehicle)
                {
                    vehicleClass.Add(new SelectListItem()
                    {
                        Text = vc.Name, Value = System.Convert.ToString(vc.Id)
                    });
                }

                ViewBag.VehicleClass = vehicleClass;

                #endregion

                #region Transaction Category
                ViewBag.TransactionCategory = HelperClass.GetReportTransactionCategory();
                #endregion
            }
            catch (Exception ex)
            {
                HelperClass.LogMessage("Failed to load Report Selection Page" + ex);
            }
            return(View());
        }