Example #1
0
 public int UpdateSupply(SupplyDTO supply)
 {
     using (var context = new PizzeriaMasterpieceEntities())
     {
         var currentSupply = context.Supplies.Find(supply.SupplyId);
         if (!string.IsNullOrWhiteSpace(supply.Name))
         {
             currentSupply.Name = supply.Name;
         }
         if (!string.IsNullOrWhiteSpace(supply.Code))
         {
             currentSupply.Code = supply.Code;
         }
         if (!string.IsNullOrWhiteSpace(supply.Description))
         {
             currentSupply.Description = supply.Description;
         }
         if (supply.Quantity != null)
         {
             currentSupply.Quantity = supply.Quantity;
         }
         if (supply.IsActive != null)
         {
             currentSupply.IsActive = supply.IsActive;
         }
         context.SaveChanges();
         return(currentSupply.SupplyId);
     }
 }
Example #2
0
        public void Add(SupplyDTO supplyDto)
        {
            var createdSupply = _mapper.Map <SupplyDTO, Supply>(supplyDto);

            _unitOfWork.SupplyRepository.Create(createdSupply);
            _unitOfWork.Save();
        }
Example #3
0
        public IHttpActionResult PostNewSupplier(SupplyDTO supply)
        {
            Supplier supplierInsert = new Supplier()
            {
                SupplierID   = supply.SupplierID,
                CompanyName  = supply.CompanyName,
                ContactName  = supply.ContactName,
                ContactTitle = supply.ContactTitle,
                Address      = supply.Address,
                City         = supply.City,
                Region       = supply.Region,
                PostalCode   = supply.PostalCode,
                Country      = supply.Country,
                Phone        = supply.Phone,
                Fax          = supply.Fax,
                HomePage     = supply.HomePage
            };

            db.Suppliers.Add(supplierInsert);
            if (db.SaveChanges() > 0)
            {
                return(Ok());
            }
            else
            {
                return(InternalServerError());
            }
        }
Example #4
0
        public SupplyDTO UpdateSupplyInformation(SupplyDTO supply)
        {
            var supplyRepository = new SupplyRepository();
            var supplyId         = supplyRepository.UpdateSupply(supply);

            return(supplyRepository.GetSupplyById(supplyId));
        }
Example #5
0
        public IHttpActionResult PutSupplier(SupplyDTO supply)
        {
            Supplier supplierPut = db.Suppliers.FirstOrDefault(s => s.SupplierID == supply.SupplierID);

            supplierPut.SupplierID   = supply.SupplierID;
            supplierPut.CompanyName  = supply.CompanyName;
            supplierPut.ContactName  = supply.ContactName;
            supplierPut.ContactTitle = supply.ContactTitle;
            supplierPut.Address      = supply.Address;
            supplierPut.City         = supply.City;
            supplierPut.Region       = supply.Region;
            supplierPut.PostalCode   = supply.PostalCode;
            supplierPut.Country      = supply.Country;
            supplierPut.Phone        = supply.Phone;
            supplierPut.Fax          = supply.Fax;
            supplierPut.HomePage     = supply.HomePage;

            if (db.SaveChanges() > 0)
            {
                return(Ok());
            }
            else
            {
                return(InternalServerError());
            }
        }
Example #6
0
        public IHttpActionResult GetSupplierById(int id)
        {
            SupplyDTO getId = db.Suppliers.Where(p => p.SupplierID == id).Select(e => new SupplyDTO()
            {
                SupplierID   = e.SupplierID,
                CompanyName  = e.CompanyName,
                ContactName  = e.ContactName,
                ContactTitle = e.ContactTitle,
                Address      = e.Address,
                City         = e.City,
                Region       = e.Region,
                PostalCode   = e.PostalCode,
                Country      = e.Country,
                Phone        = e.Phone,
                Fax          = e.Fax,
                HomePage     = e.HomePage
            }).FirstOrDefault();

            if (getId != null)
            {
                return(Ok(getId));
            }
            else
            {
                return(NotFound());
            }
        }
