public override string ToString()
        {
            var sb = new StringBuilder();

            if (MemberName.Contains("-"))
                sb.AppendLine($"    [JsonPropertyName(\"{MemberName}\")]");

            var brackets = IsArray ? "[]" : string.Empty;

            sb.AppendLine($"    public {GetCsharpTypeName()}{brackets} {GetMemberName(MemberName)} {{ get; set; }}");

            return sb.ToString();
        }
예제 #2
0
        private void ExecuteShowReport()
        {
            Result       = null;
            SearchStatus = String.Empty;
            if (SelectedContributionColumns.Count == 0)
            {
                MessageBox.Show("No Columns selected");
                return;
            }
            if (DateTime.Compare(StartDate.Date, EndDate.Date) > 0)
            {
                MessageBox.Show("Start Date should be before End Date");
                return;
            }
            Result = new FlowDocument();
            if (!WithDetails)
            {
                List <MahalluManager.Model.Contribution> input = null;
                using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                    if (DateTime.Compare(StartDate, EndDate) == 0)
                    {
                        input = unitOfWork.Contributions.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate.Date) == 0).ToList();
                    }
                    else
                    {
                        input = unitOfWork.Contributions.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate) >= 0 && DateTime.Compare(x.CreatedOn, EndDate) <= 0).ToList();
                    }
                    if (Category != null)
                    {
                        input = input.Where(x => x.CategoryName == Category.Name).ToList();;
                    }
                }
                if (ValidateReportParameters())
                {
                    BuildReport(input);
                }
            }
            else
            {
                List <MahalluManager.Model.Contribution> input = null;
                using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                    input = unitOfWork.Contributions.GetAll().ToList();
                    if (Category != null)
                    {
                        input = input.Where(x => x.CategoryName == Category.Name).ToList();;
                    }
                }

                List <ContributionDetail> inputDetails = null;
                using (UnitOfWork unitOfWork = new UnitOfWork(new MahalluDBContext())) {
                    if (DateTime.Compare(StartDate, EndDate) == 0)
                    {
                        inputDetails = unitOfWork.ContributionDetails.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate.Date) == 0).ToList();
                    }
                    else
                    {
                        inputDetails = unitOfWork.ContributionDetails.GetAll().Where(x => DateTime.Compare(x.CreatedOn, StartDate) >= 0 && DateTime.Compare(x.CreatedOn, EndDate) <= 0).ToList();
                    }
                }
                String[] temp = null;
                if (!String.IsNullOrEmpty(HouseNumber))
                {
                    if (HouseNumber.Contains(";"))
                    {
                        temp = HouseNumber.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = HouseNumber;
                    }
                    if (temp != null)
                    {
                        inputDetails = inputDetails.Where(x => temp.Contains(x.HouserNumber.ToString(), new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(HouseName))
                {
                    temp = null;
                    if (HouseName.Contains(";"))
                    {
                        temp = HouseName.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = HouseName;
                    }
                    if (temp != null)
                    {
                        inputDetails = inputDetails.Where(x => temp.Contains(x.HouserName, new ContainsComparer())).ToList();
                    }
                }
                if (!String.IsNullOrEmpty(MemberName))
                {
                    temp = null;
                    if (MemberName.Contains(";"))
                    {
                        temp = MemberName.Split(';');
                    }
                    else
                    {
                        temp    = new string[1];
                        temp[0] = MemberName;
                    }
                    if (temp != null)
                    {
                        inputDetails = inputDetails.Where(x => temp.Contains(x.MemberName, new ContainsComparer())).ToList();
                    }
                }
                if (ValidateReportParameters())
                {
                    BuildReport(input, inputDetails);
                }
            }
        }