Exemplo n.º 1
0
        public void UpConstant(string aCategory, string value1, string ConstantName = "", int SortOrder = 0, string value2 = "", string value3 = "")
        {
            constant cont = ConstantRepository.GetConstantByName(ConstantName);

            if (cont != null)
            {
                cont.Category = aCategory;
                if (ConstantName == "")
                {
                    cont.ConstantName = value1;
                }
                else
                {
                    cont.ConstantName = ConstantName;
                }
                cont.Value1 = value1;
                if (SortOrder == 0)
                {
                    cont.SortOrder = 1;
                }
                else
                {
                    cont.SortOrder = SortOrder;
                }
                cont.Status          = "Active";
                cont.Value2          = value2;
                cont.Value3          = value3;
                cont.EnteredBy       = User.Identity.Name.ToString();
                cont.DateEntered     = DateTime.Now;
                db.Entry(cont).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public ActionResult DeleteConfirmed(int ConstantID)
        {
            constant constant = ConstantRepository.GetConstantID(ConstantID);

            ConstantRepository.DeleteRedord(constant);
            return(RedirectToAction("List"));
        }
Exemplo n.º 3
0
        public void AddConstant(string aCategory, string value1, string ConstantName = "", int SortOrder = 0, string value2 = "", string value3 = "")
        {
            constant cont = new constant();

            cont.Category = aCategory;
            if (ConstantName == "")
            {
                cont.ConstantName = value1;
            }
            else
            {
                cont.ConstantName = ConstantName;
            }
            cont.Value1 = value1;
            if (SortOrder == 0)
            {
                cont.SortOrder = 1;
            }
            else
            {
                cont.SortOrder = SortOrder;
            }
            cont.Status      = "Active";
            cont.Value2      = value2;
            cont.Value3      = value3;
            cont.EnteredBy   = User.Identity.Name.ToString();
            cont.DateEntered = DateTime.Now;
            db.constants.Add(cont);
            db.SaveChanges();
            ConstantRepository.AddRecord(cont);
        }
Exemplo n.º 4
0
        //
        // GET: /Constant/Delete/5

        public ActionResult Delete(int ConstantID)
        {
            ViewBag.ConstantID = ConstantID;
            constant constant = ConstantRepository.GetConstantID(ConstantID);

            return(PartialView(constant));
        }
Exemplo n.º 5
0
        public ActionResult MiscUpdate(string category, string ConstantName, string UpdateField)
        {
            ViewBag.Value1 = false;
            ViewBag.Value2 = false;
            ViewBag.Value3 = false;

            if (UpdateField == "Value1")
            {
                ViewBag.Value1 = true;
            }
            else if (UpdateField == "Value2")
            {
                ViewBag.Value2 = true;
            }
            else if (UpdateField == "Value3")
            {
                ViewBag.Value3 = true;
            }
            else
            {
            }
            constant constant = ConstantRepository.GetConstantByCategoryName(category, ConstantName);

            return(PartialView(constant));
        }
Exemplo n.º 6
0
        public ActionResult Create(meeting meeting, string CallerType = "")
        {
            meeting mtg = db.meetings.FirstOrDefault(e => e.meetingID == meeting.meetingID && e.Title == meeting.Title);

            if (mtg != null)
            {
                TempData["Message2"] = "Meeting already exist";
                return(PartialView(meeting));
            }
            try
            {
                //if (budget.Comment == null) { budget.Comment = ""; }
                constant cont = ConstantRepository.GetConstantListByCategory("Ministry Activity").FirstOrDefault(e => e.ConstantName == "Ministry Meeting");
                //set meeting on calendar
                calendar cal = new calendar();
                cal.ministryID   = meeting.ministryID;
                cal.EventType    = cont.constantID;
                cal.CalendarDate = meeting.meetingDate;
                cal.StartTime    = meeting.StartTime;
                cal.EndTime      = meeting.EndTime;
                cal.Location     = meeting.meetingVenue;
                cal.Title        = meeting.Title;
                cal.Conductor    = meeting.Conductor;
                cal.PublicAccess = false;
                cal.Description  = "";
                cal.EnteredBy    = User.Identity.Name.ToString();
                cal.DateEntered  = System.DateTime.Today;
                cal.Status       = "Active";
                db.calendars.Add(cal);
                db.SaveChanges();

                CalendarRepository.AddRecord(cal);
                meeting.CalendarID = cal.calendarID;

                if (ModelState.IsValid)
                {
                    db.meetings.Add(meeting);
                    db.SaveChanges();
                    MeetingRepository.AddRecord(meeting);
                    TempData["Message2"] = "Meeting created successfully.";
                    GetData(meeting.ministryID);
                    if (CallerType == "Ministry")
                    {
                        return(RedirectToAction("Create", new { MinistryID = meeting.ministryID, CallerType = "Ministry" }));
                    }
                    else
                    {
                        return(RedirectToAction("Create"));
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["Message2"] = "Error adding meeting record";
            }
            GetData(meeting.ministryID);

            return(PartialView(meeting));
        }
Exemplo n.º 7
0
 public void UpdateRecord(constant constant)
 {
     if (constant.constantID > 0)
     {
         context.Entry(constant).State = System.Data.EntityState.Modified;
     }
     context.SaveChanges();
 }
Exemplo n.º 8
0
        public ActionResult MemberPledgeEnable()
        {
            GetData();
            //Member pledge entry status
            constant MemberPledgeEntry = ConstantRepository.GetConstantByName("Member Pledge Entry");

            ViewBag.MemberPledgeEntry = "";
            if (MemberPledgeEntry.Value1 == "Enable")
            {
                ViewBag.MemberPledgeEntry = string.Format("Note: Member Pledge Entry is currently Active for {0}.", MemberPledgeEntry.Value2);
            }
            else
            {
                ViewBag.MemberPledgeEntry = "Note: Member Pledge Entry is Not Active.";
            }
            return(PartialView());
        }
Exemplo n.º 9
0
        public ActionResult Index()
        {
            string role = Convert.ToString(System.Web.HttpContext.Current.Session["memberRole"]);

            ViewBag.Log = true;
            if (role.Trim() == "")
            {
                ViewBag.Log = false;
            }

            //front page postal
            ViewBag.HasFixedBanner1 = false;
            ViewBag.HasFixedBanner2 = false;
            ViewBag.HasFixedBanner3 = false;

            ViewBag.FixedBanner1 = CalendarRepository.GetCalendarByDescription("FixedBanner1");
            ViewBag.FixedBanner2 = CalendarRepository.GetCalendarByDescription("FixedBanner2");
            ViewBag.FixedBanner3 = CalendarRepository.GetCalendarByDescription("FixedBanner3");

            if (ViewBag.FixedBanner1 != null)
            {
                ViewBag.HasFixedBanner1 = true;
            }

            if (ViewBag.FixedBanner2 != null)
            {
                ViewBag.HasFixedBanner2 = true;
            }

            if (ViewBag.FixedBanner3 != null)
            {
                ViewBag.HasFixedBanner3 = true;
            }
            ViewBag.DisplayFixedBanner = false;
            constant DisplayFixedBanner = ConstantRepository.GetConstantByName("DisplayFixedBanner");

            if (DisplayFixedBanner.Value1 == "Yes")
            {
                ViewBag.DisplayFixedBanner = true;
            }


            ViewBag.Role = role;
            return(PartialView());
        }
Exemplo n.º 10
0
        public ActionResult Create(programevent programevent)
        {
            int      ministryID = GoalRepository.GetGoalByID(programevent.goalID).ministryID;
            constant cont       = ConstantRepository.GetConstantListByCategory("Ministry Activity").FirstOrDefault(e => e.ConstantName == "Program/Event");

            try
            {
                //set meeting on calendar
                calendar cal = new calendar();
                cal.ministryID   = ministryID;
                cal.EventType    = cont.constantID;
                cal.CalendarDate = programevent.C_When;
                cal.StartTime    = programevent.BeginTime;
                cal.EndTime      = programevent.EndTime;
                cal.Location     = programevent.C_Where;
                cal.Title        = programevent.Title;
                cal.Conductor    = MemberRepository.GetMemberByID(programevent.C_Who).FullNameTitle;
                cal.PublicAccess = true;
                cal.Description  = "";
                cal.EnteredBy    = User.Identity.Name.ToString();
                cal.DateEntered  = System.DateTime.Today;
                cal.Status       = "Active";
                db.calendars.Add(cal);
                db.SaveChanges();

                CalendarRepository.AddRecord(cal);
                programevent.CalendarID = cal.calendarID;

                if (ModelState.IsValid)
                {
                    db.programevents.Add(programevent);
                    db.SaveChanges();
                    ProgramEventRepository.AddRecord(programevent);
                    TempData["Message2"] = "Event added successfully.";
                    GetData(ministryID);
                    return(RedirectToAction("Create", new { GoalID = programevent.goalID }));
                }
            }
            catch (Exception ex)
            {
                TempData["Message2"] = "Error adding event";
            }
            GetData(ministryID);
            return(PartialView(programevent));
        }
Exemplo n.º 11
0
 public ActionResult Edit(constant constant)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(constant).State = EntityState.Modified;
             db.SaveChanges();
             TempData["Message2"] = string.Format("{0} record update successfully.", constant.ConstantName);
             return(RedirectToAction("List", new {}));
         }
     }
     catch (Exception ex)
     {
         TempData["Message2"] = string.Format("Error editing {0} record.", constant.ConstantName);
     }
     return(PartialView(constant));
 }
Exemplo n.º 12
0
        public ActionResult Create(constant constant)
        {
            constant c = ConstantRepository.GetAllConstantList().FirstOrDefault(e => e.Category == constant.Category && e.ConstantName == constant.ConstantName);

            if (c != null)
            {
                TempData["Message2"] = string.Format("Constant <{0}> already exist for category <{1}>.", c.ConstantName, c.Category);
                return(RedirectToAction("Create"));
            }

            try
            {
                if (constant.Value2 == null)
                {
                    constant.Value2 = "Null";
                }
                if (constant.Value3 == null)
                {
                    constant.Value3 = "Null";
                }

                if (ModelState.IsValid)
                {
                    db.constants.Add(constant);
                    db.SaveChanges();
                    ConstantRepository.AddRecord(constant);
                    TempData["Message2"] = "Constant created successfully.";
                    GetData();
                    return(RedirectToAction("Create"));
                }
            }
            catch (Exception ex)
            {
                TempData["Message2"] = "Error ocurred creating constant.";
            }
            return(PartialView(constant));
        }
Exemplo n.º 13
0
        public void TaxReport(int memberID)
        {
            string FileName = string.Format("{0}","ContributionTaxFile.pdf");
           // var path = Path.Combine(Server.MapPath("~/public_html/ClientFiles"), FileName);
            var path = Path.Combine(Server.MapPath("~/App_Data/ClientFiles"), FileName);
            bool exist = System.IO.File.Exists(string.Format("{0}", path));
            if (exist)
            {
                System.IO.File.Delete(string.Format("{0}", path));
                //System.IO.File.Delete(@"C:\test.txt");
            }

            member member = MemberRepository.GetMemberByID(memberID); 

            Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10, 10, 42, 35);
            
            PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream(path, FileMode.Create));
            doc.Open();

            //image
            picture icon = PictureRepository.GetLetterHeadImage();
            if (icon != null)
            {
                iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(icon.ImageData);
                //image.ScalePercent(50f);
                //image.SetAbsolutePosition(doc.PageSize.Width - 36f - 72f, doc.PageSize.Height - 36f - 216.6f);
                image.ScaleToFit(250f, 250f);
                // image.Border = iTextSharp.text.Rectangle.BOX;
                // image.BorderColor = iTextSharp.text.BaseColor.GREEN;
                // image.BorderWidth = 5f;
                doc.Add(image);
            }

            //get contribution data
            //ministry ministry = 
            string ChurchName = ConstantRepository.GetConstantByName("Church Name").Value1;
            string ChurchAddress = ConstantRepository.GetConstantByName("Church Address").Value1;
            string ChurchPhone = ConstantRepository.GetConstantByName("Church Phone").Value1;

            constant signature1 = ConstantRepository.GetConstantByName("TaxSignature1");
            constant signature2 = ConstantRepository.GetConstantByName("TaxSignature2");


            Paragraph data;
            data = new Paragraph(string.Format("{0}\n", ChurchName));
            doc.Add(data);
            data = new Paragraph(string.Format("{0}\n", ChurchAddress));
            doc.Add(data);
            data = new Paragraph(string.Format("{0}\n", ChurchPhone));
            doc.Add(data);

            data = new Paragraph(Environment.NewLine);
            doc.Add(data);

            data = new Paragraph("Member Contribution Tax Statement");
            doc.Add(data);

            data = new Paragraph(Environment.NewLine);
            doc.Add(data);


            string memberTitle = SpouseRepository.JointTitheTitle(memberID);
            data = new Paragraph(string.Format("For: {0}", memberTitle));
            doc.Add(data);

            data = new Paragraph(Environment.NewLine);
            doc.Add(data);

            int ContributionYear = DateTime.Today.Year;
            DateTime BeginDate = Convert.ToDateTime("1/1/" + ContributionYear.ToString());
            DateTime EndDate = Convert.ToDateTime("12/31/" + ContributionYear.ToString());
            int thiteID = ConstantRepository.GetConstantByName("Tithes").constantID;
            int offeringID = ConstantRepository.GetConstantByName("Offering").constantID;


            decimal TithesTotal = ContributionRepository.GetContributionByMemberCategoryRange(memberID, thiteID, BeginDate, EndDate).Sum(e => e.Amount);
            decimal OfferingTotal = ContributionRepository.GetContributionByMemberCategoryRange(memberID, offeringID, BeginDate, EndDate).Sum(e => e.Amount); 
            decimal Totalcontribution = ContributionRepository.GetContributionByMemberDateRange(memberID,BeginDate, EndDate).Sum(e => e.Amount);
            decimal OthersTotal = Totalcontribution - TithesTotal - OfferingTotal;


            data = new Paragraph(string.Format("Tithes: {0:c}", TithesTotal));
            doc.Add(data);

            data = new Paragraph(string.Format("Offerings: {0:c}", OfferingTotal));
            doc.Add(data);

            data = new Paragraph(string.Format("Others: {0:c}", OthersTotal));
            doc.Add(data);

            data = new Paragraph(string.Format("-----------------------------------"));
            doc.Add(data);

            data = new Paragraph(string.Format("Total: {0:c}", Totalcontribution));
            doc.Add(data);

            data = new Paragraph(Environment.NewLine);
            doc.Add(data);


            data = new Paragraph(string.Format("-----------------------------------"));
            doc.Add(data);

            if (signature1.Value1 != "")
            {
                data = new Paragraph(string.Format("Signed: {0} ({1})", signature1.Value2, signature1.Value1));
                doc.Add(data);
            }

            data = new Paragraph(Environment.NewLine);
            doc.Add(data);


            if (signature2.Value1 != "")
            {
                data = new Paragraph(string.Format("-----------------------------------"));
                doc.Add(data);
                data = new Paragraph(string.Format("Signed: {0} ({1})", signature2.Value2, signature2.Value1));
                doc.Add(data);
            }
            doc.Close();

            //document doc = DocumentRepository.GetDocumentByID(DocumentID);
            //string path = AppDomain.CurrentDomain.BaseDirectory + "App_Data/ClientFiles/";

            path = AppDomain.CurrentDomain.BaseDirectory + "App_Data/ClientFiles/";
           // path = AppDomain.CurrentDomain.BaseDirectory + "public_html/ClientFiles/";
            Response.ContentType = "application/pdf";
            
            Response.AddHeader("Content-Disposition", @"filename=""IT Report.xls""");      
            Response.TransmitFile(@path + FileName);
            //Response.TransmitFile(FileName);
        }
