public void CreateLineStatus(int id)
        {
            JobReceiveLineStatus Stat = new JobReceiveLineStatus();

            Stat.JobReceiveLineId = id;
            Stat.ObjectState      = Model.ObjectState.Added;
            Add(Stat);
        }
        public void CreateLineStatusWithInvoice(int id, decimal Qty, decimal DealQty, DateTime DocDate, ref ApplicationDbContext context)
        {
            JobReceiveLineStatus Stat = new JobReceiveLineStatus();

            Stat.JobReceiveLineId = id;
            Stat.InvoiceQty       = Qty;
            Stat.InvoiceDealQty   = DealQty;
            Stat.InvoiceDate      = DocDate;
            Stat.ObjectState      = Model.ObjectState.Added;

            context.JobReceiveLineStatus.Add(Stat);
        }
        public void CreateLineStatus(int id, ref ApplicationDbContext context, bool IsDBbased)
        {
            JobReceiveLineStatus Stat = new JobReceiveLineStatus();

            Stat.JobReceiveLineId = id;
            Stat.ObjectState      = Model.ObjectState.Added;
            if (IsDBbased)
            {
                context.JobReceiveLineStatus.Add(Stat);
            }
            else
            {
                Add(Stat);
            }
        }
        public void UpdateStatusQty(string QtyType, decimal Qty, decimal DealQty, DateTime date, int Id, ref ApplicationDbContext Context, bool DbBased)
        {
            JobReceiveLineStatus Stat = Find(Id);

            switch (QtyType)
            {
            case JobStatusQtyConstants.ReturnQty:
            {
                Stat.ReturnQty     = Qty;
                Stat.ReturnDealQty = DealQty;
                Stat.ReturnDate    = date;
                break;
            }

            case JobStatusQtyConstants.InvoiceQty:
            {
                Stat.InvoiceQty     = Qty;
                Stat.InvoiceDealQty = DealQty;
                Stat.InvoiceDate    = date;
                break;
            }

            default:
            {
                break;
            }
            }

            Stat.ObjectState = Model.ObjectState.Modified;

            if (DbBased)
            {
                Context.JobReceiveLineStatus.Add(Stat);
            }
            else
            {
                Update(Stat);
            }
        }
        public void UpdateJobReceiveQtyOnQA(JobReceiveQALineViewModel QaLine, DateTime DocDate, ref ApplicationDbContext Context)
        {
            var temp = (from p in Context.JobReceiveQALine.AsNoTracking()
                        where p.JobReceiveLineId == QaLine.JobReceiveLineId && p.JobReceiveQALineId != QaLine.JobReceiveQALineId
                        join t in Context.JobReceiveQAHeader on p.JobReceiveQAHeaderId equals t.JobReceiveQAHeaderId
                        select new
            {
                FailQty = p.FailQty,
                Date = t.DocDate,
                FailDealQty = p.FailDealQty,
                Weight = p.Weight,
                Penalty = p.PenaltyAmt,
            }).ToList();

            JobReceiveLineStatus Status = Context.JobReceiveLineStatus.Find(QaLine.JobReceiveLineId);

            if (temp.Count == 0)
            {
                Status.QaFailQty     = QaLine.FailQty;
                Status.QaDate        = DocDate;
                Status.QaFailDealQty = QaLine.FailDealQty;
                Status.QaWeight      = QaLine.Weight;
                Status.QaPenalty     = QaLine.PenaltyAmt;
            }
            else
            {
                Status.QaDate        = DocDate;
                Status.QaFailQty     = temp.Sum(m => m.FailQty) + (QaLine.FailQty);
                Status.QaFailDealQty = temp.Sum(m => m.FailDealQty) + QaLine.FailDealQty;
                Status.QaWeight      = temp.Sum(m => m.Weight) + QaLine.Weight;
                Status.QaPenalty     = temp.Sum(m => m.Penalty) + QaLine.PenaltyAmt;
            }

            Status.ObjectState = Model.ObjectState.Modified;
            Context.JobReceiveLineStatus.Add(Status);
        }
        public void DeleteLineStatus(int id)
        {
            JobReceiveLineStatus Stat = Find(id);

            Delete(Stat);
        }
 public JobReceiveLineStatus Add(JobReceiveLineStatus pt)
 {
     _JobReceiveLineStatusRepository.Insert(pt);
     return(pt);
 }
 public void Update(JobReceiveLineStatus pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _JobReceiveLineStatusRepository.Update(pt);
 }
 public void Delete(JobReceiveLineStatus pt)
 {
     _JobReceiveLineStatusRepository.Delete(pt);
 }
 public JobReceiveLineStatus Create(JobReceiveLineStatus pt)
 {
     pt.ObjectState = ObjectState.Added;
     _JobReceiveLineStatusRepository.Add(pt);
     return(pt);
 }
 public JobReceiveLineStatus Add(JobReceiveLineStatus pt)
 {
     _unitOfWork.Repository <JobReceiveLineStatus>().Insert(pt);
     return(pt);
 }
 public void Update(JobReceiveLineStatus pt)
 {
     pt.ObjectState = ObjectState.Modified;
     _unitOfWork.Repository <JobReceiveLineStatus>().Update(pt);
 }
 public void Delete(JobReceiveLineStatus pt)
 {
     _unitOfWork.Repository <JobReceiveLineStatus>().Delete(pt);
 }
 public JobReceiveLineStatus DBCreate(JobReceiveLineStatus pt)
 {
     pt.ObjectState = ObjectState.Added;
     db.JobReceiveLineStatus.Add(pt);
     return(pt);
 }
 public JobReceiveLineStatus Create(JobReceiveLineStatus pt)
 {
     pt.ObjectState = ObjectState.Added;
     _unitOfWork.Repository <JobReceiveLineStatus>().Insert(pt);
     return(pt);
 }