コード例 #1
0
 public void Update(VLCMilkCollection vlcMilkCollection)
 {
     if (vlcMilkCollection != null)
     {
         _repository.Entry <Sql.VLCMilkCollection>(vlcMilkCollection).State = System.Data.Entity.EntityState.Modified;
         //  _repository.SaveChanges();
     }
 }
コード例 #2
0
 public void Add(VLCMilkCollection vlcMilkCollection)
 {
     if (vlcMilkCollection != null)
     {
         _repository.VLCMilkCollections.Add(vlcMilkCollection);
         // _repository.SaveChanges();
     }
 }
コード例 #3
0
 public static void ConvertToVLCMilkCollectionEntity(ref VLCMilkCollection vlcMilkCollection, VLCMilkCollectionDTO vlcMilkCollectionDTO, bool isUpdate)
 {
     if (isUpdate)
     {
         vlcMilkCollection.VLCMilkCollectionId = vlcMilkCollectionDTO.VLCMilkCollectionId;
     }
     vlcMilkCollection.VLCId      = vlcMilkCollectionDTO.VLCId;
     vlcMilkCollection.CustomerId = vlcMilkCollectionDTO.CustomerId;
     vlcMilkCollection.ShiftId    = (int)vlcMilkCollectionDTO.ShiftId;
 }
コード例 #4
0
        public ResponseDTO AddVLCMilkCollection(VLCMilkCollectionDTO vLCMilkCollectionDTO)
        {
            ResponseDTO responseDTO = new ResponseDTO();
            //  this.CheckForExisitngCustomer(vlcDto.MobileNumber);
            VLCMilkCollection vLCMilkCollection = new VLCMilkCollection();

            vLCMilkCollection.VLCMilkCollectionId = unitOfWork.DashboardRepository.NextNumberGenerator("VLCMilkCollection");
            vLCMilkCollection.CollectionDateTime  = DateTimeHelper.GetISTDateTime();
            vLCMilkCollection.CreatedDate         = DateTimeHelper.GetISTDateTime();
            vLCMilkCollection.ModifiedDate        = DateTimeHelper.GetISTDateTime();
            vLCMilkCollection.CreatedBy           = vLCMilkCollectionDTO.ModifiedBy = "Admin";
            vLCMilkCollection.IsDeleted           = false;
            VLCMilkCollectionConvertor.ConvertToVLCMilkCollectionEntity(ref vLCMilkCollection, vLCMilkCollectionDTO, false);
            if (vLCMilkCollectionDTO.vLCMilkCollectionDtlDTOList != null)
            {
                foreach (var vlcCollectionDtlDTO in vLCMilkCollectionDTO.vLCMilkCollectionDtlDTOList)
                {
                    this.CheckForExistingCollectionDetailByDateShiftProduct(vLCMilkCollection.CollectionDateTime.Value.Date, vLCMilkCollectionDTO.ShiftId, vlcCollectionDtlDTO.ProductId, vLCMilkCollectionDTO.CustomerId);
                    VLCMilkCollectionDtl vLCMilkCollectionDtl = new VLCMilkCollectionDtl();
                    vLCMilkCollectionDtl.VLCMilkCollectionDtlId = unitOfWork.DashboardRepository.NextNumberGenerator("VLCMilkCollectionDtl");
                    vLCMilkCollectionDtl.VLCMilkCollectionId    = vLCMilkCollection.VLCMilkCollectionId;
                    VLCMilkCollectionConvertor.ConvertToVLCMilkCollectionDtlEntity(ref vLCMilkCollectionDtl, vlcCollectionDtlDTO, false);
                    unitOfWork.VLCMilkCollectionDtlRepository.Add(vLCMilkCollectionDtl);
                }

                vLCMilkCollection.TotalAmount   = vLCMilkCollectionDTO.vLCMilkCollectionDtlDTOList.Sum(s => s.Amount);
                vLCMilkCollection.TotalQuantity = vLCMilkCollectionDTO.vLCMilkCollectionDtlDTOList.Sum(s => s.Quantity);
            }
            else
            {
                throw new PlatformModuleException("Milk Collection Detail Not Found");
            }
            unitOfWork.VLCMilkCollectionRepository.Add(vLCMilkCollection);

            unitOfWork.SaveChanges();
            responseDTO.Status  = true;
            responseDTO.Message = String.Format("Milk Collection Detail Added Successfully ");
            responseDTO.Data    = this.GetVLCCustomerCollectionByDateAndShift(vLCMilkCollectionDTO.VLCId, DateTimeHelper.GetISTDateTime().Date, vLCMilkCollectionDTO.ShiftId, 1);

            return(responseDTO);
        }