Exemplo n.º 14
0
        public ActionResult List(DateTime bDate, DateTime eDate, int codeID = 0, string SearchType = "",string CallingMethod = "Details")
        {
            ViewBag.BeginDate = bDate;
            ViewBag.EndDate = eDate;
            ViewBag.CodeID = codeID;
            ViewBag.SearchType = SearchType;
            ViewBag.AllowEdit = false;
            if (ViewBag.CallingMethod == "Details")
            {
                ViewBag.AllowEdit = true;
            }

            GetData();
            IEnumerable<contribution> ContributionList;
            ViewBag.Title = "";
            ViewBag.DefaultSearch = false;
            if (SearchType == "MemberSearch")
            {
                ContributionList = ContributionRepository.GetContributionByMemberDateRange(codeID, bDate, eDate);
                member member = MemberRepository.GetMemberByID(codeID);

                spouse spouse1 = SpouseRepository.GetSpouseByID1(codeID);
                spouse spouse2 = SpouseRepository.GetSpouseByID2(codeID);

                if (spouse1 != null)
                {
                    ViewBag.Title = string.Format("{0} Contributions ({1} - {2})", spouse1.JointTitheTitle, bDate.ToShortDateString(), eDate.ToShortDateString());
                }
                else if (spouse2 != null)
                {
                    ViewBag.Title = string.Format("{0} Contributions ({1} - {2})", spouse2.JointTitheTitle, bDate.ToShortDateString(), eDate.ToShortDateString());
                }
                else
                {
                    ViewBag.Title = string.Format("{0} Contributions ({1} - {2})", member.FullNameTitle, bDate.ToShortDateString(), eDate.ToShortDateString());
                }
            }
            else if (SearchType == "FundSearch")
            {
                ViewBag.DefaultSearch = true;
                ContributionList = ContributionRepository.GetContributionByCategoryRange(codeID, bDate, eDate);
                constant category = ConstantRepository.GetConstantID(codeID);
                ViewBag.Title = string.Format("{0} Contributions ({1} - {2})", category.Value1, bDate.ToShortDateString(), eDate.ToShortDateString());
            }
            else
            {
                ViewBag.DefaultSearch = true;
                ContributionList = ContributionRepository.GetContributionByDateRange(bDate, eDate);
                ViewBag.Title = string.Format("All Contributions ({0} - {1})", bDate.ToShortDateString(), eDate.ToShortDateString());
            }


            ViewBag.RecordCount = ContributionList.Count();
            foreach (var i in ContributionList)
            {
                i.FundName = ConstantRepository.GetConstantID(i.subCategoryID).Value1;
                i.member = MemberRepository.GetMemberByID(i.memberID);
            }
            decimal sum = ContributionList.Sum(e => e.Amount);
            ViewBag.Heading = string.Format("Total: {0:c}",sum);
            return PartialView(ContributionList);
        }
