Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the Manage class
 /// </summary>
 public Manage()
 {
     this.InitializeComponent();
     this.InitializeResourceString();
     this.InitializeDropDownList();
     this.InitilizeDataGridViewStyle();
     this.clubMemberService = new ClubMemberService();
     this.ResetRegistration();
     this.ResetSearch();
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the Manage class
 /// </summary>
 public Manage()
 {
     this.InitializeComponent();
     this.InitializeResourceString();
     this.InitializeDropDownList();
     this.InitilizeDataGridViewStyle();
     this.clubMemberService = new ClubMemberService();            
     this.ResetRegistration();
     this.ResetSearch();
 }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the Manage class
        /// </summary>
        public Manage()
        {
            this.InitializeComponent();
            this.InitializeResourceString();
            this.InitializeDropDownList();
            this.InitilizeDataGridViewStyle();
            this.clubMemberService = new ClubMemberService();
            this.ResetRegistration();
            this.ResetSearch();

            //_datePicker.Visible = false;
            //_datePicker.CustomFormat = "dd/MM/yyyy";
            //_datePicker.ValueChanged += _datePicker_ValueChanged;

            this.Menu = mnuMain;
            mnuFile = mnuMain.MenuItems.Add("&File");
            mnuExport = mnuFile.MenuItems.Add("&Export");
            mnuExport.Click += new System.EventHandler(mnuExport_Click);
            mnuSep1 = mnuFile.MenuItems.Add("-");
            mnuExit = mnuFile.MenuItems.Add("&Exit");
            mnuExit.Click += new System.EventHandler(mnuExit_Click);
        }
Exemple #4
0
 public ClubMemberController(IClubMemberService memberRepo)
 {
     _context = memberRepo;
 }
Exemple #5
0
 public ClubController(IClubMemberService memberRepo, IClubService clubRepo)
 {
     _clubRepo   = clubRepo;
     _memberRepo = memberRepo;
 }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the Manage class
        /// </summary>
        public Person(int _memberId, Manage mainForm)
        {
            _manage = mainForm;
            memberId = _memberId;
            this.InitializeComponent();
            this.InitializeResourceString();
            this.InitializeDropDownList();
            this.InitilizeDataGridViewStyle();
            this.clubMemberService = new ClubMemberService();
            this.ResetRegistration();
            this.ResetSearch();

            PersonModel personObject = new PersonModel();
            try
            {
                DataRow dataRow = this.clubMemberService.GetFullClubMemberById(memberId);
                personObject.FirstName = dataRow["FirstName"].ToString();
                personObject.MiddleIntial = dataRow["MI"].ToString();
                personObject.LastName = dataRow["LastName"].ToString();
                personObject.Address = dataRow["Address"].ToString();
                personObject.City = dataRow["City"].ToString();
                personObject.State = dataRow["State"].ToString();
                personObject.Zip = dataRow["Zip"].ToString();
                personObject.PhoneNumber = dataRow["Phone"].ToString();
                personObject.LeaveMessage = Convert.ToBoolean(dataRow["PhoneContactFlag"].ToString());
                personObject.ChurchName = dataRow["ChurchHomeName"].ToString();
                personObject.DateOfBirth = Convert.ToDateTime(dataRow["BirthDate"]);
                personObject.Opinion = dataRow["Opinion"].ToString();
                personObject.ChurchHome = Convert.ToBoolean(dataRow["ChurchHomeFlag"].ToString());
                personObject.ChurchName = dataRow["ChurchHomeName"].ToString();
                personObject.PersonID = Convert.ToInt32(dataRow["PersonID"].ToString());
                personObject.DateUpdated = Convert.ToDateTime(dataRow["DateUpdated"]);
                personObject.ProofGuardianFlag = Convert.ToBoolean(dataRow["ProofGuardianFlag"].ToString());
                //personObject.LockItemsDate = dataRow["LockItemDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(dataRow["LockItemDate"]);
                personObject.LockItemsDate = dataRow["MaxDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(dataRow["MaxDate"]);
                personObject.LockItemsFlag = Convert.ToBoolean(dataRow["LockItemFlag"].ToString());
            }
            catch (Exception ex)
            {
                this.ShowErrorMessage(ex);
            }

            memberId = personObject.PersonID;
            txtFirstName.Text = personObject.FirstName.ToString();
            txtLastName.Text = personObject.LastName.ToString();
            txtMiddleInitial.Text = personObject.MiddleIntial.ToString();
            dtDateOfBirth.Value = Convert.ToDateTime(personObject.DateOfBirth.ToShortDateString());
            txtContactNumber.Text = personObject.PhoneNumber.ToString();
            txtAddress.Text = personObject.Address.ToString();
            txtCity.Text = personObject.City.ToString();
            txtState.Text = personObject.State.ToString();
            txtZip.Text = personObject.Zip.ToString();

            //grab first and last day of previous month
            DateTime today = DateTime.Now;

            int prevMonth = today.AddMonths(-1).Month;
            int year = today.AddMonths(-1).Year;
            int daysInPrevMonth = DateTime.DaysInMonth(year, prevMonth);
            DateTime firstDayPrevMonth = new DateTime(year, prevMonth, 1);
            DateTime lastDayPrevMonth = new DateTime(year, prevMonth, daysInPrevMonth);

            //is maxdate month in today month
            if (personObject.LockItemsDate.HasValue)
            {
                lockItemDate = Convert.ToDateTime(personObject.LockItemsDate.ToString());

                if ((lockItemDate.Month == DateTime.Now.Month) &&
                    (lockItemDate.Year == DateTime.Now.Year))
                {
                    //  Console.WriteLine("{0} {1}", firstDayPrevMonth.ToShortDateString(),
                    //lastDayPrevMonth.ToShortDateString());
                    lockItemFlag = true;
                }

                //var numVisits = this.clubMemberService.GetClubMemberVisits(memberId, lockItemDate.ToShortDateString());
                var numVisits = this.clubMemberService.GetClubMemberVisits(memberId);

                if (numVisits >= 6)
                {
                    lockItemFlag = true;
                }
            }

            //lockItemFlag = personObject.LockItemsFlag;
            //if (!string.IsNullOrEmpty(personObject.LockItemsDate.ToString()))
            //{
            //    lockItemDate = Convert.ToDateTime(personObject.LockItemsDate.ToString());

            //    //var numVisits = this.clubMemberService.GetClubMemberVisits(memberId, lockItemDate.ToShortDateString());
            //    if (numVisits >= 6)
            //    {
            //        lockItemFlag = true;
            //    }

            //    if (!lockItemFlag)
            //    {
            //        var numVisitsInMonth = this.clubMemberService.GetClubMemberVisitsInMonth(memberId, lockItemDate.ToShortDateString());
            //        if (numVisitsInMonth > 0)
            //        {
            //            lockItemFlag = true;
            //        }
            //        else { lockItemFlag = false; }
            //    }

            //    if (numVisits == 0)
            //        lockItemDate = DateTime.Today;

            //    lblNumVisits.Text = numVisits.ToString();
            //}
            //else
            //{
            //    lblNumVisits.Text = "0";
            //}

            rdoChurchHome2.Checked = true;
            if (personObject.ChurchHome)
            {
                rdoChurchHome1.Checked = true;
                rdoChurchHome2.Checked = false;
            }
            txtChurchName.Text = personObject.ChurchName.ToString();
            txtOpinion.Text = personObject.Opinion.ToString() == null ? string.Empty : personObject.Opinion.ToString();
            txtContactNumber.Text = personObject.PhoneNumber.ToString();

            rdoLeaveMessage2.Checked = true;
            if (personObject.LeaveMessage)
            {
                rdoLeaveMessage1.Checked = true;
                rdoLeaveMessage2.Checked = false;
            }

            rdoGuardian2.Checked = true;
            if (personObject.ProofGuardianFlag)
            {
                rdoGuardian1.Checked = true;
                rdoGuardian2.Checked = false;
            }

            DataTable data = this.clubMemberService.GetDependents(memberId);
            this.InitializeUpdate();
            this.LoadDataGridView(data);

            //lblLastVisit.Text = personObject.DateUpdated.ToString();

            //_datePicker.Visible = false;
            //_datePicker.CustomFormat = "dd/MM/yyyy";
            //_datePicker.ValueChanged += _datePicker_ValueChanged;

            //update lockItemFlag
            //if (lockItemFlag)
            //{
            //personObject.LockItemsFlag = lockItemFlag;
            //update flag on database
            this.clubMemberService.UpdateClubMemberLockItemFlag(personObject);
            //}
            //groupBox3.Hide();
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.btnClose_Click);
        }