コード例 #1
0
        public async Task <ResultModel> CreateVehicleLocation(VehicleLocationVm vehicleLocationVm)
        {
            try
            {
                var entity = new Domain.Entities.VehicleLocation
                {
                    Latitude  = vehicleLocationVm.Latitude,
                    Longitude = vehicleLocationVm.Longitude,
                    TripDate  = vehicleLocationVm.TripDate,
                    TripTime  = vehicleLocationVm.TripTime,
                    Speed     = vehicleLocationVm.Speed,
                    Altitude  = vehicleLocationVm.Altitude,
                    VehicleId = vehicleLocationVm.VehicleId
                };


                await _context.VEHICLE_LOCATION.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{vehicleLocationVm.VehicleId}"),
                    Id = entity.VehicleLocationId.ToString()
                });
            }

            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{vehicleLocationVm.VehicleId}")
                });
            }
        }
コード例 #2
0
        public async Task <ResultModel> CreateExpenseSubType(ExpenseSubTypeVm expenseSubTypeVm)
        {
            try
            {
                var entity = new ExpenseSubType
                {
                    ExpenseTypeId      = expenseSubTypeVm.ExpenseTypeId,
                    ExpenseSubTypeName = expenseSubTypeVm.ExpenseSubTypeName,


                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.L_EXPENSE_SUB_TYPE.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{expenseSubTypeVm.ExpenseSubTypeName}"),
                    Id = entity.ExpenseSubTypeId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{expenseSubTypeVm.ExpenseSubTypeName}")
                });
            }
        }
コード例 #3
0
        public async Task <ResultModel> UpdateBillPayment(UpdateBillPaymentVm updateBillPaymentVm)
        {
            try
            {
                if (updateBillPaymentVm.BillPaymentId > 0)
                {
                    var entity = new BillPayment
                    {
                        BillPaymentId  = updateBillPaymentVm.BillPaymentId,
                        BillNo         = updateBillPaymentVm.BillNo,
                        PaymentDate    = updateBillPaymentVm.PaymentDate,
                        BillingAmount  = updateBillPaymentVm.PaymentAmount,
                        DiscountAmount = updateBillPaymentVm.DiscountAmount,
                        DueAmount      = updateBillPaymentVm.DueAmount,
                        PaymentAmount  = updateBillPaymentVm.PaymentAmount,

                        UpdateBy   = _currentUserService.UserId,
                        UpdateDate = _dateTime.Now,
                    };

                    _context.BILL_PAYMENT.Update(entity);
                    await _context.SaveChangesAsync();

                    return(new ResultModel
                    {
                        Result = true,
                        Message = NotificationConfig.InsertSuccessMessage($"{updateBillPaymentVm.BillNo}"),
                        Id = entity.BillPaymentId.ToString()
                    });
                }
                else
                {
                    return(new ResultModel {
                        Result = false, Message = NotificationConfig.NotFoundMessage($"{updateBillPaymentVm.BillNo} ")
                    });
                }
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.UpdateErrorMessage($"{updateBillPaymentVm.BillNo}")
                });
            }
        }
コード例 #4
0
        public async Task <ResultModel> CreateExpense(ExpenseVm expenseVm)
        {
            try
            {
                var entity = new Expense
                {
                    ExpenseTypeId    = expenseVm.ExpenseTypeId,
                    ExpenseSubTypeId = expenseVm.ExpenseSubTypeId,
                    BillNo           = expenseVm.BillNo,
                    Quantity         = expenseVm.Quantity,
                    BillingDate      = expenseVm.BillingDate,
                    BillingAmount    = expenseVm.BillingAmount,
                    VehicleId        = expenseVm.VehicleId,


                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.EXPENSE.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{expenseVm.BillNo}"),
                    Id = entity.ExpenseId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{expenseVm.BillNo}")
                });
            }
        }
コード例 #5
0
        public async Task <ResultModel> CreateBillPayment(BillPaymentVm billPaymentVm)
        {
            try
            {
                var entity = new BillPayment
                {
                    BillNo         = billPaymentVm.BillNo,
                    PaymentDate    = billPaymentVm.PaymentDate,
                    BillingAmount  = billPaymentVm.PaymentAmount,
                    DiscountAmount = billPaymentVm.DiscountAmount,
                    DueAmount      = billPaymentVm.DueAmount,
                    PaymentAmount  = billPaymentVm.PaymentAmount,


                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.BILL_PAYMENT.AddAsync(entity);

                await _context.SaveChangesAsync();

                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{billPaymentVm.BillNo}"),
                    Id = entity.BillPaymentId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{billPaymentVm.BillNo}")
                });
            }
        }
コード例 #6
0
        public async Task <ResultModel> CreateVehicle(VehicleVm vehicleVm)
        {
            try
            {
                var entity = new  Vehicle
                {
                    VehicleName      = vehicleVm.VehicleName,
                    ChassisNo        = vehicleVm.ChassisNo,
                    ModelNo          = vehicleVm.ModelNo,
                    ColorCode        = vehicleVm.ColorCode,
                    ProductionYear   = vehicleVm.ProductionYear,
                    RegistrationYear = vehicleVm.RegistrationYear,
                    ManufacturerId   = vehicleVm.ManufacturerId,
                    EngineCC         = vehicleVm.EngineCC,
                    CountryCode      = vehicleVm.CountryCode,
                    Remarks          = vehicleVm.Remarks,
                    ActiveStatus     = vehicleVm.ActiveStatus,

                    UpdateBy   = _currentUserService.UserId,
                    UpdateDate = _dateTime.Now,
                    CreatedBy  = _currentUserService.UserId,
                    CreateDate = _dateTime.Now,
                };

                await _context.VEHICLE.AddAsync(entity);


                await _context.SaveChangesAsync();

                var data = new Owner
                {
                    OwnerName        = vehicleVm.Owner.OwnerName,
                    VehicleId        = entity.VehicleId,
                    JoiningDate      = vehicleVm.Owner.JoiningDate,
                    DateOfBirth      = vehicleVm.Owner.DateOfBirth,
                    NidNo            = vehicleVm.Owner.NidNo,
                    GenderId         = vehicleVm.Owner.GenderId,
                    PresentAddress   = vehicleVm.Owner.PresentAddress,
                    PermanentAddress = vehicleVm.Owner.PermanentAddress,
                    CountryCode      = vehicleVm.Owner.CountryCode,
                    Email            = vehicleVm.Owner.Email,
                    Deleted          = false
                };

                await _context.OWNER.AddAsync(data);

                await _context.SaveChangesAsync();



                return(new ResultModel
                {
                    Result = true,
                    Message = NotificationConfig.InsertSuccessMessage($"{vehicleVm.VehicleName}"),
                    Id = entity.VehicleId.ToString()
                });
            }
            catch (Exception)
            {
                return(new ResultModel {
                    Result = false, Message = NotificationConfig.InsertErrorMessage($"{vehicleVm.VehicleName}")
                });
            }
        }