예제 #1
0
        public AddSchedule()
        {
            InitializeComponent();
            dtpDateStart.Value = DateTime.Now.Date;
            dtpDateEnd.Value   = DateTime.Now.Date;

            dtpTimeStart.Value = DateTime.Now;
            dtpTimeEnd.Value   = DateTime.Now;

            Draggable drag = new Draggable(this);

            drag.makeDraggable(panelControl);

            DataTable dt = dh.getMinisters(MinisterStatus.Active);

            cmbMinister.Items.Add(string.Empty);//Added empty item to cmbMinister
            foreach (DataRow r in dt.Rows)
            {
                ComboboxContent cc = new ComboboxContent(int.Parse(r["ministerID"].ToString()), r["name"].ToString());
                cmbMinister.Items.Add(cc);
            }

            cmbScheduleType.SelectedIndex = 0;
            cmbMinister.SelectedIndex     = 0;
        }
예제 #2
0
        private void loadMinisters()
        {
            DataTable dt = dh.getMinisters(MinisterStatus.Active);

            ComboboxContent empty = new ComboboxContent(-1, "");

            cmbMinister.Items.Add(empty);

            foreach (DataRow r in dt.Rows)
            {
                ComboboxContent cc = new ComboboxContent(int.Parse(r["ministerID"].ToString()), r["name"].ToString());
                cmbMinister.Items.Add(cc);
            }

            if (operation == OperationType.Edit)
            {
                int index      = 0;
                int ministerID = Convert.ToInt32(row["ministerID"].ToString());
                //MessageBox.Show(string.Format("MinisterID is {0}: ", sacramentMinisterID.ToString()));
                foreach (ComboboxContent cc in cmbMinister.Items)
                {
                    //Console.WriteLine(string.Format("cc.id == sacramentMinisterID - {0} == {1}; Index is {2}", cc.id, sacramentMinisterID, index));
                    if (cc != null && cc.id == ministerID)
                    {
                        cmbMinister.SelectedIndex = index;

                        break;
                    }
                    index++;
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Loads ministers into a combobox
        /// </summary>
        private void loadMinisters()
        {
            DataTable dt;

            if (type == SacramentType.Confirmation)
            {//Only Archbishop and Mosignor can perform confirmation
                dt = dh.getMinisters(MinistryType.Archbishop, MinisterStatus.Active);
                DataTable dt2 = dh.getMinisters(MinistryType.Mosignor, MinisterStatus.Active);
                dt.Merge(dt2);
            }
            else
            {//All ministers can perform baptism
                dt = dh.getMinisters(MinisterStatus.Active);
            }

            ComboboxContent empty = new ComboboxContent(-1, "");

            MinisterCBox.Items.Add(empty); //First item of ministerCBox is empty
            foreach (DataRow r in dt.Rows)
            {
                int             ministerID = int.Parse(r["ministerID"].ToString());
                ComboboxContent cc         = new ComboboxContent(ministerID, r["name"].ToString());
                //MessageBox.Show("Minister = " + r["name"].ToString());
                MinisterCBox.Items.Add(cc);
            }

            MinisterCBox.SelectedIndex = 0;

            //If Operation is Edit, then load sacrament minister
            if (operation == OperationType.Edit)
            {
                int sacramentMinisterID = Convert.ToInt32(row["ministerID"].ToString());

                int index = 0;
                //MessageBox.Show(string.Format("MinisterID is {0}: ", sacramentMinisterID.ToString()));
                foreach (ComboboxContent cc in MinisterCBox.Items)
                {
                    //Console.WriteLine(string.Format("cc.id == sacramentMinisterID - {0} == {1}; Index is {2}", cc.id, sacramentMinisterID, index));
                    if (cc != null && cc.id == sacramentMinisterID)
                    {
                        MinisterCBox.SelectedIndex = index;

                        break;
                    }
                    index++;
                }
            }
        }
예제 #4
0
        public AdvanceSearch(SacramentType t)
        {
            InitializeComponent();
            DataTable dt = dh.getMinisters();

            this.t = t;

            Draggable drag = new Draggable(this);

            drag.makeDraggable(panel2);

            foreach (DataRow dr in dt.Rows)
            {
                ComboboxContent cc = new ComboboxContent(int.Parse(dr["ministerID"].ToString()), dr["name"].ToString());
                cmbMinister.Items.Add(cc);
            }
        }
예제 #5
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string name = txtName.Text.Trim();


            if (t == SacramentType.Marriage)
            {
                this.filter = string.Format(@"(groomName LIKE '%{0}%' OR brideName LIKE '%{0}%') AND ", name);
                if (cbBetweenDates.Checked)
                {
                    this.filter += string.Format("AND marriageDate >= '{0}' AND marriageDate <= '{1}'", dtpFrom.Value.ToString("yyyy-MM-dd"), dtpTo.Value.ToString("yyyy-MM-dd"));
                }
            }
            else if (t == SacramentType.Baptism)
            {
                //MessageBox.Show(string.Format("{0}, {1}, {2}", registry, page, record));
                this.filter = string.Format(@"(firstName LIKE '%{0}%' OR midName LIKE '%{0}%' OR lastName LIKE '%{0}%' OR suffix LIKE '%{0}%') AND ", name);
                if (cbBetweenDates.Checked)
                {
                    this.filter += string.Format("AND baptismDate >= '{0}' AND baptismDate <= '{1}'", dtpFrom.Value.ToString("yyyy-MM-dd"), dtpTo.Value.ToString("yyyy-MM-dd"));
                }
            }
            else
            {
                this.filter = string.Format(@"(firstName LIKE '%{0}%' OR midName LIKE '%{0}%' OR lastName LIKE '%{0}%' OR suffix LIKE '%{0}%') AND ", name);
                if (cbBetweenDates.Checked)
                {
                    this.filter += string.Format("AND confirmationDate >= '{0}' AND confirmationDate <= '{1}'", dtpFrom.Value.ToString("yyyy-MM-dd"), dtpTo.Value.ToString("yyyy-MM-dd"));
                }
            }

            this.filter += getReferenceFilter();

            if (cmbMinister.SelectedIndex != -1)
            {
                ComboboxContent cc       = cmbMinister.SelectedItem as ComboboxContent;
                string          minister = string.Format("AND ministerID = '{0}'", cc.id);
                this.filter += minister;
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
예제 #6
0
        public AddSchedule(ScheduleType t, CalendarEvent ev)
        {
            InitializeComponent();
            this.ev = ev;

            dtpDateStart.Value = ev.item.StartDate;
            dtpDateEnd.Value   = ev.item.EndDate;

            dtpTimeStart.Value = ev.item.StartDate;
            dtpTimeEnd.Value   = ev.item.EndDate;

            cmbScheduleType.SelectedIndex = (int)t;
            cmbScheduleType.Enabled       = false;

            txtTitle.Text   = ev.item.Text;
            txtDetails.Text = ev.details;


            if (t == ScheduleType.Appointment)
            {
                DataTable dt = dh.getMinisters(MinisterStatus.Active);

                foreach (DataRow r in dt.Rows)
                {
                    ComboboxContent cc = new ComboboxContent(int.Parse(r["ministerID"].ToString()), r["name"].ToString());
                    cmbMinister.Items.Add(cc);
                }

                foreach (ComboboxContent c in cmbMinister.Items)
                {
                    if (c.id == ev.ministerID)
                    {
                        cmbMinister.SelectedIndex = cmbMinister.Items.IndexOf(c);
                        break;
                    }
                }
            }
            else if (t == ScheduleType.BloodDonation)
            {
                txtVenue.Text = ev.venue;
            }
        }