Ejemplo n.º 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            HousingCooperativeEntities context = new HousingCooperativeEntities();
            Users user = context.Users.Find(tbLogin.Text);

            try
            {
                if (user.Password == tbPassword.Text)
                {
                    Properties.Settings.Default.ApplicationRole = user.Role;
                    if (user.Role == "Управляющий домом")
                    {
                        fAdministrator administrator = new fAdministrator();
                        administrator.Show();
                        Hide();
                    }
                    else
                    {
                        fReceipts fReceipts = new fReceipts();
                        fReceipts.Show();
                        Hide();
                    }
                }
                else
                {
                    lbWarning.Show();
                }
            }
            catch (Exception)
            {
                lbWarning.Show();
            }
        }
Ejemplo n.º 2
0
        private void btnOld_Click(object sender, EventArgs e)
        {
            HousingCooperativeEntities context = new HousingCooperativeEntities();

            dgvData.DataSource = context.SelectRates(2).ToList();
            btnEdit.Enabled    = false;
        }
Ejemplo n.º 3
0
        private void LoadData()
        {
            HousingCooperativeEntities context = new HousingCooperativeEntities();

            dgvData.DataSource = context.SelectRates(1).ToList();
            btnEdit.Enabled    = true;
        }
Ejemplo n.º 4
0
        private void AddOld()
        {
            HousingCooperativeEntities context = new HousingCooperativeEntities();
            Rates oldRate = context.Rates.Find(dgvData.SelectedCells[0].Value);

            oldRate.StatusRate = 2;
            context.Rates.Add(oldRate);
            context.SaveChanges();
        }
Ejemplo n.º 5
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            HousingCooperativeEntities context = new HousingCooperativeEntities();
            fRatesAdd add     = new fRatesAdd();
            Rates     newRate = context.Rates.Find(dgvData.SelectedCells[0].Value);

            add.lbRate.Text       = dgvData.SelectedCells[1].Value.ToString();
            add.nudRate.Value     = newRate.Rate;
            add.tbUnit.Text       = newRate.Unit;
            add.dtMonthYear.Value = new DateTime(newRate.YearBegin, newRate.MonthBegin, 1);
            DialogResult result = add.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                return;
            }
            AddOld();
            newRate.Rate       = add.nudRate.Value;
            newRate.Unit       = add.tbUnit.Text;
            newRate.MonthBegin = add.dtMonthYear.Value.Month;
            newRate.YearBegin  = add.dtMonthYear.Value.Year;
            context.SaveChanges();
            LoadData();
        }