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"); }