public byte ExecCover(uint pdt, bool cov, Model.Prestashop.PsImageRepository PsImageRepository, Model.Prestashop.PsImage PsImageCurrent)
 {
     if (cov)
     {
         if (PsImageRepository.ExistProductCover(pdt, Convert.ToByte(cov)))
         {
             Model.Prestashop.PsImageShopRepository PsImageShopRepository = new Model.Prestashop.PsImageShopRepository();
             Model.Prestashop.PsImageShop           PsImageShop;
             foreach (Model.Prestashop.PsImage PsImage in PsImageRepository.ListProduct(pdt))
             {
                 if (PsImage.IDImage != PsImageCurrent.IDImage)
                 {
                     PsImage.Cover = Convert.ToByte(false);
                     if (PsImageShopRepository.ExistImage(PsImage.IDImage))
                     {
                         PsImageShop = PsImageShopRepository.ReadImage(PsImage.IDImage);
                                                         #if (PRESTASHOP_VERSION_160)
                         PsImageShop.Cover = (sbyte)PsImage.Cover;
                                                         #else
                         PsImageShop.Cover = PsImage.Cover;
                                                         #endif
                     }
                 }
             }
             PsImageShopRepository.Save();
             PsImageRepository.Save();
         }
     }
     return(Convert.ToByte(cov));
 }
 public byte?ExecCover(uint pdt, bool cov, Model.Prestashop.PsImageRepository PsImageRepository, Model.Prestashop.PsImage PsImageCurrent)
 {
     if (cov)
     {
         if (PsImageRepository.ExistProductCover(pdt, Convert.ToByte(cov)))
         {
             Model.Prestashop.PsImageShopRepository PsImageShopRepository = new Model.Prestashop.PsImageShopRepository();
             Model.Prestashop.PsImageShop           PsImageShop;
             foreach (Model.Prestashop.PsImage PsImage in PsImageRepository.ListProduct(pdt))
             {
                 if (PsImage.IDImage != PsImageCurrent.IDImage)
                 {
                     PsImage.Cover = (byte?)null;
                     if (PsImageShopRepository.ExistImage(PsImage.IDImage))
                     {
                         PsImageShop       = PsImageShopRepository.ReadImage(PsImage.IDImage);
                         PsImageShop.Cover = PsImage.Cover;
                     }
                 }
             }
             PsImageShopRepository.Save();
             PsImageRepository.Save();
         }
     }
     return((cov) ? Convert.ToByte(cov) : (byte?)null);
 }