Example #1
0
        public bool UpdateExpenseTransaction(ExpenseTransactionDTO expenseTransactionDTO)
        {
            var flag = true;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var expenseTran = entities.ExpenseTransactions.FirstOrDefault(g => g.ExpenseTransactionID == expenseTransactionDTO.ExpenseTransactionID);

                    expenseTran.ExpenseTransactionID = expenseTransactionDTO.ExpenseTransactionID;
                    expenseTran.ExpenseID            = expenseTransactionDTO.ExpenseID;
                    expenseTran.Comments             = expenseTransactionDTO.Comments;
                    expenseTran.Amount       = expenseTransactionDTO.Amount;
                    expenseTran.DebitType    = expenseTransactionDTO.DebitType;
                    expenseTran.ExpenseDate  = expenseTransactionDTO.ExpenseDate;
                    expenseTran.Modifiedby   = expenseTransactionDTO.ModifiedBy;
                    expenseTran.ModifiedDate = expenseTransactionDTO.ModifiedDate;
                    expenseTran.Type         = expenseTransactionDTO.Type;
                    entities.SaveChanges();
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                throw ex;
            }

            return(flag);
        }
Example #2
0
        public List <ExpenseTransactionDTO> GetExpenseTransaction()
        {
            var lstExpenseTransaction = new List <ExpenseTransactionDTO>();

            using (var entities = new ManiMotorsEntities1())
            { lstExpenseTransaction = (from expT in entities.ExpenseTransactions
                                       join exp in entities.Expenses on expT.ExpenseID equals exp.ExpenseID
                                       select new ExpenseTransactionDTO
                {
                    ExpenseTransactionID = expT.ExpenseTransactionID,
                    ExpenseID = expT.ExpenseID,
                    ExpenseDescription = exp.Description,
                    Comments = expT.Comments,
                    Amount = expT.Amount ?? 0,
                    DebitType = expT.DebitType,
                    ExpenseDate = expT.ExpenseDate,
                    CreatedBy = expT.Createdby ?? 0,
                    CreatedDate = expT.CreatedDate,
                    ModifiedBy = expT.Modifiedby,
                    ModifiedDate = expT.ModifiedDate,
                    Type = expT.Type,
                }
                                       ).ToList(); }

            return(lstExpenseTransaction);
        }
Example #3
0
        //public List<ExpenseTransactionDTO> GetExpenseTransaction(DateTime reportDate, string mode)
        //{
        //    var lstExpenseTransaction = new List<ExpenseTransactionDTO>();
        //    using (var entities = new ManiMotorsEntities1())
        //    {
        //        if (mode == "DAILY")
        //        {
        //            var results = entities.GetDailyExpenseTransaction_SP(reportDate);
        //            foreach (var ent in results)
        //            {
        //                var expenseTransactionDTO = new ExpenseTransactionDTO();
        //                expenseTransactionDTO.ExpenseTransactionID = ent.ExpenseTransactionID;
        //                expenseTransactionDTO.ExpenseID = ent.ExpenseID ?? 0;
        //                expenseTransactionDTO.Comments = ent.Comments;
        //                expenseTransactionDTO.Amount = ent.Amount ?? 0;
        //                expenseTransactionDTO.ExpenseDescription = ent.Description;
        //                expenseTransactionDTO.CreatedDate = ent.CreatedDate ?? DateTime.Now;
        //                lstExpenseTransaction.Add(expenseTransactionDTO);
        //            }
        //        }
        //        else if (mode == "MONTHLY")
        //        {
        //            var results = entities.GetMonthlyExpenseTransaction_SP(reportDate);
        //            foreach (var ent in results)
        //            {
        //                var expenseTransactionDTO = new ExpenseTransactionDTO();
        //                expenseTransactionDTO.ExpenseTransactionID = ent.ExpenseTransactionID;
        //                expenseTransactionDTO.ExpenseID = ent.ExpenseID ?? 0;
        //                expenseTransactionDTO.Comments = ent.Comments;
        //                expenseTransactionDTO.Amount = ent.Amount ?? 0;
        //                expenseTransactionDTO.ExpenseDescription = ent.Description;
        //                expenseTransactionDTO.CreatedDate = ent.CreatedDate ?? DateTime.Now;
        //                lstExpenseTransaction.Add(expenseTransactionDTO);
        //            }

        //        }
        //        else if (mode == "YEARLY")
        //        {
        //            var results = entities.GetYearlyExpenseTransaction_SP(reportDate);
        //            foreach (var ent in results)
        //            {
        //                var expenseTransactionDTO = new ExpenseTransactionDTO();
        //                expenseTransactionDTO.ExpenseTransactionID = ent.ExpenseTransactionID;
        //                expenseTransactionDTO.ExpenseID = ent.ExpenseID ?? 0;
        //                expenseTransactionDTO.Comments = ent.Comments;
        //                expenseTransactionDTO.Amount = ent.Amount ?? 0;
        //                expenseTransactionDTO.ExpenseDescription = ent.Description;
        //                expenseTransactionDTO.CreatedDate = ent.CreatedDate ?? DateTime.Now;
        //                lstExpenseTransaction.Add(expenseTransactionDTO);
        //            }

        //        }
        //    }

        //    return lstExpenseTransaction;
        //}

        public bool AddExpenseTransaction(ExpenseTransactionDTO expenseTransactionDTO)
        {
            var flag = true;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var expenseTransaction = new ExpenseTransaction()
                    {
                        ExpenseID    = expenseTransactionDTO.ExpenseID,
                        Comments     = expenseTransactionDTO.Comments,
                        Amount       = expenseTransactionDTO.Amount,
                        DebitType    = expenseTransactionDTO.DebitType,
                        ExpenseDate  = expenseTransactionDTO.ExpenseDate,
                        CreatedDate  = expenseTransactionDTO.CreatedDate,
                        Createdby    = expenseTransactionDTO.CreatedBy,
                        Modifiedby   = expenseTransactionDTO.ModifiedBy,
                        ModifiedDate = expenseTransactionDTO.ModifiedDate,
                        Type         = expenseTransactionDTO.Type,
                    };
                    entities.ExpenseTransactions.Add(expenseTransaction);
                    entities.SaveChanges();
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                throw ex;
            }

            return(flag);
        }
