public IActionResult Index()
        {
            var loggedInEmployeeId = User.GetCurrentEmployeeId(db.Employee);
            var result             = db.Employee.GetFirstOrDefaultWithRelatedData(e => e.Id == loggedInEmployeeId);

            if (result != null)
            {
                vmUserProfile userProfile = new vmUserProfile();
                userProfile.FullName = result.FullName;
                if (result.JobLocation != null)
                {
                    userProfile.JobLocation = result.JobLocation.Name;
                }
                if (result.Department != null)
                {
                    userProfile.DepartmentName = result.Department.Name;
                }
                if (result.Designation != null)
                {
                    userProfile.Designation = result.Designation.Name;
                }
                if (result.Shift != null)
                {
                    userProfile.ShiftName = result.Shift.Name;
                }

                userProfile.FatherName     = result.FatherName;
                userProfile.MotherName     = result.MotherName;
                userProfile.PresentAddress = result.PresentAddress;

                userProfile.FirstName   = result.FirstName;
                userProfile.LastName    = result.LastName;
                userProfile.Phone       = result.Phone;
                userProfile.Email       = result.Email;
                userProfile.JoiningDate = result.JoinDate.ToShortDateString();
                userProfile.DateOfBirth = result.DateofBirth;
                if (result.PhotoUrl != null)
                {
                    userProfile.PhotoUrl = _imagePath.GetFilePathAsSourceUrl(result.PhotoUrl);
                }
                else
                {
                    userProfile.PhotoUrl = _imagePath.GetFilePathAsSourceUrl("/images/Uploads/Employee/AlterImage.png");
                }

                return(View(userProfile));
            }
            else
            {
                return(RedirectToAction("current", "Employee", new{ Area = "HR" }));
            }
        }
Beispiel #2
0
        public IActionResult ManagerDetails()
        {
            List <Manager>   clients    = _work.Managers.GetAll().Where(x => x.Id == 2009).ToList();
            List <vmManager> clientitem = new List <vmManager>();

            foreach (var item in clients)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Image))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Image);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Clients/");
                }
                clientitem.Add(new vmManager
                {
                    Id          = item.Id,
                    Name        = item.Name,
                    PhotoUrl    = item.Image,
                    Phone       = item.Phone,
                    Email       = item.Email,
                    Address     = item.Address,
                    Country     = item.Country,
                    HSC         = item.HSC,
                    SSC         = item.SSC,
                    Bsc         = item.Bsc,
                    Skill       = item.Skill,
                    Designation = item.Designation,
                    Facebook    = item.Facebook,
                    Twitter     = item.Twitter,
                    LinkdIn     = item.LinkdIn,
                });
            }

            ViewBag.leadmanagerItem = clientitem;

            return(PartialView("_ManagerDetails"));
        }
Beispiel #3
0
        public IActionResult ClientList()
        {
            ViewBag.TotalLead  = _work.Clients.TotalLead();
            ViewBag.LostLead   = _work.Clients.LostLead();
            ViewBag.ActiveLead = _work.Clients.ActiveLead();

            //List<Client> client = _work.Clients.LeadManager();
            //ViewBag.leadmanagerItem = client;

            List <Manager> clients = _work.Managers.GetAll().Where(m => m.Id == 2009).ToList();
            //List<Manager> clients =_context.Manager.ToList().FirstOrDefault(x=>x.Id==x.Id);
            List <vmManager> clientitem = new List <vmManager>();

            foreach (var item in clients)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Image))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Image);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/ManagerUpload/");
                }
                clientitem.Add(new vmManager
                {
                    Id          = item.Id,
                    Name        = item.Name,
                    PhotoUrl    = item.Image,
                    Designation = item.Designation,
                });
            }

            ViewBag.leadmanagerItem = clientitem;

            ViewBag.image = _work.Clients.GetAll().Where(p => p.Image == p.Image || p.Id == 2007);

            return(View());
        }
        public IActionResult LoadSisterConcernHeads()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            List <SisterConcernHead> concernHeads = db.SisterConcernHead.GetAllWithRelatedData();

            var SisterConcernHeadList = new List <vmSisterConcernHead>();

            //Sorting
            //if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            //{
            //    branches = branches.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            //}
            //else
            //{
            //    branches = branches.OrderByDescending(x => x.Id).ToList();
            //}

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                //branches = branches.Where(x => x.Id.Contains(searchValue)).ToList();
            }

            foreach (var item in concernHeads)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Employee.PhotoUrl))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Employee.PhotoUrl);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Uploads/Employee/AlterImage.png");
                }
                SisterConcernHeadList.Add(new vmSisterConcernHead
                {
                    Id                = item.Id,
                    CompanyName       = item.Company == null ? string.Empty : item.Company.CompanyName,
                    EmployeeName      = item.Employee == null ? string.Empty : item.Employee.FullName,
                    SisterConcernName = item.SisterConcern == null ? string.Empty : item.SisterConcern.Name,
                    PhotoUrl          = photoURL,
                    //CompanyId = item.CompanyId,
                    //EmployeeId = item.EmployeeId,
                    //SisterConcernId = item.SisterConcernId,
                });
            }
            //total number of rows count
            recordsTotal = SisterConcernHeadList.Count();

            //Paging
            var data = SisterConcernHeadList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
