public SalesEstimate UpdateChanges(SalesEstimate estimate) { var existEstimate = erpNodeDBContext.SalesEstimates.Find(estimate.Id); if (existEstimate != null) { existEstimate.Reference = estimate.Reference; existEstimate.Memo = estimate.Memo; existEstimate.ProjectGuid = estimate.ProjectGuid; existEstimate.TransactionDate = estimate.TransactionDate; existEstimate.ExpiredInDayCount = estimate.ExpiredInDayCount; existEstimate.PaymentTermGuid = estimate.PaymentTermGuid; existEstimate.ShippingTermGuid = estimate.ShippingTermGuid; existEstimate.TaxCodeGuid = estimate.TaxCodeGuid; existEstimate.TaxCode = organization.TaxCodes.Find(estimate.TaxCodeGuid); existEstimate.Calculate(); erpNodeDBContext.SaveChanges(); return(estimate); } return(null); }
public HttpResponseMessage Delete([FromUri] int Id, [FromBody] int modifiedBy) { SalesEstimate pr = new SalesEstimate(); pr.ID = Id; pr.ModifiedBy = modifiedBy; return(Request.CreateResponse(HttpStatusCode.OK, pr.Delete())); }
public HttpResponseMessage Get([FromBody] int LocationId, [FromUri] DateTime?FromDate, [FromUri] DateTime?ToDate, [FromUri] int?CustomerId) { List <SalesEstimate> reg = SalesEstimate.GetDetailsForConfirm(LocationId).ToList(); if (FromDate != null && ToDate != null) { reg = reg.Where(x => x.EntryDate >= FromDate && x.EntryDate <= ToDate).ToList(); } if (CustomerId != null && CustomerId != 0) { reg = reg.Where(x => x.CustomerId == CustomerId).ToList(); } return(Request.CreateResponse(HttpStatusCode.OK, reg)); }
public SalesEstimate Create(Guid profileGuid, DateTime createDate) { var newEstimate = new SalesEstimate() { TransactionType = TransactionTypes.SalesEstimate, Id = Guid.NewGuid(), No = this.NextNumber, ProfileGuid = profileGuid, TransactionDate = createDate, TaxCode = organization.TaxCodes.GetDefaultOuput, SelfProfileGuid = organization.SelfProfile.Id, ExpiredInDayCount = 90, }; erpNodeDBContext.SalesEstimates.Add(newEstimate); erpNodeDBContext.SaveChanges(); return(newEstimate); }
public SalesEstimate Copy(SalesEstimate originalSalesEstimate, DateTime trDate) { var cloneSalesEstimate = this.erpNodeDBContext.SalesEstimates .AsNoTracking() .Include(p => p.Items) .FirstOrDefault(x => x.Id == originalSalesEstimate.Id); cloneSalesEstimate.Id = Guid.NewGuid(); cloneSalesEstimate.TransactionDate = trDate; cloneSalesEstimate.Reference = "Clone-" + cloneSalesEstimate.Reference; cloneSalesEstimate.No = organization.SalesEstimates.NextNumber; cloneSalesEstimate.Status = EstimateStatus.Quote; cloneSalesEstimate.Items.ToList().ForEach(ci => ci.Id = Guid.NewGuid()); this.erpNodeDBContext.SalesEstimates.Add(cloneSalesEstimate); this.erpNodeDBContext.SaveChanges(); return(cloneSalesEstimate); }
public HttpResponseMessage Get([FromUri] int Id, [FromBody] int LocationId) { return(Request.CreateResponse(HttpStatusCode.OK, SalesEstimate.GetDetails(Id, LocationId))); }
public HttpResponseMessage Get([FromBody] int LocationId, [FromUri] int?CustomerId, [FromUri] DateTime?from, [FromUri] DateTime?to) { return(Request.CreateResponse(HttpStatusCode.OK, SalesEstimate.GetDetails(LocationId, CustomerId, from, to))); }
public async Task <HttpResponseMessage> SendMail([FromBody] string url, [FromUri] int salesId, [FromUri] string toAddress, [FromUri] int userId) { return(Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() => SalesEstimate.SendMail(salesId, toAddress, userId, url)))); }
public void Remove(SalesEstimate entity) { }