Example #4
0
        public VehicleInfoDTO GetVehicleInfo(int VehicleInfoID)
        {
            VehicleInfoDTO obj = new VehicleInfoDTO();

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var lstVehicleInfo = entities.VehicleInfoes.Where(x => x.VehicleInfoID == VehicleInfoID).FirstOrDefault();
                    obj.VehicleInfoID   = lstVehicleInfo.VehicleInfoID;
                    obj.VehicleTypeID   = lstVehicleInfo.VehicleTypeID;
                    obj.ModelCode       = lstVehicleInfo.ModelCode;
                    obj.ModelName       = lstVehicleInfo.ModelName;
                    obj.ExShowRoomPrice = lstVehicleInfo.ExShowRoomPrice;
                    obj.LT_RT_OtherExp  = lstVehicleInfo.LT_RT_OtherExp;
                    obj.InsurancePrice  = lstVehicleInfo.InsurancePrice;
                    obj.OnRoadPrice     = lstVehicleInfo.OnRoadPrice;
                    obj.MarginPrice     = lstVehicleInfo.MarginPrice;
                    obj.Margin50        = lstVehicleInfo.C50PercentMargin;
                    obj.Margin70        = lstVehicleInfo.C70PercentMargin;
                    obj.CreatedDate     = lstVehicleInfo.CreatedDate ?? DateTime.Now;
                    obj.CreatedBy       = lstVehicleInfo.Createdby ?? 0;
                    obj.ModifiedDate    = lstVehicleInfo.ModifiedDate ?? DateTime.Now;
                    obj.ModifiedBy      = lstVehicleInfo.Modifiedby ?? 0;
                    obj.WarrantyPrice   = lstVehicleInfo.WarrantyPrice ?? 0;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(obj);
        }
Example #5
0
        public List <CashTransactionDTO> GetCashTransaction()
        {
            var lstCashTran = new List <CashTransactionDTO>();

            using (var entities = new ManiMotorsEntities1())
            {
                lstCashTran = (from bat in entities.CashTransactions
                               select new CashTransactionDTO
                {
                    CashTransactionID = bat.CashTransactionID,
                    TransactionType = bat.TransactionType,
                    Amount = bat.Amount,
                    TransactionDate = bat.TransactionDate,
                    Description = bat.Description,
                    CreatedBy = bat.Createdby,
                    CreatedDate = bat.CreatedDate,
                    ModifiedBy = bat.Modifiedby,
                    ModifiedDate = bat.ModifiedDate,
                    Type = bat.Type,
                    Status = bat.Status,
                }
                               ).ToList();
            }

            return(lstCashTran);
        }
        public FinanceAllotmentDTO GetFinanceAllotment(int financeAllotmentId)
        {
            FinanceAllotmentDTO dto = new FinanceAllotmentDTO();

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    dto = (from vbfa in entity.VehicleBookingFinanceAllotments
                           join fi in entity.FinanceInfoes on vbfa.FinancierID equals fi.FinanceInfoID
                           where vbfa.VehicleBookingFinanceAllotmentID == financeAllotmentId
                           select new FinanceAllotmentDTO
                    {
                        VehicleBookingFinanceAllotmentID = financeAllotmentId,
                        VehicleBookingId = vbfa.VehicleBookingID,
                        FinancierName = fi.Name,
                        FinancierID = vbfa.FinancierID,
                        LoanNumber = vbfa.LoanNo,
                        FinanceDate = vbfa.FinanceDate,
                        FinanceAmount = vbfa.FinanceAmount,
                        OtherAmount = vbfa.OtherAmount,
                        OtherChargesDescription = vbfa.OtherChargesDesc
                    }
                           ).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(dto);
        }