Exemplo n.º 15
0
        //
        // GET: /Constant/Edit/5

        public ActionResult Edit(int ConstantID)
        {
            constant constant = ConstantRepository.GetConstantID(ConstantID);

            return(PartialView(constant));
        }
Exemplo n.º 16
0
 public bool AddRecord(constant Record)
 {
     myRecords.Add(record);
     return(true);
 }
Exemplo n.º 17
0
 public void DeleteRedord(constant constant)
 {
     myRecords.Remove(record);
     context.constants.Remove(constant);
     context.SaveChanges();
 }
Exemplo n.º 18
0
 public constant GetConstantByCategoryName(string Category, string Name)
 {
     record = myRecords.FirstOrDefault(e => e.Category == Category && e.ConstantName == Name);
     return(record);
 }
Exemplo n.º 19
0
        public void TaxReport2(int memberID, int Year)
        {
            try
            {
                string FileName = string.Format("{0}", "ContributionTaxFile.pdf");
                // var path = Path.Combine(Server.MapPath("~/public_html/ClientFiles"), FileName);
                var  path  = Path.Combine(Server.MapPath("~/App_Data/ClientFiles"), FileName);
                bool exist = System.IO.File.Exists(string.Format("{0}", path));
                if (exist)
                {
                    System.IO.File.Delete(string.Format("{0}", path));
                    //System.IO.File.Delete(@"C:\test.txt");
                }

                member member = MemberRepository.GetMemberByID(memberID);

                Document doc = new Document(iTextSharp.text.PageSize.LETTER, 70, 40, 42, 35);


                PdfWriter wri = PdfWriter.GetInstance(doc, new FileStream(path, FileMode.Create));
                doc.Open();

                //image
                //picture icon = PictureRepository.GetLetterHeadImage();
                //if ((icon != null) || (DisplayLog0 == "Yes"))
                //{
                //    iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(icon.ImageData);
                //    image.ScaleToFit(250f, 250f);
                //    doc.Add(image);
                //}

                //get contribution data
                //ministry ministry =

                string ChurchName           = ConstantRepository.GetConstantByName("Church Name").Value1;
                string ChurchAddress        = ConstantRepository.GetConstantByName("Church Address").Value1;
                string ChurchPhone          = ConstantRepository.GetConstantByName("Church Phone").Value1;
                string DisplayLog0          = ConstantRepository.GetConstantByName("Tax ChurchPicture").Value1;
                string DisplayChurchHeading = ConstantRepository.GetConstantByName("Tax ChurchAddress").Value1;

                constant signature1 = ConstantRepository.GetConstantByName("TaxSignature1");
                constant signature2 = ConstantRepository.GetConstantByName("TaxSignature2");

                Font      fdefault = FontFactory.GetFont("Arial", 18, Font.NORMAL, BaseColor.BLACK);
                Paragraph data;

                //Add space
                string text = @" 

                ";
                data = new Paragraph(string.Format("{0}", text));
                doc.Add(data);

                if (DisplayChurchHeading == "Yes")
                {
                    data = new Paragraph(string.Format("{0}\n", ChurchName), fdefault);
                    doc.Add(data);
                    fdefault = FontFactory.GetFont("Arial", 12, Font.NORMAL, BaseColor.BLACK);
                    data     = new Paragraph(string.Format("{0}\n", ChurchAddress), fdefault);
                    doc.Add(data);
                    data = new Paragraph(string.Format("{0}\n", ChurchPhone), fdefault);
                    doc.Add(data);

                    data = new Paragraph(Environment.NewLine);
                    data.SpacingAfter = 15;
                    doc.Add(data);
                }
                else
                {
                    data = new Paragraph();
                    data.SpacingAfter = 25;
                    doc.Add(data);
                }


                fdefault           = FontFactory.GetFont("Arial", 18, Font.BOLD, BaseColor.BLACK);
                data               = new Paragraph(Year.ToString() + " Member Contribution Tax Statement", fdefault);
                data.SpacingBefore = 35;
                doc.Add(data);

                data = new Paragraph(Environment.NewLine);
                data.SpacingAfter = 15;
                doc.Add(data);



                string memberTitle = SpouseRepository.JointTitheTitle(memberID);
                data = new Paragraph(string.Format("Dear {0},", memberTitle));
                data.SpacingAfter = 3;
                doc.Add(data);

                text              = @"Thanks for your financial support to the " + ChurchName + ". The Pastor and leaders of the church truly appreciate your contributions and pray the Lord bless you and keep You. Amen.";
                fdefault          = FontFactory.GetFont("Arial", 14, Font.NORMAL, BaseColor.BLACK);
                data              = new Paragraph(string.Format("{0}", text, fdefault));
                data.SpacingAfter = 25;
                doc.Add(data);

                data = new Paragraph(Environment.NewLine);
                doc.Add(data);

                int      ContributionYear = Year; // DateTime.Today.Year;
                DateTime BeginDate        = Convert.ToDateTime("1/1/" + ContributionYear.ToString());
                DateTime EndDate          = Convert.ToDateTime("12/31/" + ContributionYear.ToString());
                int      thiteID          = ConstantRepository.GetConstantByName("Tithes").constantID;
                int      offeringID       = ConstantRepository.GetConstantByName("Offering").constantID;

                decimal TithesTotal       = ContributionRepository.GetContributionByMemberCategoryRange(memberID, thiteID, BeginDate, EndDate).Sum(e => e.Amount);
                decimal OfferingTotal     = ContributionRepository.GetContributionByMemberCategoryRange(memberID, offeringID, BeginDate, EndDate).Sum(e => e.Amount);
                decimal Totalcontribution = ContributionRepository.GetContributionByMemberDateRange(memberID, BeginDate, EndDate).Sum(e => e.Amount);
                decimal OthersTotal       = Totalcontribution - TithesTotal - OfferingTotal;

                Font fdefault2 = FontFactory.GetFont("Arial", 18, Font.BOLD, BaseColor.BLACK);
                data = new Paragraph(string.Format("Tithes: {0:c}", TithesTotal, fdefault2));
                doc.Add(data);



                data = new Paragraph(string.Format("Offerings: {0:c}", OfferingTotal, fdefault2));
                doc.Add(data);

                data = new Paragraph(string.Format("Others: {0:c}", OthersTotal, fdefault2));
                doc.Add(data);

                data = new Paragraph(string.Format("--------------------------------------------"));
                doc.Add(data);

                data = new Paragraph(string.Format("Total: {0:c}", Totalcontribution, fdefault2));
                doc.Add(data);

                data = new Paragraph(Environment.NewLine);
                doc.Add(data);

                //Add space
                text = @" 
                ";
                data = new Paragraph(string.Format("{0}", text));
                doc.Add(data);


                data.SpacingBefore = 25;
                data = new Paragraph(string.Format("--------------------------------------------"));
                doc.Add(data);

                if (signature1.Value1 != "")
                {
                    fdefault = FontFactory.GetFont("Arial", 10, Font.ITALIC, BaseColor.RED);
                    data     = new Paragraph(string.Format("Signed: {0} ({1})", signature1.Value2, signature1.Value1, fdefault2));
                    doc.Add(data);
                }

                data.SpacingBefore = 5;
                data = new Paragraph(Environment.NewLine);
                doc.Add(data);

                //Add space
                text = @" 
                ";
                data = new Paragraph(string.Format("{0}", text));
                doc.Add(data);

                if (signature2.Value1 != "")
                {
                    fdefault = FontFactory.GetFont("Arial", 10, Font.ITALIC, BaseColor.RED);
                    data     = new Paragraph(string.Format("--------------------------------------------"));
                    doc.Add(data);
                    data = new Paragraph(string.Format("Signed: {0} ({1})", signature2.Value2, signature2.Value1, fdefault2));
                    doc.Add(data);
                }

                doc.Close();

                //document doc = DocumentRepository.GetDocumentByID(DocumentID);
                //string path = AppDomain.CurrentDomain.BaseDirectory + "App_Data/ClientFiles/";

                path = AppDomain.CurrentDomain.BaseDirectory + "App_Data/ClientFiles/";
                // path = AppDomain.CurrentDomain.BaseDirectory + "public_html/ClientFiles/";
                Response.ContentType = "application/pdf";

                Response.AddHeader("Content-Disposition", @"filename=""IT Report.xls""");
                Response.TransmitFile(@path + FileName);
                //Response.TransmitFile(FileName);
            }
            catch (Exception ex)
            {
                TempData["Message2"] = string.Format("Error printing tax report.");
            }
        }
