Exemplo n.º 1
0
        private void ManageTithes_Load(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            var allTithers = logic.GetAllTithers();

            cboTithers.AutoCompleteSource = AutoCompleteSource.CustomSource;
            var autoCompList = new AutoCompleteStringCollection();

            autoCompList.AddRange(allTithers.Select(x => x.LastName + ", " + x.FirstName + " " + x.MiddleName ?? "").ToArray());
            cboTithers.AutoCompleteCustomSource = autoCompList;
            cboTithers.DisplayMember            = "Text";
            cboTithers.ValueMember = "Id";
            cboTithers.DataSource  = allTithers.Select(x => new ViewModels.ListItem {
                Id = x.TitherId.ToString(), Text = x.LastName + ", " + x.FirstName + " " + x.MiddleName ?? ""
            }).ToList();
            dpEnd.Value = dpEnd.Value.AddDays(1);
        }
Exemplo n.º 2
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            try{
                var allTithers = logic.GetAllTithers();
                foreach (var tither in allTithers)
                {
                    tither.TitheLogs = null;
                }

                var titherFile = Utilities.ExcelExporter.Export(Utilities.ExcelExporter.ConvertToDataTable <TitherPro.Domain.Contexts.Tither>(allTithers, "Tithers"), "Tithers");
                MessageBox.Show("Your file was exported to: " + System.IO.Path.GetFullPath(titherFile));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed To Export To Excel File Error: " + ex.Message);
            }
        }
Exemplo n.º 3
0
 private void gvUsers_CellEndEdit(object sender, DataGridViewCellEventArgs e)
 {
     Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
     var row = gvUsers.Rows[e.RowIndex];
     var isAdmin = false;
     var isActive = false;
     var password = "";
     foreach(DataGridViewCell cell in row.Cells)
     {
         if (cell.State == DataGridViewElementStates.ReadOnly)
             continue;
         if (cell.OwningColumn.Name.ToLower().Contains("password"))
         {
             password = cell.Value.ToString();
         }
         if (cell.OwningColumn.Name.ToLower().Contains("isadmin"))
         {
             isAdmin = (bool)cell.Value;
         }
         if (cell.OwningColumn.Name.ToLower().Contains("active"))
         {
             isActive = (bool)cell.Value;
         }
     }
     var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
     try
     {
         logic.UpdateUser((int)row.Cells[0].Value, password, isAdmin, isActive);
     }
     catch (Exception ex)
     {
         MessageBox.Show("An Error Occurred: " + ex.Message);
     }
 }