Example #7
0
        public async Task <IActionResult> PutSupply(int supplyId, SupplyDTO supplyDTO)
        {
            if (supplyId != supplyDTO.Id)
            {
                return(BadRequest());
            }
            var updatedSupply = await _supply.Update(supplyDTO);

            return(Ok(updatedSupply));
        }
        public long MakeSupplyPayment(MultipleSupplies model, AccountTransactionActivity accountActivity, string userId)
        {
            long   accountActivityId = 0;
            string supplierId        = "";

            if (model.Supplies.Any())
            {
                foreach (var supply in model.Supplies)
                {
                    supplierId = supply.SupplierId;
                    var supplyObject = new SupplyDTO()
                    {
                        SupplyId         = supply.SupplyId,
                        SupplierId       = supply.SupplierId,
                        SupplyNumber     = supply.SupplyNumber,
                        Price            = supply.Price,
                        Amount           = supply.Amount,
                        StoreId          = supply.StoreId,
                        BranchId         = supply.BranchId,
                        SupplyDate       = supply.SupplyDate,
                        TruckNumber      = supply.TruckNumber,
                        WeightNoteNumber = supply.WeightNoteNumber,
                        Used             = supply.Used,
                        IsPaid           = true,
                        StatusId         = supply.StatusId,
                        Deleted          = supply.Deleted,
                        MoistureContent  = supply.MoistureContent,
                        BagsOfStones     = supply.BagsOfStones,
                        NormalBags       = supply.NormalBags,
                        Quantity         = supply.Quantity,
                    };
                    _dataService.SaveSupply(supplyObject, userId);
                }

                UpdateCreditorRecords(supplierId, accountActivity.Amount, userId, accountActivity.BranchId);

                var accountActivityObject = new AccountTransactionActivity()
                {
                    AspNetUserId   = accountActivity.AspNetUserId,
                    CasualWorkerId = accountActivity.CasualWorkerId,
                    Amount         = accountActivity.Amount,
                    Notes          = accountActivity.Notes,
                    AccountTransactionActivityId = accountActivity.AccountTransactionActivityId,
                    Action               = accountActivity.Action,
                    BranchId             = accountActivity.BranchId,
                    TransactionSubTypeId = accountActivity.TransactionSubTypeId,
                    SectorId             = accountActivity.SectorId,
                    Deleted              = accountActivity.Deleted,
                    CreatedBy            = accountActivity.CreatedBy,
                    CreatedOn            = accountActivity.CreatedOn
                };
                accountActivityId = _accountTransactionActivityService.SaveAccountTransactionActivity(accountActivityObject, userId);
            }
            return(accountActivityId);
        }
Example #9
0
        // CreateASupply
        public async Task <SupplyDTO> Create(SupplyDTO supplyName)
        {
            Supply supply = new Supply()
            {
                Name = supplyName.Name, Category = supplyName.Category
            };

            _context.Entry(supply).State = Microsoft.EntityFrameworkCore.EntityState.Added;
            await _context.SaveChangesAsync();

            return(supplyName);
        }
        // UpdateASupply
        /// <summary>
        /// the below method updates a particular supply item in the database
        /// </summary>
        /// <param name="supplyDTO">this selects the supply DTO (what parameters are shown to user)</param>
        /// <param name="email">checks to see if user has authorization for selected supply item</param>
        /// <returns>the supply dto with the updated supply item</returns>
        public async Task <SupplyDTO> Update(SupplyDTO supplyDTO, string email)
        {
            Supply supply = new Supply()
            {
                Id = supplyDTO.Id, Name = supplyDTO.Name, Category = supplyDTO.Category
            };

            _context.Entry(supply).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(supplyDTO);
        }
Example #11
0
        // GetASupply
        public async Task <SupplyDTO> GetSupply(int supplyId)
        {
            var supplyItem = await _context.Supplies.FindAsync(supplyId);

            SupplyDTO supply = new SupplyDTO()
            {
                Id       = supplyItem.Id,
                Name     = supplyItem.Name,
                Category = supplyItem.Category
            };

            return(supply);
        }
Example #12
0
 public static void newSupply(SupplyDTO Supply)
 {
     using (carLeasingEntities db = new carLeasingEntities())
     {
         Supply d = Casting.SupplyCasting.castToDAL(Supply);
         d.isDone = false;
         d.price  = Supply.price;
         var dd = db.Supplies.Add(d);
         db.SaveChanges();
         dd.supplyU = Supply.supplyU;
         db.SaveChanges();
     }
 }