Example #7
0
        public bool AddSpareParts(SparePartsTypeDTO sparePartsDTO)
        {
            var flag = true;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var sp = new SparePartsType()
                    {
                        Description  = sparePartsDTO.Description,
                        CreatedDate  = sparePartsDTO.CreatedDate,
                        Createdby    = sparePartsDTO.CreatedBy,
                        Modifiedby   = sparePartsDTO.ModifiedBy,
                        ModifiedDate = sparePartsDTO.ModifiedDate
                    };
                    entities.SparePartsTypes.Add(sp);
                    entities.SaveChanges();
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                throw ex;
            }

            return(flag);
        }
Example #8
0
        public List <SparePartsInfoDTO> GetAllSparePartsInfo()
        {
            List <SparePartsInfoDTO> obj = new List <SparePartsInfoDTO>();

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var lstSparePartsInfo = entities.SparePartsInfoes.ToList();
                    foreach (var Info in lstSparePartsInfo)
                    {
                        SparePartsInfoDTO dto = new SparePartsInfoDTO();
                        dto.SparePartsInfoID = Info.SparePartsInfoID;
                        dto.SparePartsTypeID = Info.SparePartsTypeID;
                        dto.ModelCode        = Info.ModelCode;
                        dto.ModelName        = Info.ModelName;
                        dto.ShowRoomPrice    = Info.ShowRoomPrice;
                        dto.MarginPrice      = Info.MarginPrice;
                        dto.CreatedDate      = Info.CreatedDate ?? DateTime.Now;
                        dto.CreatedBy        = Info.Createdby ?? 0;
                        dto.ModifiedDate     = Info.ModifiedDate ?? DateTime.Now;
                        dto.ModifiedBy       = Info.Modifiedby ?? 0;
                        obj.Add(dto);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(obj);
        }
Example #9
0
        public InsuranceAllotmentDTO GetInsuranceAllotment(int insuranceAllotmentId)
        {
            InsuranceAllotmentDTO dto = new InsuranceAllotmentDTO();

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    dto = (from vbfa in entity.VehicleBookingInsuranceAllotments
                           join fi in entity.InsuranceInfoes on vbfa.InsuranceInfoID equals fi.InsuranceInfoID
                           where vbfa.VehicleBookingInsuranceAllotmentID == insuranceAllotmentId
                           select new InsuranceAllotmentDTO
                    {
                        VehicleBookingInsuranceAllotmentID = insuranceAllotmentId,
                        VehicleBookingId = vbfa.VehicleBookingID,
                        InsuranceByDealer = vbfa.InsuranceByDealer,
                        InsuranceInfoID = vbfa.InsuranceInfoID,
                        InsuranceName = fi.Name,
                        CoverNoteNo = vbfa.CoverNoteNo,
                        PolicyNumber = vbfa.PolicyNo,
                        PolicyAmount = vbfa.PolicyAmount,
                        FromDate = vbfa.FromDate,
                        ToDate = vbfa.ToDate,
                        PolicyDeliveredDate = vbfa.PolicyDeliveredDate,
                        ContactNo = vbfa.ContactNo,
                    }
                           ).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(dto);
        }
Example #10
0
        public bool UpdateSpareParts(SparePartsTypeDTO sparePartsDTO)
        {
            var flag = true;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var Gamesys = entities.SparePartsTypes.Where(g => g.SparePartsTypeID == sparePartsDTO.SparePartsTypeID).FirstOrDefault();
                    Gamesys.Description = sparePartsDTO.Description;
                    //Gamesys.CreatedDate = expensesDTO.CreatedDate;
                    //Gamesys.Createdby = expensesDTO.CreatedBy;
                    Gamesys.Modifiedby   = sparePartsDTO.ModifiedBy;
                    Gamesys.ModifiedDate = sparePartsDTO.ModifiedDate;
                    entities.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                flag = false;
                throw ex;
            }

            return(flag);
        }
Example #11
0
        public List <FinanceInfoDTO> GetAllFinanceInfo()
        {
            List <FinanceInfoDTO> lst = new List <FinanceInfoDTO>();

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    var entlist = entity.FinanceInfoes.ToList();
                    foreach (var ent in entlist)
                    {
                        var dto = new FinanceInfoDTO();
                        dto.FinanceInfoID = ent.FinanceInfoID;
                        dto.Name          = ent.Name;
                        dto.Address1      = ent.Address1;
                        dto.Address2      = ent.Address2;
                        dto.ContactNo     = ent.ContactNo;
                        lst.Add(dto);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lst);;
        }
