protected void btnsubmit_Click(object sender, EventArgs e)
    {
        Handler hdnpartycode=new Handler();
        DataTable dtpartycode=hdnpartycode.GetTable("SELECT SRNO FROM PARTYMASTER PM WHERE PARTYCODE='"+txtpartycode.Text.Trim().ToString()+"'");
        if (dtpartycode.Rows.Count == 0)
        {
            DataTable dtmax = new DataTable();
            partymaster objpartymaster = new partymaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
            objpartymaster.partymaster_SRNO = -1;
            objpartymaster.partymaster_PARTYNAME = txtpartyname.Text.Trim().ToString();
            objpartymaster.partymaster_PARTYCODE = txtpartycode.Text.Trim().ToString();
            objpartymaster.partymaster_PARTYTYPE = ddlpartytype.SelectedItem.Text.ToString();
            objpartymaster.partymaster_PARTYTYPECODE = General.Parse<int>(ddlpartytype.SelectedValue.ToString());
            if (rdaddonyes.Checked == true)
            {
                objpartymaster.partymaster_PARTYADDON = 1;
            }
            else
            {
                objpartymaster.partymaster_PARTYADDON = 0;
            }
            objpartymaster.partymaster_PHONENO = txtphone.Text.Trim().ToString();
            if (txtfax.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_FAX = txtfax.Text.Trim().ToString();
            }
            if (txtemail.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_EMAIL = txtemail.Text.Trim().ToString();
            }
            if (txtwebsite.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_WEBSITE = txtwebsite.Text.Trim().ToString();
            }
            if (txtpanno.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_PANNO = txtpanno.Text.Trim().ToString();
            }
            if (txtcstno.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_CSTNO = txtcstno.Text.Trim().ToString();
            }
            if (txtvatno.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_VATNO = txtvatno.Text.Trim().ToString();
            }
            if (txtservicetaxno.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_SERVICETAXNO = txtservicetaxno.Text.Trim().ToString();
            }
            if (txtexciseno.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_EXCISENO = txtexciseno.Text.Trim().ToString();
            }
            if (txtexciserange.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_EXCISERANGE = txtexciserange.Text.Trim().ToString();
            }
            if (txtexcisedivision.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_EXCISEDIVISION = txtexcisedivision.Text.Trim().ToString();
            }
            if (txtexcisecollectrate.Text.Trim().ToString() != string.Empty)
            {
                objpartymaster.partymaster_EXCISECOLLECTRATE = txtexcisecollectrate.Text.Trim().ToString();
            }
            if (objpartymaster.Insert(true, "partymaster"))
            {
                string sqlmax = "SELECT MAX(SRNO) AS SRNO FROM partymaster WHERE PARTYNAME='" + txtpartyname.Text.Trim().ToString() + "' AND PARTYCODE='" + txtpartycode.Text.Trim().ToString() + "' ";
                Handler hdnmax = new Handler();
                dtmax = hdnmax.GetTable(sqlmax);
                if (dtmax.Rows.Count > 0)
                {
                    personaltable objpersonal1 = new personaltable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                    objpersonal1.personaltable_RELATIONSHIPID = -1;
                    objpersonal1.personaltable_FIRSTNAME = txtpartyname.Text.Trim().ToString();
                    objpersonal1.personaltable_BRANCHID = General.Parse<int>(Session["branchid"].ToString());
                    Handler branch = new Handler();
                    DataTable dtbranch = branch.GetTable("select BRANCHNAME from branchmaster where branchid=" + Session["branchid"].ToString());
                    objpersonal1.personaltable_BRANCHNAME = dtbranch.Rows[0][0].ToString().Trim();
                    if (objpersonal1.Insert(true, "personaltable"))
                    {
                        string sql = "SELECT MAX(PR.RELATIONSHIPID) AS RELATIONSHIPID FROM personaltable PR WHERE PR.BRANCHID=1 AND PR.FIRSTNAME='" + txtpartyname.Text.Trim().ToString() + "'";
                        Handler hdn = new Handler();
                        DataTable dt = hdn.GetTable(sql);
                        personalrelation objpersonalrelation = new personalrelation(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                        objpersonalrelation.personalrelation_SRNO = -1;
                        objpersonalrelation.personalrelation_RELATIONSHIPID = General.Parse<int>(dt.Rows[0][0].ToString());
                        objpersonalrelation.personalrelation_ASSOSIATEDFEILD = "MAIN ACCOOUNT";
                        objpersonalrelation.personalrelation_ASSOSIATEDBRANCH = General.Parse<int>(Session["branchid"].ToString());
                        objpersonalrelation.personalrelation_GROUPID = 100;
                        objpersonalrelation.personalrelation_STATUS = 0;
                        if (objpersonalrelation.Insert(true, "personalrelation"))
                        {
                        }
                    }

                    partyaddressmaster objpartyaddressmaster = new partyaddressmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                    objpartyaddressmaster.partyaddressmaster_SRNO = -1;
                    objpartyaddressmaster.partyaddressmaster_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                    objpartyaddressmaster.partyaddressmaster_ADDRESSTYPE = 1;
                    objpartyaddressmaster.partyaddressmaster_ADDRESS = txtaddress.Text.Trim().ToString();
                    objpartyaddressmaster.partyaddressmaster_CITYID = General.Parse<int>(ddlcity.SelectedValue.ToString()); ;
                    objpartyaddressmaster.partyaddressmaster_CITYNAME = ddlcity.SelectedItem.Text.Trim().ToString(); ;
                    objpartyaddressmaster.partyaddressmaster_STATEID = General.Parse<int>(ddlstate.SelectedValue.ToString()); ;
                    objpartyaddressmaster.partyaddressmaster_STATENAME = ddlstate.SelectedItem.Text.Trim().ToString(); ;
                    objpartyaddressmaster.partyaddressmaster_PINCODE = txtpin.Text.Trim().ToString(); ;
                    objpartyaddressmaster.partyaddressmaster_STATUS = 0;
                    if (objpartyaddressmaster.Insert(true, "partyaddressmaster"))
                    {
                    }
                    partyaddressmaster objpartyworkaddressmaster = new partyaddressmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                    objpartyworkaddressmaster.partyaddressmaster_SRNO = -1;
                    objpartyworkaddressmaster.partyaddressmaster_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                    objpartyworkaddressmaster.partyaddressmaster_ADDRESSTYPE = 2;
                    objpartyworkaddressmaster.partyaddressmaster_ADDRESS = txtworkaddress.Text.Trim().ToString();
                    objpartyworkaddressmaster.partyaddressmaster_CITYID = General.Parse<int>(ddlworkcity.SelectedValue.ToString()); ;
                    objpartyworkaddressmaster.partyaddressmaster_CITYNAME = ddlworkcity.SelectedItem.Text.Trim().ToString(); ;
                    objpartyworkaddressmaster.partyaddressmaster_STATEID = General.Parse<int>(ddlworkstate.SelectedValue.ToString()); ;
                    objpartyworkaddressmaster.partyaddressmaster_STATENAME = ddlworkstate.SelectedItem.Text.Trim().ToString(); ;
                    objpartyworkaddressmaster.partyaddressmaster_PINCODE = txtworkpin.Text.Trim().ToString(); ;
                    objpartyworkaddressmaster.partyaddressmaster_STATUS = 0;
                    if (objpartyworkaddressmaster.Insert(true, "partyaddressmaster"))
                    {
                    }


                    if (dtmax.Rows.Count > 0 && memberrepeater.Items.Count > 0)
                    {
                        for (int i = 0; i < memberrepeater.Items.Count; i++)
                        {

                            TextBox name = (TextBox)memberrepeater.Items[i].FindControl("txtpersonname");
                            DropDownList department = (DropDownList)memberrepeater.Items[i].FindControl("ddldepartment");
                            DropDownList designation = (DropDownList)memberrepeater.Items[i].FindControl("ddldesignation");
                            TextBox phone = (TextBox)memberrepeater.Items[i].FindControl("txtperphone");
                            TextBox email = (TextBox)memberrepeater.Items[i].FindControl("txtperemailid");
                            TextBox mobile = (TextBox)memberrepeater.Items[i].FindControl("txtpermobile");

                            personalmaster objpersonal = new personalmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                            objpersonal.personalmaster_SRNO = -1;
                            objpersonal.personalmaster_PERSONNAME = name.Text.ToString().Trim();
                            objpersonal.personalmaster_DEPARTMENT = department.SelectedItem.Text.Trim().ToString();
                            objpersonal.personalmaster_DESIGNATION = designation.SelectedItem.Text.Trim().ToString();
                            objpersonal.personalmaster_EMAILID = email.Text.ToString().Trim();
                            objpersonal.personalmaster_PHONENO = phone.Text.ToString().Trim();
                            objpersonal.personalmaster_MOBILE = mobile.Text.ToString().Trim();
                            objpersonal.personalmaster_PERSONRELATIONID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                            objpersonal.personalmaster_PERSONTYPE = "PARTY";
                            if (objpersonal.Insert(true, "personalmaster"))
                            {
                            }


                        }
                    }
                    string sqltax = "SELECT SRNO AS TAXID,TAXNAME,TAXVALUE,TAXUNIT FROM taxmaster WHERE STATUS=0";
                    Handler hdntax = new Handler();
                    DataTable dttax = hdntax.GetTable(sqltax);

                    for (int k = 0; k < dttax.Rows.Count; k++)
                    {
                        if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "VAT" && rdvat.Checked == true)
                        {
                            partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                            objpartytax.partytaxmaster_SRNO = -1;
                            objpartytax.partytaxmaster_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                            objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                            objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                            objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                            objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                            if (objpartytax.Insert(true, "partytaxmaster"))
                            {
                            }
                        }
                        if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "CST" && rdexcise.Checked == true)
                        {
                            partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                            objpartytax.partytaxmaster_SRNO = -1;
                            objpartytax.partytaxmaster_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                            objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                            objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                            objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                            objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                            if (objpartytax.Insert(true, "partytaxmaster"))
                            {
                            }
                        }
                        if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "SERVICE TAX" && rdserviceapplicable.Checked == true)
                        {
                            partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                            objpartytax.partytaxmaster_SRNO = -1;
                            objpartytax.partytaxmaster_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                            objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                            objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                            objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                            objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                            if (objpartytax.Insert(true, "partytaxmaster"))
                            {
                            }
                        }
                        if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "EXCISE" && rdexciseapplicable.Checked == true)
                        {
                            partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                            objpartytax.partytaxmaster_SRNO = -1;
                            objpartytax.partytaxmaster_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                            objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                            objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                            objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                            objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                            if (objpartytax.Insert(true, "partytaxmaster"))
                            {
                            }
                        }
                    }
                }
                Response.Redirect("partylist.aspx?ID=2");

            }
            else
            {
                MessageBox("Party Code Already Present");
            }
       
    }
    }
    protected void btnupdate_Click(object sender, EventArgs e)
    {
        DataTable dtmax = new DataTable();
        partymaster objpartymaster = new partymaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
        objpartymaster.partymaster_SRNO = -1;
        //objpartymaster.partymaster_PARTYNAME = txtpartyname.Text.Trim().ToString();
        objpartymaster.partymaster_PARTYCODE = txtpartycode.Text.Trim().ToString();
        objpartymaster.partymaster_PARTYTYPE = ddlpartytype.SelectedItem.Text.ToString();
        objpartymaster.partymaster_PARTYTYPECODE = General.Parse<int>(ddlpartytype.SelectedValue.ToString());
        if (rdaddonyes.Checked == true)
        {
            objpartymaster.partymaster_PARTYADDON = 1;
        }
        else
        {
            objpartymaster.partymaster_PARTYADDON = 0;
        }
        objpartymaster.partymaster_PHONENO = txtphone.Text.Trim().ToString();
        if (txtfax.Text.Trim().ToString() != string.Empty)
        {
            objpartymaster.partymaster_FAX = txtfax.Text.Trim().ToString();
        }
        objpartymaster.partymaster_EMAIL = txtemail.Text.Trim().ToString();
        if (txtwebsite.Text.Trim().ToString() != string.Empty)
        {
            objpartymaster.partymaster_WEBSITE = txtwebsite.Text.Trim().ToString();
        }
        objpartymaster.partymaster_PANNO = txtpanno.Text.Trim().ToString();
        objpartymaster.partymaster_CSTNO = txtcstno.Text.Trim().ToString();
        objpartymaster.partymaster_VATNO = txtvatno.Text.Trim().ToString();
        objpartymaster.partymaster_SERVICETAXNO = txtservicetaxno.Text.Trim().ToString();
        objpartymaster.partymaster_EXCISENO = txtexciseno.Text.Trim().ToString();
        objpartymaster.partymaster_EXCISERANGE = txtexciserange.Text.Trim().ToString();
        objpartymaster.partymaster_EXCISEDIVISION = txtexcisedivision.Text.Trim().ToString();
        objpartymaster.partymaster_EXCISECOLLECTRATE = txtexcisecollectrate.Text.Trim().ToString();
        string condition = "SRNO=" + ViewState["PARTYID"].ToString().Trim();
        if (objpartymaster.Insert(false, "partymaster", condition))
        {

            {
                partyaddressmaster objpartyaddressmaster = new partyaddressmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objpartyaddressmaster.partyaddressmaster_SRNO = -1;
                objpartyaddressmaster.partyaddressmaster_PARTYID = -1;
                objpartyaddressmaster.partyaddressmaster_ADDRESSTYPE = -1;
                objpartyaddressmaster.partyaddressmaster_ADDRESS = txtaddress.Text.Trim().ToString();
                objpartyaddressmaster.partyaddressmaster_CITYID = General.Parse<int>(ddlcity.SelectedValue.ToString()); ;
                objpartyaddressmaster.partyaddressmaster_CITYNAME = ddlcity.SelectedItem.Text.Trim().ToString(); ;
                objpartyaddressmaster.partyaddressmaster_STATEID = General.Parse<int>(ddlstate.SelectedValue.ToString()); ;
                objpartyaddressmaster.partyaddressmaster_STATENAME = ddlstate.SelectedItem.Text.Trim().ToString(); ;
                objpartyaddressmaster.partyaddressmaster_PINCODE = txtpin.Text.Trim().ToString(); ;
                objpartyaddressmaster.partyaddressmaster_STATUS = 0;
                string condition1 = "PARTYID=" + ViewState["PARTYID"].ToString().Trim() + " AND ADDRESSTYPE=1";
                if (objpartyaddressmaster.Insert(false, "partyaddressmaster", condition1))
                {
                }
                partyaddressmaster objpartyworkaddressmaster = new partyaddressmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objpartyworkaddressmaster.partyaddressmaster_SRNO = -1;
                objpartyworkaddressmaster.partyaddressmaster_PARTYID = -1;
                objpartyworkaddressmaster.partyaddressmaster_ADDRESSTYPE = -1;
                objpartyworkaddressmaster.partyaddressmaster_ADDRESS = txtworkaddress.Text.Trim().ToString();
                objpartyworkaddressmaster.partyaddressmaster_CITYID = General.Parse<int>(ddlworkcity.SelectedValue.ToString()); ;
                objpartyworkaddressmaster.partyaddressmaster_CITYNAME = ddlworkcity.SelectedItem.Text.Trim().ToString(); ;
                objpartyworkaddressmaster.partyaddressmaster_STATEID = General.Parse<int>(ddlworkstate.SelectedValue.ToString()); ;
                objpartyworkaddressmaster.partyaddressmaster_STATENAME = ddlworkstate.SelectedItem.Text.Trim().ToString(); ;
                objpartyworkaddressmaster.partyaddressmaster_PINCODE = txtworkpin.Text.Trim().ToString(); ;
                objpartyworkaddressmaster.partyaddressmaster_STATUS = 0;
                string condition2 = "PARTYID=" + ViewState["PARTYID"].ToString().Trim() + " AND ADDRESSTYPE=2";
                if (objpartyworkaddressmaster.Insert(false, "partyaddressmaster", condition2))
                {
                }


                if (memberrepeater.Items.Count > 0)
                {


                    int membercount = ((DataTable)ViewState["personaldata"]).Rows.Count;
                    for (int i = 0; i < memberrepeater.Items.Count; i++)
                    {
                        TextBox name = (TextBox)memberrepeater.Items[i].FindControl("txtpersonname");
                        DropDownList department = (DropDownList)memberrepeater.Items[i].FindControl("ddldepartment");
                        DropDownList designation = (DropDownList)memberrepeater.Items[i].FindControl("ddldesignation");
                        TextBox phone = (TextBox)memberrepeater.Items[i].FindControl("txtperphone");
                        TextBox email = (TextBox)memberrepeater.Items[i].FindControl("txtperemailid");
                        TextBox mobile = (TextBox)memberrepeater.Items[i].FindControl("txtpermobile");

                        if (i < membercount)
                        {
                            personalmaster objpersonal = new personalmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                            objpersonal.personalmaster_SRNO = -1;
                            objpersonal.personalmaster_PERSONNAME = name.Text.ToString().Trim();
                            objpersonal.personalmaster_EMAILID = email.Text.ToString().Trim();
                            objpersonal.personalmaster_PHONENO = phone.Text.ToString().Trim();
                            objpersonal.personalmaster_MOBILE = mobile.Text.ToString().Trim();
                            objpersonal.personalmaster_PERSONRELATIONID = -1;
                            string taxcondition = "SRNO=" + ((DataTable)ViewState["personaldata"]).Rows[i]["SRNO"].ToString().Trim();
                            if (objpersonal.Insert(false, "personalmaster", taxcondition))
                            {
                            }
                        }
                        else
                        {
                            personalmaster objpersonal = new personalmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                            objpersonal.personalmaster_SRNO = -1;
                            objpersonal.personalmaster_PERSONNAME = name.Text.ToString().Trim();
                            objpersonal.personalmaster_EMAILID = email.Text.ToString().Trim();
                            objpersonal.personalmaster_PHONENO = phone.Text.ToString().Trim();
                            objpersonal.personalmaster_MOBILE = mobile.Text.ToString().Trim();
                            objpersonal.personalmaster_PERSONRELATIONID = General.Parse<int>(ViewState["PARTYID"].ToString().Trim());
                            objpersonal.personalmaster_PERSONTYPE = "PARTY";
                            if (objpersonal.Insert(true, "personalmaster"))
                            {
                            }
                        }

                    }


                }
                string sqltax = "SELECT SRNO AS TAXID,TAXNAME,TAXVALUE,TAXUNIT FROM taxmaster WHERE STATUS=0";
                Handler hdntax = new Handler();
                DataTable dttax = hdntax.GetTable(sqltax);

                SqlConnection Connection = new SqlConnection("Data Source=50.28.62.129,1433;Network Library=DBMSSOCN;Initial Catalog=db_fuel;User ID=fuel;Password= lSa2@11h");
                string qry = "delete from partytaxmaster where partyid=" + ViewState["PARTYID"].ToString();

                Connection.Open();
                SqlCommand com = new SqlCommand(qry, Connection);
                com.ExecuteNonQuery();
                Connection.Close();

                for (int k = 0; k < dttax.Rows.Count; k++)
                {
                    if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "VAT" && rdvat.Checked == true)
                    {
                        partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                        objpartytax.partytaxmaster_SRNO = -1;
                        objpartytax.partytaxmaster_PARTYID = General.Parse<int>(ViewState["PARTYID"].ToString());
                        objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                        objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                        objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                        objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                        if (objpartytax.Insert(true, "partytaxmaster"))
                        {
                        }
                    }
                    if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "CST" && rdexcise.Checked == true)
                    {
                        partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                        objpartytax.partytaxmaster_SRNO = -1;
                        objpartytax.partytaxmaster_PARTYID = General.Parse<int>(ViewState["PARTYID"].ToString());
                        objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                        objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                        objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                        objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                        if (objpartytax.Insert(true, "partytaxmaster"))
                        {
                        }
                    }
                    if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "SERVICE TAX" && rdserviceapplicable.Checked == true)
                    {
                        partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                        objpartytax.partytaxmaster_SRNO = -1;
                        objpartytax.partytaxmaster_PARTYID = General.Parse<int>(ViewState["PARTYID"].ToString());
                        objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                        objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                        objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                        objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                        if (objpartytax.Insert(true, "partytaxmaster"))
                        {
                        }
                    }
                    if (dttax.Rows[k]["TAXNAME"].ToString().Trim() == "EXCISE" && rdexciseapplicable.Checked == true)
                    {
                        partytaxmaster objpartytax = new partytaxmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                        objpartytax.partytaxmaster_SRNO = -1;
                        objpartytax.partytaxmaster_PARTYID = General.Parse<int>(ViewState["PARTYID"].ToString());
                        objpartytax.partytaxmaster_TAXID = General.Parse<int>(dttax.Rows[k]["TAXID"].ToString());
                        objpartytax.partytaxmaster_TAXNAME = dttax.Rows[k]["TAXNAME"].ToString();
                        objpartytax.partytaxmaster_TAXVALUE = General.Parse<double>(dttax.Rows[k]["TAXVALUE"].ToString());
                        objpartytax.partytaxmaster_TAXUNIT = dttax.Rows[k]["TAXUNIT"].ToString();
                        if (objpartytax.Insert(true, "partytaxmaster"))
                        {
                        }
                    }
                }
            }
        }
        MessageBox("Party Updated Successfully");
        Response.Redirect("partylist.aspx?id=1");
    }