protected void btnsubmit_Click(object sender, EventArgs e) { inventorymaster objmaster = new inventorymaster(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objmaster.inventorymaster_SRNO = -1; objmaster.inventorymaster_CMPID = General.Parse<int>(Session["cmpid"].ToString()); objmaster.inventorymaster_COALID = General.Parse<int>(ddlcoaltype.SelectedValue.Trim().ToString()); objmaster.inventorymaster_COALTYPE = ddlcoaltype.SelectedItem.Text.Trim().ToString(); objmaster.inventorymaster_DATE = txtdate.Text.Trim().ToString(); objmaster.inventorymaster_DEPOTID = General.Parse<int>(ddldepot.SelectedValue.Trim().ToString()); objmaster.inventorymaster_PARTYID = General.Parse<int>(ddlparty.SelectedValue.Trim().ToString()); objmaster.inventorymaster_GRADE = ddlcoalgrade.SelectedItem.Text.Trim().ToString(); objmaster.inventorymaster_GRADEID = General.Parse<int>(ddlcoalgrade.SelectedValue.Trim().ToString()); objmaster.inventorymaster_QUANTITY = General.Parse<double>(txtquantity.Text.Trim().ToString()); objmaster.inventorymaster_TRNASACTIONTYPE = "OUTWARD"; objmaster.inventorymaster_TRANSPORTERID = General.Parse<int>(ddltransporter.SelectedValue.Trim().ToString()); objmaster.inventorymaster_VEHICLEID = General.Parse<int>(ddlvehicle.SelectedValue.Trim().ToString()); //objmaster.inventorymaster_VEHICLEID = 1; objmaster.inventorymaster_DESTINATION = txtdestination.Text.Trim().ToString(); objmaster.inventorymaster_TYPE = "LINKEDCUSTOMER"; objmaster.inventorymaster_STATUS = 0; objmaster.inventorymaster_DOID = -1; if (objmaster.Insert(true, "inventorymaster")) { ClearControls(); MessageBox("Coal Outward successfully"); } }
protected void btnsubmit_Click(object sender, EventArgs e) { inventorymaster objmaster = new inventorymaster(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objmaster.inventorymaster_SRNO = -1; objmaster.inventorymaster_CMPID = General.Parse<int>(Session["cmpid"].ToString()); objmaster.inventorymaster_COALID = General.Parse<int>(ddlcoaltype.SelectedValue.Trim().ToString()); objmaster.inventorymaster_COALTYPE = ddlcoaltype.SelectedItem.Text.Trim().ToString(); objmaster.inventorymaster_DATE = txtdate.Text.Trim().ToString(); objmaster.inventorymaster_DEPOTID = General.Parse<int>(ddldepot.SelectedValue.Trim().ToString()); objmaster.inventorymaster_DOID = -1; objmaster.inventorymaster_GRADEID = General.Parse<int>(ddlcoalgrade.SelectedValue.Trim().ToString()); objmaster.inventorymaster_GRADE = ddlcoalgrade.SelectedItem.Text.Trim().ToString(); objmaster.inventorymaster_QUANTITY = General.Parse<double>(txtquantity.Text.Trim().ToString()); objmaster.inventorymaster_TRNASACTIONTYPE = "OUTWARD"; objmaster.inventorymaster_TRANSPORTERID = General.Parse<int>(ddltransporter.SelectedValue.Trim().ToString()); objmaster.inventorymaster_VEHICLEID = General.Parse<int>(ddlvehicle.SelectedValue.Trim().ToString()); objmaster.inventorymaster_DESTINATION = txtdestination.Text.Trim(); objmaster.inventorymaster_TYPE = "DIRECTCUSTOMER"; objmaster.inventorymaster_STATUS = 0; objmaster.inventorymaster_PARTYID = -1; if (objmaster.Insert(true, "inventorymaster")) { string sqlmax = "SELECT MAX(SRNO) AS SRNO FROM INVENTORYMASTER IM WHERE CMPID=" + Session["cmpid"].ToString() + " AND COALID=" + ddlcoaltype.SelectedValue.Trim().ToString() + " AND GRADEID=" + ddlcoalgrade.SelectedValue.Trim().ToString() + " AND QUANTITY='" + txtquantity.Text.Trim().ToString() + "'"; Handler hdnmax = new Handler(); DataTable dtmax = hdnmax.GetTable(sqlmax); personalmaster objpersonal = new personalmaster(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objpersonal.personalmaster_SRNO = -1; objpersonal.personalmaster_PERSONNAME = txtpersonname.Text.ToString().Trim(); objpersonal.personalmaster_DESIGNATION = ddldesignation.SelectedItem.Text.Trim().ToString(); objpersonal.personalmaster_EMAILID = txtemailid.Text.ToString().Trim(); objpersonal.personalmaster_MOBILE = txtpersonno.Text.ToString().Trim(); objpersonal.personalmaster_PERSONRELATIONID = General.Parse<int>(dtmax.Rows[0][0].ToString()); objpersonal.personalmaster_PERSONTYPE = "SALE"; if (objpersonal.Insert(true, "personalmaster")) { string sqlmax1 = "SELECT MAX(SRNO) AS SRNO FROM PERSONALMASTER GM WHERE PERSONTYPE='SALE' AND PERSONRELATIONID='" + dtmax.Rows[0][0].ToString() + "'"; Handler hdnmax1 = new Handler(); DataTable dtmax1 = hdnmax1.GetTable(sqlmax1); inventorymaster objmaster1 = new inventorymaster(HttpContext.Current.Server.MapPath("~/XML/database.xml")); objmaster1.inventorymaster_SRNO = -1; objmaster1.inventorymaster_CMPID = -1; objmaster1.inventorymaster_COALID = -1; objmaster1.inventorymaster_DEPOTID = -1; objmaster1.inventorymaster_DOID = -1; objmaster1.inventorymaster_GRADEID = -1; objmaster1.inventorymaster_QUANTITY = -1; objmaster1.inventorymaster_TRANSPORTERID = -1; objmaster1.inventorymaster_VEHICLEID = -1; objmaster1.inventorymaster_STATUS = -1; objmaster1.inventorymaster_PARTYID = General.Parse<int>(dtmax.Rows[0][0].ToString().Trim()); string condition = "SRNO=" + dtmax.Rows[0][0].ToString(); if (objmaster1.Insert(false, "inventorymaster", condition)) { } } } ClearControls(); MessageBox("Sales Successfully"); }