コード例 #5
0
        public static VLCCustomerCollectionDTO ConvertToVLCCustomerCollectionDTO(VLCMilkCollection vLCMilkCollection)
        {
            VLCCustomerCollectionDTO vLCCustomerCollectionDTO = new VLCCustomerCollectionDTO();

            if (vLCMilkCollection != null && vLCMilkCollection.VLCMilkCollectionDtls.Count() > 0)
            {
                vLCCustomerCollectionDTO.VLCMilkCollectionId = vLCMilkCollection.VLCMilkCollectionId;
                vLCCustomerCollectionDTO.CollectionDateTime  = vLCMilkCollection.CollectionDateTime.GetValueOrDefault();
                vLCCustomerCollectionDTO.CustomerId          = vLCMilkCollection.CustomerId.GetValueOrDefault();
                vLCCustomerCollectionDTO.CustomerCodeId      = vLCMilkCollection.Customer.CustomerCode;
                vLCCustomerCollectionDTO.CustomerName        = vLCMilkCollection.Customer.CustomerName;
                vLCCustomerCollectionDTO.Shift         = vLCMilkCollection.ShiftId == 1 ? "Morning" : "Evening";
                vLCCustomerCollectionDTO.TotalAmount   = vLCMilkCollection.TotalAmount.GetValueOrDefault();
                vLCCustomerCollectionDTO.TotalQuantity = vLCMilkCollection.TotalQuantity.GetValueOrDefault();
                foreach (var dtl in vLCMilkCollection.VLCMilkCollectionDtls)
                {
                    vLCCustomerCollectionDTO.vLCCustomerCollectionDtlDTOList.Add(ConvertToCustomerCollectionDtlDTO(dtl));
                }
            }
            return(vLCCustomerCollectionDTO);
        }
コード例 #6
0
        public static VLCMilkCollectionDTO ConvertToVLCMilkCollectionDto(VLCMilkCollection vlcMilkCollection)
        {
            VLCMilkCollectionDTO vlcMilkCollectionDTO = new VLCMilkCollectionDTO();

            vlcMilkCollectionDTO.VLCMilkCollectionId = vlcMilkCollection.VLCMilkCollectionId;
            vlcMilkCollectionDTO.VLCId         = vlcMilkCollection.VLCId.GetValueOrDefault();
            vlcMilkCollectionDTO.TotalAmount   = vlcMilkCollection.TotalAmount.GetValueOrDefault();
            vlcMilkCollectionDTO.TotalQuantity = vlcMilkCollection.TotalQuantity.GetValueOrDefault();

            ShiftEnum shift;

            Enum.TryParse <ShiftEnum>(vlcMilkCollection.ShiftId.ToString(), out shift);
            vlcMilkCollectionDTO.ShiftId = shift;

            vlcMilkCollectionDTO.CollectionDateTime = vlcMilkCollection.CollectionDateTime.HasValue ? vlcMilkCollection.CollectionDateTime.Value : DateTime.Now;

            vlcMilkCollectionDTO.CreatedBy    = vlcMilkCollection.CreatedBy;
            vlcMilkCollectionDTO.CreatedDate  = vlcMilkCollection.CreatedDate;
            vlcMilkCollectionDTO.CreatedBy    = vlcMilkCollection.CreatedBy;
            vlcMilkCollectionDTO.CreatedDate  = vlcMilkCollection.CreatedDate;
            vlcMilkCollectionDTO.IsDeleted    = vlcMilkCollection.IsDeleted.GetValueOrDefault();
            vlcMilkCollectionDTO.ModifiedBy   = vlcMilkCollection.ModifiedBy;
            vlcMilkCollectionDTO.ModifiedDate = vlcMilkCollection.ModifiedDate.GetValueOrDefault();
            vlcMilkCollectionDTO.CustomerName = vlcMilkCollection.Customer.CustomerName.ToString();
            vlcMilkCollectionDTO.VLCName      = vlcMilkCollection.VLC.VLCName.ToString();

            if (vlcMilkCollection.VLCMilkCollectionDtls != null && vlcMilkCollection.VLCMilkCollectionDtls.Count() > 0)
            {
                vlcMilkCollectionDTO.vLCMilkCollectionDtlDTOList = new List <VLCMilkCollectionDtlDTO>();
                foreach (VLCMilkCollectionDtl item in vlcMilkCollection.VLCMilkCollectionDtls)
                {
                    vlcMilkCollectionDTO.vLCMilkCollectionDtlDTOList.Add(ConvertToVLCMilkCollectionDetailDTO(item));
                }
            }

            return(vlcMilkCollectionDTO);
        }