Exemplo n.º 4
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
            try{
                var allTithers = logic.GetAllTithers();
                foreach (var tither in allTithers)
                {

                    tither.TitheLogs = null;
                }

                var titherFile = Utilities.ExcelExporter.Export(Utilities.ExcelExporter.ConvertToDataTable<TitherPro.Domain.Contexts.Tither>(allTithers, "Tithers"), "Tithers");
                MessageBox.Show("Your file was exported to: " + System.IO.Path.GetFullPath(titherFile));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed To Export To Excel File Error: " + ex.Message);
            }
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            try
            {
                logic.AddTither(txtFirstName.Text, txtLastName.Text, txtMiddleName.Text);
                gvTithers.DataSource          = logic.GetAllTithers();
                gvTithers.Columns[0].ReadOnly = true;
                gvTithers.Columns[gvTithers.Columns.Count - 1].Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 6
0
 private void BindData()
 {
     var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
     try
     {
         gvTithes.DataSource = logic.GetReportDetails(dpStart.Value, dpEnd.Value);
         gvTithes.Columns[0].ReadOnly = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("An Error Occurred: " + ex.Message);
     }
 }
Exemplo n.º 7
0
        private void BindData()
        {
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            try
            {
                gvTithes.DataSource          = logic.GetReportDetails(dpStart.Value, dpEnd.Value);
                gvTithes.Columns[0].ReadOnly = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 8
0
        private void UserManager_Load(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            gvUsers.DataSource          = logic.GetAllUsers();
            gvUsers.Columns[0].ReadOnly = true;
        }
Exemplo n.º 9
0
 private void btnCheckDups_Click(object sender, EventArgs e)
 {
     Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
     var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
     try
     {
         gvTithers.DataSource = logic.RecommendTithers(txtFirstName.Text, txtLastName.Text);
         gvTithers.Columns[0].ReadOnly = true;
         gvTithers.Columns[gvTithers.Columns.Count - 1].Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("An Error Occurred: " + ex.Message);
         return;
     }
 }
Exemplo n.º 10
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(System.Configuration.ConfigurationManager.ConnectionStrings[Woodensoft.Tither.Utilities.Constants.DbName].ConnectionString);

            try
            {
                var report = logic.GetReport(dpBegin.Value, dpEnd.Value);
                if (report == null)
                {
                    return;
                }
                lblTotalTithes.Text = report.TotalTithes.ToString();
                lblMostTithed.Text  = report.MaxTithe.ToString();
                lblLeastTithed.Text = report.MinTithe.ToString();
                var sb = new StringBuilder();
                if (report.MinTither != null)
                {
                    var tither = report.MinTither;
                    {
                        sb.Append(tither.LastName + "," + tither.FirstName + " " + tither.MiddleName ?? "" + Environment.NewLine);
                    }
                }
                lblLeastTithers.Text = sb.ToString();
                sb.Clear();
                if (report.MaxTither != null)
                {
                    var tither = report.MaxTither;
                    {
                        sb.Append(tither.LastName + "," + tither.FirstName + " " + tither.MiddleName ?? "" + Environment.NewLine);
                    }
                }
                lblBigTithers.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 11
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(System.Configuration.ConfigurationManager.ConnectionStrings[Woodensoft.Tither.Utilities.Constants.DbName].ConnectionString);
            try
            {
                var report = logic.GetReport(dpBegin.Value, dpEnd.Value);
                if (report == null)
                    return;
                lblTotalTithes.Text = report.TotalTithes.ToString();
                lblMostTithed.Text = report.MaxTithe.ToString();
                lblLeastTithed.Text = report.MinTithe.ToString();
                var sb = new StringBuilder();
                if (report.MinTither != null)
                {
                    var tither = report.MinTither;
                    {
                        sb.Append(tither.LastName + "," + tither.FirstName + " " + tither.MiddleName ?? "" + Environment.NewLine);
                    }
                }
                lblLeastTithers.Text = sb.ToString();
                sb.Clear();
                if (report.MaxTither != null)
                {
                    var tither = report.MaxTither;
                    {
                        sb.Append(tither.LastName + "," + tither.FirstName + " " + tither.MiddleName ?? "" + Environment.NewLine);
                    }
                }
                lblBigTithers.Text = sb.ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 12
0
        private void gvTithes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            if (e.ColumnIndex == gvTithes.ColumnCount - 1)
            {
                logic.DeleteTithe((long)gvTithes.Rows[e.RowIndex].Cells[0].Value);
            }
            gvTithes.DataSource = logic.GetAllTitherLogs(dpStart.Value, dpEnd.Value);
        }
Exemplo n.º 13
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
            try
            {
                gvTithers.DataSource = logic.GetAllTithers();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 14
0
        private void gvUsers_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            var row      = gvUsers.Rows[e.RowIndex];
            var isAdmin  = false;
            var isActive = false;
            var password = "";

            foreach (DataGridViewCell cell in row.Cells)
            {
                if (cell.State == DataGridViewElementStates.ReadOnly)
                {
                    continue;
                }
                if (cell.OwningColumn.Name.ToLower().Contains("password"))
                {
                    password = cell.Value.ToString();
                }
                if (cell.OwningColumn.Name.ToLower().Contains("isadmin"))
                {
                    isAdmin = (bool)cell.Value;
                }
                if (cell.OwningColumn.Name.ToLower().Contains("active"))
                {
                    isActive = (bool)cell.Value;
                }
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            try
            {
                logic.UpdateUser((int)row.Cells[0].Value, password, isAdmin, isActive);
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 15
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(System.Configuration.ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
            try
            {
                var reportDetails = logic.GetReportDetails(dtStart.Value, dpEnd.Value);
                gvReportDetails.DataSource = reportDetails;
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 16
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(System.Configuration.ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            try
            {
                var reportDetails = logic.GetReportDetails(dtStart.Value, dpEnd.Value);
                gvReportDetails.DataSource = reportDetails;
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 17
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            try
            {
                logic.AddUser(txtUser.Text, txtPass.Text, cbxAdmin.Checked);
                gvUsers.DataSource = logic.GetAllUsers();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
            }
        }
Exemplo n.º 18
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var     logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
            decimal amount;

            if (!decimal.TryParse(txtAmount.Text, out amount))
            {
                MessageBox.Show("Amount is not a valid number!");
                return;
            }
            int titherId;

            if (cboTithers.SelectedValue == null || !int.TryParse(cboTithers.SelectedValue.ToString(), out titherId))
            {
                MessageBox.Show("Error: No Tither Was Selected!");
                return;
            }
            try
            {
                logic.AddTitheLog(dpTitheDate.Value, amount, titherId);
                BindData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
        }
Exemplo n.º 19
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(System.Configuration.ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
            try
            {
                var reportDetails = logic.GetReportDetails(dtStart.Value, dpEnd.Value);
                var fileName = Utilities.ExcelExporter.Export(Utilities.ExcelExporter.ConvertToDataTable<Woodensoft.TitherPro.Domain.Models.TitherReportDetails>(reportDetails, "TithingReport"), "TithingReport");
                MessageBox.Show("Your Excel File Was Created Here: " + System.IO.Path.GetFullPath(fileName));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed To Generate Excel File Error: " + ex.Message);
            }
        }
Exemplo n.º 20
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(System.Configuration.ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            try
            {
                var reportDetails = logic.GetReportDetails(dtStart.Value, dpEnd.Value);
                var fileName      = Utilities.ExcelExporter.Export(Utilities.ExcelExporter.ConvertToDataTable <Woodensoft.TitherPro.Domain.Models.TitherReportDetails>(reportDetails, "TithingReport"), "TithingReport");
                MessageBox.Show("Your Excel File Was Created Here: " + System.IO.Path.GetFullPath(fileName));
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed To Generate Excel File Error: " + ex.Message);
            }
        }
Exemplo n.º 21
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);
            decimal amount;
            if(!decimal.TryParse(txtAmount.Text, out amount))
            {
                MessageBox.Show("Amount is not a valid number!");
                return;
            }
            int titherId;
            if(cboTithers.SelectedValue == null || !int.TryParse(cboTithers.SelectedValue.ToString(), out titherId))
            {
                MessageBox.Show("Error: No Tither Was Selected!");
                return;
            }
            try
            {
                logic.AddTitheLog(dpTitheDate.Value, amount, titherId);
                BindData();
            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
        }
Exemplo n.º 22
0
        private void gvTithes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            if (e.ColumnIndex == gvTithes.ColumnCount - 1)
            {
                logic.DeleteTithe((long)gvTithes.Rows[e.RowIndex].Cells[0].Value);
            }
            gvTithes.DataSource = logic.GetAllTitherLogs(dpStart.Value, dpEnd.Value);
        }
Exemplo n.º 23
0
        private void ManageTithes_Load(object sender, EventArgs e)
        {
            try
            {
                Utilities.SessionValidator.ValidateSession(this, Woodensoft.TitherPro.Core.BusinessLogic.StateManager.Instance.GetUser());

            }
            catch (Exception ex)
            {
                MessageBox.Show("An Error Occurred: " + ex.Message);
                return;
            }
            var logic = new Woodensoft.TitherPro.Core.BusinessLogic.BusinessLogic(ConfigurationManager.ConnectionStrings[Utilities.Constants.DbName].ConnectionString);

            var allTithers = logic.GetAllTithers();
            cboTithers.AutoCompleteSource = AutoCompleteSource.CustomSource;
            var autoCompList = new AutoCompleteStringCollection();
            autoCompList.AddRange(allTithers.Select(x => x.LastName + ", " + x.FirstName + " " + x.MiddleName ?? "").ToArray());
            cboTithers.AutoCompleteCustomSource = autoCompList;
            cboTithers.DisplayMember = "Text";
            cboTithers.ValueMember = "Id";
            cboTithers.DataSource = allTithers.Select(x => new ViewModels.ListItem { Id = x.TitherId.ToString(), Text = x.LastName + ", " + x.FirstName + " " + x.MiddleName ?? "" }).ToList();
            dpEnd.Value = dpEnd.Value.AddDays(1);
        }