Ejemplo n.º 1
0
        private void clnt_delete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("This option can remove a some rows from another table. Are you sure?", "caption", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
                {
                    int    clnt_id1 = Int32.Parse(client_id.Text);
                    Client clnt_del = sdb.Clients.Single(x => x.client_id == clnt_id1);
                    while (sdb.Projects.SingleOrDefault(x => x.client == clnt_id1) != null)
                    {
                        Project prjct = sdb.Projects.Single(x => x.client == clnt_id1);
                        sdb.Projects.DeleteOnSubmit(prjct);
                        sdb.SubmitChanges();
                        this.projectTableAdapter.Fill(this.accountingDBDataSet.Project);
                    }
                    sdb.Clients.DeleteOnSubmit(clnt_del);
                    sdb.SubmitChanges();
                    this.clientTableAdapter2.Fill(this.accountingDBDataSet5.Client);
                }
            }
            else if (result == DialogResult.No)
            {
            }
        }
Ejemplo n.º 2
0
 private void emp_delete_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         int      emp_id1 = Int32.Parse(emp_id.Text);
         Employee emp_del = sdb.Employees.Single(x => x.emp_id == emp_id1);
         sdb.Employees.DeleteOnSubmit(emp_del);
         sdb.SubmitChanges();
         this.employeeTableAdapter3.Fill(this.accountingDBDataSet5.Employee);
     }
 }
Ejemplo n.º 3
0
 private void accnt_delete_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         int     accnt_id1 = Int32.Parse(acc_id.Text);
         Account accnt_del = sdb.Accounts.Single(x => x.acc_id == accnt_id1);
         sdb.Accounts.DeleteOnSubmit(accnt_del);
         sdb.SubmitChanges();
         this.accountsTableAdapter.Fill(this.accountingDBDataSet.Accounts);
     }
 }
Ejemplo n.º 4
0
 private void trans_update_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         int         id    = Int32.Parse(trans_id.Text);
         Transaction trans = sdb.Transactions.SingleOrDefault(x => x.trans_id == id);
         trans.trans_id   = Int32.Parse(trans_id.Text);
         trans.trans_date = DateTime.Parse(trans_date.Text);
         trans.donor_id   = Int32.Parse(donor_id.Text);
         trans.rcvr_id    = Int32.Parse(rcvr_id.Text);
         trans.amount     = Int32.Parse(amount.Text);
         sdb.SubmitChanges();
         this.transactionsTableAdapter.Fill(this.accountingDBDataSet.Transactions);
     }
 }
Ejemplo n.º 5
0
 private void accnt_update_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         int     id    = Int32.Parse(acc_id.Text);
         Account accnt = sdb.Accounts.SingleOrDefault(x => x.acc_id == id);
         accnt.acc_id    = Int32.Parse(acc_id.Text);
         accnt.acc_hd    = acc_hd.Text;
         accnt.rept_hd   = rept_hd.Text;
         accnt.vchr_hd   = vchr_hd.Text;
         accnt.bill_amnt = float.Parse(bill_amnt.Text);
         sdb.SubmitChanges();
         this.accountsTableAdapter.Fill(this.accountingDBDataSet.Accounts);
     }
 }
Ejemplo n.º 6
0
 private void trans_save_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         Transaction trans = new Transaction();
         trans.trans_id   = Int32.Parse(trans_id.Text);
         trans.trans_date = DateTime.Parse(trans_date.Text);
         trans.donor_id   = Int32.Parse(donor_id.Text);
         trans.rcvr_id    = Int32.Parse(rcvr_id.Text);
         trans.amount     = float.Parse(amount.Text);
         sdb.Transactions.InsertOnSubmit(trans);
         sdb.SubmitChanges();
         this.transactionsTableAdapter.Fill(this.accountingDBDataSet.Transactions);
         MessageBox.Show("Data Inserted!");
     }
 }
Ejemplo n.º 7
0
 private void accnt_save_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         Account accnt = new Account();
         accnt.acc_id    = Int32.Parse(acc_id.Text);
         accnt.acc_hd    = acc_hd.Text;
         accnt.rept_hd   = rept_hd.Text;
         accnt.vchr_hd   = vchr_hd.Text;
         accnt.bill_amnt = float.Parse(bill_amnt.Text);
         sdb.Accounts.InsertOnSubmit(accnt);
         sdb.SubmitChanges();
         this.accountsTableAdapter.Fill(this.accountingDBDataSet.Accounts);
         MessageBox.Show("Data Inserted!");
     }
 }
Ejemplo n.º 8
0
 private void clnt_update_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         int    id   = Int32.Parse(client_id.Text);
         Client clnt = sdb.Clients.SingleOrDefault(x => x.client_id == id);;
         clnt.client_id      = Int32.Parse(client_id.Text);
         clnt.clent_name     = clent_name.Text;
         clnt.client_address = client_address.Text;
         clnt.phone_no       = phn_no.Text;
         clnt.mail           = emp_mail.Text;
         clnt.client_picture = client_pictureBox.ImageLocation;
         sdb.SubmitChanges();
         this.clientTableAdapter2.Fill(this.accountingDBDataSet5.Client);
     }
 }
Ejemplo n.º 9
0
 private void prjct_delete_Click(object sender, EventArgs e)
 {
     try {
         using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
         {
             int     prjct_id1 = Int32.Parse(prjct_id.Text);
             Project prjct_del = sdb.Projects.Single(x => x.prjct_id == prjct_id1);
             sdb.Projects.DeleteOnSubmit(prjct_del);
             sdb.SubmitChanges();
             this.projectTableAdapter.Fill(this.accountingDBDataSet.Project);
         }
     }
     catch (SqlException)
     {
         MessageBox.Show("SQL Exception. Maybe you are trying to delete a primary key value that references another tables foreign key!!!");
     }
 }
Ejemplo n.º 10
0
 private void emp_save_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         Employee emp = new Employee();
         emp.emp_id      = Int32.Parse(emp_id.Text);
         emp.emp_name    = emp_name.Text;
         emp.designation = design.Text;
         emp.joindate    = DateTime.Parse(joindate.Text);
         emp.basic_sal   = float.Parse(basic.Text);
         emp.receivable  = float.Parse(rcvbl.Text);
         emp.address     = address.Text;
         emp.phone_no    = phn_no.Text;
         emp.mail        = emp_mail.Text;
         emp.emp_picture = emp_pictureBox.ImageLocation;
         emp.dept_name   = dept_name.Text;
         sdb.Employees.InsertOnSubmit(emp);
         sdb.SubmitChanges();
         this.employeeTableAdapter3.Fill(this.accountingDBDataSet5.Employee);
         MessageBox.Show("Data Inserted!");
     }
 }
Ejemplo n.º 11
0
 private void clnt_save_Click(object sender, EventArgs e)
 {
     try
     {
         using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
         {
             Client clnt = new Client();
             clnt.client_id      = Int32.Parse(client_id.Text);
             clnt.clent_name     = clent_name.Text;
             clnt.client_address = client_address.Text;
             clnt.phone_no       = phone_no.Text;
             clnt.mail           = cl_mail.Text;
             clnt.client_picture = client_pictureBox.ImageLocation;
             sdb.Clients.InsertOnSubmit(clnt);
             sdb.SubmitChanges();
             this.clientTableAdapter2.Fill(this.accountingDBDataSet5.Client);
             MessageBox.Show("Data Inserted!");
         }
     }catch (SqlException) {
         MessageBox.Show("SQL Exception");
     }
 }
Ejemplo n.º 12
0
 private void prjct_save_Click(object sender, EventArgs e)
 {
     try{
         using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
         {
             Project prjct = new Project();
             prjct.prjct_id     = Int32.Parse(prjct_id.Text);
             prjct.prjct_name   = prjct_name.Text;
             prjct.prjct_status = prjct_status.Text;
             prjct.curr_amount  = float.Parse(curr_amount.Text);
             prjct.prjct_exp    = float.Parse(prjct_exp1.Text);
             prjct.rc_able      = float.Parse(rc_able.Text);
             prjct.client       = Int32.Parse(client.Text);
             sdb.Projects.InsertOnSubmit(prjct);
             sdb.SubmitChanges();
             this.projectTableAdapter.Fill(this.accountingDBDataSet.Project);
             MessageBox.Show("Data Inserted!");
         }
     }
     catch (SqlException)
     {
         MessageBox.Show("Client ID Not present!");
     }
 }
Ejemplo n.º 13
0
 private void prjct_update_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         try
         {
             int     id    = Int32.Parse(prjct_id.Text);
             Project prjct = sdb.Projects.SingleOrDefault(x => x.prjct_id == id);
             prjct.prjct_id     = Int32.Parse(prjct_id.Text);
             prjct.prjct_name   = prjct_name.Text;
             prjct.prjct_status = prjct_status.Text;
             prjct.curr_amount  = float.Parse(curr_amount.Text);
             prjct.prjct_exp    = float.Parse(prjct_exp1.Text);
             prjct.rc_able      = float.Parse(rc_able.Text);
             prjct.client       = Int32.Parse(client.Text);
             sdb.SubmitChanges();
             this.projectTableAdapter.Fill(this.accountingDBDataSet.Project);
         }
         catch (SqlException)
         {
             MessageBox.Show("Client ID not present!");
         }
     }
 }
Ejemplo n.º 14
0
 private void emp_update_Click(object sender, EventArgs e)
 {
     using (AccountingDataClassesDataContext sdb = new AccountingDataClassesDataContext())
     {
         int      id = Int32.Parse(emp_id.Text);
         Employee emp = sdb.Employees.SingleOrDefault(x => x.emp_id == id);
         int      emp_id1, basic_sal1;
         Int32.TryParse(emp_id.Text, out emp_id1);
         emp.emp_id      = emp_id1;
         emp.emp_name    = emp_name.Text;
         emp.designation = design.Text;
         emp.joindate    = DateTime.Parse(joindate.Text);
         Int32.TryParse(basic.Text, out basic_sal1);
         emp.basic_sal   = basic_sal1;
         emp.receivable  = float.Parse(rcvbl.Text);
         emp.address     = address.Text;
         emp.phone_no    = phn_no.Text;
         emp.mail        = emp_mail.Text;
         emp.emp_picture = emp_pictureBox.ImageLocation;
         emp.dept_name   = dept_name.Text;
         sdb.SubmitChanges();
         this.employeeTableAdapter3.Fill(this.accountingDBDataSet5.Employee);
     }
 }