Example #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            A_Handler = new AccessionHandler();
            A1        = new Accession();


            //A1.Acc_id = Convert.ToInt32(txtAcc_id.Text);
            A1.Reg_id     = Convert.ToInt32(ddlReg_id.SelectedValue);
            A1.Book_id    = Convert.ToInt32(ddlBook_id.SelectedValue);
            A1.College_id = Convert.ToInt32(ddlCollege_id.SelectedValue);
            A1.Acc_code   = txtAcc_code.Text;
            A1.Location   = txtLocation.Text;

            A1.Is_issue = Convert.ToInt32(DropDownList1.SelectedValue.ToString());
            A1.Status   = Convert.ToInt32(DropDownList2.SelectedValue.ToString());



            if (btnSubmit.Text == "Submit")
            {
                bool B = A_Handler.AddNewAccession(A1);
                if (B == true)
                {
                    Label1.Text = "Record Inserted";
                    MSG         = "Record Inserted";
                }
                else
                {
                    Label1.Text = "Record Not Inserted";
                    MSG         = "Record Not Inserted";
                }
            }
            else if (btnSubmit.Text == "Update")
            {
                A1.Acc_id = Convert.ToInt32(txtAcc_id.Text);
                bool B = A_Handler.UpdateAccession(A1);
                if (B == true)
                {
                    Label1.Text = "Record Updated";
                    MSG         = "Record Not Updated";
                }
                else
                {
                    Label1.Text = "Record Not Updated";
                    MSG         = "Record Not Updated";
                }
            }
            else if (btnSubmit.Text == "Delete")
            {
                A1.Acc_id = Convert.ToInt32(txtAcc_id.Text);
                bool B = A_Handler.DeleteAccession(A1);
                if (B == true)
                {
                    Label1.Text = "Record Deleted";
                    MSG         = "Record Deleted";
                }
                else
                {
                    Label1.Text = "Record Not Deleted";
                    MSG         = "Record Not Deleted";
                }
            }

            //  Response.Redirect("~/ADMIN/Accession_list.aspx?msg="+MSG);
        }