Beispiel #5
0
        public IActionResult LoadNotifaction()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            List <Notification> notifactionlList = db.Notification.GetAll().ToList();

            List <vmNotification> notifactionlItem = new List <vmNotification>();

            foreach (var item in notifactionlList)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Avatar))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Avatar);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Uploads/Employee/AlterImage.png");
                }
                notifactionlItem.Add(new vmNotification
                {
                    Id           = item.Id,
                    Avatar       = photoURL,
                    Title        = item.Title,
                    Details      = item.Details,
                    SendTo       = item.SendTo,
                    ReceivedFrom = item.ReceivedFrom,
                    ReadingTime  = item.ReadingTime,
                    IsRead       = item.IsRead,
                    Url          = item.Url,
                });
            }

            if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            {
            }
            else
            {
                notifactionlItem = notifactionlItem.OrderByDescending(model => model.Id).ToList();
            }

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                notifactionlItem = notifactionlItem.Where(model => model.Title.Contains(searchValue) || model.SendTo.Contains(searchValue) || model.ReceivedFrom.Contains(searchValue) || model.ReadingTime.Contains(searchValue) || model.Avatar.Contains(searchValue)).ToList();
            }

            //total number of rows count
            recordsTotal = notifactionlItem.Count();

            //Paging
            var data = notifactionlItem.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
