Exemplo n.º 1
0
        public async Task <ApiResponse> AllAgent()
        {
            var listAgentMaster = await _context.TblAgentMaster.ToListAsync();

            var listCompany = await _context.TblCompany.ToListAsync();

            var items = (from lam in listAgentMaster
                         join lc in listCompany on lam.CompanyId equals lc.Id
                         select new { Id = lam.Id,
                                      AgentName = lam.AgentName,
                                      ContactPerson = lam.ContactPerson,
                                      AgentAddress = lam.AgentAddress,
                                      Fax = lam.Fax,
                                      Phone = lam.Phone,
                                      Telephone = lam.Telephone,
                                      Email = lam.Email,
                                      RecordDate = lam.RecordDate,
                                      UpdateDate = lam.UpdateDate,
                                      DeleteStatus = lam.DeleteStatus,
                                      CompanyId = lam.CompanyId,
                                      CompanyName = listCompany.Where(i => i.Id == lam.CompanyId).FirstOrDefault().CompanyName }
                         ).ToList();
            var ApiResponse = await response.ApiResult("OK", items, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 2
0
        public async Task <ApiResponse> AllInstallment()
        {
            var listcustomer = await _context.TblCustomerMaster.ToListAsync();

            var listinstallment = await _context.TblInstallment.ToListAsync();

            var items = (from li in listinstallment
                         join lc in listcustomer on li.CustomerId equals lc.Id
                         select new {
                id = li.Id,
                stockNumber = li.StockNumber,
                customerId = li.CustomerId,
                salemanId = li.SalemanId,
                salePrice = li.SalePrice,
                downPayment = li.DownPayment,
                timeDurationYears = li.TimeDurationYears,
                totalInstallment = li.TotalInstallment,
                taxPer = li.TaxPer,
                taxAmount = li.TaxAmount,
                finalAmount = li.FinalAmount,
                installAmount = li.InstallAmount,
                status = li.Status,
                createdDate = li.CreatedDate,
                updatedDate = li.UpdatedDate,
                deletedDate = li.DeletedDate,
                invoiceNumber = li.InvoiceNumber,
                installmentmode = li.Installmentmode,
                day = li.Day,
                // paymentMode=li.PaymentMode,
                customerName = lc.CustomerName, customerCode = lc.CustomerCode
            }).ToList();
            var ApiResponse = await response.ApiResult("OK", items, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 3
0
        public async Task <ApiResponse> AllYard()
        {
            var listYard = await _context.TblYard.OrderBy(i => i.Name).ToListAsync();

            //  var AgentIdlist = (from ld in listYard select new { ld.AgentId }).ToList();
            var agentlist = await _context.TblAgentMaster.ToListAsync();

            var portlist = await _context.TblPortMaster.ToListAsync();

            var items = (from lY in listYard
                         select new
            {
                id = lY.Id,
                name = lY.Name,
                numberOfFreeDay = lY.NumberOfFreeDay,
                handlingChages = lY.HandlingChages,
                radiationCharges = lY.RadiationCharges,
                godownCharges = lY.GodownCharges,
                otherCharges = lY.OtherCharges,
                portlist = portlist.Where(i => ConvertStringToIntList(lY.PortId).Contains(Convert.ToInt32(i.Id))),
                agentlist = agentlist.Where(i => ConvertStringToIntList(lY.AgentId).Contains(Convert.ToInt32(i.Id))),

                portid = lY.PortId
            }).ToList();


            var ApiResponse = await response.ApiResult("OK", items, "Data Found");

            return(ApiResponse);
        }
Exemplo n.º 4
0
        public async Task <ApiResponse> Login(TblUserMaster objuser)
        {
            var loginDetail = await _context.TblUserMaster.Where(i => i.Email == objuser.Email && i.Password == objuser.Password && i.Active == true && i.DeleteStatus == null).ToListAsync();

            if (loginDetail.Count == 1)
            {
                var listGroupMaster = await _context.TblGroupMaster.ToListAsync();

                var items = (from lu in loginDetail join lg in listGroupMaster on lu.UserTypeId equals lg.Id
                             select new {
                    emailId = lu.Email,
                    userId = lu.Id,
                    userName = lu.UserName,
                    userTypeName = lg.GroupName,
                    userTypeId = lu.UserTypeId
                })
                            .ToList();
                var ApiResponse = await response.ApiResult("OK", items, "Data Found");

                return(ApiResponse);
            }
            else
            {
                var ApiResponse = await response.ApiResult("OK", "", "Email/Password Wrong");

                return(ApiResponse);
            }
        }
Exemplo n.º 5
0
        public async Task <ApiResponse> AllProduct()
        {
            var categoryList = await _context.TblCategoryMaster.ToListAsync();

            var varientname = categoryList.Where(i => i.Type == "Variant").Select(i => i.CategoryType).FirstOrDefault();
            var productList = await _context.TblProduct.ToListAsync();

            var items = (from pl in productList
                         select new
            {
                prodictid = pl.Id,
                productType = pl.ProductType,
                typeid = pl.Typeid,
                modelid = pl.ModelId,
                makerid = pl.MakerId,
                chassisType = pl.ChassisType,
                drive = pl.Drive,
                fule = pl.Fuel,
                noOfDoor = pl.NoOfDoors,
                noOfSeat = pl.NoOfSeats,
                engine_cc = pl.EngineCc,
                makername = categoryList.Where(i => i.Id == pl.MakerId).Select(i => i.CategoryType).FirstOrDefault() != null ? categoryList.Where(i => i.Id == pl.MakerId).Select(i => i.CategoryType).FirstOrDefault() : "N/A"
                ,
                modelname = categoryList.Where(i => i.Id == pl.ModelId && i.Type == "ModelMaster").Select(i => i.CategoryType).FirstOrDefault() != null ? categoryList.Where(i => i.Id == pl.ModelId && i.Type == "ModelMaster").Select(i => i.CategoryType).FirstOrDefault() : "N/A"
                ,
                type = categoryList.Where(i => i.Id == pl.Typeid && i.Type == "TypeMaster").Select(i => i.CategoryType).FirstOrDefault() != null ? categoryList.Where(i => i.Id == pl.Typeid && i.Type == "TypeMaster").Select(i => i.CategoryType).FirstOrDefault() : "N/A"
                ,
                variant = categoryList.Where(i => i.Id == pl.VariantId && i.Type == "Variant").Select(i => i.CategoryType).FirstOrDefault() != null ? categoryList.Where(i => i.Id == pl.VariantId && i.Type == "Variant").Select(i => i.CategoryType).FirstOrDefault() : "N/A"
            }).OrderBy(i => i.makername).ToList();
            var ApiResponse = await response.ApiResult("OK", items, "Product Found");

            return(ApiResponse);
        }
Exemplo n.º 6
0
        public async Task <ApiResponse> GetAllCurrency()
        {
            var listCurrency = await _context.TblCurrencyMaster.ToListAsync();

            var ApiResponse = await response.ApiResult("OK", listCurrency, "Record Found");

            return(ApiResponse);
        }
        public async Task <ApiResponse> AllCompany()
        {
            var items = await _context.TblCompany.OrderByDescending(i => i.Id).ToListAsync();

            var ApiResponse = await response.ApiResult("OK", items, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 8
0
        public async Task <ApiResponse> AllVesselName()
        {
            var items = await _context.TblVesselName.ToListAsync();

            var ApiResponse = await response.ApiResult("OK", items, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 9
0
        public async Task <ApiResponse> InvoiceGeneratedList()
        {
            var currencyList = await _context.TblCurrencyMaster.ToListAsync();

            var salemanList = await _context.TblUserMaster.ToListAsync();

            var customerList = await _context.TblCustomerMaster.ToListAsync();

            var stockList = await _context.TblStock.ToListAsync();

            var productList = await _context.TblProduct.ToListAsync();

            var colorList = await _context.TblColor.ToListAsync();

            var productStocklist = (from ls in stockList
                                    join lp in productList on ls.ProductId equals lp.Id
                                    join lc in colorList on ls.ColorId equals lc.Id
                                    select new
            {
                StockNumber = ls.StockNumber,
                Fuel = lp.Fuel,
                ChassisType = lp.ChassisType,
                Drive = lp.Drive,
                Color = lc.Name
            }).ToList();
            var items = await _context.TblInvoice.Where(i => i.Status == "Sale").ToListAsync();

            var item = (from it in items
                        select new
            {
                StockNumber = it.StockNumber,
                ProductName = "Product Name",
                // Customer="Customer",
                //SalesMan="SalesMan",
                Status = it.Status,
                SaleReffNo = "SaleReffNO",
                SaleDate = it.SaleDate,
                SalePrice = it.SalePrice,
                PaymentStatus = it.PaymentStatus,
                PaidAmount = it.PaidAmount,
                BalanceAmount = it.BalanceAmount,
                IndividualInvoiceNumber = it.IndividualInvoiceNumber,
                InvoiceNumber = it.InvoiceNumber,
                NotifyParty = it.NotifyParty,
                ConsigneeName = it.ConsigneeName,
                ConsigneeAddress = it.ConsigneeAddress,
                CFS = it.Cfs,
                Detail = productStocklist.Where(i => i.StockNumber == it.StockNumber),
                Customer = customerList.Where(i => i.Id == it.CustomerId).FirstOrDefault().CustomerName,
                Salesman = salemanList.Where(i => i.Id == it.UserId).FirstOrDefault().UserName,
                CurrencyName = currencyList.Where(i => i.Id == it.CurrencyId).FirstOrDefault().Name,
                CancelDate = it.CancelDate
            }).OrderByDescending(i => i.SaleDate).ToList();
            var ApiResponse = await response.ApiResult("OK", item, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 10
0
        public async Task <ApiResponse> GetCustomerTT()
        {
            try{
                var ttList = await _context.TblCustomerTt.Where(i => i.Id == 13).ToListAsync();

                var currencyList = await _context.TblCurrencyMaster.ToListAsync();

                var salemanList = await _context.TblUserMaster.ToListAsync();

                var customerList = await _context.TblCustomerMaster.ToListAsync();

                var banklist = await _context.TblBank.ToListAsync();

                var items = (from tt in ttList select new {
                    ttstatus = tt.Ttstatus,
                    customername = customerList.Where(i => i.Id == tt.Customerid).FirstOrDefault().CustomerName,
                    customercode = customerList.Where(i => i.Id == tt.Customerid).FirstOrDefault().CustomerCode,
                    bankreferance = "bank reference",
                    receivedbankname = banklist.Where(i => i.Id == tt.ReceivedBankId).FirstOrDefault().Name,
                    date = tt.RecordDate,
                    remmiterbankname = tt.RemmiterBankName,
                    remmitername = tt.RemmiterName,
                    currency = currencyList.Where(i => i.Id == tt.CurrencyId).FirstOrDefault().Name,
                    amount = tt.Amount,
                    bankcharges = tt.BankCharges,
                    totalttamount = tt.ToatalAmount,
                    confirmby = tt.ComfirmBy,
                    ttremark = tt.Remarks,
                    transferamount = tt.TransferAmount,
                    transferbankcharges = tt.BankCharges,
                    refundamount = tt.RefundAmount,
                    refundbankcharges = tt.RefundBankCharge,
                    receivedamount = tt.ReceviedAmount,
                    receivedremarks = tt.ReceviedRemarks,
                    transferremarks = tt.TransferRemarks,
                    refundremarks = tt.RefundRemarks,
                    updatedate = tt.UpdateDate
                }).ToList();
                var ApiResponse = await response.ApiResult("OK", items, "Record Found");

                return(ApiResponse);
            }
            catch (Exception ex) {
                var ApiResponseCatch = await response.ApiResult("OK", "", ex.ToString());

                return(ApiResponseCatch);
            }
        }
Exemplo n.º 11
0
        public async Task <ApiResponse> AllAuction()
        {
            var items = await _context.TblAuctionMaster.ToListAsync();

            var ApiResponse = await response.ApiResult("OK", items, "Data Found");

            return(ApiResponse);
        }
Exemplo n.º 12
0
        public async Task <ApiResponse> AllCustomer()
        {
            try
            {
                var listcustomer = await _context.TblCustomerMaster.Where(i => i.DeleteStatus == null).OrderBy(i => i.CustomerName).ToListAsync();

                var ApiResponse = await response.ApiResult("OK", listcustomer, "Record Found");

                return(ApiResponse);
            }
            catch (Exception ex)
            {
                var ApiResponseCatch = await response.ApiResult("OK", ex, "Error ");

                return(ApiResponseCatch);
            }
        }
Exemplo n.º 13
0
        //public async Task<ActionResult<IEnumerable<TblStock>>> GetStockByNumber(TblStock tblStock)
        //{
        //    var tblStockResult = await _context.TblStock.Where(i=>i.StockNumber==tblStock.StockNumber).ToListAsync();

        //    if (tblStock == null)
        //    {
        //        return NotFound();
        //    }

        //    return tblStockResult;
        //}
        public async Task <ApiResponse> GetStockByNumber(TblStock tblStock)
        {
            ApiResponse response = new ApiResponse();
            string      message  = "Record Not Found";

            try
            {
                List <TblStock> listStock = new List <TblStock>();
                if (tblStock.StockNumber != "")
                {
                    var stockArray = tblStock.StockNumber.Split(',');

                    for (int i = 0; i < stockArray.Length; i++)
                    {
                        var stocknumber = stockArray[i].ToString();

                        var listinvoice = await _context.TblInvoice.Where(j => j.StockNumber == stocknumber).ToListAsync();

                        if (listinvoice.Count == 0)
                        {
                            List <TblStock> tblStockResult = await _context.TblStock.Where(j => j.StockNumber == stocknumber).ToListAsync();

                            listStock.AddRange(tblStockResult);
                        }
                    }
                    if (listStock.Count == 0)
                    {
                        //message;
                    }
                    else
                    {
                        message = "Record Found";
                    }
                }
                var ApiResponse = await response.ApiResult("OK", listStock, message);

                return(ApiResponse);
            }
            catch (Exception ex)
            {
                var ApiResponse = await response.ApiResult("FAILED", "", ex.ToString());

                return(ApiResponse);
            }
        }
Exemplo n.º 14
0
        public async Task <ApiResponse> AllVessel()
        {
            var countrylist = await _context.TblCountryMaster.ToListAsync();

            var vesselnameList = await _context.TblVesselName.ToListAsync();

            var shippingAgentlist = await _context.TblShippingAgent.ToListAsync();

            var yardlist = await _context.TblYard.ToListAsync();

            var vesselmasterList = await _context.TblVesselMaster.ToListAsync();

            var items = (from vm in vesselmasterList
                         select new
            {
                id = vm.Id,
                vesselname = vesselnameList.Where(i => i.Id == vm.VesselNameId).Select(i => i.VesselName).FirstOrDefault(),
                voyageno = vm.VoyageNo,
                vesseltype = vm.VesselType,
                ispackagedeal = vm.IsPackageDeal,
                noofcontainer = vm.NoOfContainer,
                yardname = yardlist.Where(i => vm.YardId.Contains((i.Id).ToString())).Select(i => i.Name),
                source = countrylist.Where(i => i.Id == vm.SourceCountryId).Select(i => i.CountryName),
                destination = countrylist.Where(i => i.Id == vm.DestinationCountryId).Select(i => i.CountryName),
                shippingagent = shippingAgentlist.Where(i => vm.ShippingAgentid.Contains((i.Id).ToString())).Select(i => i.ShippingAgentName),
                etddate = vm.Etddate,
                lastofconsigneedate = vm.LastConsigneDate,
                lastofcfsdate = vm.LastCfsdate
            }).ToList();
            var ApiResponse = await response.ApiResult("OK", items, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 15
0
        public async Task <ApiResponse> AllPort()
        {
            var items = await _context.TblPortMaster.OrderBy(i => i.PortName).ToListAsync();

            var ApiResponse = await response.ApiResult("OK", items, "Data Found");

            return(ApiResponse);
        }
Exemplo n.º 16
0
        public async Task <ApiResponse> AddAttribute(TblAttribute tblAttribute)
        {
            try
            {
                _context.TblAttribute.Add(tblAttribute);
                await _context.SaveChangesAsync();

                var ApiResponse = await GetAllProduct();

                return(ApiResponse);
            }
            catch (Exception ex)
            {
                var ApiResponse = await response.ApiResult("FAILED", ex, "Error Data Insert");

                return(ApiResponse);
            }
            // return CreatedAtAction("GetTblAttribute", new { id = tblAttribute.Id }, tblAttribute);
        }
Exemplo n.º 17
0
        public async Task <ActionResult <ApiResponse> > AllCategory(TblCategoryMaster tblobj)
        {
            var items = await _context.TblCategoryMaster.Where(i => i.Type == tblobj.Type).ToListAsync();

            var ApiResponse = await response.ApiResult("OK", items, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 18
0
        public async Task <ApiResponse> AllCountry()
        {
            var listCountry = await _context.TblCountryMaster.OrderByDescending(i => i.Id).ToListAsync();

            var ApiResponse = await response.ApiResult("OK", listCountry, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 19
0
        public async Task <ApiResponse> TransportationByPortAuction(TblTransportation tbltransportation)
        {
            var companylist = await _context.TblCompany.Distinct().ToListAsync();

            var transportList = await _context.TblTransportation.Where(i => i.SourceId == tbltransportation.SourceId && i.DesstinationId == tbltransportation.DesstinationId && i.TypeId == tbltransportation.TypeId).ToListAsync();

            var items = (from tl in transportList
                         select new
            {
                id = tl.Id,
                name = companylist.Where(i => i.Id == tl.CompanyId).Select(i => i.CompanyName).FirstOrDefault()
            }).ToList();
            var ApiResponse = await response.ApiResult("OK", items, "Record Found");

            return(ApiResponse);
        }
Exemplo n.º 20
0
        public async Task <ApiResponse> UpdateBank(TblBank tblBank)
        {
            _context.Entry(tblBank).State = EntityState.Modified;
            _context.Entry(tblBank).Property(x => x.RecordDate).IsModified = false;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                var ApiResponse = await response.ApiResult("FAILED", "", "Bank Not Found");

                return(ApiResponse);
            }

            var responseBank = await GetAllBanks();

            return(responseBank);
        }