public void GetDataGridValues(int iCompanyID, int iSuppCompanyID, string StrVClass, string VendorID, int Status) { //Supplier oSupplier = new Supplier(); Supplier_New objSupplier = new Supplier_New(); DataSet ds = new DataSet(); //ds = oSupplier.GetSupplierStatusFromTradingRelation(iCompanyID,iSuppCompanyID,StrVClass,VendorID,Status); ds = objSupplier.GetSupplierStatusFromTradingRelation(iCompanyID, iSuppCompanyID, StrVClass, VendorID, Status); grdApprover.DataSource = ds; grdApprover.DataBind(); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { grdApprover.Visible = true; lblMessage.Text = ""; } else { grdApprover.Visible = false; lblMessage.Text = "Sorry no records found."; } } else { grdApprover.Visible = false; lblMessage.Text = "Sorry no records found."; } } else { grdApprover.Visible = false; lblMessage.Text = "Sorry no records found."; } }
private void btnSave_Click(object sender, System.EventArgs e) { Supplier_New objAddApproval = new Supplier_New(); int IretVal = 0; string iCounty = ""; string iCountry = ""; string NetWorkID = ""; string sVendorClass = ""; string Currency = "GBP"; //blocked by kuntal karar on 03.03.2015--------------------- // Supplier objSupp = new Supplier(); //------------------Added by kuntal karar on 03.03.2015-----for pt. no. 27----------------------------------- //--------------------------------------------------------------------------------------------- if (iTradingID == 0) { NetWorkID = System.Guid.NewGuid().ToString().Substring(0, 11).Trim(); ViewState["NetWorkID"] = NetWorkID; } sVendorClass = thtVendorClass.Text.Trim(); iCounty = ddlCounty.SelectedItem.Text.Trim(); iCountry = ddlCountry.SelectedItem.Text.Trim(); if (Convert.ToString(cboCurrencyType.SelectedItem.Text) != "Select Currency") { Currency = Convert.ToString(cboCurrencyType.SelectedItem.Text); } //----adding by Subha Das 9th January 2015 string NominalCodeID1 = ""; string NominalCodeID2 = ""; if (txtNominal1.Text.ToString() != "") { NominalCodeID1 = txtNominal1.Text.Trim().Substring(0, txtNominal1.Text.Trim().IndexOf('/')); // NominalCodeID1 = txtNominal1.Text.Trim(); } if (txtNominal2.Text.ToString() != "") { NominalCodeID2 = txtNominal2.Text.Trim().Substring(0, txtNominal2.Text.Trim().IndexOf('/')); } //IretVal = objSupp.SaveCompanyDetailsAndTradingRelations(iTradingID, Convert.ToInt32(ddlCompany.SelectedValue), txtSupplier.Text.Trim(), NetWorkID, txtAddress1.Text.Trim(), // txtAddress2.Text.ToString(), txtAddress3.Text.ToString(), thtPostCode.Text.ToString(), iCounty, iCountry, txtTelephone.Text.ToString(), txtEmail.Text.ToString(), txtVatNo.Text.ToString(), // TxtVendorID.Text.ToString(), thtVendorClass.Text.ToString(), thtVendorGroup.Text.ToString(), txtApCompanyID.Text.ToString(), Currency, Convert.ToInt32(ddlStatus.SelectedValue), Convert.ToInt32(Session["UserID"]), Convert.ToString(ddlNominalCode1.SelectedValue), Convert.ToString(ddlNominalCode2.SelectedValue), Convert.ToInt32(ddlPreApprove.SelectedValue)); //----------------------blocked by kuntal karar on 03.03.2015---------------------------------- //IretVal = objAddApproval.SaveCompanyDetailsAndTradingRelations(iTradingID, Convert.ToInt32(ddlCompany.SelectedValue), txtSupplier.Text.Trim(), NetWorkID, txtAddress1.Text.Trim(), // txtAddress2.Text.ToString(), txtAddress3.Text.ToString(), thtPostCode.Text.ToString(), iCounty, iCountry, txtTelephone.Text.ToString(), txtEmail.Text.ToString(), txtVatNo.Text.ToString(), // TxtVendorID.Text.ToString(), thtVendorClass.Text.ToString(), thtVendorGroup.Text.ToString(), txtApCompanyID.Text.ToString(), Currency, Convert.ToInt32(ddlStatus.SelectedValue), Convert.ToInt32(Session["UserID"]), // NominalCodeID1, NominalCodeID2, Convert.ToInt32(ddlPreApprove.SelectedValue)); //---------------------------------------------------------------------------------------------- //Modified by Mainak 2018-09-21 //IretVal = objAddApproval.SaveCompanyDetailsAndTradingRelations(iTradingID, Convert.ToInt32(ddlCompany.SelectedValue), txtSupplier.Text.Trim(), NetWorkID, txtAddress1.Text.Trim(), // txtAddress2.Text.ToString(), txtAddress3.Text.ToString(), thtPostCode.Text.ToString(), iCounty, iCountry, txtTelephone.Text.ToString(), txtEmail.Text.ToString(), txtVatNo.Text.ToString(), // TxtVendorID.Text.ToString(), thtVendorClass.Text.ToString(), thtVendorGroup.Text.ToString(), txtApCompanyID.Text.ToString(), Currency, Convert.ToInt32(ddlStatus.SelectedValue), Convert.ToInt32(Session["UserID"]), // NominalCodeID1, NominalCodeID2, Convert.ToInt32(ddlPreApprove.SelectedValue), Convert.ToInt32(ddlFnBNeed.SelectedValue)); IretVal = objAddApproval.SaveCompanyDetailsAndTradingRelations(iTradingID, Convert.ToInt32(ddlCompany.SelectedValue), txtSupplier.Text.Trim(), NetWorkID, txtAddress1.Text.Trim(), txtAddress2.Text.ToString(), txtAddress3.Text.ToString(), thtPostCode.Text.ToString(), iCounty, iCountry, txtTelephone.Text.ToString(), txtEmail.Text.ToString(), txtVatNo.Text.ToString(), TxtVendorID.Text.ToString(), thtVendorClass.Text.ToString(), thtVendorGroup.Text.ToString(), txtApCompanyID.Text.ToString(), Currency, Convert.ToInt32(ddlStatus.SelectedValue), Convert.ToInt32(Session["UserID"]), NominalCodeID1, NominalCodeID2, Convert.ToInt32(ddlPreApprove.SelectedValue), Convert.ToInt32(ddlFnBNeed.SelectedValue), Convert.ToInt32(ddlExpDept.SelectedValue)); //Response.Write( // "<br />TradingID: " + iTradingID // + "<br />ddlCompany.SelectedValue : " + ddlCompany.SelectedValue // + "<br />txtSupplier.Text: " + txtSupplier.Text.Trim() // + "<br />NetWorkID: " + NetWorkID // + "<br />txtAddress1.Text: " + txtAddress1.Text.Trim() // + "<br />txtAddress2.Text: " + txtAddress2.Text.ToString() // + "<br />txtAddress3.Text: " + txtAddress3.Text.ToString() // + "<br />thtPostCode.Text: " + thtPostCode.Text.ToString() // + "<br />iCounty: " + iCounty // + "<br />iCountry: " + iCountry // + "<br />txtTelephone.Text: " + txtTelephone.Text.ToString() // + "<br />txtEmail.Text: " + txtEmail.Text.ToString() // + "<br />txtVatNo.Text: " + txtVatNo.Text.ToString() // + "<br />TxtVendorID.Text: " + TxtVendorID.Text.ToString() // + "<br />thtVendorClass.Text: " + thtVendorClass.Text.ToString() // + "<br />thtVendorGroup.Text: " + thtVendorGroup.Text.ToString() // + "<br />txtApCompanyID.Text: " + txtApCompanyID.Text.ToString() // + "<br />txtApCompanyID.Text: " + Currency // + "<br />ddlStatus.SelectedValue : " + ddlStatus.SelectedValue // + "<br />Session[\"UserID\"]: " + Session["UserID"] // + "<br />NominalCodeID1: " + NominalCodeID1 // + "<br />NominalCodeID2: " + NominalCodeID2 // + "<br />ddlPreApprove.SelectedValue: " + ddlPreApprove.SelectedValue // + "<br />ddlFnBNeed.SelectedValue: " + ddlFnBNeed.SelectedValue // ); //If SAVE is pressed in the page below when Active = ‘No’ then the system //should replicate the same functions as if the user had pressed the ‘Delete’ //button, as mentioned above. if (ddlStatus.SelectedIndex == 1 && Request.QueryString["ComID"] != null) { objAddApproval.DeleteSupplierRecord(iTradingRelationID: iTradingID, iModUserID: Convert.ToInt32(Session["UserID"])); } //Response.Write("<br /><br /><br />IretVal: " + IretVal); if (IretVal > 0) { if (IretVal == 1) { lblMessage.Text = "Error in saving data."; Response.Write("<script>alert('Error in saving data.');</script>"); } if (IretVal == 2) { lblMessage.Text = "Record(s) saved successfully."; Response.Write("<script>alert('Record(s) save successfully.');</script>"); Response.Redirect("BrowseSupplier.aspx"); } if (IretVal > 10) { lblMessage.Text = " company supplies stock."; //blocked by kuntalkarar on 10thMay2017 //SendEmail(); Response.Redirect("BrowseSupplier.aspx"); } } else { string str = ""; if (IretVal == -101) { str = "Vendorid already exists against this buyer and supplier."; } else if (IretVal == -102) { str = "Company Name already exists against this buyer."; } else if (IretVal == 0) { str = "An unexpected error occured."; } lblMessage.Text = str; Response.Write("IretVal: " + IretVal + ", " + str); Response.Write("<script>alert('" + str + "');</script>"); } }