Beispiel #6
0
        public IActionResult LoadProducts()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            var products = _work.Products.GetAllWithCategory();

            var productList = new List <ProductListViewModel>();

            foreach (var item in products)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Image))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Image);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Products/");
                }
                productList.Add(new ProductListViewModel
                {
                    Id               = item.Id,
                    Name             = item.Name,
                    Order            = item.Order,
                    CategoryName     = item.ProductCategory.Name,
                    PurchasePrice    = item.PurchasePrice,
                    RetailPrice      = item.RetailPrice,
                    WholeSellPrice   = item.WholeSellPrice,
                    Discount         = item.Discount,
                    Description      = item.Description,
                    ShortDescription = item.ShortDescription,
                    ReleaseDate      = item.ReleaseDate,
                    Image            = item.Image,
                    IsPopular        = item.IsPopular
                });
            }
            //Sorting
            if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            {
                products = products.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            }
            else
            {
                products = products.OrderByDescending(x => x.Id).ToList();
            }

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                products = products.Where(x => x.Name.Contains(searchValue) || x.ProductCategory.Name.Contains(searchValue)).ToList();
            }



            //total number of rows count
            recordsTotal = productList.Count();

            //Paging
            var data = productList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
        public IActionResult LoadproductCategories()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            var productCategoies = _context.ProductCategories.ToList();

            var ProductCategorytList = new List <ProductCategoryViewModel>();

            //Sorting
            if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            {
                productCategoies = productCategoies.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            }
            else
            {
                productCategoies = productCategoies.OrderByDescending(x => x.Id).ToList();
            }

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                productCategoies = productCategoies.Where(x => x.Name.Contains(searchValue)).ToList();
            }

            foreach (var item in productCategoies)
            {
                string photoURL = "";

                if (!string.IsNullOrEmpty(item.Image))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Image);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Products/");
                }
                ProductCategorytList.Add(new ProductCategoryViewModel
                {
                    Id   = item.Id,
                    Name = item.Name,
                });
            }

            //total number of rows count
            recordsTotal = ProductCategorytList.Count();

            //Paging
            var data = ProductCategorytList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
        public IActionResult LoadAboutUs()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            var aboutus = _work.AboutUs.GetAll();

            var aboutusList = new List <AboutUsViewModel>();

            //Sorting
            if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            {
                aboutus = aboutus.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            }
            else
            {
                aboutus = aboutus.OrderByDescending(x => x.Id).ToList();
            }

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                aboutus = aboutus.Where(x => x.AboutMainSologan.Contains(searchValue)).ToList();
            }

            foreach (var item in aboutus)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.WhoWeAreImageOne))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.WhoWeAreImageOne);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/AboutUs/");
                }
                if (!string.IsNullOrEmpty(item.WhoWeAreImageTwo))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.WhoWeAreImageTwo);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/AboutUs");
                }
                aboutusList.Add(new AboutUsViewModel
                {
                    Id = item.Id,
                    AboutMainSologan      = item.AboutMainSologan,
                    OurMissionDescription = item.OurMissionDescription,
                    OurVisionDescription  = item.OurVisionDescription,
                    WhyUsDescription      = item.WhyUsDescription,
                    WhoWeAreDescription   = item.WhoWeAreDescription,
                    WhoWeAreImageOne      = item.WhoWeAreImageOne,
                    WhoWeAreImageTwo      = item.WhoWeAreImageTwo,
                });
            }

            //total number of rows count
            recordsTotal = aboutusList.Count();


            //Paging
            var data = aboutusList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
        public IActionResult LoadManualAbsents()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            List <ManualAbsent> absents = db.ManualAbsent.GetAllWithRelatedData();

            var ManualAbsentList = new List <vmManualAbsent>();

            //Sorting
            //if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            //{
            //    branches = branches.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            //}
            //else
            //{
            //    branches = branches.OrderByDescending(x => x.Id).ToList();
            //}

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                //branches = branches.Where(x => x.Id.Contains(searchValue)).ToList();
            }

            foreach (var item in absents)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Employee.PhotoUrl))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Employee.PhotoUrl);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Uploads/Employee/AlterImage.png");
                }
                ManualAbsentList.Add(new vmManualAbsent
                {
                    Id                  = item.Id,
                    EmployeeName        = item.Employee == null ? string.Empty : item.Employee.FullName,
                    TransactionTime     = item.TransactionTime,
                    Reason              = item.Reason,
                    Approver            = item.Approver == null ? string.Empty : item.Employee.FullName,
                    ApprovedTime        = item.ApprovedTime,
                    PhotoUrl            = photoURL,
                    EmployeeId          = item.EmployeeId,
                    DateTransactionTime = item.TransactionTime.ToShortDateString(),
                });
            }
            //total number of rows count
            recordsTotal = ManualAbsentList.Count();

            //Paging
            var data = ManualAbsentList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
