public List <HoldCargoViewModel> Match(List <HoldCargo> _holdcargo)
        {
            List <HoldCargoViewModel> _results = new List <HoldCargoViewModel>();
            PackageNumberBL           _packageNumberService = new PackageNumberBL();
            StatusBL        status          = new StatusBL();
            ReasonBL        reason          = new ReasonBL();
            UserRoleBL      user            = new UserRoleBL();
            ShipmentBL      shipmentService = new ShipmentBL();
            List <Shipment> shipList        = shipmentService.GetAll();
            UserStore       _userService    = new UserStore();

            foreach (HoldCargo holdCargo in _holdcargo)
            {
                HoldCargoViewModel model = new HoldCargoViewModel();
                //string _airwaybill = _packageNumberService.GetAll().Find(x => x.PackageNo == holdCargo.Cargo).Shipment.AirwayBillNo;
                HoldCargoViewModel isExist = _results.Find(x => x.AirwayBillNo == holdCargo.AirwayBillNo);

                if (isExist != null)
                {
                }
                else
                {
                    model.Date         = holdCargo.HoldCargoDate;
                    model.AirwayBillNo = holdCargo.AirwayBillNo;

                    Shipment ship = shipList.Find(x => x.AirwayBillNo == holdCargo.AirwayBillNo);

                    if (ship != null)
                    {
                        model.Shipper     = ship.Shipper.FullName;
                        model.Consignee   = ship.Consignee.FullName;
                        model.Address     = ship.Consignee.Address1;
                        model.PaymentMode = ship.PaymentMode.PaymentModeName;
                        model.ServiceMode = ship.ServiceMode.ServiceModeName;
                        model.Status      = status.GetById(holdCargo.StatusID).StatusName; // status.GetAll().Find(x => x.StatusID == holdCargo.StatusID).StatusName;
                        model.Reason      = reason.GetById(holdCargo.ReasonID).ReasonName; // .Find(x => x.ReasonID == holdCargo.ReasonID).ReasonName;
                        model.EndorseBy   = holdCargo.Endorsedby;
                        //model.ScannedBy = user.GetActiveRoles().Find(x => x.RoleId == AppUser.User.UserId).RoleName;
                        //model.ScannedBy = holdCargo.User.Employee.FullName;
                        model.ScannedBy = "N/A";
                        string employee = _userService.FindById(holdCargo.CreatedBy).Employee.FullName;
                        if (employee != "")
                        {
                            model.ScannedBy = employee;
                        }
                        //model.PreparedBy = user.GetAllUsers().Find(x => x.UserId == shi)
                        model.Aging  = Math.Round((DateTime.Now - holdCargo.HoldCargoDate).TotalDays, 2);
                        model.Branch = holdCargo.User.Employee.AssignedToArea.City.BranchCorpOffice.BranchCorpOfficeName;
                        _results.Add(model);
                    }
                }
            }
            return(_results);
        }
 public ActionResult Login(UserModel user)
 {
     if (ModelState.IsValid)
     {
         bool IsValidUser = new UserRoleBL().ValidateUser(user.UserName, user.Password);
         if (IsValidUser)
         {
             FormsAuthentication.SetAuthCookie(user.UserName, false);
             return(RedirectToAction("Index", "Home"));
         }
     }
     ModelState.AddModelError("", "Invalid Username or Password");
     return(View());
 }
Exemple #3
0
        private void CreateSideMenu()
        {
            var session = new SLLITPage();

            var menu = new UserRoleBL().GetMenuByUserID(session.CurrentUserID);

            string html = "";
            liItems.InnerHtml = String.Empty;

            var tempHtml = string.Empty;
            var finalHtml = string.Empty;

            var currentRoleName = string.Empty;

            finalHtml += "<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below 'sidebar-toggler-wrapper' LI element -->";
            finalHtml += "<li class='sidebar-toggler-wrapper'>";
            finalHtml += "   <!-- BEGIN SIDEBAR TOGGLER BUTTON -->";
            finalHtml += "   <div class='sidebar-toggler'>";
            finalHtml += "   </div>";
            finalHtml += "   <!-- END SIDEBAR TOGGLER BUTTON -->";
            finalHtml += "</li>";
            finalHtml += "<li class='start active'>";
            finalHtml += "   <a href='" + ResolveUrl("~/Default.aspx") + "'>";
            finalHtml += "       <i class='icon-home'></i>";
            finalHtml += "       <span class='title'>Home</span>";
            finalHtml += "       <span class='selected'></span>";
            finalHtml += "   </a>";
            finalHtml += "</li>";

            foreach (var item in menu)
            {
                if (currentRoleName == string.Empty)//first case
                {
                    currentRoleName = item.RoleName;

                    finalHtml += "<li>";
                    finalHtml += "  <a href='javascript:;'>";
                    finalHtml += "      <i class='fa " + item.RoleIcon + "'></i>";
                    finalHtml += "      <span class='title'>" + item.RoleName + "</span>";
                    finalHtml += "      <span class='arrow '></span>";
                    finalHtml += "  </a>";
                    finalHtml += "<ul class='sub-menu'>";
                }

                if (currentRoleName != item.RoleName)//if role changes
                {
                    currentRoleName = item.RoleName;
                    finalHtml += tempHtml;
                    finalHtml += "      </ul>";
                    finalHtml += "  </li>";
                    finalHtml += "<li>";
                    finalHtml += "  <a href='javascript:;'>";
                    finalHtml += "      <i class='fa " + item.RoleIcon + "'></i>";
                    finalHtml += "      <span class='title'>" + item.RoleName + "</span>";
                    finalHtml += "      <span class='arrow '></span>";
                    finalHtml += "  </a>";
                    finalHtml += "<ul class='sub-menu'>";

                    tempHtml = string.Empty;
                }

                tempHtml += " <li><a href='" + ResolveUrl(item.MenuHomePage) + "'>" + item.MenuDisplayName + "</a></li>";
            }

            finalHtml += tempHtml;
            finalHtml += "  </ul>";
            finalHtml += "</li>";

            liItems.InnerHtml = finalHtml;
        }