Exemplo n.º 1
0
        string ClientID()
        {
            int    iCount = 0;
            string ID;

            db = new DCbankDataContext();
            var Query_ID = db.sp_GetClientIDCount();

            foreach (sp_GetClientIDCountResult count in Query_ID)
            {
                iCount = count.Count.Value;
            }
            iCount++;
            if (iCount.ToString().Length.Equals(1))
            {
                ID = "AC-" + iCount.ToString().PadLeft(4, '0').ToString() + "-" + DateTime.Now.Year.ToString().Substring(2, 2);
            }
            else if (iCount.ToString().Length.Equals(2))
            {
                ID = "AC-" + iCount.ToString().PadLeft(3, '0').ToString() + "-" + DateTime.Now.Year.ToString().Substring(2, 2);
            }
            else
            {
                ID = "AC-" + iCount.ToString().PadLeft(2, '0').ToString() + "-" + DateTime.Now.Year.ToString().Substring(2, 2);
            }
            return(txtAccID.Text = ID);
        }
Exemplo n.º 2
0
        private void btnChangePass_Click(object sender, EventArgs e)
        {
            db = new DCbankDataContext();

            Pass = frmLogin.Password.ToString();
            if (txtusername.Text.Equals("") || txtoldpass.Text.Equals("") || txtnewpass.Text.Equals("") || txtconfirmnewpass.Text.Equals(""))
            {
                lblverifyUser.Text = "Fill up Everything";
            }
            else
            {
                if (Pass != encrypt(txtoldpass.Text))
                {
                    lblverifyUser.Text = "Incorrect Old Password";
                }
                else
                {
                    if (txtnewpass.Text != txtconfirmnewpass.Text)
                    {
                        lblverifyUser.Text = "Your New Password and Confirm New Password is not match";
                    }
                    else
                    {
                        db.sp_changepass(txtusername.Text, encrypt(txtoldpass.Text), encrypt(txtnewpass.Text));
                        DialogResult result = MessageBox.Show("Successfully Update", "Note", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                        if (result == DialogResult.OK)
                        {
                            this.Close();
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void btnForgotPass_Click(object sender, EventArgs e)
        {
            db = new DCbankDataContext();
            if (txtanswer.Text.Equals("") || txtanswer.Text.Equals(""))
            {
                lblAction.Text = "Fill up Everything";
            }
            else
            {
                int counter    = 0;
                var Query_Pass = db.sp_retrieve_user(txtusername.Text, cboQuestion.Text, txtanswer.Text);
                foreach (sp_retrieve_userResult entry in Query_Pass)
                {
                    DialogResult result = MessageBox.Show("Your Password: "******"Successfully retrieved", MessageBoxButtons.OK);
                    if (result == DialogResult.OK)
                    {
                        this.Hide();
                        frmLogin A = new frmLogin();
                        A.Show();
                        FormSlideEffect.Slide(A, FormSlideEffect.Slides.Up);
                    }

                    counter++;
                }
                if (counter.Equals(0))
                {
                    lblAction.Text = "Incorrect Information";
                }
            }
        }
Exemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     db = new DCbankDataContext();
     db.sp_Update_isNotActive(User, "NOT ACTIVE");
     MessageBox.Show("Successfuly Update");
     dataGridView1.DataSource = db.sp_view_teller();
 }
Exemplo n.º 5
0
        public static string GenTransacID(TextBox TransacID)
        {
            int    iiCount = 0;
            string ID      = "";

            db = new DCbankDataContext();
            var query = db.sp_GetTransacIDCount();

            foreach (sp_GetTransacIDCountResult count in query)
            {
                iiCount = count.Count1.Value;
            }
            iiCount++;
            if (iiCount.ToString().Length.Equals(1))
            {
                ID = "T-" + iiCount.ToString().PadLeft(4, '0').ToString() + "-" + DateTime.Now.Year.ToString().Substring(2, 2);
            }
            else if (iiCount.ToString().Length.Equals(2))
            {
                ID = "T-" + iiCount.ToString().PadLeft(3, '0').ToString() + "-" + DateTime.Now.Year.ToString().Substring(2, 2);
            }
            else
            {
                ID = "T-" + iiCount.ToString().PadLeft(2, '0').ToString() + "-" + DateTime.Now.Year.ToString().Substring(2, 2);
            }
            return(TransacID.Text = ID);
        }
Exemplo n.º 6
0
        private void txtusername_TextChanged(object sender, EventArgs e)
        {
            db = new DCbankDataContext();
            var Query_User = db.sp_verifyusername(txtusername.Text);

            foreach (sp_verifyusernameResult entry in Query_User)
            {
                lblverifyUser.Text = "Username is taken";
            }
        }
Exemplo n.º 7
0
        private void frmInquire_Load(object sender, EventArgs e)
        {
            db = new DCbankDataContext();
            var Query_View = db.sp_ViewAccountID();

            foreach (sp_ViewAccountIDResult entry in Query_View)
            {
                string ID = entry.CAccountID.ToString();
                cmbAccount.Items.Add(ID);
            }
        }
Exemplo n.º 8
0
        private void cmbAccount_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            db = new DCbankDataContext();
            var Query_Client = db.sp_view_client(cmbAccount.Text);

            foreach (sp_view_clientResult entry in Query_Client)
            {
                lblBalance.Text = entry.CurrentBalance.Value.ToString();
                lblname.Text    = entry.lname.ToString() + ", " + entry.fname.ToString();
            }
        }
Exemplo n.º 9
0
        public frmRegister()
        {
            InitializeComponent();

            db = new DCbankDataContext();
            var Query_User = db.sp_verifyusername(txtusername.Text);

            foreach (sp_verifyusernameResult entry in Query_User)
            {
                Username = entry.username.ToString();
            }
        }
Exemplo n.º 10
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            db = new DCbankDataContext();
            if (txtuser.Text.Equals("") || txtpass.Text.Equals(""))
            {
                lblAction.Text = "Fill up Everything";
            }
            else
            {
                int count       = 0;
                var Query_Login = db.sp_verifyusernamepass(txtuser.Text, encrypt(txtpass.Text));
                foreach (sp_verifyusernamepassResult entry in Query_Login)
                {
                    if (entry.isactive.Equals("ACTIVE"))
                    {
                        Username   = entry.username.ToString();
                        UserType   = entry.usertype.ToString();
                        NameOfUser = entry.name.ToString();
                        Password   = entry.password.ToString();

                        this.Hide();
                        frmMain M = new frmMain();
                        M.Show();
                    }
                    else
                    {
                        lblAction.Text = "Your Account is not Active";
                    }
                    count++;
                }
                if (count.Equals(0))
                {
                    int count1     = 0;
                    var Query_User = db.sp_verifyusername(txtuser.Text);
                    foreach (sp_verifyusernameResult entry in Query_User)
                    {
                        lblAction.Text = "Incorrect Password";
                        count1++;
                    }
                    if (count1.Equals(0))
                    {
                        lblAction.Text = "Invalid Account";
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void btnWithdraw_Click(object sender, EventArgs e)
        {
            db = new DCbankDataContext();
            if (cmbAccount.Text.Equals("") || txtAmount.Text.Equals(""))
            {
                lblAction.Text = "Fill up Everything";
            }
            else
            {
                if (decimal.Parse(txtAmount.Text) >= min)
                {
                    if (decimal.Parse(txtAmount.Text) <= decimal.Parse(lblBalance.Text))
                    {
                        db = new DCbankDataContext();
                        db.sp_client_withdraw(txtTransacID.Text,
                                              cmbAccount.Text.ToUpper(),
                                              frmLogin.Username,
                                              decimal.Parse(txtAmount.Text),
                                              decimal.Parse(lblBalance.Text) - decimal.Parse(txtAmount.Text),
                                              DateTime.Now.Date);

                        MessageBox.Show("Successfully Deposit", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        frmTransaction.GenTransacID(txtTransacID);
                        cmbAccount.Text = "";
                        txtAmount.Clear();

                        var Query_Client = db.sp_view_client(cmbAccount.Text);
                        foreach (sp_view_clientResult entry in Query_Client)
                        {
                            lblBalance.Text = entry.CurrentBalance.ToString();
                        }
                        lblAction.Visible = false;
                    }
                    else
                    {
                        lblAction.Text = "Insufficient funds.";
                    }
                }
                else
                {
                    lblAction.Text = "Minimum Amount to Withdraw Is 100 Pesos";
                    txtAmount.Clear();
                }
            }
        }
Exemplo n.º 12
0
 private void btnRegister_Click(object sender, EventArgs e)
 {
     db = new DCbankDataContext();
     if (txtname.Text.Equals("") || txtusername.Text.Equals("") || txtpassword.Text.Equals("") || txtconfirmpass.Text.Equals("") || txtanswer.Text.Equals(""))
     {
         lblverifyUser.Text = "Fill up Everything";
     }
     else
     {
         if (txtpassword.Text != txtconfirmpass.Text)
         {
             lblverifyUser.Text = "Your Password and Confirm Password is not match";
         }
         else
         {
             if (txtusername.Text.Equals(Username))
             {
                 lblverifyUser.Text = "Username is taken";
             }
             else
             {
                 db.sp_INSERT_admin(txtusername.Text, txtname.Text, encrypt(txtpassword.Text), cboQuestion.Text, txtanswer.Text);
                 DialogResult result = MessageBox.Show("Back to Main Menu", "Successfully Register", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                 if (result == DialogResult.OK)
                 {
                     this.Close();
                 }
                 else
                 {
                     txtusername.Clear();
                     txtname.Clear();
                     txtpassword.Clear();
                     cboQuestion.Text = "What is your favorite pet?";
                     txtanswer.Clear();
                 }
             }
         }
     }
 }
Exemplo n.º 13
0
 private void btnClient_Click(object sender, EventArgs e)
 {
     db = new DCbankDataContext();
     if (txtfname.Text.Equals("") || txtlname.Text.Equals(""))
     {
         lblstatus.Text = "Fill up Everything";
     }
     else
     {
         db.sp_insert_client(txtAccID.Text, txtfname.Text, txtlname.Text);
         DialogResult result = MessageBox.Show("Back to Main Menu?", "Successfully Add Client", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
         if (result == DialogResult.OK)
         {
             this.Close();
         }
         else
         {
             ClientID();
             txtfname.Clear();
             txtlname.Clear();
         }
     }
 }
Exemplo n.º 14
0
 private void frmViewUser_Load(object sender, EventArgs e)
 {
     db = new DCbankDataContext();
     dataGridView1.DataSource = db.sp_view_teller();
 }
Exemplo n.º 15
0
 private void txtsearchC_TextChanged(object sender, EventArgs e)
 {
     db = new DCbankDataContext();
     dataGridView1.DataSource = db.sp_searchT(txtsearch.Text);
 }
Exemplo n.º 16
0
 private void frmTransaction_Load(object sender, EventArgs e)
 {
     db = new DCbankDataContext();
     dataGridView1.DataSource = db.sp_view_transactions();
 }