Example #12
0
        public bool AddExpenses(ExpensesDTO expensesDTO)
        {
            var flag = true;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var expense = new Expens()
                    {
                        Description  = expensesDTO.Description,
                        CreatedDate  = expensesDTO.CreatedDate,
                        Createdby    = expensesDTO.CreatedBy,
                        Modifiedby   = expensesDTO.ModifiedBy,
                        ModifiedDate = expensesDTO.ModifiedDate
                    };
                    entities.Expenses.Add(expense);
                    entities.SaveChanges();
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                throw ex;
            }

            return(flag);
        }
        public CustomerEnquiryFollowupDTO GetCustomerEnquiryFollowupbyId(int CustomerEnquiryid)
        {
            CustomerEnquiryFollowupDTO lst = new CustomerEnquiryFollowupDTO();

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    lst = (from ce in entity.CustomerEnquiries
                           join cef in entity.CustomerEnquiryFollowUps on ce.CustomerEnquiryID equals cef.CustomerEnquiryID
                           join vs in entity.VehicleSalesStatus on ce.VehicleStatusID equals vs.VehicleSalesStatusID
                           join vi in entity.VehicleInfoes on ce.Model1 equals vi.VehicleInfoID
                           join c in entity.Customers on ce.CustomerID equals c.CustomerID
                           where cef.CustomerEnquiryID == CustomerEnquiryid &&
                           cef.IsLatest == true
                           select new CustomerEnquiryFollowupDTO
                    {
                        CustomerName = c.Name,
                        CustomerId = c.CustomerID,
                        ModelName = vi.ModelName,
                        CustomerEnquiryId = ce.CustomerEnquiryID,
                        FollowUpDate = cef.FollowUpDate,
                        StatusDescription = vs.Description,
                        StatusId = vs.VehicleSalesStatusID,
                        CustomerMobileNo = c.ContactNo,
                        Description = cef.Description
                    }).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lst);
        }
Example #14
0
        public List <VehicleStatusDTO> GetVehicleSalesStatus(string mode)
        {
            List <VehicleStatusDTO> lst = new List <VehicleStatusDTO>();

            using (var entity = new ManiMotorsEntities1())
            {
                if (mode == "ALL")
                {
                    lst = (from v in entity.VehicleSalesStatus
                           select new VehicleStatusDTO
                    {
                        VehicleSalesStatusID = v.VehicleSalesStatusID,
                        Description = v.Description
                    }).ToList();
                }
                else
                {
                    lst = (from v in entity.VehicleSalesStatus
                           where v.Description == "Open" || v.Description == "Closed"
                           select new VehicleStatusDTO
                    {
                        VehicleSalesStatusID = v.VehicleSalesStatusID,
                        Description = v.Description
                    }).ToList();
                }
            }
            return(lst);
        }
Example #15
0
        public SparePartsInfoDTO GetSparePartsInfo(int SparePartsInfoID)
        {
            SparePartsInfoDTO obj = new SparePartsInfoDTO();

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var lstSparePartsInfo = entities.SparePartsInfoes.Where(x => x.SparePartsInfoID == SparePartsInfoID).FirstOrDefault();
                    obj.SparePartsInfoID = lstSparePartsInfo.SparePartsInfoID;
                    obj.SparePartsTypeID = lstSparePartsInfo.SparePartsTypeID;
                    obj.ModelCode        = lstSparePartsInfo.ModelCode;
                    obj.ModelName        = lstSparePartsInfo.ModelName;
                    obj.ShowRoomPrice    = lstSparePartsInfo.ShowRoomPrice;
                    obj.MarginPrice      = lstSparePartsInfo.MarginPrice;
                    obj.CreatedDate      = lstSparePartsInfo.CreatedDate ?? DateTime.Now;
                    obj.CreatedBy        = lstSparePartsInfo.Createdby ?? 0;
                    obj.ModifiedDate     = lstSparePartsInfo.ModifiedDate ?? DateTime.Now;
                    obj.ModifiedBy       = lstSparePartsInfo.Modifiedby ?? 0;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(obj);
        }
Example #16
0
        public CustomerDTO GetCustomer(int CustomerId)
        {
            CustomerDTO dto = new CustomerDTO();

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var cust = entities.Customers.FirstOrDefault(c => c.CustomerID == CustomerId);
                    dto.CustomerID   = cust.CustomerID;
                    dto.Name         = cust.Name;
                    dto.Address1     = cust.Address1;
                    dto.Address2     = cust.Address2;
                    dto.Email        = cust.Email;
                    dto.ContactNo    = cust.ContactNo;
                    dto.Age          = cust.Age ?? 0;
                    dto.DOB          = cust.DateOfBirth ?? DateTime.Now;
                    dto.Gender       = cust.Gender;
                    dto.Occupation   = cust.Occupation;
                    dto.AreaName     = cust.AreaName;
                    dto.CreatedDate  = cust.CreatedDate ?? DateTime.Now;
                    dto.CreatedBy    = cust.Createdby ?? 1;
                    dto.ModifiedDate = cust.ModifiedDate ?? DateTime.Now;
                    dto.ModifiedBy   = cust.Modifiedby ?? 1;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(dto);
        }
Example #17
0
        public bool UpdateBankAccountTransaction(BankAccountTransactionDTO baDTO)
        {
            var flag = true;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var bTran = entities.BankAccountTransactions.FirstOrDefault(g => g.BankAccountTransactionID == baDTO.BankAccountTransactionID);

                    bTran.BankAccountTransactionID = baDTO.BankAccountTransactionID;
                    bTran.BankAccountTypeID        = baDTO.BankAccountTypeID;
                    bTran.TransactionType          = baDTO.TransactionType;
                    bTran.Amount          = baDTO.Amount;
                    bTran.TransactionDate = baDTO.TransactionDate;
                    bTran.Description     = baDTO.Description;
                    bTran.CreatedDate     = baDTO.CreatedDate;
                    bTran.Createdby       = baDTO.CreatedBy;
                    bTran.Modifiedby      = baDTO.ModifiedBy;
                    bTran.ModifiedDate    = baDTO.ModifiedDate;
                    bTran.Type            = baDTO.Type;
                    entities.SaveChanges();
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                throw ex;
            }

            return(flag);
        }