Beispiel #10
0
        public IActionResult LoadCompanyHeads()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            List <CompanyHead> company = db.CompanyHead.GetAllWithRelatedData();

            var companyHeadList = new List <vmCompanyHead>();

            //replace photoURL path
            foreach (var item in company)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Employee.PhotoUrl))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Employee.PhotoUrl);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Uploads/Employee/AlterImage.png");
                }
                companyHeadList.Add(new vmCompanyHead
                {
                    Id           = item.Id,
                    CompanyName  = item.Company == null ? string.Empty : item.Company.CompanyName,
                    EmployeeName = item.Employee == null ? string.Empty : item.Employee.FullName,
                    PhotoUrl     = photoURL,
                    //CompanyId = item.CompanyId,
                    EmployeeId = item.EmployeeId,
                });
            }

            //Sorting
            //if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            //{
            //    company = company.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            //}
            //else
            //{
            //    company = company.OrderByDescending(x => x.Id).ToList();
            //}


            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                //company = company.Where(x => x.CompanyName.Contains(searchValue)
                //        || (x.Employee != null && x.EmployeeName.Contains(searchValue))

                //        ).ToList();
                //company = company.Where(x => x.CompanyName.Contains(searchValue) || x.ContactPerson.Contains(searchValue)||x.Email.Contains(searchValue)|| x.Address.Contains(searchValue)).ToList();
            }



            //companyHeadList = companyHeadList.OrderByDescending(i => i.CreatedDate.Date)
            //    .ThenByDescending(i => i.CreatedDate.TimeOfDay).ToList();
            //total number of rows count
            recordsTotal = companyHeadList.Count();

            //Paging
            var data = companyHeadList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
        public JsonResult LoadAllApplication()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();
            var dateRange     = Request.Form["dateRange"].FirstOrDefault();



            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;



            var loggedInEmployeeId = User.GetCurrentEmployeeId(db.Employee);
            var leaveList          = db.ApplicationApproval.GetAll().Where(x => x.ApplicationType == ApplicationType.Late && x.ApproverId == loggedInEmployeeId && x.Lock == false).ToList();
            var todaysLeaveList    = new List <TodaysLeave>();

            foreach (var item in leaveList)
            {
                var leaveData = db.LatePermission.GetFirstOrDefaultwithRelatedData(x => x.IsDeleted == false && x.Id == Convert.ToInt64(item.ApplicationId));
                if (leaveData != null)
                {
                    var leave = new TodaysLeave
                    {
                        ApproverId    = loggedInEmployeeId,
                        Name          = leaveData.Employee.FullName,
                        EmployeeId    = leaveData.Employee.MaskingId,
                        Remarks       = item.Comments ?? "",
                        Days          = "",
                        From          = leaveData.WhenTime.ToString(),
                        Status        = item.Status.ToString(),
                        Purpose       = leaveData.Purpose,
                        AppliedDate   = leaveData.CreatedDate.ToString(),
                        Id            = item.Id,
                        FromDate      = leaveData.WhenTime,
                        LeaveType     = "Late In",
                        CommentsCount = db.ApplicationApproval.GetAll().Count(x => x.ApplicationType == ApplicationType.Late && x.Comments != null && x.ApplicationId == leaveData.Id.ToString() && x.Level > item.Level)
                    };

                    if (!string.IsNullOrEmpty(leaveData.Employee.PhotoUrl))
                    {
                        leave.PhotoUrl = _imagePath.GetFilePathAsSourceUrl(leaveData.Employee.PhotoUrl);
                    }
                    else
                    {
                        leave.PhotoUrl = _imagePath.GetFilePathAsSourceUrl("/images/Uploads/Employee/AlterImage.png");
                    }


                    if (item.ApproveTime != null)
                    {
                        leave.ApprovedBy   = "(" + item.Approver.MaskingId + ") " + item.Approver.FullName;
                        leave.ApprovedTime = leaveData.ApprovedTime.Value.ToString();
                    }
                    else
                    {
                        leave.ApprovedBy   = "";
                        leave.ApprovedTime = "";
                    }

                    if (!string.IsNullOrEmpty(leaveData.Employee.PhotoUrl))
                    {
                        leave.PhotoUrl = _imagePath.GetFilePathAsSourceUrl(leaveData.Employee.PhotoUrl);
                    }

                    todaysLeaveList.Add(leave);
                }
            }


            //check job status
            if (searchValue == "all")
            {
                todaysLeaveList = todaysLeaveList.ToList();
                searchValue     = "";
            }
            else if (searchValue == "pending")
            {
                todaysLeaveList = todaysLeaveList.Where(x => x.Status == "Pending").ToList();
                searchValue     = "";
            }
            else if (searchValue == "approved")
            {
                todaysLeaveList = todaysLeaveList.Where(x => x.Status == "Approved").ToList();
                searchValue     = "";
            }
            else if (searchValue == "rejected")
            {
                todaysLeaveList = todaysLeaveList.Where(x => x.Status == "Rejected").ToList();
                searchValue     = "";
            }
            else
            {
                todaysLeaveList = todaysLeaveList.Where(x => x.Status == "Pending").ToList();
            }

            if (!string.IsNullOrEmpty(dateRange))
            {
                var startDate = DateTime.Parse(dateRange.Substring(0, 10));
                var endDate   = DateTime.Parse(dateRange.Substring(13, 10));
                todaysLeaveList = todaysLeaveList.Where(x => x.FromDate >= startDate && x.ToDate <= endDate).ToList();
            }



            //total number of rows count
            recordsTotal = todaysLeaveList.Count();

            //Paging
            var data = todaysLeaveList.Skip(skip).Take(pageSize).OrderBy(o => o.Status).ThenByDescending(t => t.FromDate).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
