protected void btnsubmit_Click(object sender, EventArgs e)
    {
        domaster objdomaster = new domaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
        objdomaster.domaster_DOID = -1;
        objdomaster.domaster_DOFOR = ddldotype.SelectedValue.Trim().ToString();
        objdomaster.domaster_COLLIERYID = General.Parse<int>(ddlcolliery.SelectedValue.Trim().ToString());
        objdomaster.domaster_DONO = txtdono.Text.Trim();
        objdomaster.domaster_CMPID = General.Parse<int>(Session["cmpid"].ToString().Trim());
        objdomaster.domaster_DODATE = txtdodate.Text.Trim();
        if (ddldotype.SelectedValue.Trim().ToString() == "AUCTION")
        {
            objdomaster.domaster_PARTYID = General.Parse<int>(ddlauction.SelectedValue.Trim().ToString());
        }
        else
        {
            objdomaster.domaster_PARTYID = General.Parse<int>(ddlparty.SelectedValue.Trim().ToString());
        }
        objdomaster.domaster_DESTINATION = txtdestination.Text.Trim().ToString();
        objdomaster.domaster_MONTHID=General.Parse<int>(ddlmonth.SelectedValue.Trim().ToString());
        objdomaster.domaster_MONTH=ddlmonth.SelectedItem.Text.Trim().ToString();
        objdomaster.domaster_STATUS = 0;
        if (objdomaster.Insert(true, "domaster"))
        {
            string sqlmax = "SELECT MAX(DOID) AS DOID FROM DOMASTER DM WHERE DM.DONO='" + txtdono.Text.Trim().ToString() + "' AND DM.STATUS=0";
            Handler hdnmax = new Handler();
            DataTable dtmax = hdnmax.GetTable(sqlmax);
            if (dtmax.Rows.Count > 0)
            {
                dodetailmaster objdodetailmaster = new dodetailmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objdodetailmaster.dodetailmaster_SRNO = -1;
                objdodetailmaster.dodetailmaster_COALID=General.Parse<int>(ddlcoaltype.SelectedValue.ToString().Trim());
                objdodetailmaster.dodetailmaster_GRADE = ddlcoalgrade.SelectedItem.Text.Trim().ToString();
                objdodetailmaster.dodetailmaster_DOID = General.Parse<int>(dtmax.Rows[0][0].ToString().Trim());
                objdodetailmaster.dodetailmaster_QUANTITY = General.Parse<double>(txtquantity.Text.ToString().Trim());

                objdodetailmaster.dodetailmaster_BASICCHARGES = General.Parse<double>(txtbasiccharges.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_SIZINGCHARGES = General.Parse<double>(txtsizingcharges.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_STC = General.Parse<double>(txtstc.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_SED = General.Parse<double>(txtsed.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_ROYALTY = General.Parse<double>(txtroyalty.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_CENTALEXCISE = General.Parse<double>(txtexcise.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_CLEANENERGYNESS = General.Parse<double>(txtcleanenergyness.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_MPRDTAX = General.Parse<double>(txtmpgatsava.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_TRANSITTAX = General.Parse<double>(txttransit.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_ENTRYFEE = General.Parse<double>(txtentryfee.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_VATCST = General.Parse<double>(txtvatcst.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_TCS = General.Parse<double>(txttcs.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_TOTALAMOUNT = General.Parse<double>(txttotal.Text.ToString().Trim());
                objdodetailmaster.dodetailmaster_STATUS = 0;
                if (objdodetailmaster.Insert(true, "dodetailmaster"))
                {
                }

                for (int i = 0; i < paymentrepeater.Items.Count; i++)
                {

                    TextBox txtpmtno = (TextBox)paymentrepeater.Items[i].FindControl("txtpmtno");
                    DropDownList ddlpaymenttype = (DropDownList)paymentrepeater.Items[i].FindControl("ddlpaymenttype");
                    DropDownList ddlbank = (DropDownList)paymentrepeater.Items[i].FindControl("ddlbank");
                    TextBox txtpmtdate = (TextBox)paymentrepeater.Items[i].FindControl("txtpmtdate");
                    TextBox txtamount = (TextBox)paymentrepeater.Items[i].FindControl("txtamount");


                    paymentmaster objpayment = new paymentmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                    objpayment.paymentmaster_SRNO = -1;
                    objpayment.paymentmaster_PAYMENTTYPE = ddlpaymenttype.SelectedItem.Text.Trim().ToString();
                    objpayment.paymentmaster_PAYMENTNO = General.Parse<int>(txtpmtno.Text.Trim());
                    objpayment.paymentmaster_PAYMENTDATE = txtpmtdate.Text.Trim().ToString();
                    objpayment.paymentmaster_RELATIONTYPE = "DO";
                    objpayment.paymentmaster_RELATIONID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                    objpayment.paymentmaster_BANKNAME = ddlbank.SelectedItem.Text.Trim().ToString();
                    objpayment.paymentmaster_AMOUNT= General.Parse<double>(txtamount.Text.Trim());
                    objpayment.paymentmaster_STATUS = 0;
                    if (objpayment.Insert(true, "paymentmaster"))
                    {
                    }
                }
                foreach (ListItem aListItem in chktermslist.Items)
                {
                    if (aListItem.Selected)
                    {
                        termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                        objterms.termstable_SRNO = -1;
                        objterms.termstable_STATUS = 0;
                        objterms.termstable_PARTYTYPE = "DO";
                        objterms.termstable_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                        objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                        objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                        objterms.termstable_TERMSVALUE = -1;
                        if (objterms.Insert(true, "termstable"))
                        {
                        }
                    }
                }
            }
            Response.Redirect("dolist.aspx");
        }
    }
 protected void btnsubmit5_Click(object sender, EventArgs e)
 {
     contractdetailmaster contractdetail = new contractdetailmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
     contractdetail.contractdetailmaster_SRNO = -1;
     contractdetail.contractdetailmaster_CONTRACTID = -1;
     if (txtarbitration.Text.Trim().ToString() != string.Empty)
     {
         contractdetail.contractdetailmaster_ARBITRATION = txtarbitration.Text.Trim().ToString();
     }
     if (txttermination.Text.Trim().ToString() != string.Empty)
     {
         contractdetail.contractdetailmaster_TERMINATION = txttermination.Text.Trim().ToString();
     }
     if (txtforcemajeure.Text.Trim().ToString() != string.Empty)
     {
         contractdetail.contractdetailmaster_FORCEMAJEURE = txtforcemajeure.Text.Trim().ToString();
     }
     contractdetail.contractdetailmaster_STATUS = -1;
     string condition = "CONTRACTID=" + ViewState["contractid"].ToString() + " AND STATUS=0";
     if (contractdetail.Insert(false, "contractdetailmaster", condition))
     {
     }
     foreach (ListItem aListItem in chkotherterms.Items)
     {
         if (aListItem.Selected)
         {
             termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
             objterms.termstable_SRNO = -1;
             objterms.termstable_STATUS = 0;
             objterms.termstable_PARTYTYPE = "CONTRACT";
             objterms.termstable_PARTYID = General.Parse<int>(ViewState["contractid"].ToString());
             objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
             objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
             objterms.termstable_TERMSVALUE = -1;
             if (objterms.Insert(true, "termstable"))
             {
             }
         }
     }
     ScriptManager.RegisterStartupScript(this, this.GetType(), "msg1", "ShowDiv6();", true);
 }
    protected void btnsubmit3_Click(object sender, EventArgs e)
    {

        foreach (ListItem aListItem in chklowerbtu.Items)
        {
            if (aListItem.Selected)
            {
                termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objterms.termstable_SRNO = -1;
                objterms.termstable_STATUS = 0;
                objterms.termstable_PARTYTYPE = "CONTRACT";
                objterms.termstable_PARTYID = General.Parse<int>(ViewState["contractid"].ToString());
                objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                objterms.termstable_TERMSVALUE = -1;
                if (objterms.Insert(true, "termstable"))
                {
                }
            }
        }
        foreach (ListItem aListItem in chkashpenalty.Items)
        {
            if (aListItem.Selected)
            {
                termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objterms.termstable_SRNO = -1;
                objterms.termstable_STATUS = 0;
                objterms.termstable_PARTYTYPE = "CONTRACT";
                objterms.termstable_PARTYID = General.Parse<int>(ViewState["contractid"].ToString());
                objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                objterms.termstable_TERMSVALUE = -1;
                if (objterms.Insert(true, "termstable"))
                {
                }
            }
        }
        contractdetailmaster contractdetail = new contractdetailmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
        contractdetail.contractdetailmaster_SRNO = -1;
        contractdetail.contractdetailmaster_CONTRACTID = -1;
        if (txtdeleysupply.Text.Trim().ToString() != string.Empty)
        {
            contractdetail.contractdetailmaster_SUPPLYDELEYDETAILS = txtdeleysupply.Text.Trim().ToString();
        }
        if (txtexcesssupply.Text.Trim().ToString() != string.Empty)
        {
            contractdetail.contractdetailmaster_EXCESSSUPPLY = txtexcesssupply.Text.Trim().ToString();
        }
        if (txtweighment.Text.Trim().ToString() != string.Empty)
        {
            contractdetail.contractdetailmaster_WEIGHTMENT = txtweighment.Text.Trim().ToString();
        }
        if (txtsecuritydeposit.Text.Trim().ToString() != string.Empty)
        {
            contractdetail.contractdetailmaster_SECURITYDEPOSIT = txtsecuritydeposit.Text.Trim().ToString();
        }
        contractdetail.contractdetailmaster_STATUS = -1;
        string condition = "CONTRACTID=" + ViewState["contractid"].ToString() +" AND STATUS=0";
        if (contractdetail.Insert(false, "contractdetailmaster",condition))
        {
        }
        ScriptManager.RegisterStartupScript(this, this.GetType(), "msg1", "ShowDiv4();", true);
    }
    protected void btnsubmit2_Click(object sender, EventArgs e)
    {
        contractdetailmaster contractdetail = new contractdetailmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
        contractdetail.contractdetailmaster_SRNO = -1;
        contractdetail.contractdetailmaster_CONTRACTID = General.Parse<int>(ViewState["contractid"].ToString());
        if (txtworkdetails.Text.Trim().ToString() != string.Empty)
        {
            contractdetail.contractdetailmaster_WORKDETAILS = txtworkdetails.Text.Trim().ToString();
        }
        if (txtdeliverydetails.Text.Trim().ToString() != string.Empty)
        {
            contractdetail.contractdetailmaster_DELIVERYDETAILS = txtdeliverydetails.Text.Trim().ToString();
        }
        contractdetail.contractdetailmaster_STATUS = 0;
        if (contractdetail.Insert(true, "contractdetailmaster"))
        {
        }

        foreach (ListItem aListItem in chkqualityguarantity.Items)
        {
            if (aListItem.Selected)
            {
                termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objterms.termstable_SRNO = -1;
                objterms.termstable_STATUS = 0;
                objterms.termstable_PARTYTYPE = "CONTRACT";
                objterms.termstable_PARTYID = General.Parse<int>(ViewState["contractid"].ToString());
                objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                objterms.termstable_TERMSVALUE = -1;
                if (objterms.Insert(true, "termstable"))
                {
                }
            }
        }
        foreach (ListItem aListItem in chkqualityanalysis.Items)
        {
            if (aListItem.Selected)
            {
                termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objterms.termstable_SRNO = -1;
                objterms.termstable_STATUS = 0;
                objterms.termstable_PARTYTYPE = "CONTRACT";
                objterms.termstable_PARTYID = General.Parse<int>(ViewState["contractid"].ToString());
                objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                objterms.termstable_TERMSVALUE = -1;
                if (objterms.Insert(true, "termstable"))
                {
                }
            }
        }
        foreach (ListItem aListItem in chkpaymentterms.Items)
        {
            if (aListItem.Selected)
            {
                termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objterms.termstable_SRNO = -1;
                objterms.termstable_STATUS = 0;
                objterms.termstable_PARTYTYPE = "CONTRACT";
                objterms.termstable_PARTYID = General.Parse<int>(ViewState["contractid"].ToString());
                objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                objterms.termstable_TERMSVALUE = -1;
                if (objterms.Insert(true, "termstable"))
                {
                }
            }
        }

        ScriptManager.RegisterStartupScript(this, this.GetType(), "msg1", "ShowDiv3();", true);
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        
        string partyid = string.Empty;
        string contactperson = string.Empty;
        partyid = ddlparty.SelectedValue.ToString();
        quotationmaster objquotation = new quotationmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
        objquotation.quotationmaster_QUOTATIONID = -1;
        objquotation.quotationmaster_PARTYID=General.Parse<int>(partyid);
         objquotation.quotationmaster_PARTYTYPE = 1;
        objquotation.quotationmaster_CONTACTPERSON=General.Parse<int>(contactperson);
        objquotation.quotationmaster_DATE = txtdate.Text.Trim().ToString();
        objquotation.quotationmaster_EXPIRYDATE = txtexpirydate.Text.Trim().ToString();
        if (txtrefno.Text.Trim().ToString() != string.Empty)
        {
            objquotation.quotationmaster_REFNO = txtrefno.Text.Trim().ToString();
        }
        objquotation.quotationmaster_COALCOST = General.Parse<double>(txtfinalcoalcost.Text.Trim().ToString());
        objquotation.quotationmaster_TAXCOST = General.Parse<double>(txtfinaltax.Text.Trim().ToString());
        objquotation.quotationmaster_TRANSPORTATIONCOST = General.Parse<double>(txttransportationcost.Text.Trim().ToString());
        objquotation.quotationmaster_TOTALCOST = General.Parse<double>(txtfinalcoalcost.Text.Trim().ToString());
        objquotation.quotationmaster_STATUS = 0;
        if (objquotation.Insert(true, "quotationmaster"))
        {
            string sqlmax = "SELECT MAX(QUOTATIONID) AS QUOTATIONID FROM QUOTATIONMASTER GM WHERE PARTYID=" + partyid;
            Handler hdnmax = new Handler();
            DataTable dtmax = hdnmax.GetTable(sqlmax);

            quotationspecification objspecification = new quotationspecification(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
            objspecification.quotationspecification_SRNO = -1;
            objspecification.quotationspecification_QUOTATIONID = General.Parse<int>(dtmax.Rows[0][0].ToString());
            objspecification.quotationspecification_COALTYPE = ddlcoalgrade.SelectedItem.Text;
            objspecification.quotationspecification_COALTYPEID = General.Parse<int>(ddlcoalgrade.SelectedValue.ToString());
            objspecification.quotationspecification_COALSOURCE = ddlcoalsource.SelectedItem.Text;
            objspecification.quotationspecification_COALSOURCEID = General.Parse<int>(ddlcoalsource.SelectedValue.ToString());
            objspecification.quotationspecification_COALQUANTITY = General.Parse<double>(txtcoalquantity.Text.Trim().ToString());
            objspecification.quotationspecification_COALRATE = General.Parse<double>(txtcoalrate.Text.Trim().ToString());
            objspecification.quotationspecification_COALSIZEMIN = General.Parse<double>(txtcoalsizemin.Text.Trim().ToString());
            objspecification.quotationspecification_COALSIZEMAX = General.Parse<double>(txtcoalsizemax.Text.Trim().ToString());
            objspecification.quotationspecification_GCV = General.Parse<double>(txtgcv.Text.Trim().ToString());
            objspecification.quotationspecification_GCVERROR = General.Parse<double>(txtgcv.Text.Trim().ToString());
            objspecification.quotationspecification_MOISTURE = General.Parse<double>(txtmoisture.Text.Trim().ToString());
            objspecification.quotationspecification_MOISTUREERROR = General.Parse<double>(txtmoistureerror.Text.Trim().ToString());
            if (objspecification.Insert(true, "quotationspecification"))
            {
            }
            for (int t = 0; t < ((DataTable)Session["tax"]).Rows.Count; t++)
            {
                string sqltax = "SELECT SRNO,TAXNAME,TAXUNIT,TAXVALUE FROM TAXMASTER TM WHERE TM.STATUS=0 AND TM.TAXNAME='" + ((DataTable)Session["tax"]).Rows[t]["TAXNAME"].ToString().Trim() + "' AND TM.TAXVALUE=" + ((DataTable)Session["tax"]).Rows[t]["TAXVALUE"].ToString().Trim();
                Handler hdntax = new Handler();
                DataTable dttax = hdntax.GetTable(sqltax);
                taxationmaster objtax = new taxationmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objtax.taxationmaster_SRNO = -1;
                objtax.taxationmaster_TAXPARTYTYPE = "QUOTATION";
                objtax.taxationmaster_TAXPARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                objtax.taxationmaster_TAXID = General.Parse<int>(dttax.Rows[0]["SRNO"].ToString());
                objtax.taxationmaster_TAXNAME = dttax.Rows[0]["TAXNAME"].ToString().Trim();
                objtax.taxationmaster_TAXVALUE = General.Parse<double>(dttax.Rows[0]["TAXVALUE"].ToString().Trim());
                objtax.taxationmaster_TAXUNIT = dttax.Rows[0]["TAXUNIT"].ToString().Trim();
                objtax.taxationmaster_STATUS = 0;
                if (objtax.Insert(true, "taxationmaster"))
                {
                }
            }
            foreach (ListItem aListItem in chktermslist.Items)
            {
                if (aListItem.Selected)
                {
                    termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                    objterms.termstable_SRNO = -1;
                    objterms.termstable_STATUS = 0;
                    objterms.termstable_PARTYTYPE = "QUOTATION";
                    objterms.termstable_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString());
                    objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                    objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                    objterms.termstable_TERMSVALUE =-1;
                    if (objterms.Insert(true, "termstable"))
                    {
                    }
                }
            }
                     
           
        }
        Response.Redirect("Quotationlist.aspx?ID=1");
    }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {

        string partyid = string.Empty;
        string contactperson = string.Empty;
        partyid = ddlparty.SelectedValue.ToString();
        quotationmaster objquotation = new quotationmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
        objquotation.quotationmaster_QUOTATIONID = -1;
        objquotation.quotationmaster_PARTYID = General.Parse<int>(partyid);
        objquotation.quotationmaster_PARTYTYPE = 1;
        objquotation.quotationmaster_CONTACTPERSON = General.Parse<int>(contactperson);
        objquotation.quotationmaster_DATE = txtdate.Text.Trim().ToString();
        objquotation.quotationmaster_EXPIRYDATE = txtexpirydate.Text.Trim().ToString();
        if (txtrefno.Text.Trim().ToString() != string.Empty)
        {
            objquotation.quotationmaster_REFNO = txtrefno.Text.Trim().ToString();
        }
        objquotation.quotationmaster_COALCOST = General.Parse<double>(txtfinalcoalcost.Text.Trim().ToString());
        objquotation.quotationmaster_TAXCOST = General.Parse<double>(txtfinaltax.Text.Trim().ToString());
        objquotation.quotationmaster_TRANSPORTATIONCOST = General.Parse<double>(txttransportationcost.Text.Trim().ToString());
        objquotation.quotationmaster_TOTALCOST = General.Parse<double>(txtfinalcoalcost.Text.Trim().ToString());
        objquotation.quotationmaster_STATUS = 0;
        string condition = "QUOTATIONID=" + ViewState["QUOTATIONID"].ToString();
        if (objquotation.Insert(false, "quotationmaster", condition))
        {
            quotationspecification objspecification = new quotationspecification(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
            objspecification.quotationspecification_SRNO = -1;
            objspecification.quotationspecification_QUOTATIONID = -1;
            objspecification.quotationspecification_COALTYPE = ddlcoalgrade.SelectedItem.Text;
            objspecification.quotationspecification_COALTYPEID = General.Parse<int>(ddlcoalgrade.SelectedValue.ToString());
            objspecification.quotationspecification_COALSOURCE = ddlcoalsource.SelectedItem.Text;
            objspecification.quotationspecification_COALSOURCEID = General.Parse<int>(ddlcoalsource.SelectedValue.ToString());
            objspecification.quotationspecification_COALQUANTITY = General.Parse<double>(txtcoalquantity.Text.Trim().ToString());
            objspecification.quotationspecification_COALRATE = General.Parse<double>(txtcoalrate.Text.Trim().ToString());
            objspecification.quotationspecification_COALSIZEMIN = General.Parse<double>(txtcoalsizemin.Text.Trim().ToString());
            objspecification.quotationspecification_COALSIZEMAX = General.Parse<double>(txtcoalsizemax.Text.Trim().ToString());
            objspecification.quotationspecification_GCV = General.Parse<double>(txtgcv.Text.Trim().ToString());
            objspecification.quotationspecification_GCVERROR = General.Parse<double>(txtgcv.Text.Trim().ToString());
            objspecification.quotationspecification_MOISTURE = General.Parse<double>(txtmoisture.Text.Trim().ToString());
            objspecification.quotationspecification_MOISTUREERROR = General.Parse<double>(txtmoistureerror.Text.Trim().ToString());
            if (objspecification.Insert(false, "quotationspecification", condition))
            {
            }
            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 taxationmaster where TAXPARTYTYPE='QUOTATION' AND TAXPARTYID=" + ViewState["QUOTATIONID"].ToString();

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

            for (int t = 0; t < ((DataTable)Session["tax"]).Rows.Count; t++)
            {
                string sqltax = "SELECT SRNO,TAXNAME,TAXUNIT,TAXVALUE FROM TAXMASTER TM WHERE TM.STATUS=0 AND TM.TAXNAME='" + ((DataTable)Session["tax"]).Rows[t]["TAXNAME"].ToString().Trim() + "' AND TM.TAXVALUE=" + ((DataTable)Session["tax"]).Rows[t]["TAXVALUE"].ToString().Trim();
                Handler hdntax = new Handler();
                DataTable dttax = hdntax.GetTable(sqltax);
                taxationmaster objtax = new taxationmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                objtax.taxationmaster_SRNO = -1;
                objtax.taxationmaster_TAXPARTYTYPE = "QUOTATION";
                objtax.taxationmaster_TAXPARTYID = General.Parse<int>(ViewState["QUOTATIONID"].ToString());
                objtax.taxationmaster_TAXID = General.Parse<int>(dttax.Rows[0]["SRNO"].ToString());
                objtax.taxationmaster_TAXNAME = dttax.Rows[0]["TAXNAME"].ToString().Trim();
                objtax.taxationmaster_TAXVALUE = General.Parse<double>(dttax.Rows[0]["TAXVALUE"].ToString().Trim());
                objtax.taxationmaster_TAXUNIT = dttax.Rows[0]["TAXUNIT"].ToString().Trim();
                objtax.taxationmaster_STATUS = 0;
                if (objtax.Insert(true, "taxationmaster"))
                {
                }
            }

            string qry1 = "delete from termstable where partytype='QUOTATION' AND PARTYID=" + ViewState["QUOTATIONID"].ToString();

            Connection.Open();
            SqlCommand com1 = new SqlCommand(qry1, Connection);
            com1.ExecuteNonQuery();
            Connection.Close();
            foreach (ListItem aListItem in chktermslist.Items)
            {
                if (aListItem.Selected)
                {
                    termstable objterms = new termstable(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
                    objterms.termstable_SRNO = -1;
                    objterms.termstable_STATUS = 0;
                    objterms.termstable_PARTYTYPE = "QUOTATION";
                    objterms.termstable_PARTYID = General.Parse<int>(ViewState["QUOTATIONID"].ToString());
                    objterms.termstable_TERMSID = General.Parse<int>(aListItem.Value.ToString().Trim());
                    objterms.termstable_TERMS = aListItem.Text.Trim().ToString();
                    objterms.termstable_TERMSVALUE = -1;
                    if (objterms.Insert(true, "termstable"))
                    {
                    }
                }
            }


        }
        Response.Redirect("Quotationlist.aspx?ID=2");
    }