Example #13
0
 public static void updateSupply(SupplyDTO Supply)
 {
     using (carLeasingEntities db = new carLeasingEntities())
     {
         var s = db.Supplies.FirstOrDefault(p => p.supplyId == Supply.supplyId);
         s.fromDate     = Supply.fromDate;
         s.fromHour     = Supply.fromHour;
         s.carLocationx = Supply.carLocationx;
         s.carLocationy = Supply.carLocationy;
         s.toDate       = Supply.toDate;
         s.toHour       = Supply.toHour;
         db.SaveChanges();
     }
 }
        // GetASupply
        /// <summary>
        /// the below method brings up to the user all supply items currently in their table
        /// </summary>
        /// <param name="supplyId">the id number of each particular supply item (the method checks for them all)</param>
        /// <param name="email">authenticates the user's access level for the supply items</param>
        /// <returns>the suppply items in the database</returns>
        public async Task <SupplyDTO> GetSupply(int supplyId, string email)
        {
            Supply supplyName = await _context.Supplies.Where(x => x.Email == email)
                                .FirstOrDefaultAsync(x => x.Id == supplyId);

            var supplyItem = await _context.Supplies.FindAsync(supplyId);

            SupplyDTO supply = new SupplyDTO()
            {
                Id       = supplyItem.Id,
                Name     = supplyItem.Name,
                Category = supplyItem.Category
            };

            return(supply);
        }
Example #15
0
        public void newSupply(string subItem, SupplyDTO Supply)
        {
            switch (subItem)
            {
            case "newSupply":
                Supply.supplyU = Helper.getCurrentUserId(Request.GetRequestContext());
                SupplyFunction.newSupply(Supply);
                break;

            case "updateSupply":
                SupplyFunction.updateSupply(Supply);
                break;

            default:
                break;
            }
        }
Example #16
0
        public async void CanCreateANewSupply()
        {
            var testEmail = "*****@*****.**";

            var supply = new SupplyDTO
            {
                Name     = "Thin Stuff",
                Category = "Glue"
            };

            var service = BuildService();

            var saved = await service.Create(supply, testEmail);

            Assert.NotNull(saved);
            Assert.Equal(supply.Name, saved.Name);
            Assert.Equal(supply.Category, saved.Category);
        }
Example #17
0
 public SupplyDTO InsertSupply(SupplyDTO supply)
 {
     using (var context = new PizzeriaMasterpieceEntities())
     {
         var newSupply = new Supply
         {
             SupplyId    = -1,
             Code        = supply.Code,
             Name        = supply.Name,
             Description = supply.Description,
             Quantity    = supply.Quantity,
             IsActive    = 1,
         };
         context.Supplies.Add(newSupply);
         context.SaveChanges();
         return(GetSupplyById(newSupply.SupplyId));
     }
 }
Example #18
0
 public static Supply castToDAL(SupplyDTO supplyDTO)
 {
     using (carLeasingEntities db = new carLeasingEntities())
     {
         return(new Supply()
         {
             supplyId = supplyDTO.supplyId,
             carLocationx = supplyDTO.carLocationx,
             carLocationy = supplyDTO.carLocationy,
             carNum = supplyDTO.carNum,
             fromDate = supplyDTO.fromDate,
             fromHour = supplyDTO.fromHour,
             toDate = supplyDTO.toDate,
             supplyU = supplyDTO.supplyU,
             toHour = supplyDTO.toHour,
             Transactions = db.Transactions.Where(p => p.supplyId == supplyDTO.supplyId).ToList(),
             User = db.Users.FirstOrDefault(p => p.userId == supplyDTO.supplyU)
         });
     }
 }
Example #19
0
        public async void CanUpdateASupply()
        {
            var testEmail = "*****@*****.**";
            var service   = BuildService();

            var supply = new SupplyDTO
            {
                Id       = 1,
                Name     = "Exacto",
                Category = "Cutting"
            };

            await service.Update(supply, testEmail);

            var returnFromMethod = await service.GetSupply(1, testEmail);

            Assert.NotNull(returnFromMethod);
            Assert.Equal(supply.Id, returnFromMethod.Id);
            Assert.Equal(supply.Name, returnFromMethod.Name);
            Assert.Equal(supply.Category, returnFromMethod.Category);
        }