Example #18
0
        public List <BankAccountTransactionDTO> GetBankAccountTransaction()
        {
            var lstBankActTran = new List <BankAccountTransactionDTO>();

            using (var entities = new ManiMotorsEntities1())
            {
                lstBankActTran = (from bat in entities.BankAccountTransactions
                                  join bt in entities.BankAccountTypes on bat.BankAccountTypeID equals bt.BankAccountTypeID
                                  select new BankAccountTransactionDTO
                {
                    BankAccountTransactionID = bat.BankAccountTransactionID,
                    BankAccountTypeID = bat.BankAccountTypeID,
                    BankAccountTypeDescription = bt.Description,
                    TransactionType = bat.TransactionType,
                    Amount = bat.Amount,
                    TransactionDate = bat.TransactionDate,
                    Description = bat.Description,
                    CreatedBy = bat.Createdby,
                    CreatedDate = bat.CreatedDate,
                    ModifiedBy = bat.Modifiedby,
                    ModifiedDate = bat.ModifiedDate,
                    Type = bat.Type,
                }
                                  ).ToList();
            }

            return(lstBankActTran);
        }
Example #19
0
        public bool AddBankAccountTransaction(BankAccountTransactionDTO baDTO)
        {
            var flag = true;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    var bTran = new BankAccountTransaction()
                    {
                        BankAccountTypeID = baDTO.BankAccountTypeID,
                        TransactionType   = baDTO.TransactionType,
                        Amount            = baDTO.Amount,
                        Description       = baDTO.Description,
                        TransactionDate   = baDTO.TransactionDate,
                        CreatedDate       = baDTO.CreatedDate,
                        Createdby         = baDTO.CreatedBy,
                        Modifiedby        = baDTO.ModifiedBy,
                        ModifiedDate      = baDTO.ModifiedDate,
                        Type = baDTO.Type,
                    };
                    entities.BankAccountTransactions.Add(bTran);
                    entities.SaveChanges();
                    flag = true;
                }
            }
            catch (Exception ex)
            {
                flag = false;
                throw ex;
            }

            return(flag);
        }
        public VehicleBookingFollowupDTO GetVehicleBookingFollowupbyId(int vehicleBookingId)
        {
            VehicleBookingFollowupDTO lst = new VehicleBookingFollowupDTO();

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    lst = (from vb in entity.VehicleBookings
                           join vbf in entity.VehicleBookingFollowUps on vb.VehicleBookingID equals vbf.VehicleBookingID
                           join vs in entity.VehicleSalesStatus on vb.StatusID equals vs.VehicleSalesStatusID
                           join vi in entity.VehicleInfoes on vb.ModelID equals vi.VehicleInfoID
                           join c in entity.Customers on vb.CustomerID equals c.CustomerID
                           where vbf.VehicleBookingID == vehicleBookingId &&
                           vbf.isActive == true
                           select new VehicleBookingFollowupDTO
                    {
                        CustomerName = c.Name,
                        CustomerId = c.CustomerID,
                        ModelName = vi.ModelName,
                        VehicleBookingID = vb.VehicleBookingID,
                        FollowUpDate = vbf.FollowupDate,
                        StatusDescription = vs.Description,
                        StatusId = vs.VehicleSalesStatusID,
                        CustomerMobileNo = c.ContactNo,
                        Description = vbf.Description
                    }).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lst);
        }
Example #21
0
        public RTOAllotmentDTO GetRTOAllotment(int rtoAllotmentId)
        {
            RTOAllotmentDTO dto = new RTOAllotmentDTO();

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    dto = (from vbfa in entity.VehicleBookingRTOAllotments
                           join fi in entity.RTOInfoes on vbfa.RTOInfoID equals fi.RTOInfoID
                           where vbfa.VehicleBookingRTOAllotmentID == rtoAllotmentId
                           select new RTOAllotmentDTO
                    {
                        VehicleBookingRTOAllotmentID = rtoAllotmentId,
                        VehicleBookingId = vbfa.VehicleBookingID,
                        RTOName = fi.Name,
                        RTOInfoID = vbfa.RTOInfoID,
                        TempRegNo = vbfa.TempRegNo,
                        RegNo = vbfa.RegNo,
                        RegDate = vbfa.RegDate,
                        Amount = vbfa.Amount,
                        AgentName = vbfa.AgentName,
                        RCBookNo = vbfa.RCBookNo,
                        RCDeliveredDate = vbfa.RCDeliveredDate,
                        Remark = vbfa.Remark,
                    }
                           ).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(dto);
        }
