コード例 #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();
            }
        }
コード例 #2
0
ファイル: fRates.cs プロジェクト: Shicagu/VSProjects
        private void btnOld_Click(object sender, EventArgs e)
        {
            HousingCooperativeEntities context = new HousingCooperativeEntities();

            dgvData.DataSource = context.SelectRates(2).ToList();
            btnEdit.Enabled    = false;
        }
コード例 #3
0
ファイル: fRates.cs プロジェクト: Shicagu/VSProjects
        private void LoadData()
        {
            HousingCooperativeEntities context = new HousingCooperativeEntities();

            dgvData.DataSource = context.SelectRates(1).ToList();
            btnEdit.Enabled    = true;
        }
コード例 #4
0
ファイル: fRates.cs プロジェクト: Shicagu/VSProjects
        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();
        }
コード例 #5
0
ファイル: fRates.cs プロジェクト: Shicagu/VSProjects
        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();
        }