Esempio n. 1
0
 private void Principal_Load(object sender, EventArgs e)
 {
     lblName.Text     = SUsers.getInstance().Name;
     lblLastName.Text = SUsers.getInstance().LastName;
     lblRole.Text     = SUsers.getRole();
     if (SUsers.getRole() != "Admin")
     {
         btnCreateUser.Visible = false;
         btnRole.Visible       = false;
     }
     if (SUsers.getBank() == null)
     {
         gbBank.Visible    = false;
         btnFixedT.Visible = false;
     }
     else
     {
         btnAddBank.Visible = false;
         gbBank.Visible     = true;
         btnFixedT.Visible  = true;
         gbBank.Text        = SUsers.getInstance().Bank.Type;
         lblCode.Text       = SUsers.getBank().Code;
         lblMount.Text      = SUsers.getBank().Mount.ToString();
     }
 }
Esempio n. 2
0
        private void btnDeposit_Click(object sender, EventArgs e)
        {
            string amount = Interaction.InputBox("please, insert the amount what you could deposit.", "do a deposit");
            Users  user   = SUsers.getInstance();

            user.Bank.deposit(Convert.ToDouble(amount));
            cBank.updateBank(user.Bank);
            MessageBox.Show("cash added!!!", "successful operation");
            Principal_Load(sender, e);
        }
Esempio n. 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CheckUserID();
                if (hddnMatch.Value == "True")
                {
                    ShowPopUpMsg("UserID already exist \n Please change userID");
                    return;
                }

                if (txtEmail.Text.Trim() == "")
                {
                    ShowPopUpMsg("EmailID Can't Blank");
                    return;
                }

                if (txtPassWord.Text.Trim() != txtConfirmPass.Text.Trim())
                {
                    ShowPopUpMsg("Password and Confirm Password Different \n Please Type Same Pasword");
                    return;
                }

                SUsers ud = new SUsers();
                ud.firstName     = txtUserFName.Text.Trim();
                ud.lastName      = txtUserLName.Text.Trim();
                ud.userName      = txtUserId.Text.Trim();
                ud.emailID       = txtEmail.Text.Trim();
                ud.contactNo     = txtMobile.Text.Trim();
                ud.distributorID = Convert.ToInt32(ddlDistributor.SelectedValue);
                ud.roleID        = 0;
                ud.pwd           = Encryption.Encrypt(txtPassWord.Text.Trim());
                ud.activeFrom    = Convert.ToDateTime(txtActiveFrom.Text.Trim());
                ud.activeTo      = Convert.ToDateTime(txtActiveTo.Text.Trim());
                ud.isActive      = CheckBox1.Checked;

                int LoginId = Convert.ToInt32(Session["LoginId"]);
                int a       = svc.AddUserService(ud, LoginId);
                if (a > 0)
                {
                    string LoginUrl = "http://" + HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath + "/Login.aspx";
                    SendMail(txtEmail.Text.Trim(), "Login Detail", txtUserFName.Text.Trim() + " " + txtUserLName.Text.Trim(), txtUserId.Text.Trim(), txtPassWord.Text.Trim(), LoginUrl);
                    ShowPopUpMsg("User Added Successfuly");
                    ResetControl(1);
                }
                else
                {
                    ShowPopUpMsg("User Added Unsuccessfuly" + "\n" + "Please Try Again");
                }
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 4
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (users.confirmLogin(txtUser.Text, txtPass.Text))
     {
         Users user = users.getUserByName(txtUser.Text);
         user.Bank = cbank.getBankByUser(user.User);
         SUsers.setInstance(user);
         Principal principal = new Principal();
         Hide();
         principal.ShowDialog();
     }
     else
     {
         MessageBox.Show("there is no user with this password or user", "there is an error:");
     }
 }
Esempio n. 5
0
        private void btnTransfer_Click(object sender, EventArgs e)
        {
            CUsers cuser    = new CUsers();
            string userstng = Interaction.InputBox("please, insert the user's code that you want to transfer.", "insert code:");
            double amount   = Convert.ToDouble(Interaction.InputBox("please, insert the amount that you want to transfer.", "insert amount:"));

            if (userstng != null & amount != 0)
            {
                Users receptor = cuser.getUserByCode(userstng);
                Users emisor   = SUsers.getInstance();
                cuser.transfer(emisor, receptor, amount);
                Menu_Load(sender, e);
            }
            else
            {
                MessageBox.Show("please, insert a code count or amount to process", "there is an error:");
            }
        }
Esempio n. 6
0
        private void btnExtraction_Click(object sender, EventArgs e)
        {
            string amount;

            if (SUsers.getBank().Type == "VIP")
            {
                amount = Interaction.InputBox("please, insert the amount what you could extract", "do an extract");
            }
            else
            {
                amount = Interaction.InputBox("please, insert the amount what you could extract, you have a 20% of surcharge.", "do an extract");
            }

            Users user = SUsers.getInstance();

            user.Bank.extract(Convert.ToDouble(amount));
            cBank.updateBank(user.Bank);
            MessageBox.Show("cash extracted!!!", "successful operation");
            Menu_Load(sender, e);
        }