Example #20
0
 public void updateSupply(SupplyDTO supply)
 {
     SupplyFunction.updateSupply(supply);
 }
        public long SaveBatch(Batch batch, string userId)
        {
            var batchDTO = new DTO.BatchDTO()
            {
                BatchId   = batch.BatchId,
                Name      = batch.Name,
                SectorId  = batch.SectorId,
                Quantity  = batch.Quantity,
                BranchId  = batch.BranchId,
                Deleted   = batch.Deleted,
                CreatedBy = batch.CreatedBy,
                CreatedOn = batch.CreatedOn
            };

            var batchId = this._dataService.SaveBatch(batchDTO, userId);


            if (batch.Supplies.Any())
            {
                EF.Models.Supply supplyObject = new EF.Models.Supply();

                foreach (var batchSupply in batch.Supplies)
                {
                    var batchSupplyDTO = new BatchSupplyDTO()
                    {
                        BatchId  = batchId,
                        SupplyId = batchSupply.SupplyId,
                        Quantity = batchSupply.Quantity,
                    };
                    this._dataService.PurgeBatchSupply(batchId, batchSupply.SupplyId);
                    this._dataService.SaveBatchSupply(batchSupplyDTO);

                    var storeMaizeStock = new StoreMaizeStock()
                    {
                        SupplyId = batchSupply.SupplyId,
                        Quantity = batchSupply.Quantity,
                        StoreId  = batch.StoreId,
                        BranchId = batch.BranchId,
                        SectorId = batch.SectorId,
                    };
                    _supplyService.SaveStoreMaizeStock(storeMaizeStock, false);

                    supplyObject = this._supplyDataService.GetSupply(batchSupply.SupplyId);
                    var supply = new SupplyDTO()
                    {
                        Quantity   = supplyObject.Quantity,
                        SupplyDate = supplyObject.SupplyDate,
                        //SupplyNumber =  supplyObject.SupplyNumber,
                        BranchId         = supplyObject.BranchId,
                        SupplierId       = supplyObject.SupplierId,
                        Amount           = supplyObject.Amount,
                        StoreId          = supplyObject.StoreId,
                        TruckNumber      = supplyObject.TruckNumber,
                        Price            = supplyObject.Price,
                        WeightNoteNumber = supplyObject.WeightNoteNumber,
                        BagsOfStones     = supplyObject.BagsOfStones,
                        NormalBags       = supplyObject.NormalBags,
                        MoistureContent  = supplyObject.MoistureContent,
                        Deleted          = supplyObject.Deleted,
                        AmountToPay      = supplyObject.AmountToPay,
                        DeletedBy        = supplyObject.DeletedBy,
                        DeletedOn        = supplyObject.DeletedOn,
                        StatusId         = Convert.ToInt64(supplyStatusIdInProgress),
                        Used             = true,
                        SupplyId         = supplyObject.SupplyId
                    };
                    this._supplyDataService.SaveSupply(supply, userId);
                }
            }
            return(batchId);
        }
Example #22
0
        public async Task <ActionResult <SupplyDTO> > GetSupply(int supplyId)
        {
            SupplyDTO supply = await _supply.GetSupply(supplyId);

            return(supply);
        }
Example #23
0
        public async Task <ActionResult <SupplyDTO> > PostSupply(SupplyDTO supply)
        {
            await _supply.Create(supply);

            return(CreatedAtAction("GetSupply", new { id = supply.Id }, supply));
        }
