private Receiving getEntityByModel(ReceivingModel model)
        {
            if (model == null) return null;

            Receiving entity = new Receiving();

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

            entity.Date = model.Date;
            entity.DCNo = model.DCNo;
            entity.Id = model.Id;
            entity.POId = model.POId;
            entity.ReceiptNo = model.ReceiptNo;
            entity.SOBId = model.SOBId;
            entity.UpdateBy = model.UpdateBy;
            entity.UpdateDate = model.UpdateDate;

            return entity;
        }
 public ReceivingModel(Receiving entity)
 {
     if (entity != null)
     {
         this.CompanyId = entity.CompanyId;
         this.CreateBy = entity.CreateBy;
         this.CreateDate = entity.CreateDate;
         this.Date = entity.Date;
         this.DCNo = entity.DCNo;
         this.Id = entity.Id;
         this.POId = entity.POId;
         this.ReceiptNo = entity.ReceiptNo;
         this.SOBId = entity.SOBId;
         this.UpdateBy = entity.UpdateBy;
         this.UpdateDate = entity.UpdateDate;
         this.Confirmed = entity.Confirmed;
     }
 }
 public string Update(Receiving entity)
 {
     var originalEntity = this.Context.Receivings.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
 public string Insert(Receiving entity)
 {
     this.Context.Receivings.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }
 public string Update(Receiving entity)
 {
     return this.repository.Update(entity);
 }
 public string Insert(Receiving entity)
 {
     return this.repository.Insert(entity);
 }