示例#1
0
        public FrmMain()
        {
            InitializeComponent();
            string document_path  = Application.StartupPath + "/renthouse.txt";
            string document_path2 = Application.StartupPath + "/salehouse.txt";

            rentHouseOperations = new TDRentHouseDal(document_path);
            saleHouseOperations = new TDSaleHouseDal(document_path2);

            DataGridViewButtonColumn btn = new DataGridViewButtonColumn();

            dgvRentHouses.Columns.Add(btn);
            btn.HeaderText = "Resimler";
            btn.Text       = "Resimler";
            btn.UseColumnTextForButtonValue = true;
            DataGridViewButtonColumn btn1 = new DataGridViewButtonColumn();

            dgvSaleHouses.Columns.Add(btn1);
            btn1.HeaderText = "Resimler";
            btn1.Text       = "Resimler";
            btn1.UseColumnTextForButtonValue = true;

            var singletonUser = SingletonUser.CreateAsSingleton();

            lblUser.Text = singletonUser.ReadUsername();
        }
示例#2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text.Length > 0 && txtPassword.Text.Length > 0)
            {
                User user   = new User(txtUsername.Text, txtPassword.Text);
                bool status = userOperations.Login(user);
                if (status == true)
                {
                    var singletonUser = SingletonUser.CreateAsSingleton();
                    singletonUser.WriteUsername(txtUsername.Text);

                    FrmMain frmMain = new FrmMain();
                    frmMain.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Kullanıcı Adı Veya Şifre Hatalı.");
                }
            }
            else
            {
                MessageBox.Show("Lütfen Gerekli Alanları Doldurunuz.");
            }
        }