Example #24
0
 public void newSupply(SupplyDTO newSupply)
 {
     SupplyFunction.newSupply(newSupply);
 }
        public ResponseDTO UpdateOrderStatus(OrderStatusDTO order)
        {
            try
            {
                var orderRepository         = new OrderRepository();
                var supplyRepository        = new SupplyRepository();
                var productSupplyRepository = new ProductSupplyRepository();
                if (order.OrderStatusId == 3)
                {
                    orderRepository.UpdateOrderStatus(order);
                    return(new ResponseDTO()
                    {
                        Status = 1,
                        Message = "Pedido Rechazado"
                    });
                }
                else
                {
                    var currentoOrder = orderRepository.GetOrder(order.OrderId);
                    if (currentoOrder.OrderStatusId != 1)
                    {
                        return(new ResponseDTO()
                        {
                            Status = 1,
                            Message = "El Pedido ya fue atendido"
                        });
                    }
                    // var currentSupplies = supplyRepository.GetSupplies();

                    var serviceReference = new SupplyServiceReference.SupplyServieClient();
                    var currentSupplies  = serviceReference.ListAllSupplyInformation();

                    var usedSupplies = new List <SupplyDTO>();
                    foreach (var odetail in currentoOrder.OrderDetails)
                    {
                        var supplies = productSupplyRepository.GetSuppliesByProduct(odetail.ProductId);
                        foreach (var supply in supplies)
                        {
                            var csupply = usedSupplies.FirstOrDefault(p => p.SupplyId == supply.SupplyId);
                            if (csupply != null)
                            {
                                csupply.Quantity = csupply.Quantity + supply.Quantity * odetail.Quantity;
                            }
                            else
                            {
                                var newcsupply = new SupplyDTO();
                                newcsupply.SupplyId = supply.SupplyId;
                                newcsupply.Quantity = supply.Quantity * odetail.Quantity;
                                usedSupplies.Add(newcsupply);
                            }
                        }
                    }

                    foreach (var item in usedSupplies)
                    {
                        var csupply = currentSupplies.FirstOrDefault(p => p.SupplyId == item.SupplyId);
                        if (item.Quantity > csupply.Quantity)
                        {
                            order.OrderStatusId = 3;
                            orderRepository.UpdateOrderStatus(order);
                            return(new ResponseDTO()
                            {
                                Status = 1,
                                Message = "Pedido Rechazado Automaticamente por falta de Stock"
                            });
                        }
                    }

                    foreach (var item in usedSupplies)
                    {
                        var csupply = currentSupplies.FirstOrDefault(p => p.SupplyId == item.SupplyId);
                        csupply.Quantity = csupply.Quantity - item.Quantity;
                        //supplyRepository.UpdateSupply(csupply);
                        serviceReference.UpdateSupplyInformation(csupply);
                    }
                    orderRepository.UpdateOrderStatus(order);
                    return(new ResponseDTO()
                    {
                        Status = 1,
                        Message = "Pedido Aprobado"
                    });
                }
            }
            catch (Exception ex)
            {
                return(new ResponseDTO()
                {
                    Status = 0,
                    Message = "A ocurrido un error"
                });
            }
        }
        /// <summary>
        /// Saves a new Supply or updates an already existing Supply.
        /// </summary>
        /// <param name="Supply">Supply to be saved or updated.</param>
        /// <param name="SupplyId">SupplyId of the Supply creating or updating</param>
        /// <returns>SupplyId</returns>
        public long SaveSupply(SupplyDTO supplyDTO, string userId)
        {
            long supplyId = 0;

            if (supplyDTO.SupplyId == 0)
            {
                var supply = new Supply()
                {
                    Quantity   = supplyDTO.Quantity,
                    SupplyDate = supplyDTO.SupplyDate,
                    //SupplyNumber = supplyDTO.SupplyNumber,
                    BranchId         = supplyDTO.BranchId,
                    SupplierId       = supplyDTO.SupplierId,
                    Amount           = supplyDTO.Amount,
                    TruckNumber      = supplyDTO.TruckNumber,
                    Used             = supplyDTO.Used,
                    MoistureContent  = supplyDTO.MoistureContent,
                    WeightNoteNumber = supplyDTO.WeightNoteNumber,
                    NormalBags       = supplyDTO.NormalBags,
                    BagsOfStones     = supplyDTO.BagsOfStones,
                    Price            = supplyDTO.Price,
                    IsPaid           = supplyDTO.IsPaid,
                    StatusId         = Convert.ToInt64(supplyStatusId),
                    CreatedOn        = DateTime.Now,
                    TimeStamp        = DateTime.Now,
                    CreatedBy        = userId,
                    Deleted          = false,
                    AmountToPay      = supplyDTO.AmountToPay,
                    StoreId          = supplyDTO.StoreId,
                    Offloading       = supplyDTO.Offloading,
                };

                this.UnitOfWork.Get <Supply>().AddNew(supply);
                this.UnitOfWork.SaveChanges();
                supplyId = supply.SupplyId;
                return(supplyId);
            }

            else
            {
                var result = this.UnitOfWork.Get <Supply>().AsQueryable()
                             .SingleOrDefault(e => e.SupplyId == supplyDTO.SupplyId);
                if (result != null)
                {
                    result.Quantity   = supplyDTO.Quantity;
                    result.SupplyDate = supplyDTO.SupplyDate;
                    //result.SupplyNumber =  supplyDTO.SupplyNumber;
                    result.BranchId         = supplyDTO.BranchId;
                    result.SupplierId       = supplyDTO.SupplierId;
                    result.Amount           = supplyDTO.Amount;
                    result.IsPaid           = supplyDTO.IsPaid;
                    result.TruckNumber      = supplyDTO.TruckNumber;
                    result.Price            = supplyDTO.Price;
                    result.AmountToPay      = supplyDTO.AmountToPay;
                    result.Used             = supplyDTO.Used;
                    result.WeightNoteNumber = supplyDTO.WeightNoteNumber;
                    result.BagsOfStones     = supplyDTO.BagsOfStones;
                    result.NormalBags       = supplyDTO.NormalBags;
                    result.StatusId         = supplyDTO.StatusId;
                    result.MoistureContent  = supplyDTO.MoistureContent;
                    result.UpdatedBy        = userId;
                    result.TimeStamp        = DateTime.Now;
                    result.Deleted          = supplyDTO.Deleted;
                    result.DeletedBy        = supplyDTO.DeletedBy;
                    result.DeletedOn        = supplyDTO.DeletedOn;
                    result.StoreId          = supplyDTO.StoreId;
                    result.Offloading       = supplyDTO.Offloading;

                    this.UnitOfWork.Get <Supply>().Update(result);

                    this.UnitOfWork.SaveChanges();
                }
                return(supplyDTO.SupplyId);
            }
        }
