Ejemplo n.º 1
0
        private void btnClearPic_Click(object sender, EventArgs e)
        {
            string paths = PhotoPath.getPath();

            picMember.Image = Image.FromFile(paths + "\\photos\\profile_img.png");
            photoName       = string.Empty;
        }
Ejemplo n.º 2
0
        private void btnLoadPic_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.InitialDirectory = "C:\\";
            open.Filter           = "Image Files(*.jpg)|*.jpg|All Files(*.*)|*.*";
            open.FilterIndex      = 1;

            if (open.ShowDialog() == DialogResult.OK)
            {
                if (open.CheckFileExists)
                {
                    string paths           = PhotoPath.getPath();
                    string correctFileName = System.IO.Path.GetFileName(open.FileName);
                    string fileSuffix      = DateTime.Now.ToString("dd_MM_yy_hh_mm_ss");
                    try
                    {
                        photoName = "userphoto" + fileSuffix + ".jpg";
                        System.IO.File.Copy(open.FileName, paths + "\\photos\\" + photoName);
                        picMember.Image = Image.FromFile(paths + "\\photos\\" + photoName);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void btnFindMember_Click(object sender, EventArgs e)
        {
            //Build Savings Table with Personal Savings Account Type and other Savings Account Type using the BuildTempSavingsAcctType Class
            BuildTempSavingsAcctType.Create();

            SqlConnection conn     = ConnectDB.GetConnection();
            string        strQuery = "Select MemberID, FileNo, LastName + ' ' + FirstName + ' ' + MiddleName as FullName, Photo from Members " +
                                     "where FileNo='" + txtFileNo.Text.Trim() + "'";
            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = strQuery;

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    memberID = Convert.ToInt16(reader["MemberID"].ToString());

                    lblMemberProfile.Text = reader["FullName"].ToString() + "\n" + reader["FileNo"].ToString();

                    //display member photo
                    string paths = PhotoPath.getPath();
                    //MessageBox.Show(reader["Photo"].ToString());
                    if (reader["Photo"].ToString() != string.Empty)
                    {
                        picMember.Image = Image.FromFile(paths + "\\photos\\" + reader["Photo"].ToString());
                    }
                    else
                    {
                        picMember.Image = Image.FromFile(paths + "\\photos\\profile_img.png");
                    }
                    picMember.Visible        = true;
                    lblMemberProfile.Visible = true;


                    grpBoxSavingsInfo.Enabled = true;
                    loadDataSetSavingsForward();
                    loadDataSetMemberSavings();
                }
                else
                {
                    MessageBox.Show("Sorry, there is no Member with that File No.", "Savings", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
Ejemplo n.º 4
0
        private void btnGetMember_Click(object sender, EventArgs e)
        {
            SqlConnection conn     = ConnectDB.GetConnection();
            string        strQuery = "Select m.MemberID,m.FileNo,m.Title,m.FirstName,m.LastName,m.MiddleName,m.Photo " +
                                     "from Members m where m.FileNo='" + txtFileNo.Text.Trim() + "'";
            SqlCommand cmd = new SqlCommand(strQuery, conn);

            string paths = PhotoPath.getPath();

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    if (reader.Read())
                    {
                        picMember.Visible     = true;
                        lblMemberInfo.Visible = true;
                        lblMemberInfo.Text    = reader["Title"].ToString() + ' ' + reader["LastName"].ToString() + ' ' + reader["FirstName"].ToString() + ' ' + reader["MiddleName"].ToString();
                        if (reader["Photo"].ToString() != string.Empty)
                        {
                            picMember.Image = Image.FromFile(paths + "\\photos\\" + reader["Photo"].ToString());
                        }
                        else
                        {
                            picMember.Image = Image.FromFile(paths + "\\photos\\profile_img.png");
                        }

                        memberID = reader["MemberID"].ToString();
                        //getMember Savings Account Types
                        cboSavingsType.DataSource = null;
                        getMemberSavingsAccountType(memberID);
                        getPreviousWithdrawals();
                    }
                }
                else
                {
                    lblMemberInfo.Text    = string.Empty;
                    picMember.Image       = Image.FromFile(paths + "\\photos\\profile_img.png");
                    picMember.Visible     = false;
                    lblMemberInfo.Visible = false;
                    MessageBox.Show("There is no record with that FileNo.", "Withdrawal", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
Ejemplo n.º 5
0
        private int findMember(string fileNo, SqlConnection conn)
        {
            int        memberID = 0;
            string     strQuery = "Select MemberID, FileNo, Title + ' ' + LastName + ' ' + MiddleName + ' ' + FirstName as FullName, Photo from Members where FileNo='" + fileNo + "'";
            SqlCommand cmd      = new SqlCommand(strQuery, conn);

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                string        paths  = PhotoPath.getPath();
                if (reader.HasRows)
                {
                    if (reader.Read())
                    {
                        memberID = Convert.ToInt16(reader["MemberID"]);
                        MemberProfileInfo.Text = reader["FullName"].ToString() + "\n" + reader["FileNo"].ToString();;
                        if (reader["Photo"].ToString() != string.Empty)
                        {
                            picMember.Image = Image.FromFile(paths + "\\photos\\" + reader["Photo"].ToString());
                        }
                        else
                        {
                            picMember.Image = Image.FromFile(paths + "\\photos\\profile_img.png");
                        }
                        MemberProfileInfo.Visible = true;
                        picMember.Visible         = true;
                        btnSave.Enabled           = true;
                    }
                }
                else
                {
                    picMember.Image           = Image.FromFile(paths + "\\photos\\profile_img.png");
                    picMember.Visible         = false;
                    MemberProfileInfo.Visible = false;
                    btnSave.Enabled           = false;
                    MessageBox.Show("Sorry, that Record is not Found!", "Make Contributions", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(memberID);
        }
Ejemplo n.º 6
0
        private int fetchMemberProfileData(int memberID, string selectedRecordFileNo, SqlConnection conn)
        {
            string strQuery = "Select m.MemberID, m.FileNo, m.Title, m.FirstName, m.MiddleName, m.LastName, m.Gender, m.Address," +
                              "m.LGA, s.State, m.Phone, m.Email, d.DepartmentName, b.BankName, m.AccountNo, m.Photo,m.NOKFullName,m.NOKAddress," +
                              "m.NOKPhone from Members m inner join States s on m.StateID = s.StateID " +
                              "inner join Departments d on m.DepartmentID = d.DepartmentID " +
                              "inner join Banks b on m.BankID = b.BankID " +
                              "where m.FileNo='" + selectedRecordFileNo + "'";
            SqlCommand cmd = new SqlCommand(strQuery, conn);

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    txtFileNo.Text     = reader["FileNo"].ToString();
                    txtTitle.Text      = reader["Title"].ToString();
                    txtFirstName.Text  = reader["FirstName"].ToString();
                    txtMIddleName.Text = reader["MiddleName"].ToString();
                    txtLastName.Text   = reader["LastName"].ToString();
                    txtGender.Text     = (reader["Gender"].ToString() == "M" ? "Male" : "Female");
                    txtAddress.Text    = reader["Address"].ToString();
                    txtLGA.Text        = reader["LGA"].ToString();
                    txtState.Text      = reader["State"].ToString();
                    txtPhone.Text      = reader["Phone"].ToString();
                    txtEmail.Text      = reader["EMail"].ToString();
                    txtDepartment.Text = reader["DepartmentName"].ToString();
                    txtBank.Text       = reader["BankName"].ToString();
                    txtAccountNo.Text  = reader["AccountNo"].ToString();
                    txtNOKName.Text    = reader["NOKFullName"].ToString();
                    txtNOKAddress.Text = reader["NOKAddress"].ToString();
                    txtNOKPhone.Text   = reader["NOKPhone"].ToString();

                    string paths = PhotoPath.getPath();

                    if (reader["Photo"].ToString() != string.Empty)
                    {
                        //Load User picture
                        //string paths = Application.StartupPath.Substring(0, (Application.StartupPath.Length - 9));

                        picMember.Image = Image.FromFile(paths + "\\photos\\" + reader["Photo"].ToString());
                        //MessageBox.Show(paths);
                    }
                    else
                    {
                        picMember.Image = Image.FromFile(paths + "\\photos\\profile_img.png");
                    }

                    memberID = (int)reader["MemberID"];
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(memberID);
        }
Ejemplo n.º 7
0
        private void getSuretyData(string strSender, string memberFileNo)
        {
            string memberProfile = string.Empty;
            string memberID      = string.Empty;
            string memberPic     = string.Empty;
            string paths         = PhotoPath.getPath();

            SqlConnection conn     = ConnectDB.GetConnection();
            string        strQuery = "Select MemberID,FileNo,Title,LastName,MiddleName,FirstName,Photo from Members where FileNo='" + memberFileNo + "'";
            SqlCommand    cmd      = new SqlCommand(strQuery, conn);

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    reader.Read();
                    memberProfile = reader["Title"].ToString() + " " + reader["LastName"].ToString() + " " + reader["FirstName"].ToString() + " " + reader["MiddleName"].ToString();
                    memberID      = reader["MemberID"].ToString();
                    memberPic     = reader["Photo"].ToString();

                    switch (strSender)
                    {
                    case "Surety1":
                        lblSurety1.Visible       = true;
                        picSurety1.Visible       = true;
                        lblSurety1.Text          = "Surety 1\n" + memberProfile;
                        lblSuretyMemberID_1.Text = memberID;
                        if (memberPic != string.Empty)
                        {
                            picSurety1.Image = Image.FromFile(paths + "//photos//" + memberPic.ToString());
                        }
                        break;

                    case "Surety2":
                        lblSurety2.Visible       = true;
                        picSurety2.Visible       = true;
                        lblSurety2.Text          = "Surety 2\n" + memberProfile;
                        lblSuretyMemberID_2.Text = memberID;
                        if (memberPic != string.Empty)
                        {
                            picSurety2.Image = Image.FromFile(paths + "//photos//" + memberPic.ToString());
                        }
                        break;

                    case "Witness":
                        lblWitness.Visible       = true;
                        picWitness.Visible       = true;
                        lblWitness.Text          = "Witness\n" + memberProfile;
                        lblSuretyMemberID_3.Text = memberID;
                        if (memberPic != null || memberPic == string.Empty)
                        {
                            picWitness.Image = Image.FromFile(paths + "//photos//" + memberPic.ToString());
                        }
                        break;
                    }//end of Switch
                }
                else
                {
                    MessageBox.Show("Sorry, there is no member with the File No. [" + memberFileNo + "]", "Loan Application", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    switch (strSender)
                    {
                    case "Surety1":
                        txtSuretyFileNo1.Clear();
                        break;

                    case "Surety2":
                        txtSuretyFileNo2.Clear();
                        break;

                    case "Witness":
                        txtWitnessFileNo.Clear();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }
Ejemplo n.º 8
0
        private void loadMemberRegisteredSavingsType()
        {
            decimal       totalSavings = 0;
            SqlConnection conn         = ConnectDB.GetConnection();
            string        strQuery     = "Select m.MemberID, m.FileNo, m.Title + ' ' + m.LastName + ' ' + m.MiddleName + ' ' +  m.FirstName as [FullName], " +
                                         "m.Photo, m.DateCreated as RegDateCreated, t.SavingsName, s.SavingsAcctID, s.Amount, s.Remark, " +
                                         "s.DateCreated as SavingsDateCreated from Members m left join MemberSavingsTypeAcct s on m.MemberID=s.MemberID " +
                                         "left join SavingsType t on s.SavingsTypeID=t.SavingsTypeID where m.FileNo='" + txtFileNo.Text.Trim() + "'";

            /**
             * string strSharesQuery = "Select m.MemberID, m.FileNo, s.Shares from Members m " +
             *  "inner join Shares s on m.MemberID=s.MemberID where m.FileNo='" + txtFileNo.Text.Trim() + "'";
             **/


            SqlCommand cmd = new SqlCommand(strQuery, conn);

            //SqlCommand cmdShares = new SqlCommand(strSharesQuery, conn);

            try
            {
                conn.Open();

                /****Execute and read shares --- Modification after first Observation meeting with Client
                 * SqlDataReader reader = cmdShares.ExecuteReader();
                 * if (reader.HasRows)
                 * {
                 *  if (reader.Read())
                 *  {
                 *      txtShares.Text = CheckForNumber.formatCurrency(reader["Shares"].ToString());
                 *  }
                 * }
                 * reader.Close();
                 *
                 * ***/
                //Execute and read Regular Savings and other savings

                SqlDataReader reader      = cmd.ExecuteReader();
                int           recordCount = 0;
                lstVSavings.Items.Clear();


                //Check if record is found and start performing operation
                if (reader.HasRows)
                {
                    string paths = PhotoPath.getPath();

                    picMember.Visible            = true;
                    lblMemberProfileInfo.Visible = true;
                    lblRegistrationDate.Visible  = true;

                    #region Read Data from Reader
                    while (reader.Read())
                    {
                        recordCount++;

                        if (recordCount == 1)
                        {
                            //MessageBox.Show("Record Count: " + recordCount.ToString());
                            if (reader["Photo"].ToString() != string.Empty)
                            {
                                picMember.Image = Image.FromFile(paths + "\\photos\\" + reader["Photo"].ToString());
                            }
                            else
                            {
                                picMember.Image = Image.FromFile(paths + "\\photos\\profile_img.png");
                            }
                            lblMemberProfileInfo.Text = reader["FullName"].ToString() + "\n" + reader["FileNo"].ToString();
                            lblRegistrationDate.Text  = "Member since " + string.Format("{0:ddd, MMM d, yyyy}", reader["RegDateCreated"]);
                            myselectedmemberID        = (int)reader["MemberID"];
                        }

                        if (reader["Remark"].ToString() == "Shares Savings")
                        {
                            txtRegularSavings.Text = CheckForNumber.formatCurrency(reader["Amount"].ToString());
                            totalSavings          += Convert.ToDecimal(reader["Amount"]);
                            continue;
                        }

                        string[]     row  = { reader["SavingsAcctID"].ToString(), reader["Remark"].ToString(), CheckForNumber.formatCurrency(reader["Amount"].ToString()), string.Format("{0:ddd, MMM d, yyyy}", reader["SavingsDateCreated"]) };
                        ListViewItem item = new ListViewItem(row);
                        lstVSavings.Items.Add(item);

                        totalSavings += Convert.ToDecimal(reader["Amount"]);
                    }
                    #endregion
                }
                else
                {
                    MessageBox.Show("Sorry, Record with that FileNo is not found", "Members Savings", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                lblRecordNo.Text        = "No. of Records : " + recordCount;
                lblTotalSavings.Text    = "Savings Total: " + CheckForNumber.formatCurrency2(totalSavings.ToString());
                lblTotalSavings.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "-- loadMemberRegisteredSavingsType -- ");
            }
            finally
            {
                conn.Close();
            }
        }
Ejemplo n.º 9
0
        private void btnFindMember_Click(object sender, EventArgs e)
        {
            clearAndSetControls();
            decimal       totalSavings = 0;
            SqlConnection conn         = ConnectDB.GetConnection();

            /** - Modified about First Meeting
             * string strSharesQuery = "Select m.MemberID, m.FileNo, s.SharesID, s.Shares, s.DateCreated from Members m " +
             *  "inner join Shares s on m.MemberID=s.MemberID where m.FileNo='" + txtFileNo.Text.Trim() + "'";
             *
             * **/

            string strQuery = "Select m.MemberID, m.FileNo, m.Title + ' ' + m.LastName + ' ' + m.MiddleName + ' ' +  m.FirstName as [FullName], m.Photo, m.DateCreated as RegDateCreated," +
                              "t.SavingsName, s.SavingsAcctID, s.Amount, s.Remark, s.DateCreated as SavingsDateCreated from Members m left outer join MemberSavingsTypeAcct s on m.MemberID=s.MemberID " +
                              "left outer join SavingsType t on s.SavingsTypeID=t.SavingsTypeID where m.FileNo='" + txtFileNo.Text.Trim() + "'";

            //SqlCommand cmdShares = new SqlCommand(strSharesQuery, conn);
            SqlCommand cmd = new SqlCommand(strQuery, conn);

            try
            {
                conn.Open();
                lstVSavings.Items.Clear();

                /** Modified after first meeting....Shares is type of Savings
                 * SqlDataReader reader = cmdShares.ExecuteReader();
                 * if (reader.HasRows)
                 * {
                 *   if (reader.Read())
                 *   {
                 *       string[] row = { reader["SharesID"].ToString(), "Shares", CheckForNumber.formatCurrency(reader["Shares"].ToString()), string.Format("{0:ddd, MMM d, yyyy}", reader["DateCreated"]) };
                 *       ListViewItem item = new ListViewItem(row);
                 *       lstVSavings.Items.Add(item);
                 *   }
                 * }
                 * reader.Close();
                 * */


                int counter = 0;


                string paths = PhotoPath.getPath();
                //MessageBox.Show(Application.StartupPath.ToString());
                //MessageBox.Show(paths.ToString());
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    picMember.Visible            = true;
                    lblMemberProfileInfo.Visible = true;
                    lblRegistrationDate.Visible  = true;

                    while (reader.Read())
                    {
                        string[]     row  = { reader["SavingsAcctID"].ToString(), reader["Remark"].ToString(), CheckForNumber.formatCurrency(reader["Amount"].ToString()), string.Format("{0:ddd, MMM d, yyyy}", reader["RegDateCreated"]) };
                        ListViewItem item = new ListViewItem(row);
                        lstVSavings.Items.Add(item);

                        counter++;
                        totalSavings += Convert.ToDecimal(reader["Amount"]);
                        if (counter == 1)
                        {
                            if (reader["Photo"].ToString() != string.Empty)
                            {
                                picMember.Image = Image.FromFile(paths + "\\photos\\" + reader["Photo"].ToString());
                            }
                            else
                            {
                                picMember.Image = Image.FromFile(paths + "\\photos\\profile_img.png");
                            }
                            lblMemberProfileInfo.Text = reader["FullName"].ToString() + "\n" + reader["FileNo"].ToString();
                            lblRegistrationDate.Text  = "Member since " + string.Format("{0:ddd, MMM d, yyyy}", reader["RegDateCreated"]);
                            myselectedmemberID        = (int)reader["MemberID"];
                        }
                    }
                }
                else
                {
                    clearAndSetControls();
                    MessageBox.Show("Sorry, Record with File No. [" + txtFileNo.Text + "] is not Found!", "Edit Member Savings", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                lblRecordNo.Text        = "No. of Records: " + counter.ToString();
                lblTotalSavings.Text    = "Savings Total:   " + CheckForNumber.formatCurrency2(totalSavings.ToString());
                lblTotalSavings.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
        }