Exemplo n.º 20
0
        public IEnumerable <ministry> GetMyDefaultMinistries(int memberID)
        {
            List <ministry> ministryList = new List <ministry>();
            var             member       = context.members.FirstOrDefault(e => e.memberID == memberID);
            double          age          = DateTime.Now.Date.Subtract(member.DOB).TotalDays / 365;


            IEnumerable <ministry> allMinistries = myRecords.Where(e => e.DefaultMemberType != null && e.Status == "Active");

            using (churchdatabaseEntities context2 = new churchdatabaseEntities())
            {
                foreach (ministry m in allMinistries)
                {
                    if (m.DefaultMemberType == "Children")
                    {
                        constant c    = context2.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Children");
                        int      age1 = Convert.ToInt16(c.Value2);
                        int      age2 = Convert.ToInt16(c.Value3);
                        if ((age >= age1) && (age <= age2))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "Youths")
                    {
                        constant c    = context2.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Youths");
                        int      age1 = Convert.ToInt16(c.Value2);
                        int      age2 = Convert.ToInt16(c.Value3);
                        if ((age >= age1) && (age <= age2))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "Young Adults")
                    {
                        constant c    = context2.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Young Adults");
                        int      age1 = Convert.ToInt16(c.Value2);
                        int      age2 = Convert.ToInt16(c.Value3);
                        if ((age >= age1) && (age <= age2))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "Adults")
                    {
                        constant c    = context2.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Adults");
                        int      age1 = Convert.ToInt16(c.Value2);
                        int      age2 = Convert.ToInt16(c.Value3);
                        if ((age >= age1) && (age <= age2))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "Men")
                    {
                        constant c    = context2.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Men");
                        int      age1 = Convert.ToInt16(c.Value2);
                        if ((age >= age1) && (member.Gender == "Male"))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "Women")
                    {
                        constant c    = context2.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Women");
                        int      age1 = Convert.ToInt16(c.Value2);
                        if ((age >= age1) && (member.Gender == "Female"))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "Seniors")
                    {
                        constant c    = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Seniors");
                        int      age1 = Convert.ToInt16(c.Value2);
                        int      age2 = Convert.ToInt16(c.Value3);
                        if ((age >= age1) && (age >= age2))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "All Members")
                    {
                        constant c    = context2.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "All Members");
                        int      age1 = Convert.ToInt16(c.Value2);
                        int      age2 = Convert.ToInt16(c.Value3);
                        if ((age >= age1) && (age <= age2))
                        {
                            ministryList.Add(m);
                        }
                    }
                    else if (m.DefaultMemberType == "Married Couples")
                    {
                        using (churchdatabaseEntities context3 = new churchdatabaseEntities())
                        {
                            var spouse = context3.spouses.FirstOrDefault(e => e.spouse1ID == memberID);
                            if (spouse != null)
                            {
                                ministryList.Add(m);
                            }

                            spouse = context3.spouses.FirstOrDefault(e => e.spouse2ID == memberID);
                            if (spouse != null)
                            {
                                ministryList.Add(m);
                            }
                        }
                    }
                    else
                    {
                    }
                }
            }
            return(ministryList.ToList());
        }
