Beispiel #1
0
        private void materialRaisedButton3_Click(object sender, EventArgs e)
        {
            string       room1      = materialSingleLineTextField6.Text;
            FileStream   ambildata1 = new FileStream("Room.txt", FileMode.Open, FileAccess.Read);
            StreamReader bacadata1  = new StreamReader(ambildata1);
            string       linee      = bacadata1.ReadLine();

            while (linee != null)
            {
                // Console.Clear();
                string[] dataroom = linee.Split('#');
                if (room1 == dataroom[0])
                {
                    dataroom0 = dataroom[0];
                    dataroom1 = dataroom[1];
                    dataroom2 = dataroom[2];
                    dataroom3 = dataroom[3];
                    dataroom4 = dataroom[4];
                    dataroom5 = dataroom[5];
                }
                else
                {
                }
                linee = bacadata1.ReadLine();
            }
            bacadata1.Close();
            ambildata1.Close();
            if (room1 == dataroom0)
            {
                //Load Data
                declaredata();
                if (MessageBox.Show("Are you sure want to delete data?" + " " + dataroom0, "DELETE DATA!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string path         = ("Room.txt");
                    var    oldlinelogin = File.ReadAllLines(path);
                    var    newline      = oldlinelogin.Where(line => !line.Contains(room1 + "#"));
                    File.WriteAllLines(path, newline);
                    MessageBox.Show("Data has been deleted.", "SUCCESS!");
                    this.Hide();
                    var tc = new Technic();
                    tc.Closed += (s, args) => this.Close();
                    tc.Show();
                }
                else
                {
                    this.Hide();
                    var tc = new Technic();
                    tc.Closed += (s, args) => this.Close();
                    tc.Show();
                }
            }
            else
            {
                MessageBox.Show("Data not found, Try again!", "WRONG DATA!");
                materialSingleLineTextField6.Text = "";
                materialSingleLineTextField6.Focus();
            }
        }
Beispiel #2
0
        private void searchenter()
        {
            string       room      = materialSingleLineTextField6.Text;
            FileStream   ambildata = new FileStream("Room.txt", FileMode.Open, FileAccess.Read);
            StreamReader bacadata  = new StreamReader(ambildata);
            string       linee     = bacadata.ReadLine();

            while (linee != null)
            {
                // Console.Clear();
                string[] dataroom = linee.Split('#');
                if (room == dataroom[0])
                {
                    dataroom0 = dataroom[0];
                    dataroom1 = dataroom[1];
                    dataroom2 = dataroom[2];
                    dataroom3 = dataroom[3];
                    dataroom4 = dataroom[4];
                    dataroom5 = dataroom[5];
                }
                else
                {
                }
                linee = bacadata.ReadLine();
            }
            bacadata.Close();
            ambildata.Close();

            if (room == dataroom0)
            {
                materialSingleLineTextField1.Text = dataroom0;
                comboBox1.Text = dataroom1;
                materialSingleLineTextField2.Text = dataroom2;
                materialSingleLineTextField3.Text = dataroom3;
                comboBox2.Text = dataroom4;
                comboBox3.Text = dataroom5;
            }
            else
            {
                MessageBox.Show("Data not found, Try again!", "WRONG DATA!");
                this.Hide();
                var tc = new Technic();
                tc.Closed += (s, args) => this.Close();
                tc.Show();
            }
        }
Beispiel #3
0
        //Login Lewat Button
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            username = materialSingleLineTextField1.Text;
            sandi    = EncryptPassword(materialSingleLineTextField2.Text);

            errorProvider1.Clear();
            if (username.Trim().Length != 0)
            {
                FileStream   fs   = new FileStream("Akun.txt", FileMode.Open, FileAccess.Read);
                StreamReader sr   = new StreamReader(fs);
                string       line = sr.ReadLine();
                string[]     dataakun;
                int          flag = 0;
                while (line != null)
                {
                    dataakun = line.Split('#');
                    if (dataakun[8] == username && dataakun[9] == sandi)
                    {
                        flag                = 1;
                        akunid              = dataakun[0];
                        LoginForm.nama      = dataakun[1];
                        LoginForm.jenisakun = dataakun[11];
                        if (dataakun[10] == "Active")
                        {
                            MessageBox.Show("Welcome," + " " + LoginForm.nama, "LOGIN SUCCESS!");
                            if ("Receptionist" == LoginForm.jenisakun)
                            {
                                this.Hide();
                                var hm = new Home();
                                hm.Closed += (s, args) => this.Close();
                                hm.Show();
                            }
                            if ("Hotel Technicians" == LoginForm.jenisakun)
                            {
                                this.Hide();
                                var tec = new Technic();
                                tec.Closed += (s, args) => this.Close();
                                tec.Show();
                            }
                            if ("Administrator" == LoginForm.jenisakun)
                            {
                                this.Hide();
                                var ad = new Admin();
                                ad.Closed += (s, args) => this.Close();
                                ad.Show();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Account Not Active", "LOGIN FAILED! ");
                            materialSingleLineTextField1.Text = "";
                            materialSingleLineTextField2.Text = "";
                            materialSingleLineTextField1.Focus();
                        }
                    }
                    else
                    {
                    }
                    line = sr.ReadLine();
                }

                sr.Close();
                fs.Close();
                if (flag == 0)
                {
                    MessageBox.Show("Wrong Username or Password", "LOGIN FAILED! ");
                    materialSingleLineTextField1.Text = "";
                    materialSingleLineTextField2.Text = "";
                    materialSingleLineTextField1.Focus();
                }
            }
            else
            {
                errorProvider1.SetError(materialSingleLineTextField1, "Enter your username!");
            }
        }
Beispiel #4
0
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            string       akunid     = materialSingleLineTextField15.Text;
            FileStream   ambildata1 = new FileStream("Akun.txt", FileMode.Open, FileAccess.Read);
            StreamReader bacadata1  = new StreamReader(ambildata1);
            string       linee      = bacadata1.ReadLine();

            while (linee != null)
            {
                // Console.Clear();
                string[] dataakun = linee.Split('#');
                if (akunid == dataakun[0])
                {
                    dataakun0 = dataakun[0];
                    dataakun1 = dataakun[1];
                    dataakun2 = dataakun[2];
                    dataakun3 = dataakun[3];
                    dataakun4 = dataakun[4];
                    dataakun5 = dataakun[5];
                }
                else
                {
                }
                linee = bacadata1.ReadLine();
            }
            bacadata1.Close();
            ambildata1.Close();
            if (akunid == dataakun0)
            {
                string password = materialSingleLineTextField10.Text;

                //validasi email
                string vemail = materialSingleLineTextField12.Text;
                Regex  regex  = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
                Match  match  = regex.Match(vemail);

                //Load Data
                declaredata();

                //Load Encrypt
                string sandi   = Encrypt(materialSingleLineTextField10.Text);
                string jawaban = Encrypt(materialSingleLineTextField9.Text);

                //Membersihkan Error
                errorProvider1.Clear();

                //Check Data Kosong
                if (nama.Trim().Length != 0)
                {
                    if (comboBox9.Text != "- Select Citizenship -")
                    {
                        if (alamat.Trim().Length != 0)
                        {
                            if (hp.Trim().Length != 0)
                            {
                                if (email.Trim().Length != 0)
                                {
                                    if (username.Trim().Length != 0)
                                    {
                                        if (password.Trim().Length != 0)
                                        {
                                            if (comboBox8.Text != "- Select Type -")
                                            {
                                                if (comboBox6.Text != "- Select Question -")
                                                {
                                                    if (jawaban.Trim().Length != 0)
                                                    {
                                                        if (match.Success)
                                                        {
                                                            string old    = dataakun0 + "#" + dataakun1 + "#" + dataakun2 + "#" + dataakun3 + "#" + dataakun4 + "#" + dataakun5 + "#" + dataakun6 + "#" + dataakun7 + "#" + dataakun8 + "#" + dataakun9 + "#" + dataakun10 + "#" + dataakun11 + "#" + dataakun12 + "#" + dataakun13 + "#";
                                                            string neww   = akunid + "#" + nama + "#" + ttl + "#" + gender + "#" + warganegara + "#" + alamat + "#" + hp + "#" + email + "#" + username + "#" + sandi + "#" + status + "#" + type + "#" + quest + "#" + jawaban + "#";
                                                            string update = File.ReadAllText("Akun.txt");
                                                            update = update.Replace(old, neww);
                                                            File.WriteAllText("Akun.txt", update);
                                                            MessageBox.Show("Account has been Updated.", "SUCCESS!");
                                                            if (LoginForm.username == username && type == "Hotel Technicians")
                                                            {
                                                                this.Hide();
                                                                var tc = new Technic();
                                                                tc.Closed += (s, args) => this.Close();
                                                                tc.Show();
                                                            }
                                                            else
                                                            {
                                                                if (LoginForm.username == username && type == "Receptionist")
                                                                {
                                                                    this.Hide();
                                                                    var hm = new Home();
                                                                    hm.Closed += (s, args) => this.Close();
                                                                    hm.Show();
                                                                }
                                                                else
                                                                {
                                                                    this.Hide();
                                                                    var ad = new Admin();
                                                                    ad.Closed += (s, args) => this.Close();
                                                                    ad.Show();
                                                                }
                                                            }
                                                        }
                                                        else
                                                        {
                                                            errorProvider1.SetError(materialSingleLineTextField12, "Please enter valid email!");
                                                        }
                                                    }
                                                    else
                                                    {
                                                        errorProvider1.SetError(materialSingleLineTextField9, "Must be filled!");
                                                    }
                                                }
                                                else
                                                {
                                                    errorProvider1.SetError(comboBox6, "Please select question!");
                                                }
                                            }
                                            else
                                            {
                                                errorProvider1.SetError(comboBox8, "Please select type account!");
                                            }
                                        }
                                        else
                                        {
                                            errorProvider1.SetError(materialSingleLineTextField10, "Must be filled!");
                                        }
                                    }
                                    else
                                    {
                                        errorProvider1.SetError(materialSingleLineTextField11, "Must be filled!");
                                    }
                                }
                                else
                                {
                                    errorProvider1.SetError(materialSingleLineTextField12, "Must be filled!");
                                }
                            }
                            else
                            {
                                errorProvider1.SetError(materialSingleLineTextField13, "Must be filled!");
                            }
                        }
                        else
                        {
                            errorProvider1.SetError(textBox2, "Must be filled!");
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(comboBox9, "Please select citizenship!");
                    }
                }
                else
                {
                    errorProvider1.SetError(materialSingleLineTextField14, "Must be filled!");
                }
            }
            else
            {
                MessageBox.Show("Data not found, Try again!", "WRONG DATA!");
                materialSingleLineTextField24.Text = "";
                materialSingleLineTextField24.Focus();
            }
        }
Beispiel #5
0
        private void materialRaisedButton6_Click(object sender, EventArgs e)
        {
            //Untuk Validasi Room
            FileStream   bd   = new FileStream("Room.txt", FileMode.Open, FileAccess.Read);
            StreamReader bdd  = new StreamReader(bd);
            string       line = bdd.ReadLine();

            string[] dataroom2;
            int      flag = 0;

            while (line != null)
            {
                dataroom2 = line.Split('#');
                if (materialSingleLineTextField1.Text == dataroom2[0])
                {
                    flag = 1;
                }
                else
                {
                }
                line = bdd.ReadLine();
            }
            bdd.Close();
            bd.Close();

            //Load Data
            declaredata();

            //Membersihkan Error
            errorProvider1.Clear();

            //Check Data Kosong
            if (RoomNumber.Trim().Length != 0)
            {
                if (comboBox1.Text != "- Select Room Class -")
                {
                    if (Capacityroom.Trim().Length != 0)
                    {
                        if (Price.Trim().Length != 0)
                        {
                            if (comboBox2.Text != "- Select Room Status -")
                            {
                                if (comboBox3.Text != "- Select Room Condition -")
                                {
                                    if (flag != 1)
                                    {
                                        FileStream   fs       = new FileStream("Room.txt", FileMode.Append, FileAccess.Write);
                                        StreamWriter sw       = new StreamWriter(fs);
                                        string       savedata = RoomNumber + "#" + Roomclass + "#" + Capacityroom + "#" + Price + "#" + Roomstatus + "#" + Roomcondition + "#";
                                        sw.WriteLine(savedata);
                                        sw.Close();
                                        fs.Close();
                                        MessageBox.Show("Data has been added.", "SUCCESS!");
                                        this.Hide();
                                        var tc = new Technic();
                                        tc.Closed += (s, args) => this.Close();
                                        tc.Show();
                                    }
                                    else
                                    {
                                        MessageBox.Show("Sorry room already exists!", "FAILED!");
                                        this.Hide();
                                        var tc = new Technic();
                                        tc.Closed += (s, args) => this.Close();
                                        tc.Show();
                                    }
                                }
                                else
                                {
                                    errorProvider1.SetError(comboBox3, "Please select room condition!");
                                }
                            }
                            else
                            {
                                errorProvider1.SetError(comboBox2, "Please select room status!");
                            }
                        }
                        else
                        {
                            errorProvider1.SetError(materialSingleLineTextField3, "Must be filled!");
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(materialSingleLineTextField2, "Must be filled!");
                    }
                }
                else
                {
                    errorProvider1.SetError(comboBox1, "Please select roomclass!");
                }
            }
            else
            {
                errorProvider1.SetError(materialSingleLineTextField1, "Must be filled!");
            }
        }
Beispiel #6
0
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            string       room1      = materialSingleLineTextField6.Text;
            FileStream   ambildata1 = new FileStream("Room.txt", FileMode.Open, FileAccess.Read);
            StreamReader bacadata1  = new StreamReader(ambildata1);
            string       linee      = bacadata1.ReadLine();

            while (linee != null)
            {
                // Console.Clear();
                string[] dataroom = linee.Split('#');
                if (room1 == dataroom[0])
                {
                    dataroom0 = dataroom[0];
                    dataroom1 = dataroom[1];
                    dataroom2 = dataroom[2];
                    dataroom3 = dataroom[3];
                    dataroom4 = dataroom[4];
                    dataroom5 = dataroom[5];
                }
                else
                {
                }
                linee = bacadata1.ReadLine();
            }
            bacadata1.Close();
            ambildata1.Close();
            if (room1 == dataroom0)
            {
                //Load Data
                declaredata();

                //Membersihkan Error
                errorProvider1.Clear();

                //Check Data Kosong
                if (RoomNumber.Trim().Length != 0)
                {
                    if (comboBox1.Text != "- Select Room Class -")
                    {
                        if (Capacityroom.Trim().Length != 0)
                        {
                            if (Price.Trim().Length != 0)
                            {
                                if (comboBox2.Text != "- Select Room Status -")
                                {
                                    if (comboBox3.Text != "- Select Room Condition -")
                                    {
                                        string old    = dataroom0 + "#" + dataroom1 + "#" + dataroom2 + "#" + dataroom3 + "#" + dataroom4 + "#" + dataroom5 + "#";
                                        string neww   = RoomNumber + "#" + Roomclass + "#" + Capacityroom + "#" + Price + "#" + Roomstatus + "#" + Roomcondition + "#";
                                        string update = File.ReadAllText("Room.txt");
                                        update = update.Replace(old, neww);
                                        File.WriteAllText("Room.txt", update);
                                        MessageBox.Show("Data has been updated.", "SUCCESS!");
                                        this.Hide();
                                        var tc = new Technic();
                                        tc.Closed += (s, args) => this.Close();
                                        tc.Show();
                                    }
                                    else
                                    {
                                        errorProvider1.SetError(comboBox3, "Please select room condition!");
                                    }
                                }
                                else
                                {
                                    errorProvider1.SetError(comboBox2, "Please select room status!");
                                }
                            }
                            else
                            {
                                errorProvider1.SetError(materialSingleLineTextField3, "Must be filled!");
                            }
                        }
                        else
                        {
                            errorProvider1.SetError(materialSingleLineTextField2, "Must be filled!");
                        }
                    }
                    else
                    {
                        errorProvider1.SetError(comboBox1, "Please select roomclass!");
                    }
                }
                else
                {
                    errorProvider1.SetError(materialSingleLineTextField1, "Must be filled!");
                }
            }
            else
            {
                MessageBox.Show("Data not found, Try again!", "WRONG DATA!");
                materialSingleLineTextField6.Text = "";
                materialSingleLineTextField6.Focus();
            }
        }