示例#1
0
        private void load_data()
        {
            rpsDataContext dbcon = new rpsDataContext();

            //Bill_Table bill = new Bill_Table();
            var bills = from q in dbcon.Bill_Tables
                        where q.flat == comboBox1.SelectedValue.ToString()
                        select new { q.Bill_Date,
                                     q.House_Rent,
                                     q.Electricity_Bill,
                                     q.Water_Bill,
                                     q.Gas_Bill,
                                     q.Service_Charge };

            bills = bills.OrderByDescending(x => x.Bill_Date);
            dataGridView1.DataSource = bills;

            RENTER r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == comboBox1.SelectedValue.ToString());

            if (r != null)
            {
                label5.Text = r.r_name;
                label6.Text = r.rent_date.ToString();;
            }
        }
 private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (this.Text == "New_Bill")
     {
         rpsDataContext dbcon = new rpsDataContext();
         RENTER         r     = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == comboBox1.SelectedItem.ToString());
         if (r == null)
         {
             dateTimePicker1.Enabled = false;
             richTextBox1.Enabled    = false;
             richTextBox2.Enabled    = false;
             richTextBox3.Enabled    = false;
             richTextBox4.Enabled    = false;
             richTextBox5.Enabled    = false;
             button1.Enabled         = false;
             MessageBox.Show("Currently no renter in this flat");
         }
         else
         {
             dateTimePicker1.Enabled = true;
             richTextBox1.Enabled    = true;
             richTextBox2.Enabled    = true;
             richTextBox3.Enabled    = true;
             richTextBox4.Enabled    = true;
             richTextBox5.Enabled    = true;
             button1.Enabled         = true;
             //MessageBox.Show("Currently no renter in this flat");
         }
     }
 }
        public My_Information()
        {
            InitializeComponent();

            textBox9.Text = login.user;

            rpsDataContext dbcon = new rpsDataContext();
            RENTER         r     = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == login.user);

            if (r != null)
            {
                textBox1.Text = r.r_name;

                textBox2.Text  = r.rf_name;
                textBox3.Text  = r.rm_name;
                textBox5.Text  = r.r_contact;
                textBox10.Text = r.renter_email;
                textBox4.Text  = r.pt_address;
                textBox7.Text  = r.r_off_add;
                textBox6.Text  = r.r_occupation;
                textBox12.Text = Convert.ToString(r.rent_date);
                textBox11.Text = r.renter_family_mamber;
                textBox8.Text  = r.r_off_contact;
                textBox9.Text  = r.rented_flat;
            }
        }
        public flat()
        {
            InitializeComponent();
            //richTextBox1.Text = "sadi khondoker\n01696969";

            label1.Text = floors.floor_no;
            label2.Text = floors.flat1;
            label3.Text = floors.flat2;


            rpsDataContext dbcon = new rpsDataContext();

            RENTER r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == label2.Text);

            if (r != null)
            {
                label4.Visible      = true;
                pictureBox3.Visible = true;
                label6.Visible      = true;
                flat1_status();

                richTextBox1.Text = r.r_name + "\n" + r.r_contact;
            }
            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == label3.Text);
            if (r != null)
            {
                label5.Visible      = true;
                pictureBox4.Visible = true;
                label7.Visible      = true;
                flat2_status();

                richTextBox2.Text = r.r_name + "\n" + r.r_contact;
            }
        }
示例#5
0
        private Image load_image(RENTER r)
        {
            byte[]       img = r.renter_image.ToArray();
            MemoryStream ms  = new MemoryStream(img);

            //renterImage.Image = Image.FromStream(ms);

            return(Image.FromStream(ms));
        }
        private bool flat_has_renter()
        {
            rpsDataContext dbcon = new rpsDataContext();
            RENTER         r     = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == flatselected);

            if (r != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Previous_Bills.billType = "new";
            rpsDataContext dbcon = new rpsDataContext();
            RENTER         r     = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == flat.flatselected.ToString());

            if (r == null)
            {
                MessageBox.Show("Currently no renter in this flat");
            }
            else
            {
                new New_Bill().ShowDialog();
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            rpsDataContext dbcon = new rpsDataContext();
            RENTER         r     = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == login.user);

            if (r != null)
            {
                r.r_contact            = textBox5.Text;
                r.renter_email         = textBox10.Text;
                r.r_off_add            = textBox7.Text;
                r.r_occupation         = textBox6.Text;
                r.renter_family_mamber = textBox11.Text;
                r.r_off_contact        = textBox8.Text;

                dbcon.SubmitChanges();
                MessageBox.Show("Successfully upadated");



                textBox1.Text = r.r_name;

                textBox2.Text  = r.rf_name;
                textBox3.Text  = r.rm_name;
                textBox5.Text  = r.r_contact;
                textBox10.Text = r.renter_email;
                textBox4.Text  = r.pt_address;
                textBox7.Text  = r.r_off_add;
                textBox6.Text  = r.r_occupation;
                textBox12.Text = Convert.ToString(r.rent_date);
                textBox11.Text = r.renter_family_mamber;
                textBox8.Text  = r.r_off_contact;
                textBox9.Text  = r.rented_flat;

                textBox5.ReadOnly  = true;
                textBox10.ReadOnly = true;
                textBox7.ReadOnly  = true;
                textBox6.ReadOnly  = true;
                textBox11.ReadOnly = true;
                textBox8.ReadOnly  = true;
            }
        }
        public void giveRent()
        {
            rpsDataContext dbcon = new rpsDataContext();
            RENTER         r     = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "A-1");

            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("A-1");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "A-2");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("A-2");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "A-3");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("A-3");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "A-4");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("A-4");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "A-5");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("A-5");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "A-6");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("A-6");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "B-1");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("B-1");
            }
            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "B-2");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("B-2");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "B-3");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("B-3");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "B-4");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("B-4");
            }

            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "B-5");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("B-5");
            }
            r = dbcon.RENTERs.SingleOrDefault(x => x.rented_flat == "B-6");
            if (r != null)
            {
                RentedFlatComboBox.Items.Remove("B-6");
            }
        }
        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);
            }
        }
示例#11
0
 partial void DeleteRENTER(RENTER instance);
示例#12
0
 partial void UpdateRENTER(RENTER instance);
示例#13
0
 partial void InsertRENTER(RENTER instance);