Esempio n. 1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (validasiInput())
            {
                string pathFile = "";
                string filename = "";

                if (!String.IsNullOrEmpty(this.path))
                {
                    pathFile = fungsi.returnDestPath(this.path, "profil");
                    filename = Path.GetFileName(pathFile);
                }

                string user = txtUsername.Text, pass = txtPassword.Text, tipe = "User", nama = txtName.Text,
                       alamat = rtbAddress.Text, telp = mtbTelephone.Text.Replace("+62", "0"), gender = cBoxGender.Text, fine = "0";
                koneksiSql koneksi = new koneksiSql();
                if (koneksi.InsertIntoUser(user, pass, tipe, nama, alamat, telp, gender, filename, fine))
                {
                    fungsi.copyKe(path, "profil");
                    this.Close();
                }
                else
                {
                    txtUsername.Focus();
                }
            }
            else
            {
                FormKosong dialog = new FormKosong();
                dialog.loadUC(new UcNotif1(dialog));
                dialog.ShowDialog();
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (validasiInput())
            {
                string pathFile = "";

                if (!String.IsNullOrEmpty(this.path))
                {
                    pathFile = fungsi.returnDestPath(this.path, "profil");
                }

                string user = txtUsername.Text, pass = txtPassword.Text, tipe = cBoxAccountType.Text, nama = txtName.Text,
                       alamat = rtbAddress.Text, telp = mtbTelephone.Text.Replace("+62", "0"), gender = cBoxGender.Text, fine = txtFine.Text;
                if (AddNewAcc)
                {
                    if (koneksi.InsertIntoUser(user, pass, tipe, nama, alamat, telp, gender, Path.GetFileName(pathFile), fine))
                    {
                        fungsi.copyKe(path, "profil");
                        this.Close();
                    }
                    else
                    {
                        txtUsername.Focus();
                    }
                }
                else
                {
                    if (koneksi.UpdateUser(user, pass, tipe, nama, alamat, telp, gender, Path.GetFileName(pathFile), fine))
                    {
                        fungsi.copyKe(path, "profil");
                        checkFromMain();
                    }

                    else
                    {
                        txtUsername.Focus();
                    }
                }
            }
        }