Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                rpsDataContext dbcon = new rpsDataContext();

                if (dbcon.logins.Any(x => x.user_id == login.user &&
                                     x.password == textBox1.Text) == true)
                {
                    if (textBox2.Text.Length < 6)
                    {
                        MessageBox.Show("Select a password with at least 6 characters !!");
                    }
                    else if (textBox2.Text != textBox3.Text)
                    {
                        MessageBox.Show("Password doesn't match");
                    }

                    else
                    {
                        login l = new login();
                        l = dbcon.logins.SingleOrDefault(x => x.user_id == login.user);

                        if (l != null)
                        {
                            l.user_id  = label5.Text;
                            l.password = textBox2.Text;
                            dbcon.SubmitChanges();
                            MessageBox.Show("Password successfully changed! Please re-login");
                            this.Dispose();
                            new login().Show();
                        }
                    }
                }

                else
                {
                    MessageBox.Show("Your password is incorrect!");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            try
            {
                rpsDataContext dbcon = new rpsDataContext();

                if (FirstNameTextBox.Text == null || FatherFirstNameTextBox.Text == null ||
                    MotherFirstNameTextBox == null || ContactNoTextbox.Text == null ||
                    EmailTextbox.Text == null || PAddressTextBox.Text == null ||
                    OffAddressTextBox == null || comboBox1.Text == null ||
                    OfficeContNoTextBox == null || RentedFlatComboBox.Text == null ||
                    renterImage.Image == null)
                {
                    MessageBox.Show("Please fill up all the feilds!!!");
                }

                else if (textBox1.Text.Length < 6)
                {
                    MessageBox.Show("Select a password with at least 6 characters !!");
                }

                else
                {
                    //renter
                    RENTER r = new RENTER();
                    r.r_name               = FirstNameTextBox.Text + " " + LastNameTextBox.Text;
                    r.rf_name              = FatherFirstNameTextBox.Text + " " + FatherLastNameTextBox.Text;
                    r.rm_name              = MotherFirstNameTextBox.Text + " " + MotherLastNameTextBox.Text;
                    r.r_contact            = ContactNoTextbox.Text;
                    r.renter_email         = EmailTextbox.Text;
                    r.pt_address           = PAddressTextBox.Text;
                    r.r_off_add            = OffAddressTextBox.Text;
                    r.r_occupation         = textBox2.Text;
                    r.rent_date            = dateTimePicker1.Value;
                    r.renter_family_mamber = comboBox1.Text;
                    r.r_off_contact        = OfficeContNoTextBox.Text;
                    r.rented_flat          = RentedFlatComboBox.Text;

                    byte[]       img = null;
                    FileStream   fs  = new FileStream(imgLoc, FileMode.Open, FileAccess.Read);
                    BinaryReader br  = new BinaryReader(fs);
                    img = br.ReadBytes((int)fs.Length);

                    r.renter_image = img;

                    //login_table
                    login l = new login();
                    l.user_id  = RentedFlatComboBox.Text;
                    l.password = textBox1.Text;

                    //deafult bill
                    Bill_Table bill = new Bill_Table();
                    bill.flat             = RentedFlatComboBox.Text;
                    bill.House_Rent       = 0;
                    bill.Electricity_Bill = 0;
                    bill.Water_Bill       = 0;
                    bill.Gas_Bill         = 0;
                    bill.Service_Charge   = 0;

                    dbcon.logins.InsertOnSubmit(l);
                    dbcon.RENTERs.InsertOnSubmit(r);
                    dbcon.Bill_Tables.InsertOnSubmit(bill);

                    dbcon.SubmitChanges();

                    MessageBox.Show("Congratulations!! You may login now");
                    this.Hide();
                    new login().Show();
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #3
0
 partial void Deletelogin(login instance);
Exemple #4
0
 partial void Updatelogin(login instance);
Exemple #5
0
 partial void Insertlogin(login instance);