public string Update(MiscellaneousTransaction entity)
 {
     MiscellaneousTransaction originalEntity = this.Context.MiscellaneousTransactions.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     return entity.Id.ToString();
 }
        private static MiscellaneousTransaction GetEntityByModel(MiscellaneousTransactionDetailModel model, int count)
        {
            if (model == null) return null;

            MiscellaneousTransaction entity = new MiscellaneousTransaction();

            if (count == 0)
            {
                entity.CompanyId = AuthenticationHelper.CompanyId.Value;
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CompanyId = model.CompanyId;
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }

            entity.CodeCombinationId = model.CodeCombinationId;
            entity.Cost = model.Cost;
            entity.Id = model.Id;
            entity.ItemId = model.ItemId;
            entity.LocatorId = model.LocatorId;
            entity.LotNo = model.LotNo;
            entity.Quantity = model.Quantity;
            entity.SerialNo = model.SerialNo;
            entity.SOBId = model.SOBId;
            entity.TransactionDate = model.TransactionDate;
            entity.TransactionType = model.TransactionType;
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            entity.WarehouseId = model.WarehouseId;
            return entity;
        }
 public MiscellaneousTransactionModel(MiscellaneousTransaction entity) 
 {
     this.Id = entity.Id;
     this.CompanyId = entity.CompanyId;
     this.CreateBy = entity.CreateBy;
     this.CreateDate = entity.CreateDate;
     this.SOBId = entity.SOBId;
     this.TransactionDate = entity.TransactionDate;
     this.TransactionType = entity.TransactionType;
     this.UpdateBy = entity.UpdateBy;
     this.UpdateDate = entity.UpdateDate;
     this.CodeCombinationId = entity.CodeCombinationId;
 }
 public MiscellaneousTransactionDetailModel(MiscellaneousTransaction entity) 
 {
     this.Id = entity.Id;
     this.CompanyId = entity.CompanyId;
     this.Cost = entity.Cost;
     this.CreateBy = entity.CreateBy;
     this.CreateDate = entity.CreateDate;
     this.ItemId = entity.ItemId;
     this.LocatorId = entity.LocatorId;
     this.LotNo = entity.LotNo;
     this.Quantity = entity.Quantity;
     this.SerialNo = entity.SerialNo;
     this.SOBId = entity.SOBId;
     this.TransactionDate = entity.TransactionDate;
     this.TransactionType = entity.TransactionType;
     this.UpdateBy = entity.UpdateBy;
     this.UpdateDate = entity.UpdateDate;
     this.WarehouseId = entity.WarehouseId;
     this.CodeCombinationId = entity.CodeCombinationId;
 }
 public string Update(MiscellaneousTransaction entity)
 {
     return this.repository.Update(entity);
 }
 public string Insert(MiscellaneousTransaction entity)
 {
     return this.repository.Insert(entity);
 }
 public string Insert(MiscellaneousTransaction entity)
 {
     this.Context.MiscellaneousTransactions.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }