Exemplo n.º 1
0
 private void dgvSelectBc_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvSelectBc.CurrentRow.Index != -1)
         {
             model.id = Convert.ToInt32(dgvSelectBc.CurrentRow.Cells["idDataGridViewTextBoxColumn"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 model                 = mc.Bcs.Where(x => x.id == model.id).FirstOrDefault();
                 labelBcName.Text      = model.fullName;
                 txtTotalAmount.Text   = model.totalAmount;
                 txtStartDate.Text     = model.startDate.ToString();
                 txtEndDate.Text       = model.endDate.ToString();
                 txtDuration.Text      = model.duration;
                 txtMonthlyAmount.Text = model.monthlyContryPerPerson;
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("There Are No Beesi Available");
     }
     dgvSelectBc.Visible = false;
     dgvSelectBc.Visible = false;
 }
Exemplo n.º 2
0
        private void btnAprilSave_Click(object sender, EventArgs e)
        {
            fourt_mr April = new fourt_mr();

            April.memberName      = comboBox1.Text.Trim();
            April.monthlyAmount   = txtMonthlyAmount.Text.Trim();
            April.interest        = txtInterest.Text.Trim();
            April.paidAmount      = txtPaidAmount.Text.Trim();
            April.collectedAmount = txtCollectAmt.Text.Trim();
            April.bcName          = labelBcName.Text.Trim();
            if (txtInterest.Text == "")
            {
                MessageBox.Show("Enter The Interest % Amount");
            }
            else if (txtPaidAmount.Text == "")
            {
                MessageBox.Show("Enter Paid Amount");
            }
            else
            {
                using (MonthlyContributionEntities ma = new MonthlyContributionEntities())
                {
                    ma.fourt_mr.Add(April);
                    ma.SaveChanges();
                    MessageBox.Show("   Record Save For" + Environment.NewLine +
                                    " Member:  " + comboBox1.Text + Environment.NewLine +
                                    " To Beei Name:  " + labelBcName.Text);
                }
            }
        }
Exemplo n.º 3
0
 private void dgvBeesi_Click_1(object sender, EventArgs e)
 {
     try
     {
         if (dgvBeesi.CurrentRow.Index != -1)
         {
             model.id = Convert.ToInt32(dgvBeesi.CurrentRow.Cells["idDataGridViewTextBoxColumn1"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 model               = mc.Bcs.Where(x => x.id == model.id).FirstOrDefault();
                 txtBcName.Text      = model.fullName;
                 txtCountry.Text     = model.monthlyContryPerPerson;
                 txtDuration.Text    = model.duration;
                 txtTotalAmount.Text = model.totalAmount;
                 txtTotalMember.Text = model.totalAmount;
                 btnDelete.Enabled   = true;
                 txtCreate.Enabled   = false;
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("Beesi Not Available");
     }
 }
Exemplo n.º 4
0
 private void dvgMembers_Click(object sender, EventArgs e)
 {
     try
     {
         if (dvgMembers.CurrentRow.Index != -1)
         {
             model.id = Convert.ToInt32(dvgMembers.CurrentRow.Cells["id"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 model            = mc.Members.Where(x => x.id == model.id).FirstOrDefault();
                 txtFullName.Text = model.fullName;
                 txtMobile.Text   = model.mobile;
                 txtEmailId.Text  = model.emailId;
                 txtCity.Text     = model.city;
                 // model.updatedAt = DateTime.Now;
             }
             btnAdd.Text       = "Update";
             btnDelete.Enabled = true;
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("There Are No Member Available");
     }
 }
Exemplo n.º 5
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtFullName.Text == "" || txtEmailId.Text == "" || txtMobile.Text == "")
     {
         MessageBox.Show("Fill The Required Fields ");
     }
     else if (!this.txtEmailId.Text.Contains('@') || !this.txtEmailId.Text.Contains('.'))
     {
         MessageBox.Show("Enter Wright Email Address");
     }
     else
     {
         ReloadForm();
         model.fullName = txtFullName.Text.Trim();
         model.mobile   = txtMobile.Text.Trim();
         model.emailId  = txtEmailId.Text.Trim();
         model.DOB      = dateTimePickerDOB.Value;
         model.city     = txtCity.Text.Trim();
         //model.createdAt = DateTime.Now;
         using (MonthlyContributionEntities MC = new MonthlyContributionEntities())
         {
             if (model.id == 0) //for Insert
             {
                 MC.Members.Add(model);
             }
             else
             {
                 MC.Entry(model).State = EntityState.Modified;//for Update
             }
             try
             {
                 MC.SaveChanges();
             }
             catch (DbEntityValidationException c)
             {
                 foreach (var eve in c.EntityValidationErrors)
                 {
                     Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                       eve.Entry.Entity.GetType().Name, eve.Entry.State);
                     foreach (var ve in eve.ValidationErrors)
                     {
                         Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                           ve.PropertyName, ve.ErrorMessage);
                     }
                 }
             }
         }
         clear();
         MessageBox.Show("Submitted Successfully.");
         dvg();
     }
 }
Exemplo n.º 6
0
        // Button click
        private void txtCreate_Click(object sender, EventArgs e)
        {
            if (txtBcName.Text == "" || txtTotalAmount.Text == "" || txtTotalMember.Text == "") // validation for empty textbox
            {
                MessageBox.Show("Fill The Required Fields");
            }
            else
            {
                model.fullName               = txtBcName.Text.Trim();
                model.totalAmount            = txtTotalAmount.Text.Trim();
                model.totalMember            = txtTotalMember.Text.Trim();
                model.duration               = txtDuration.Text.Trim();
                model.monthlyContryPerPerson = txtCountry.Text.Trim();
                model.startDate              = dtpStartdate.Value;
                model.endDate = dtpEndDate.Value;

                int        i        = 0;
                List <int> ChkedRow = new List <int>();


                using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
                {
                    if (model.id == 0)
                    {
                        mc.Bcs.Add(model);
                    }
                    try // for Entity Exception
                    {
                        mc.SaveChanges();
                    }
                    catch (DbEntityValidationException c)
                    {
                        foreach (var eve in c.EntityValidationErrors)
                        {
                            Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                              eve.Entry.Entity.GetType().Name, eve.Entry.State);
                            foreach (var ve in eve.ValidationErrors)
                            {
                                Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                  ve.PropertyName, ve.ErrorMessage);
                            }
                        }
                    }
                    MessageBox.Show("Beesi Created Succefully.");
                }
            }
        }
Exemplo n.º 7
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are You Sure to Delete this Record ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         using (MonthlyContributionEntities MC = new MonthlyContributionEntities())
         {
             var entry = MC.Entry(model);
             if (entry.State == EntityState.Detached)
             {
                 MC.Members.Attach(model);
                 MC.Members.Remove(model);
                 MC.SaveChanges();
                 clear();
                 MessageBox.Show("Deleted Successfully");
                 dvg();
             }
         }
     }
 }
 private void dgvBcName_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvBcName.CurrentRow.Index != -1)
         {
             modelb.id = Convert.ToInt32(dgvBcName.CurrentRow.Cells["idDataGridViewTextBoxColumn1"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 modelb         = mc.Bcs.Where(x => x.id == modelb.id).FirstOrDefault();
                 txtBcName.Text = modelb.fullName;
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("No Details Available");
     }
 }
Exemplo n.º 9
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (txtFisrtN.Text == "")
     {
         MessageBox.Show("Enter First Name");
     }
     else if (txtUserN.Text == "")
     {
         MessageBox.Show("Enter User Name");
     }
     else if (txtPassword.Text == "" || txtconfpass.Text == "")
     {
         MessageBox.Show("Enter Password");
     }
     else if (txtPassword.Text != txtconfpass.Text)
     {
         MessageBox.Show("Password and confirm password not same");
     }
     else
     {
         model.FirstName       = txtFisrtN.Text.Trim();
         model.LastName        = txtLastN.Text.Trim();
         model.UserName        = txtUserN.Text.Trim();
         model.Email           = txteml.Text.Trim();
         model.PhoneNo         = txtPhoneN.Text.Trim();
         model.Password        = txtPassword.Text.Trim();
         model.ConfirmPassword = txtconfpass.Text.Trim();
         using (MonthlyContributionEntities m = new MonthlyContributionEntities())
         {
             if (m.Users.Any(o => o.UserName == txtUserN.Text))
             {
                 MessageBox.Show("User Name Alreaady Exists !");
             }
             else
             {
                 m.Users.Add(model);
                 m.SaveChanges();
                 MessageBox.Show("Account Created. ");
                 clear();
             }
         }
     }
 }
 private void dgvSeven_Click(object sender, EventArgs e)
 {
     try{
         if (dgvSeven.CurrentRow.Index != -1)
         {
             m7.id = Convert.ToInt32(dgvSeven.CurrentRow.Cells["sevenId"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 m7                  = mc.Seven_mR.Where(x => x.id == m7.id).FirstOrDefault();
                 textBox1.Text       = m7.bcName;
                 btnDelSeven.Enabled = true;
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("There Are no Record Available");
     }
 }
        // delet buttons
        private void btnDeleteFirst_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are You Sure to Delete this Record ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                using (MonthlyContributionEntities MC = new MonthlyContributionEntities())
                {
                    var entry = MC.Entry(m1);
                    if (entry.State == EntityState.Detached)
                    {
                        MC.First_mR.Attach(m1);
                        MC.First_mR.Remove(m1);
                        MC.SaveChanges();

                        MessageBox.Show("Deleted Successfully");
                    }
                }
            }
            dgvFirstR.DataSource = mc.First_mR.ToList();
        }
 private void metroGrid1_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvFourth.CurrentRow.Index != -1)
         {
             m4.id = Convert.ToInt32(dgvFourth.CurrentRow.Cells["founthId"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 m4                 = mc.fourt_mr.Where(x => x.id == m4.id).FirstOrDefault();
                 textBox1.Text      = m4.bcName;
                 btnDelFour.Enabled = true;
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("There Are no Record Available");
     }
 }
 // grid view click
 private void dgvFirstR_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvFirstR.CurrentRow.Index != -1)
         {
             m1.id = Convert.ToInt32(dgvFirstR.CurrentRow.Cells["idDataGridViewTextBoxColumn"].Value);
             using (MonthlyContributionEntities mc = new MonthlyContributionEntities())
             {
                 m1                     = mc.First_mR.Where(x => x.id == m1.id).FirstOrDefault();
                 textBox1.Text          = m1.bcName;
                 btnDeleteFirst.Enabled = true;
             }
         }
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("There Are no Record Available");
     }
 }
Exemplo n.º 14
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are You Sure to Delete this Details ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         using (MonthlyContributionEntities MC = new MonthlyContributionEntities())
         {
             var entry = MC.Entry(model);
             if (entry.State == EntityState.Detached)
             {
                 MC.Bcs.Attach(model);
                 MC.Bcs.Remove(model);
                 MC.SaveChanges();
                 clear();
                 MessageBox.Show("Deleted Successfully");
                 dgvBeesi.DataSource = mc.Bcs.ToList();
             }
         }
     }
     btnDelete.Enabled = false;
     txtCreate.Enabled = true;
 }
 private void btnLogin_Click(object sender, EventArgs e)
 {
     using (MonthlyContributionEntities m = new MonthlyContributionEntities())
     {
         var user = m.Users.FirstOrDefault(o => o.UserName == txtUserName.Text);
         if (user != null)
         {
             if (user.Password == txtPass.Text)
             {
                 HomePage f1 = new HomePage();
                 f1.Show();
                 this.Hide();
             }
             else
             {
                 MessageBox.Show("Wrong Password");
             }
         }
         else
         {
             MessageBox.Show("No User found");
         }
     }
 }
Exemplo n.º 16
0
 public BC_Current()
 {
     InitializeComponent();
     MC = new MonthlyContributionEntities();
 }
Exemplo n.º 17
0
 public MemberForm()
 {
     InitializeComponent();
     MC = new MonthlyContributionEntities();
     LoadTheme();
 }
Exemplo n.º 18
0
 // Data Grid View
 public void dvg()
 {
     MC = new MonthlyContributionEntities();
     memberBindingSource.DataSource = MC.Members.ToList();
     clear();
 }