Example #27
0
        public long MakeSupplyPayment(MultipleSupplies model, AccountTransactionActivity accountActivity, string userId)
        {
            long accountActivityId = 0;
            //long defaultBranchId = 2;
            string supplierId = "";

            if (model.Supplies.Any())
            {
                foreach (var supply in model.Supplies)
                {
                    supplierId = supply.SupplierId;
                    var supplyObject = new SupplyDTO()
                    {
                        SupplyId   = supply.SupplyId,
                        SupplierId = supply.SupplierId,
                        //SupplyNumber = supply.SupplyNumber,
                        Price            = supply.Price,
                        Amount           = supply.Amount,
                        AmountToPay      = supply.AmountToPay,
                        StoreId          = supply.StoreId,
                        BranchId         = supply.BranchId,
                        SupplyDate       = supply.SupplyDate,
                        TruckNumber      = supply.TruckNumber,
                        WeightNoteNumber = supply.WeightNoteNumber,
                        Used             = supply.Used,
                        IsPaid           = true,
                        StatusId         = supply.StatusId,
                        Deleted          = supply.Deleted,
                        MoistureContent  = supply.MoistureContent,
                        BagsOfStones     = supply.BagsOfStones,
                        NormalBags       = supply.NormalBags,
                        Quantity         = supply.Quantity,
                        Offloading       = supply.Offloading,
                    };
                    _dataService.SaveSupply(supplyObject, userId);
                }


                UpdateCreditorRecords(supplierId, accountActivity.Amount, userId);


                var accountActivityObject = new AccountTransactionActivity()
                {
                    AspNetUserId   = accountActivity.AspNetUserId,
                    CasualWorkerId = accountActivity.CasualWorkerId,
                    Amount         = accountActivity.Amount,
                    Notes          = accountActivity.Notes,
                    AccountTransactionActivityId = accountActivity.AccountTransactionActivityId,
                    Action               = accountActivity.Action,
                    BranchId             = accountActivity.BranchId,
                    TransactionSubTypeId = accountActivity.TransactionSubTypeId,
                    SectorId             = accountActivity.SectorId,
                    Deleted              = accountActivity.Deleted,
                    CreatedBy            = accountActivity.CreatedBy,
                    CreatedOn            = accountActivity.CreatedOn
                };
                accountActivityId = _accountTransactionActivityService.SaveAccountTransactionActivity(accountActivityObject, userId);

                if (accountActivity.PaymentModeId == 2)
                {
                    if (accountActivity.BranchId == 0 || accountActivity.BranchId == null)
                    {
                        Cash cash = new Cash()
                        {
                            Amount               = accountActivity.Amount,
                            Notes                = accountActivity.Notes,
                            Action               = accountActivity.Action,
                            BranchId             = Convert.ToInt64(accountActivity.BranchId),
                            TransactionSubTypeId = accountActivity.TransactionSubTypeId,
                            SectorId             = accountActivity.SectorId,
                        };
                        _cashService.SaveApplicationCash(cash, userId);
                    }
                    else
                    {
                        Cash cash = new Cash()
                        {
                            Amount               = accountActivity.Amount,
                            Notes                = accountActivity.Notes,
                            Action               = accountActivity.Action,
                            BranchId             = Convert.ToInt64(accountActivity.BranchId),
                            TransactionSubTypeId = accountActivity.TransactionSubTypeId,
                            SectorId             = accountActivity.SectorId,
                        };
                        _cashService.SaveCash(cash, userId);
                    }
                }
            }
            return(accountActivityId);
        }