Example #22
0
        public bool SaveCustomer(CustomerDTO cust, string mode)
        {
            var flag = false;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    if (mode == "EDIT")
                    {
                        var dto = entities.Customers.FirstOrDefault(v => v.CustomerID == cust.CustomerID);
                        //dto.CustomerID = cust.CustomerID;
                        dto.Name         = cust.Name;
                        dto.Address1     = cust.Address1;
                        dto.Address2     = cust.Address2;
                        dto.Email        = cust.Email;
                        dto.ContactNo    = cust.ContactNo;
                        dto.Age          = cust.Age;
                        dto.DateOfBirth  = cust.DOB;
                        dto.Gender       = cust.Gender;
                        dto.Occupation   = cust.Occupation;
                        dto.AreaName     = cust.AreaName;
                        dto.CreatedDate  = cust.CreatedDate;
                        dto.Createdby    = cust.CreatedBy;
                        dto.ModifiedDate = cust.ModifiedDate;
                        dto.Modifiedby   = cust.ModifiedBy;
                        entities.SaveChanges();
                        flag = true;
                    }
                    else
                    {
                        MM.DataLayer.Customer dto = new MM.DataLayer.Customer();
                        dto.Name         = cust.Name;
                        dto.Address1     = cust.Address1;
                        dto.Address2     = cust.Address2;
                        dto.Email        = cust.Email;
                        dto.ContactNo    = cust.ContactNo;
                        dto.Age          = cust.Age;
                        dto.DateOfBirth  = cust.DOB;
                        dto.Gender       = cust.Gender;
                        dto.Occupation   = cust.Occupation;
                        dto.AreaName     = cust.AreaName;
                        dto.CreatedDate  = cust.CreatedDate;
                        dto.Createdby    = cust.CreatedBy;
                        dto.ModifiedDate = cust.ModifiedDate;
                        dto.Modifiedby   = cust.ModifiedBy;
                        entities.SaveChanges();
                        entities.Customers.Add(dto);
                        entities.SaveChanges();
                        flag = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(flag);
        }
Example #23
0
        public int SaveRTOAllotment(RTOAllotmentDTO dto, string mode = "")
        {
            var rtoAllotmentId = 0;

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    if (mode == "EDIT")
                    {
                        var obj = entity.VehicleBookingRTOAllotments.FirstOrDefault(vbfa => vbfa.VehicleBookingRTOAllotmentID == dto.VehicleBookingRTOAllotmentID);
                        obj.VehicleBookingID = dto.VehicleBookingId;
                        obj.RTOInfoID        = dto.RTOInfoID;
                        obj.TempRegNo        = dto.TempRegNo;
                        obj.RegNo            = dto.RegNo;
                        obj.RegDate          = dto.RegDate;
                        obj.Amount           = dto.Amount;
                        obj.AgentName        = dto.AgentName;
                        obj.RCBookNo         = dto.RCBookNo;
                        obj.RCDeliveredDate  = dto.RCDeliveredDate;
                        obj.Remark           = dto.Remark;
                        obj.Createdby        = dto.CreatedBy;
                        obj.CreatedDate      = dto.CreatedDate;
                        obj.Modifiedby       = dto.ModifiedBy;
                        obj.ModifiedDate     = dto.ModifiedDate;
                        entity.SaveChanges();
                        rtoAllotmentId = obj.VehicleBookingRTOAllotmentID;
                    }
                    else
                    {
                        VehicleBookingRTOAllotment obj = new VehicleBookingRTOAllotment()
                        {
                            VehicleBookingID = dto.VehicleBookingId,
                            RTOInfoID        = dto.RTOInfoID,
                            TempRegNo        = dto.TempRegNo,
                            RegNo            = dto.RegNo,
                            RegDate          = dto.RegDate,
                            Amount           = dto.Amount,
                            AgentName        = dto.AgentName,
                            RCBookNo         = dto.RCBookNo,
                            RCDeliveredDate  = dto.RCDeliveredDate,
                            Remark           = dto.Remark,
                            Createdby        = dto.CreatedBy,
                            CreatedDate      = dto.CreatedDate,
                            Modifiedby       = dto.ModifiedBy,
                            ModifiedDate     = dto.ModifiedDate
                        };
                        entity.VehicleBookingRTOAllotments.Add(obj);
                        entity.SaveChanges();
                        rtoAllotmentId = obj.VehicleBookingRTOAllotmentID;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(rtoAllotmentId);
        }
Example #24
0
        public bool SaveVehicleInfo(VehicleInfoDTO dto, string mode)
        {
            var flag = false;

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    if (mode == "EDIT")
                    {
                        var info = entities.VehicleInfoes.FirstOrDefault(v => v.VehicleInfoID == dto.VehicleInfoID);
                        info.VehicleTypeID    = dto.VehicleTypeID;
                        info.ModelCode        = dto.ModelCode;
                        info.ModelName        = dto.ModelName;
                        info.ExShowRoomPrice  = dto.ExShowRoomPrice;
                        info.LT_RT_OtherExp   = dto.LT_RT_OtherExp;
                        info.InsurancePrice   = dto.InsurancePrice;
                        info.OnRoadPrice      = dto.OnRoadPrice;
                        info.MarginPrice      = dto.MarginPrice;
                        info.C50PercentMargin = dto.Margin50;
                        info.C70PercentMargin = dto.Margin70;
                        info.CreatedDate      = dto.CreatedDate;
                        info.Createdby        = dto.CreatedBy;
                        info.ModifiedDate     = dto.ModifiedDate;
                        info.Modifiedby       = dto.ModifiedBy;
                        info.WarrantyPrice    = dto.WarrantyPrice;
                        entities.SaveChanges();
                        flag = true;
                    }
                    else
                    {
                        VehicleInfo info = new VehicleInfo();
                        info.VehicleTypeID    = dto.VehicleTypeID;
                        info.ModelCode        = dto.ModelCode;
                        info.ModelName        = dto.ModelName;
                        info.ExShowRoomPrice  = dto.ExShowRoomPrice;
                        info.LT_RT_OtherExp   = dto.LT_RT_OtherExp;
                        info.InsurancePrice   = dto.InsurancePrice;
                        info.OnRoadPrice      = dto.OnRoadPrice;
                        info.MarginPrice      = dto.MarginPrice;
                        info.C50PercentMargin = dto.Margin50;
                        info.C70PercentMargin = dto.Margin70;
                        info.CreatedDate      = dto.CreatedDate;
                        info.Createdby        = dto.CreatedBy;
                        info.ModifiedDate     = dto.ModifiedDate;
                        info.Modifiedby       = dto.ModifiedBy;
                        info.WarrantyPrice    = dto.WarrantyPrice;
                        entities.VehicleInfoes.Add(info);
                        entities.SaveChanges();
                        flag = true;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(flag);
        }
Example #25
0
        public int SaveInsuranceAllotment(InsuranceAllotmentDTO dto, string mode = "")
        {
            var insuranceAllotmentId = 0;

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    if (mode == "EDIT")
                    {
                        var obj = entity.VehicleBookingInsuranceAllotments.FirstOrDefault(vbfa => vbfa.VehicleBookingInsuranceAllotmentID == dto.VehicleBookingInsuranceAllotmentID);
                        obj.VehicleBookingID    = dto.VehicleBookingId;
                        obj.InsuranceByDealer   = dto.InsuranceByDealer;
                        obj.InsuranceInfoID     = dto.InsuranceInfoID;
                        obj.CoverNoteNo         = dto.CoverNoteNo;
                        obj.PolicyNo            = dto.PolicyNumber;
                        obj.PolicyAmount        = dto.PolicyAmount;
                        obj.FromDate            = dto.FromDate;
                        obj.ToDate              = dto.ToDate;
                        obj.PolicyDeliveredDate = dto.PolicyDeliveredDate;
                        obj.ContactNo           = dto.ContactNo;
                        obj.Createdby           = dto.CreatedBy;
                        obj.CreatedDate         = dto.CreatedDate;
                        obj.Modifiedby          = dto.ModifiedBy;
                        obj.ModifiedDate        = dto.ModifiedDate;
                        entity.SaveChanges();
                        insuranceAllotmentId = obj.VehicleBookingInsuranceAllotmentID;
                    }
                    else
                    {
                        VehicleBookingInsuranceAllotment obj = new VehicleBookingInsuranceAllotment()
                        {
                            VehicleBookingID    = dto.VehicleBookingId,
                            InsuranceByDealer   = dto.InsuranceByDealer,
                            InsuranceInfoID     = dto.InsuranceInfoID,
                            CoverNoteNo         = dto.CoverNoteNo,
                            PolicyNo            = dto.PolicyNumber,
                            PolicyAmount        = dto.PolicyAmount,
                            FromDate            = dto.FromDate,
                            ToDate              = dto.ToDate,
                            PolicyDeliveredDate = dto.PolicyDeliveredDate,
                            Createdby           = dto.CreatedBy,
                            CreatedDate         = dto.CreatedDate,
                            Modifiedby          = dto.ModifiedBy,
                            ModifiedDate        = dto.ModifiedDate
                        };
                        entity.VehicleBookingInsuranceAllotments.Add(obj);
                        entity.SaveChanges();
                        insuranceAllotmentId = obj.VehicleBookingInsuranceAllotmentID;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(insuranceAllotmentId);
        }
Example #26
0
 public static string[] colorsarr()
 {
     string[] colorArray;
     using (var entities = new ManiMotorsEntities1())
     {
         colorArray = entities.Colors.Select(x => x.Description).ToArray();
     }
     return colorArray;
 }
Example #27
0
        public int GetCashInHandForSalesCreditPending()
        {
            int cashInHand = 0;

            using (var entities = new ManiMotorsEntities1())
            {
                int Credits = entities.CashTransactions.Where(c => c.TransactionType == "CREDIT" && c.Type.ToUpper() == "SALES" && c.Status == "PENDING").Select(x => x.Amount).DefaultIfEmpty(0).Sum();
                cashInHand = Credits;
            }
            return(cashInHand);
        }
Example #28
0
        public int GetCashInHandForServiceDebitPending()
        {
            int cashInHand = 0;

            using (var entities = new ManiMotorsEntities1())
            {
                int Debits = entities.CashTransactions.Where(c => c.TransactionType == "DEBIT" && c.Type.ToUpper() == "SERVICE" && c.Status == "PENDING").Select(x => x.Amount).DefaultIfEmpty(0).Sum();
                cashInHand = Debits;
            }
            return(cashInHand);
        }
Example #29
0
        public VehicleInventoryDTO GetVehicleInventory(int InventoryId)
        {
            VehicleInventoryDTO voIDTO = new VehicleInventoryDTO();

            try
            {
                using (var entities = new ManiMotorsEntities1())
                {
                    voIDTO = (from invlist in entities.VehicleInventories
                              join invstatus in entities.VehicleInventoryStatus
                              on invlist.VehicleInventoryID equals invstatus.VehicleInventoryID
                              join vehinfo in entities.VehicleInfoes
                              on invlist.VehicleInfoID equals vehinfo.VehicleInfoID
                              join vehStatus in entities.VehicleInventoryStatus
                              on invlist.VehicleInventoryID equals vehStatus.VehicleInventoryID
                              join vehStatusTypes in entities.VehicleInventoryStatusTypes
                              on vehStatus.VehicleInventoryStatusTypeID equals vehStatusTypes.VehicleInventoryStatusTypeID
                              where invlist.VehicleInventoryID == InventoryId
                              select new VehicleInventoryDTO
                    {
                        VehicleInventoryID = invlist.VehicleInventoryID,
                        VehicleInfoID = invlist.VehicleInfoID,
                        VehicleModelName = vehinfo.ModelName,
                        VehicleModelCode = vehinfo.ModelCode,
                        ChasisNo = invlist.ChasisNo,
                        EngineNo = invlist.EngineNo,
                        Color = invlist.Color,
                        MfgDate = invlist.ManfgDate ?? DateTime.Now,
                        ServiceBookNo = invlist.ServiceBookNo,
                        KeyNo = invlist.KeyNo,
                        BatteryMake = invlist.BatteryMake,
                        BatteryNo = invlist.BatteryNo,
                        VehicleInventoryStatusTypeID = vehStatusTypes.VehicleInventoryStatusTypeID,
                        VehicleInventoryStatusName = vehStatusTypes.Description,
                        Is50PerMarginPrice = invlist.Is50PercentMarginPrice ?? false,
                        Is70PerMarginPrice = invlist.Is70PercentMarginPrice ?? false,
                        IsMarginPrice = invlist.IsMarginPrice ?? false,
                        ExShowRoomPrice = invlist.ExShowroomPrice ?? 0,
                        LT_RT_OtherExp = invlist.LT_RT_OtherExp ?? 0,
                        InsurancePrice = invlist.InsurancePrice ?? 0,
                        OnRoadPrice = invlist.OnRoadPrice ?? 0,
                        MarginPrice = invlist.MarginPrice ?? 0,
                        Margin50 = invlist.CreditPercentMargin ?? 0,
                        Margin70 = invlist.FullCashPercentMargin ?? 0,
                        WarrantyPrice = invlist.WarrantyPrice ?? 0
                    }).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(voIDTO);
        }
Example #30
0
        public int SaveFinanceAllotment(FinanceAllotmentDTO dto, string mode = "")
        {
            var financeAllotmentId = 0;

            try
            {
                using (var entity = new ManiMotorsEntities1())
                {
                    if (mode == "EDIT")
                    {
                        var obj = entity.VehicleBookingFinanceAllotments.FirstOrDefault(vbfa => vbfa.VehicleBookingFinanceAllotmentID == dto.VehicleBookingFinanceAllotmentID);
                        obj.VehicleBookingID = dto.VehicleBookingId;
                        obj.FinancierID      = dto.FinancierID;
                        obj.LoanNo           = dto.LoanNumber;
                        obj.FinanceDate      = dto.FinanceDate;
                        obj.FinanceAmount    = dto.FinanceAmount;
                        obj.OtherChargesDesc = dto.OtherChargesDescription;
                        obj.OtherAmount      = dto.OtherAmount;
                        obj.Createdby        = dto.CreatedBy;
                        obj.CreatedDate      = dto.CreatedDate;
                        obj.Modifiedby       = dto.ModifiedBy;
                        obj.ModifiedDate     = dto.ModifiedDate;
                        entity.SaveChanges();
                        financeAllotmentId = obj.VehicleBookingFinanceAllotmentID;
                    }
                    else
                    {
                        VehicleBookingFinanceAllotment obj = new VehicleBookingFinanceAllotment()
                        {
                            VehicleBookingID = dto.VehicleBookingId,
                            FinancierID      = dto.FinancierID,
                            LoanNo           = dto.LoanNumber,
                            FinanceDate      = dto.FinanceDate,
                            FinanceAmount    = dto.FinanceAmount,
                            OtherChargesDesc = dto.OtherChargesDescription,
                            OtherAmount      = dto.OtherAmount,
                            Createdby        = dto.CreatedBy,
                            CreatedDate      = dto.CreatedDate,
                            Modifiedby       = dto.ModifiedBy,
                            ModifiedDate     = dto.ModifiedDate
                        };
                        entity.VehicleBookingFinanceAllotments.Add(obj);
                        entity.SaveChanges();
                        financeAllotmentId = obj.VehicleBookingFinanceAllotmentID;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(financeAllotmentId);
        }