Exemplo n.º 21
0
        public Dictionary <int, string> GetMinistryMemberList(int ministryID)
        {
            Dictionary <int, string> MinistryMemberList = new Dictionary <int, string>();
            ministry ministry   = context.ministries.SingleOrDefault(e => e.ministryID == ministryID);
            var      memberlist = context.members.Where(e => e.Status == "Active");

            if (ministry.CodeDesc == "Church")
            {
                memberlist = context.members.Where(e => e.Status == "Active");
            }
            else if (ministry.CodeDesc == "Babies")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Babies");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                int      upperYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = context.members.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (ministry.CodeDesc == "Children")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Children");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      upperYear      = year - lowerAgeYear;
                int      lowerYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = context.members.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (ministry.CodeDesc == "Youth")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Youths");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      upperYear      = year - lowerAgeYear;
                int      lowerYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = context.members.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (ministry.CodeDesc == "Men")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Men");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                memberlist = context.members.Where(e => e.Status == "Active" && e.Gender == "Male" && e.DOB >= BeginDate);
            }
            else if (ministry.CodeDesc == "Women")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Women");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                memberlist = context.members.Where(e => e.Status == "Active" && e.Gender == "Female" && e.DOB >= BeginDate);
            }
            else if (ministry.CodeDesc == "Seniors")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Seniors");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                memberlist = context.members.Where(e => e.Status == "Active" && e.DOB >= BeginDate);
            }
            else if (ministry.CodeDesc == "Marriage")
            {
                var spouse1Group = from g in context.members.Where(e => e.Status == "Active")
                                   join c in context.spouses
                                   on g.memberID equals c.spouse1ID
                                   select g;

                var spouse2Group = from g in context.members.Where(e => e.Status == "Active")
                                   join c in context.spouses
                                   on g.memberID equals c.spouse2ID
                                   select g;

                memberlist = spouse1Group.Concat(spouse2Group);
            }
            else if (ministry.CodeDesc == "Singles")
            {
                ministryID = context.ministries.SingleOrDefault(e => e.CodeDesc == "Singles").ministryID;
                memberlist = from g in context.members.Where(e => e.Status == "Active")
                             join c in context.ministrymembers.Where(e => e.ministryID == ministryID)
                             on g.memberID equals c.memberID
                             //where c.ministryID == ministryID
                             select g;
            }
            else
            {
                memberlist = from g in context.members.Where(e => e.Status == "Active")
                             join c in context.ministrymembers.Where(e => e.ministryID == ministryID)
                             on g.memberID equals c.memberID
                             //where c.ministryID == ministryID
                             select g;
            }
            if (memberlist.Count() == 0)
            {
                return(MinistryMemberList);
            }

            MinistryMemberList = memberlist
                                 .OrderBy(e => (string)e.FirstName)
                                 .ToDictionary(e => (int)e.memberID, e => (string)string.Format("{0} {1}", e.FirstName, e.LastName));

            return(MinistryMemberList);
        }