Beispiel #12
0
        public IActionResult LoadBlog()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            var blog = _work.Blogs.GetAll();

            var blogList = new List <BlogsViewModel>();

            //Sorting
            if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            {
                blog = blog.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            }
            else
            {
                blog = blog.OrderByDescending(x => x.Id).ToList();
            }

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                blog = blog.Where(x => x.Title.Contains(searchValue)).ToList();
            }

            foreach (var item in blog)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Image))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Image);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/blogs/");
                }

                blogList.Add(new BlogsViewModel
                {
                    Id       = item.Id,
                    Creator  = item.Creator,
                    VideoUrl = item.VideoUrl,
                    Date     = item.Date,

                    Title       = item.Title,
                    Description = item.Description,
                    ChangeDate  = item.Date.ToString("MM/dd/yyyy HH:mm:ss")
                });
            }

            //total number of rows count
            recordsTotal = blogList.Count();

            //Paging
            var data = blogList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
Beispiel #13
0
        public IActionResult LoadOurTeam()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            var ourteam = _work.OurTeams.GetAllWithDepartmentAndDesignation();

            var ourTeamList = new List <OurTeamViewModel>();

            //Sorting
            if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            {
                ourteam = ourteam.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            }
            else
            {
                ourteam = ourteam.OrderByDescending(x => x.Id).ToList();
            }

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                ourteam = ourteam.Where(x => x.Name.Contains(searchValue)).ToList();
            }

            foreach (var item in ourteam)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Image))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Image);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/OurTeam/MHAnwarHossainAbirannnoreara.jpg");
                }
                ourTeamList.Add(new OurTeamViewModel
                {
                    Id              = item.Id,
                    Name            = item.Name,
                    Order           = item.Order,
                    Image           = item.Image,
                    Description     = item.Description,
                    Facebook        = item.Facebook,
                    Twitter         = item.Twitter,
                    LinkedIn        = item.LinkedIn,
                    DepartmentName  = item.Department.Name,
                    DesignationName = item.Designation.Name,
                });
            }

            //total number of rows count
            recordsTotal = ourTeamList.Count();


            //Paging
            var data = ourTeamList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }
Beispiel #14
0
        public IActionResult LoadBanner()
        {
            var draw          = Request.Form["draw"].FirstOrDefault();
            var start         = Request.Form["start"].FirstOrDefault();
            var length        = Request.Form["length"].FirstOrDefault();
            var sortColumn    = Request.Form["columns[" + Request.Form["order[0][column]"].FirstOrDefault() + "][name]"].FirstOrDefault();
            var sortColumnDir = Request.Form["order[0][dir]"].FirstOrDefault();
            var searchValue   = Request.Form["search[value]"].FirstOrDefault();

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = 0;

            var banners = _work.Banner.GetAll();

            var BannerList = new List <BannerViewModel>();

            foreach (var item in banners)
            {
                string photoURL = "";
                if (!string.IsNullOrEmpty(item.Image))
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl(item.Image);
                }
                else
                {
                    photoURL = _imagePath.GetFilePathAsSourceUrl("/images/Banners/");
                }
                BannerList.Add(new BannerViewModel
                {
                    Id          = item.Id,
                    Image       = item.Image,
                    SolganOne   = item.SolganOne,
                    SolganTwo   = item.SolganTwo,
                    SolganThree = item.SolganThree,
                    Order       = item.Order,
                });
            }
            //Sorting
            if (!string.IsNullOrEmpty(sortColumn) && !string.IsNullOrEmpty(sortColumnDir))
            {
                banners = banners.AsQueryable().OrderBy(sortColumn + " " + sortColumnDir).ToList();
            }
            else
            {
                banners = banners.OrderByDescending(x => x.Id).ToList();
            }

            //Search
            if (!string.IsNullOrEmpty(searchValue))
            {
                banners = banners.Where(x => x.SolganOne.Contains(searchValue) || x.SolganTwo.Contains(searchValue) || x.SolganThree.Contains(searchValue)).ToList();
            }



            //total number of rows count
            recordsTotal = BannerList.Count();

            //Paging
            var data = BannerList.Skip(skip).Take(pageSize).ToList();

            //Returning Json Data
            return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }));
        }