public override async Task <GetRolesResponse> GerRolesSeries(SeriesId request, ServerCallContext context)
        {
            try
            {
                var roles = await _series.GetRolesSeries(request.Id);

                if (roles is null)
                {
                    throw new Exception("SeriesRep - GetRoles");
                }
                List <RoleAdd> rolesAdd = new List <RoleAdd>();
                await Task.Run(() =>
                {
                    roles.ToList().ForEach((role) =>
                    {
                        var ro = _mapper.Map <Role, RoleAdd>(role);
                        rolesAdd.Add(ro);
                    });
                });

                return(new GetRolesResponse()
                {
                    Roles = { rolesAdd }, Signal = true
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "ERROR");
                return(new GetRolesResponse()
                {
                    Signal = false
                });
            }
        }
        public override async Task <GetSeriesByIdResponse> GetSeriesById(SeriesId request, ServerCallContext context)
        {
            try
            {
                var series = await _series.GetSeriesById(request.Id);

                if (series is null)
                {
                    throw new Exception("SeriesRep - GetSeriesById");
                }
                var seriesFull = _mapper.Map <Series2, SeriesFull>(series);
                return(new GetSeriesByIdResponse()
                {
                    Series = seriesFull, Signal = true
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "ERROR");
                return(new GetSeriesByIdResponse()
                {
                    Series = null, Signal = false
                });
            }
        }
예제 #3
0
        public bool Equals(BulkMoveSeries other)
        {
            if (other == null)
            {
                return(false);
            }

            return(SeriesId.Equals(other.SeriesId));
        }
예제 #4
0
        // Generated by R#
        public override int GetHashCode()
        {
            var hashCode = 785467465;

            hashCode = hashCode * -1521134295 + FleetId.GetHashCode();
            hashCode = hashCode * -1521134295 + SeriesId.GetHashCode();
            hashCode = hashCode * -1521134295 + SeasonId.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(RaceNumber);

            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(Place);

            return(hashCode);
        }
예제 #5
0
        public static Task CreateInvalidSeries()
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context          = new BookOrganizer2DbContext(connectionString);
            var repository       = new SeriesRepository(context);
            var seriesService    = new SeriesService(repository);

            var seriesId = new SeriesId(SequentialGuid.NewSequentialGuid());
            var command  = new Commands.Create {
                Id = seriesId
            };

            return(seriesService.Handle(command));
        }
예제 #6
0
        public override int GetHashCode()
        {
            var ret = (Title != null) ? Title.GetHashCode() : 0;

            ret  = (ret * 397) ^ (EpisodeNumber != null ? EpisodeNumber.GetHashCode() : 0);
            ret  = (ret * 397) ^ (EpisodeTitle != null ? EpisodeTitle.GetHashCode() : 0);
            ret  = (ret * 397) ^ (Synopsis != null ? Synopsis.GetHashCode() : 0);
            ret  = (ret * 397) ^ (Team1 != null ? Team1.GetHashCode() : 0);
            ret  = (ret * 397) ^ (Team2 != null ? Team2.GetHashCode() : 0);
            ret  = (ret * 397) ^ SeriesId.GetHashCode();
            ret &= 0x7fffffff;

            return(ret);
        }
예제 #7
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj.GetType() != GetType())
            {
                return(false);
            }

            return(SeriesId.Equals(((BulkMoveSeries)obj).SeriesId));
        }
예제 #8
0
        // DELETE

        public static Task RemoveSeries(SeriesId id)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context          = new BookOrganizer2DbContext(connectionString);
            var repository       = new SeriesRepository(context);

            var seriesService = new SeriesService(repository);
            var command       = new Commands.Delete
            {
                Id = id,
            };

            return(seriesService.Handle(command));
        }
예제 #9
0
        public static Task UpdateSeriesName(SeriesId id, string firstName)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context          = new BookOrganizer2DbContext(connectionString);
            var repository       = new SeriesRepository(context);

            var seriesService = new SeriesService(repository);
            var command       = new Commands.SetSeriesName
            {
                Id   = id,
                Name = firstName
            };

            return(seriesService.Handle(command));
        }
예제 #10
0
        public static Task UpdateSeriesReadOrder(SeriesId seriesId, ICollection <ReadOrder> newReadOrder)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context          = new BookOrganizer2DbContext(connectionString);
            var repository       = new SeriesRepository(context);

            var seriesService = new SeriesService(repository);
            var command       = new Commands.SetReadOrder
            {
                Id    = seriesId,
                Books = newReadOrder
            };

            return(seriesService.Handle(command));
        }
예제 #11
0
        public static Task UpdateSeriesDescription(SeriesId id, string description)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context          = new BookOrganizer2DbContext(connectionString);
            var repository       = new SeriesRepository(context);

            var seriesService = new SeriesService(repository);
            var command       = new Commands.SetDescription()
            {
                Id          = id,
                Description = description
            };

            return(seriesService.Handle(command));
        }
