public HomeController(IMemoryCache cache, LogisticsContext dbContext)
 {
     _cache            = cache;
     _dbContext        = dbContext;
     _orderLogic       = new Lms_OrderLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderPoco>(_dbContext));
     _orderStatusLogic = new Lms_OrderStatusLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderStatusPoco>(_dbContext));
 }
Esempio n. 2
0
 public ReportController(IMemoryCache cache, LogisticsContext dbContext)
 {
     _dbContext              = dbContext;
     _cache                  = cache;
     _orderLogic             = new Lms_OrderLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderPoco>(_dbContext));
     _customerLogic          = new Lms_CustomerLogic(_cache, new EntityFrameworkGenericRepository <Lms_CustomerPoco>(_dbContext));
     _addressLogic           = new Lms_CustomerAddressMappingLogic(_cache, new EntityFrameworkGenericRepository <Lms_CustomerAddressMappingPoco>(_dbContext));
     _invoiceLogic           = new Lms_InvoiceLogic(_cache, new EntityFrameworkGenericRepository <Lms_InvoicePoco>(_dbContext));
     _additionalServiceLogic = new Lms_OrderAdditionalServiceLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderAdditionalServicePoco>(_dbContext));
 }
Esempio n. 3
0
        public MiscellaneousOrderController(IMemoryCache cache, IEmailService emailService, IHostingEnvironment hostingEnvironment, IHttpContextAccessor httpContext, LogisticsContext dbContext)
        {
            _cache              = cache;
            _dbContext          = dbContext;
            _emailService       = emailService;
            _hostingEnvironment = hostingEnvironment;
            _httpContext        = httpContext;

            _orderLogic       = new Lms_OrderLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderPoco>(_dbContext));
            _orderStatusLogic = new Lms_OrderStatusLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderStatusPoco>(_dbContext));
        }
        public ReportController(IMemoryCache cache, IHostingEnvironment hostingEnvironment, IHttpContextAccessor httpContext, LogisticsContext dbContext)
        {
            _dbContext          = dbContext;
            _cache              = cache;
            _hostingEnvironment = hostingEnvironment;
            _httpContext        = httpContext;

            _orderLogic             = new Lms_OrderLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderPoco>(_dbContext));
            _customerLogic          = new Lms_CustomerLogic(_cache, new EntityFrameworkGenericRepository <Lms_CustomerPoco>(_dbContext));
            _addressMappingLogic    = new Lms_CustomerAddressMappingLogic(_cache, new EntityFrameworkGenericRepository <Lms_CustomerAddressMappingPoco>(_dbContext));
            _addressLogic           = new Lms_AddressLogic(_cache, new EntityFrameworkGenericRepository <Lms_AddressPoco>(_dbContext));
            _invoiceLogic           = new Lms_InvoiceLogic(_cache, new EntityFrameworkGenericRepository <Lms_InvoicePoco>(_dbContext));
            _additionalServiceLogic = new Lms_OrderAdditionalServiceLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderAdditionalServicePoco>(_dbContext));
            _paymentMethodLogic     = new Lms_PaymentMethodLogic(_cache, new EntityFrameworkGenericRepository <Lms_PaymentMethodPoco>(_dbContext));
            _paymentCollectionLogic = new Lms_InvoicePaymentCollectionLogic(_cache, new EntityFrameworkGenericRepository <Lms_InvoicePaymentCollectionPoco>(_dbContext));

            _cityLogic     = new App_CityLogic(_cache, new EntityFrameworkGenericRepository <App_CityPoco>(_dbContext));
            _provinceLogic = new App_ProvinceLogic(_cache, new EntityFrameworkGenericRepository <App_ProvincePoco>(_dbContext));
            _countryLogic  = new App_CountryLogic(_cache, new EntityFrameworkGenericRepository <App_CountryPoco>(_dbContext));
            _bankLogic     = new Lms_BankLogic(_cache, new EntityFrameworkGenericRepository <Lms_BankPoco>(_dbContext));
        }
        public SearchController(IMemoryCache cache, IEmailService emailService, IHostingEnvironment hostingEnvironment, IHttpContextAccessor httpContext, LogisticsContext dbContext)
        {
            _cache              = cache;
            _dbContext          = dbContext;
            _emailService       = emailService;
            _hostingEnvironment = hostingEnvironment;
            _httpContext        = httpContext;

            _orderLogic    = new Lms_OrderLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderPoco>(_dbContext));
            _customerLogic = new Lms_CustomerLogic(_cache, new EntityFrameworkGenericRepository <Lms_CustomerPoco>(_dbContext));
            _addressLogic  = new Lms_AddressLogic(_cache, new EntityFrameworkGenericRepository <Lms_AddressPoco>(_dbContext));
            _employeeLogic = new Lms_EmployeeLogic(_cache, new EntityFrameworkGenericRepository <Lms_EmployeePoco>(_dbContext));

            _cityLogic     = new App_CityLogic(_cache, new EntityFrameworkGenericRepository <App_CityPoco>(_dbContext));
            _provinceLogic = new App_ProvinceLogic(_cache, new EntityFrameworkGenericRepository <App_ProvincePoco>(_dbContext));
            _countryLogic  = new App_CountryLogic(_cache, new EntityFrameworkGenericRepository <App_CountryPoco>(_dbContext));

            _unitTypeLogic    = new Lms_UnitTypeLogic(_cache, new EntityFrameworkGenericRepository <Lms_UnitTypePoco>(_dbContext));
            _weightScaleLogic = new Lms_WeightScaleLogic(_cache, new EntityFrameworkGenericRepository <Lms_WeightScalePoco>(_dbContext));

            _deliveryOptionLogic   = new Lms_DeliveryOptionLogic(_cache, new EntityFrameworkGenericRepository <Lms_DeliveryOptionPoco>(_dbContext));
            _vehicleTypeScaleLogic = new Lms_VehicleTypeLogic(_cache, new EntityFrameworkGenericRepository <Lms_VehicleTypePoco>(_dbContext));
        }
        public IActionResult PartialLoadEmployeeOrders(string empId, string fromDate, string toDate)
        {
            List <ViewModel_PayrollOrder> viewModelPayrollOrders = new List <ViewModel_PayrollOrder>();

            if (empId != "")
            {
                int      selectedEmpId    = Convert.ToInt16(empId);
                DateTime selectedFromDate = Convert.ToDateTime(fromDate);
                DateTime selectedToDate   = Convert.ToDateTime(toDate);

                _deliveryOptionLogic = new Lms_DeliveryOptionLogic(_cache, new EntityFrameworkGenericRepository <Lms_DeliveryOptionPoco>(_dbContext));
                var deliveryOptionList = _deliveryOptionLogic.GetList();

                _employeeLogic = new Lms_EmployeeLogic(_cache, new EntityFrameworkGenericRepository <Lms_EmployeePoco>(_dbContext));
                var employeeList = _employeeLogic.GetList();

                _additionalServiceLogic = new Lms_OrderAdditionalServiceLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderAdditionalServicePoco>(_dbContext));

                _orderLogic = new Lms_OrderLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderPoco>(_dbContext));
                var orderList = _orderLogic.GetList();

                _orderStatusLogic = new Lms_OrderStatusLogic(_cache, new EntityFrameworkGenericRepository <Lms_OrderStatusPoco>(_dbContext));
                var orderStatusList = _orderStatusLogic.GetList().Where(c => (c.DispatchedToEmployeeId == selectedEmpId || c.PassedOffToEmployeeId == selectedEmpId) && c.CreateDate >= selectedFromDate && c.CreateDate <= selectedToDate && c.IsDelivered == true).ToList();

                orderList = (from order in orderList
                             join status in orderStatusList on order.Id equals status.OrderId
                             select order).ToList();

                foreach (var order in orderList)
                {
                    ViewModel_PayrollOrder payrollOrder = new ViewModel_PayrollOrder();
                    var empInfo = _employeeLogic.GetSingleById(selectedEmpId);

                    var orderStatus = orderStatusList.Where(c => c.OrderId == order.Id).FirstOrDefault();


                    payrollOrder.WaybillNumber           = order.WayBillNumber;
                    payrollOrder.WaybillDate             = order.CreateDate;
                    payrollOrder.OrderType               = order.OrderTypeId == 1 ? "Single" : "Return";
                    payrollOrder.DeliveryOptionShortCode = deliveryOptionList.Where(c => c.Id == order.DeliveryOptionId).FirstOrDefault().ShortCode;
                    payrollOrder.PickupEmployeeId        = (int)orderStatus.DispatchedToEmployeeId;
                    payrollOrder.PickupEmployeeName      = employeeList.Where(c => c.Id == payrollOrder.PickupEmployeeId).FirstOrDefault().FirstName;

                    var deliveryEmpId = orderStatusList.Where(c => c.OrderId == order.Id).FirstOrDefault().PassedOffToEmployeeId;
                    if (deliveryEmpId != null && deliveryEmpId > 0)
                    {
                        payrollOrder.DeliveryEmployeeId   = (int)orderStatus.PassedOffToEmployeeId;
                        payrollOrder.DeliveryEmployeeName = employeeList.Where(c => c.Id == payrollOrder.DeliveryEmployeeId).FirstOrDefault().FirstName;
                    }
                    else
                    {
                        payrollOrder.DeliveryEmployeeId   = payrollOrder.PickupEmployeeId;
                        payrollOrder.DeliveryEmployeeName = payrollOrder.PickupEmployeeName;
                    }

                    payrollOrder.WaybillBaseAmount = order.OrderBasicCost;
                    if (order.BasicCostOverriden != null && order.BasicCostOverriden > 0)
                    {
                        payrollOrder.WaybillBaseAmount = (decimal)order.BasicCostOverriden;
                    }

                    payrollOrder.OrderCommissionPercent = empInfo.CommissionPercentage == null ? 0 : (decimal)empInfo.CommissionPercentage;
                    payrollOrder.OrderFuelPercent       = empInfo.FuelPercentage == null ? 0 : (decimal)empInfo.FuelPercentage;

                    payrollOrder.OrderCommissionAmnt = payrollOrder.WaybillBaseAmount * payrollOrder.OrderCommissionPercent / 100;
                    payrollOrder.OrderFuelAmnt       = payrollOrder.WaybillBaseAmount * payrollOrder.OrderFuelPercent / 100;

                    payrollOrder.AddServiceAmnt = 0;

                    var additionalServices = _additionalServiceLogic.GetList().Where(c => c.OrderId == order.Id);
                    foreach (var addSrv in additionalServices)
                    {
                        if (addSrv.DriverPercentageOnAddService != null && addSrv.DriverPercentageOnAddService > 0)
                        {
                            payrollOrder.AddServiceAmnt = payrollOrder.AddServiceAmnt + (addSrv.AdditionalServiceFee * (decimal)addSrv.DriverPercentageOnAddService / 100);
                        }
                    }
                    payrollOrder.WaitTime = orderStatus.DeliveryWaitTimeHour;

                    viewModelPayrollOrders.Add(payrollOrder);
                }
            }

            return(PartialView("_PartialViewEmployeeDeliveries", viewModelPayrollOrders));
        }