Exemplo n.º 22
0
        public IEnumerable <member> GetMemberListCategory(string MemberGroup)
        {
            var memberlist = myRecords.Where(e => e.Status == "Active");

            if (MemberGroup == "Babies")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Babies");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                int      upperYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = myRecords.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (MemberGroup == "Children")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Children");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      upperYear      = year - lowerAgeYear;
                int      lowerYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = myRecords.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (MemberGroup == "Youth")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Youths");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      upperYear      = year - lowerAgeYear;
                int      lowerYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = myRecords.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (MemberGroup == "Young Adults")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Young Adults");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      upperYear      = year - lowerAgeYear;
                int      lowerYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = myRecords.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (MemberGroup == "Adults")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Adults");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      upperYear      = year - lowerAgeYear;
                int      lowerYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                memberlist = myRecords.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);
            }
            else if (MemberGroup == "Men")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Men");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                memberlist = myRecords.Where(e => e.Status == "Active" && e.Gender == "Male" && e.DOB <= BeginDate);
            }
            else if (MemberGroup == "Women")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Women");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                memberlist = myRecords.Where(e => e.Status == "Active" && e.Gender == "Female" && e.DOB <= BeginDate);
            }
            else if (MemberGroup == "Seniors")
            {
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Seniors");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      year           = System.DateTime.Today.Year;
                int      lowerYear      = year - lowerAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                memberlist = myRecords.Where(e => e.Status == "Active" && e.DOB <= BeginDate);
            }
            else if (MemberGroup == "Marriage")
            {
                var spouse = from g in context.members.Where(e => e.Status == "Active")
                             join c in context.spouses
                             on g.memberID equals c.spouse1ID
                             select g;

                memberlist = spouse;
            }
            else if (MemberGroup == "Singles")
            {
                //get all adults
                constant Membercategory = context.constants.SingleOrDefault(e => e.Category == "Member Category" && e.ConstantName == "Adults");
                int      lowerAgeYear   = Convert.ToInt16(Membercategory.Value2);
                int      upperAgeYear   = Convert.ToInt16(Membercategory.Value3);
                int      year           = System.DateTime.Today.Year;
                int      upperYear      = year - lowerAgeYear;
                int      lowerYear      = year - upperAgeYear;
                DateTime aDate          = System.DateTime.Today;
                DateTime BeginDate      = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + lowerYear.ToString());
                DateTime EndDate        = Convert.ToDateTime(aDate.Month + "/" + aDate.Day + "/" + upperYear.ToString());

                var All_memberlist = myRecords.Where(e => e.Status == "Active" && e.DOB >= BeginDate && e.DOB <= EndDate);

                //get all married couples
                var spouse = from g in context.members.Where(e => e.Status == "Active")
                             join c in context.spouses
                             on g.memberID equals c.spouse1ID
                             select g;

                var Married_memberlist1 = spouse;

                var spouse2 = from g in context.members.Where(e => e.Status == "Active")
                              join c in context.spouses
                              on g.memberID equals c.spouse2ID
                              select g;

                var Married_memberlist2 = spouse2;
                //remove married couples from adult list
                var excludeIds  = new HashSet <int>(Married_memberlist1.Select(x => x.memberID));
                var excludeIds2 = new HashSet <int>(Married_memberlist2.Select(x => x.memberID));

                var MemberPartialList  = All_memberlist.Where(x => !excludeIds.Contains(x.memberID)).ToList();
                var MemberPartialList2 = MemberPartialList.Where(x => !excludeIds2.Contains(x.memberID)).ToList();

                memberlist = MemberPartialList2.Distinct();
            }
            else
            {
                memberlist = myRecords.Where(e => e.Status == "Active");
            }
            return(memberlist);
        }