private string deleteLot(ReceivingDetailModel model) { LotNumber lot = lotService.GetSingle(model.LotNoId.Value.ToString(), AuthenticationHelper.CompanyId.Value); List <LotNumber> savedLots = lotService.GetAllbyLotNo(AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId, lot.LotNo, lot.ItemId).ToList(); if (model.LotNoId != null) { List <SerialNumber> savedSerials = lotService.GetSerialsbyLotNo(model.LotNoId.Value, AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId); if (savedSerials != null && savedSerials.Count() > 0) { if (!string.IsNullOrEmpty(model.SerialNo)) { List <string> currentSerials = model.SerialNo.Trim().Split(new char[] { ',' }).ToList(); if (savedSerials.Any(rec => rec.SerialNo != currentSerials.FirstOrDefault(x => x == rec.SerialNo))) { lot.Qty = lot.Qty - model.ThisPurchaseQty; lotService.Update(lot); return(""); } else { lotService.Delete(model.LotNoId.Value.ToString(), AuthenticationHelper.CompanyId.Value); } } else { lot.Qty = lot.Qty - model.ThisPurchaseQty; lotService.Update(lot); return(""); } } else { lotService.Delete(model.LotNoId.Value.ToString(), AuthenticationHelper.CompanyId.Value); } } return(""); }
public static void Delete(string id) { service.Delete(id, AuthenticationHelper.CompanyId.Value); }