protected void btnsubmit_Click(object sender, EventArgs e) { auctionmaster objauctionmaster = new auctionmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objauctionmaster.auctionmaster_AUCTIONID = -1; objauctionmaster.auctionmaster_AUCTIONNAME = txtauctionname.Text.Trim().ToString(); objauctionmaster.auctionmaster_CMPID = General.Parse<int>(Session["cmpid"].ToString()); objauctionmaster.auctionmaster_AUCTIONDATE = txtauctiondate.Text.Trim().ToString(); objauctionmaster.auctionmaster_STARTDATE = txtstartdate.Text.Trim().ToString(); objauctionmaster.auctionmaster_ENDDATE = txtenddate.Text.Trim().ToString(); objauctionmaster.auctionmaster_DESCRIPTION = txtdescription.Text.Trim().ToString(); objauctionmaster.auctionmaster_STATUS = 0; if (objauctionmaster.Insert(true, "auctionmaster")) { string sqlmax = "SELECT MAX(AM.AUCTIONID) FROM AUCTIONMASTER AM WHERE AM.STATUS=0 AND AM.AUCTIONNAME='"+txtauctionname.Text.Trim().ToString()+"' AND"+ " AM.AUCTIONDATE='" + txtauctiondate.Text.Trim().ToString() + "' AND AM.CMPID=" + Session["cmpid"].ToString(); Handler hdnmax = new Handler(); DataTable dtmax = hdnmax.GetTable(sqlmax); if (dtmax.Rows.Count > 0 && coaltyperepeater.Items.Count > 0) { for (int i = 0; i < coaltyperepeater.Items.Count; i++) { DropDownList ddlcoaltype = (DropDownList)coaltyperepeater.Items[i].FindControl("ddlcoaltype"); DropDownList ddlcoalgrade = (DropDownList)coaltyperepeater.Items[i].FindControl("ddlcoalgrade"); DropDownList ddlquantityunit = (DropDownList)coaltyperepeater.Items[i].FindControl("ddlquantityunit"); TextBox txtcoalrate = (TextBox)coaltyperepeater.Items[i].FindControl("txtcoalrate"); TextBox txtquantity = (TextBox)coaltyperepeater.Items[i].FindControl("txtquantity"); auctionspecification objspecification = new auctionspecification(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objspecification.auctionspecification_SRNO = -1; objspecification.auctionspecification_CONTRACTTYPE = "AUCTION"; objspecification.auctionspecification_CONTRACTID = General.Parse<int>(dtmax.Rows[0][0].ToString()); objspecification.auctionspecification_COALTYPE = ddlcoaltype.SelectedItem.Text.Trim(); objspecification.auctionspecification_GRADE = ddlcoalgrade.SelectedItem.Text.Trim(); objspecification.auctionspecification_QUANTITY = General.Parse<double>(txtquantity.Text.Trim().ToString()); objspecification.auctionspecification_RATE = General.Parse<double>(txtcoalrate.Text.Trim().ToString()); objspecification.auctionspecification_QUANTITYUNIT = ddlquantityunit.SelectedValue.ToString(); objspecification.auctionspecification_STATUS = 0; if (objspecification.Insert(true, "auctionspecification")) { } } } Response.Redirect("auctiondetails.aspx?AUCTIONID=" + dtmax.Rows[0][0].ToString().Trim()); } }
protected void btnupdate_Click(object sender, EventArgs e) { auctionmaster objauctionmaster = new auctionmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objauctionmaster.auctionmaster_AUCTIONID = -1; objauctionmaster.auctionmaster_AUCTIONNAME = txtauctionname.Text.Trim().ToString(); objauctionmaster.auctionmaster_CMPID = -1; objauctionmaster.auctionmaster_AUCTIONDATE = txtauctiondate.Text.Trim().ToString(); objauctionmaster.auctionmaster_STARTDATE = txtstartdate.Text.Trim().ToString(); objauctionmaster.auctionmaster_ENDDATE = txtenddate.Text.Trim().ToString(); objauctionmaster.auctionmaster_DESCRIPTION = txtdescription.Text.Trim().ToString(); objauctionmaster.auctionmaster_STATUS =General.Parse<int>(ddlstatus.SelectedValue.Trim().ToString()); string condition = "AUCTIONID=" + ViewState["AUCTIONID"].ToString().Trim(); if (objauctionmaster.Insert(false, "auctionmaster", condition)) { if (coaltyperepeater.Items.Count > 0) { for (int i = 0; i < coaltyperepeater.Items.Count; i++) { DropDownList ddlcoaltype = (DropDownList)coaltyperepeater.Items[i].FindControl("ddlcoaltype"); DropDownList ddlcoalgrade = (DropDownList)coaltyperepeater.Items[i].FindControl("ddlcoalgrade"); DropDownList ddlquantityunit = (DropDownList)coaltyperepeater.Items[i].FindControl("ddlquantityunit"); TextBox txtcoalrate = (TextBox)coaltyperepeater.Items[i].FindControl("txtcoalrate"); TextBox txtquantity = (TextBox)coaltyperepeater.Items[i].FindControl("txtquantity"); auctionspecification objspecification = new auctionspecification(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objspecification.auctionspecification_SRNO = -1; objspecification.auctionspecification_CONTRACTID = -1; objspecification.auctionspecification_COALTYPE = ddlcoaltype.SelectedItem.Text.Trim(); objspecification.auctionspecification_GRADE = ddlcoalgrade.SelectedItem.Text.Trim(); objspecification.auctionspecification_QUANTITY = General.Parse<double>(txtquantity.Text.Trim().ToString()); objspecification.auctionspecification_RATE = General.Parse<double>(txtcoalrate.Text.Trim().ToString()); objspecification.auctionspecification_QUANTITYUNIT = ddlquantityunit.SelectedValue.ToString(); objspecification.auctionspecification_STATUS = 0; string condition1 = "CONTRACTTYPE='AUCTION' AND CONTRACTID=" + ViewState["AUCTIONID"].ToString().Trim(); if (objspecification.Insert(false, "auctionspecification", condition1)) { } } } } }