Exemplo n.º 1
0
        private string deleteSerials(ReceivingDetailModel model)
        {
            ReceivingDetail savedDetail = service.GetSingleReceivingDetail(model.Id);

            if (!string.IsNullOrEmpty(savedDetail.SerialNo))
            {
                List <string>       savedSerials = savedDetail.SerialNo.Split(new char[] { ',' }).ToList();
                bool                isAllowed    = true;
                List <SerialNumber> tobeDeleted  = new List <SerialNumber>();
                foreach (var serial in savedSerials)
                {
                    SerialNumber currentSerial = lotService.GetSerialNo(serial, savedDetail.LotNoId.Value, AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId);
                    if (currentSerial != null)
                    {
                        isAllowed = lotService.CheckSerialNumAvailability(AuthenticationHelper.CompanyId.Value, savedDetail.LotNoId.Value, serial);
                        if (!isAllowed)
                        {
                            return("Record can not be deleted!");
                        }
                        else
                        {
                            tobeDeleted.Add(lotService.GetSerialNo(serial, savedDetail.LotNoId.Value, AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId));
                        }
                    }
                }
                if (isAllowed)
                {
                    if (tobeDeleted.Count() > 0)
                    {
                        foreach (var item in tobeDeleted)
                        {
                            lotService.DeleteSerialNum(item.Id.ToString(), AuthenticationHelper.CompanyId.Value);
                        }
                    }
                }
            }
            return("");
        }
Exemplo n.º 2
0
 public static SerialNumber GetSerialNo(string serial, long lotNoId)
 {
     return(service.GetSerialNo(serial, lotNoId, AuthenticationHelper.CompanyId.Value, SessionHelper.SOBId));
 }