예제 #12
0
        public static Task UpdateSeriesPicturePath(SeriesId id, string path)
        {
            var connectionString = ConnectivityService.GetConnectionString("TEMP");
            var context          = new BookOrganizer2DbContext(connectionString);
            var repository       = new SeriesRepository(context);

            var seriesService = new SeriesService(repository);
            var command       = new Commands.SetPicturePath
            {
                Id          = id,
                PicturePath = path
            };

            return(seriesService.Handle(command));
        }
예제 #13
0
파일: Media.cs 프로젝트: w1r2p1/Snack-Time
        public override int GetHashCode()
        {
            int hash = 1;

            if (SeriesId != 0)
            {
                hash ^= SeriesId.GetHashCode();
            }
            if (EpisodeFileId != 0)
            {
                hash ^= EpisodeFileId.GetHashCode();
            }
            if (SeasonNumber != 0)
            {
                hash ^= SeasonNumber.GetHashCode();
            }
            if (EpisideNumber != 0)
            {
                hash ^= EpisideNumber.GetHashCode();
            }
            if (Title.Length != 0)
            {
                hash ^= Title.GetHashCode();
            }
            if (Overview.Length != 0)
            {
                hash ^= Overview.GetHashCode();
            }
            if (PlayableId.Length != 0)
            {
                hash ^= PlayableId.GetHashCode();
            }
            if (progress_ != null)
            {
                hash ^= Progress.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #14
0
        public override async Task <SeriesMessageResponse> DeleteSeries(SeriesId request, ServerCallContext context)
        {
            try
            {
                var response = await _series.DeleteSeries(request.Id);

                if (!response)
                {
                    throw new Exception("SeriesRep - PostSeries");
                }
                return(new SeriesMessageResponse()
                {
                    Signal = true, Poruka = "Uspesno obrisano"
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "ERROR");
                return(new SeriesMessageResponse()
                {
                    Signal = false, Poruka = "Greska"
                });
            }
        }
예제 #15
0
        /// <summary>
        /// Returns a System.String containing an Xml representation of the specified property of the current object
        /// </summary>
        /// <param name="property">name of a specific property that is to be written out as Xml.
        /// If this value is filled in, only the <id/> node and the node for property are output.
        /// At the time of this writing, this is only used for product_pictures.
        /// </param>
        /// <returns></returns>
        public string ToXml(string property)
        {
            var xml = new XElement(_objectName);

            xml.Add(new XElement("id", Id.ToString()));

            if ((property == null || property == "product_type_id") && LogBits.BitTest(Enums.Logfield.ProductTypeId))
            {
                xml.Add(new XElement("product_type_id", (int)ProductTypeId));
            }

            if ((property == null || property == "name_nl") && Name_NL != null && LogBits.BitTest(Enums.Logfield.PublicProductName_NL))
            {
                xml.Add(new XElement("name_nl", Name_NL));
            }

            //if ((property == null || property == "name_en") && Name_EN != null && LogBits.BitTest(Enums.Logfield.PublicProductName_EN))
            //    xml.Add(new XElement("name_en", Name_EN));

            if ((property == null || property == "songs") && LogBits.BitTest(Enums.Logfield.SongSortOrder))
            {
                xml.Add(new XElement("songs", from song in Songs
                                     select new XElement(XElement.Parse(song.ToXml()))));
            }

            if ((property == null || property == "subtitle_nl") && LogBits.BitTest(Enums.Logfield.Subtitle_NL))
            {
                xml.Add(new XElement("subtitle_nl", Subtitle_NL));
            }

            if ((property == null || property == "author_id") && LogBits.BitTest(Enums.Logfield.AuthorId))
            {
                xml.Add(new XElement("author_id", AuthorId.ToString()));
            }

            if ((property == null || property == "arranger_id") && LogBits.BitTest(Enums.Logfield.ArrangerId))
            {
                xml.Add(new XElement("arranger_id", ArrangerId.ToString()));
            }

            if ((property == null || property == "manufacturer_id") && LogBits.BitTest(Enums.Logfield.ManufacturerId))
            {
                xml.Add(new XElement("manufacturer_id", ManufacturerId.ToString()));
            }

            if ((property == null || property == "instrument_id") && LogBits.BitTest(Enums.Logfield.InstrumentId))
            {
                xml.Add(new XElement("instrument_id", InstrumentId.ToString()));
            }

            if ((property == null || property == "sell_price") && !SalesPrice.IsNullOrZero() && LogBits.BitTest(Enums.Logfield.SalesPrice))
            {
                xml.Add(new XElement("sell_price", SalesPrice));
            }

            if ((property == null || property == "reference") && LogBits.BitTest(Enums.Logfield.ReferenceNumber))
            {
                xml.Add(new XElement("reference", ReferenceNumber));
            }

            if ((property == null || property == "isbn") && LogBits.BitTest(Enums.Logfield.Isbn))
            {
                xml.Add(new XElement("isbn", Isbn));
            }

            if ((property == null || property == "ismn") && LogBits.BitTest(Enums.Logfield.Ismn))
            {
                xml.Add(new XElement("ismn", Ismn));
            }

            if ((property == null || property == "ean") && LogBits.BitTest(Enums.Logfield.Ean))
            {
                xml.Add(new XElement("ean", Ean));
            }

            if ((property == null || property == "upc") && LogBits.BitTest(Enums.Logfield.Upc))
            {
                xml.Add(new XElement("upc", Upc));
            }

            if ((property == null || property == "language_id") && LogBits.BitTest(Enums.Logfield.LanguageId))
            {
                xml.Add(new XElement("language_id", LanguageId != null ? ((int)LanguageId).ToString() : String.Empty));
            }

            if ((property == null || property == "binding_id") && LogBits.BitTest(Enums.Logfield.BindingId))
            {
                xml.Add(new XElement("binding_id", BindingId.ToString()));
            }

            if ((property == null || property == "grade_level") && LogBits.BitTest(Enums.Logfield.GradeLevel))
            {
                xml.Add(new XElement("grade_level", GradeLevel));
            }

            if ((property == null || property == "product_series_id") && LogBits.BitTest(Enums.Logfield.SeriesId))
            {
                xml.Add(new XElement("product_series_id", SeriesId.ToString()));
            }

            if ((property == null || property == "nr_of_pages") && LogBits.BitTest(Enums.Logfield.Pages))
            {
                xml.Add(new XElement("nr_of_pages", Pages.ToString()));
            }

            if ((property == null || property == "tax_rate_id") && LogBits.BitTest(Enums.Logfield.TaxRateId))
            {
                xml.Add(new XElement("tax_rate_id", ((int)TaxRateId).ToString()));
            }

            if ((property == null || property == "product_pictures") && LogBits.BitTest(Enums.Logfield.ProductPictureFilename))
            {
                xml.Add(new XElement("product_pictures", from picture in ProductPictures
                                     select new XElement(XElement.Parse(picture.ToXml()))));
            }

            if ((property == null || property == "description_nl") && LogBits.BitTest(Enums.Logfield.Description_NL))
            {
                xml.Add(new XElement("description_nl", Description_NL));
            }

            if ((property == null || property == "weight") && LogBits.BitTest(Enums.Logfield.Weight))
            {
                xml.Add(new XElement("weight", Weight.ToString()));
            }

            if ((property == null || property == "length") && LogBits.BitTest(Enums.Logfield.Length))
            {
                xml.Add(new XElement("length", Length.ToString()));
            }

            if ((property == null || property == "width") && LogBits.BitTest(Enums.Logfield.Width))
            {
                xml.Add(new XElement("width", Width.ToString()));
            }

            if ((property == null || property == "height") && LogBits.BitTest(Enums.Logfield.Height))
            {
                xml.Add(new XElement("height", Height.ToString()));
            }

            if ((property == null || property == "product_categories") && LogBits.BitTest(Enums.Logfield.ProductCategory))
            {
                xml.Add(new XElement("product_categories", from category in ProductCategories
                                     select new XElement("product_category", new XElement("id", category.Id),
                                                         new XElement("test", Test.ToInt()))));
            }

            if ((property == null || property == "internal_stock_qty") && LogBits.BitTest(Enums.Logfield.InternalStock))
            {
                xml.Add(new XElement("internal_stock_qty", InternalStock.ToString()));
            }

            if ((property == null || property == "external_stock_qty") && LogBits.BitTest(Enums.Logfield.ExternalStock))
            {
                xml.Add(new XElement("external_stock_qty", ExternalStock != null ? ExternalStock.ToString() : "1"));
            }

            if ((property == null || property == "supplier_id") && LogBits.BitTest(Enums.Logfield.SupplierId))
            {
                xml.Add(new XElement("supplier_id", SupplierId.ToString()));
            }

            if ((property == null || property == "promotion") && LogBits.BitTest(Enums.Logfield.Promotion))
            {
                xml.Add(new XElement("promotion", Promotion.ToInt().ToString()));
            }

            if ((property == null || property == "highlight_on_home") && LogBits.BitTest(Enums.Logfield.HighlightOnHome))
            {
                xml.Add(new XElement("highlight_on_home", HighlightOnHome.ToInt().ToString()));
            }

            if ((property == null || property == "available") && LogBits.BitTest(Enums.Logfield.ActiveInWebshop))
            {
                xml.Add(new XElement("available", ActiveInWebshop.ToInt().ToString()));
            }

            if ((property == null || property == "bestseller") && LogBits.BitTest(Enums.Logfield.BestSeller))
            {
                xml.Add(new XElement("bestseller", BestSeller.ToInt().ToString()));
            }

            if ((property == null || property == "minimum_order_qty") && LogBits.BitTest(Enums.Logfield.MinimumOrderQty))
            {
                xml.Add(new XElement("minimum_order_qty", (MinimumOrderQuantity != 0) ? MinimumOrderQuantity.ToString() : String.Empty));
            }

            if ((property == null || property == "teacher_discount") && LogBits.BitTest(Enums.Logfield.WebshopTeacherDiscount))
            {
                xml.Add(new XElement("teacher_discount", TeacherDiscount.ToString()));
            }

            if ((property == null || property == "reseller_discount") && LogBits.BitTest(Enums.Logfield.WebshopResellerDiscount))
            {
                xml.Add(new XElement("reseller_discount", ResellerDiscount.ToString()));
            }

            if ((property == null || property == "search_keywords") && LogBits.BitTest(Enums.Logfield.SearchKeywords))
            {
                xml.Add(new XElement("search_keywords", SearchKeywords));
            }

            if ((property == null || property == "store_pickup_only") && LogBits.BitTest(Enums.Logfield.StorePickupOnly))
            {
                xml.Add(new XElement("store_pickup_only", StorePickupOnly.ToInt().ToString()));
            }

            if ((property == null || property == "test"))
            {
                xml.Add(new XElement("test", Test.ToInt()));
            }

            if ((property == null || property == "created") && LogBits.BitTest(Enums.Logfield.CreateDttm))
            {
                xml.Add(new XElement("created", (!CreatedDttm.IsNullOrDefault()) ? ((DateTime)CreatedDttm).ToString("yyyy-MM-dd HH:mm:ss") : String.Empty));
            }

            if ((property == null || property == "updated") && LogBits.BitTest(Enums.Logfield.UpdateDttm))
            {
                xml.Add(new XElement("updated", (!UpdatedDttm.IsNullOrDefault()) ? ((DateTime)UpdatedDttm).ToString("yyyy-MM-dd HH:mm:ss") : String.Empty));
            }

            if ((property == null || property == "deleted") && LogBits.BitTest(Enums.Logfield.DeleteDttm))
            {
                xml.Add(new XElement("deleted", (!DeletedDttm.IsNullOrDefault()) ? ((DateTime)DeletedDttm).ToString("yyyy-MM-dd HH:mm:ss") : String.Empty));
            }

            string xmlString = xml.ToString();

            return(xmlString);
        }
예제 #16
0
 public override int GetHashCode() => UserId.GetHashCode() ^ SeriesId.GetHashCode(); //https://stackoverflow.com/a/70375/12641623
예제 #17
0
 private ValueTask <Series> GetSeriesAsync(SeriesId seriesId)
 => Context.Series.FindAsync(seriesId);
예제 #18
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Subject != null)
            {
                result.AddRange(Subject.Validate());
            }
            if (DateTimeElement != null)
            {
                result.AddRange(DateTimeElement.Validate());
            }
            if (Operator != null)
            {
                result.AddRange(Operator.Validate());
            }
            if (Identifier != null)
            {
                result.AddRange(Identifier.Validate());
            }
            if (AccessionNo != null)
            {
                result.AddRange(AccessionNo.Validate());
            }
            if (StudyId != null)
            {
                result.AddRange(StudyId.Validate());
            }
            if (SeriesId != null)
            {
                result.AddRange(SeriesId.Validate());
            }
            if (Method != null)
            {
                result.AddRange(Method.Validate());
            }
            if (Requester != null)
            {
                result.AddRange(Requester.Validate());
            }
            if (ModalityElement != null)
            {
                result.AddRange(ModalityElement.Validate());
            }
            if (DeviceNameElement != null)
            {
                result.AddRange(DeviceNameElement.Validate());
            }
            if (HeightElement != null)
            {
                result.AddRange(HeightElement.Validate());
            }
            if (WidthElement != null)
            {
                result.AddRange(WidthElement.Validate());
            }
            if (BitsElement != null)
            {
                result.AddRange(BitsElement.Validate());
            }
            if (FramesElement != null)
            {
                result.AddRange(FramesElement.Validate());
            }
            if (FrameDelay != null)
            {
                result.AddRange(FrameDelay.Validate());
            }
            if (View != null)
            {
                result.AddRange(View.Validate());
            }
            if (Content != null)
            {
                result.AddRange(Content.Validate());
            }

            return(result);
        }
예제 #19
0
 public override int GetHashCode()
 {
     return(SeriesId.GetHashCode());
 }