protected void GetVendorList() { VendorBLL vendor = new VendorBLL(); try { DataTable dt = vendor.GetVendorList(); vendorListGridView.DataSource = dt; vendorListGridView.DataBind(); if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Vendor List Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; } }
protected void GetVendorList() { VendorBLL vendor = new VendorBLL(); try { DataTable dt = vendor.GetVendorList(); if (dt.Rows.Count > 0) { vendorListListBox.Items.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { vendorListListBox.Items.Add(new ListItem(dt.Rows[i]["VendorName"].ToString(), dt.Rows[i]["VendorId"].ToString())); } } else { msgbox.Visible = true; msgTitleLabel.Text = "Vendor Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; countVendorLabel.Text = "Total: " + vendorListListBox.Items.Count.ToString(); } }
protected void GetVendorList() { VendorBLL vendor = new VendorBLL(); try { vendor.WarehouseId = warehouseDropDownList.SelectedValue; DataTable dt = vendor.GetVendorListByWareHouseId(); vendorListGridView.DataSource = dt; vendorListGridView.DataBind(); if (vendorListGridView.Rows.Count > 0) { vendorListGridView.UseAccessibleHeader = true; vendorListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Vendor List Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; } }
protected void LoadVendors() { VendorBLL vendor = new VendorBLL(); try { vendor.WarehouseId = warehouseDropDownList.SelectedValue; DataTable dt = vendor.GetVendorListByWareHouseId(); vendorDropDownList.DataSource = dt; vendorDropDownList.DataValueField = "VendorId"; vendorDropDownList.DataTextField = "VendorName"; vendorDropDownList.DataBind(); vendorDropDownList.Items.Insert(0, ""); vendorDropDownList.SelectedIndex = 0; } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { vendor = null; } }
protected void btnVendorPaymentList_OnClick(object sender, EventArgs e) { VendorBLL vendorBll = new VendorBLL(); try { if (vendorDropDownList.SelectedValue == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Business Name field is required."; } else if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required."; } else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required."; } else { string vendorId = vendorDropDownList.SelectedValue.Trim(); string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()); string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()); string status = statusDropDownList.SelectedValue; DataTable dt = vendorBll.GetVendorWisePaymentList(vendorId, fromDate, toDate, status); vendorPaymentListGridView.DataSource = dt; vendorPaymentListGridView.DataBind(); if (vendorPaymentListGridView.Rows.Count > 0) { vendorPaymentListGridView.UseAccessibleHeader = true; vendorPaymentListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { vendorBll = null; } }
protected void deletedListButton_Click(object sender, EventArgs e) { VendorBLL vendor = new VendorBLL(); try { if (fromDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date From field is required."; } else if (toDateTextBox.Text.Trim() == "" || LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()) == "False") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Date To field is required."; } else { string fromDate = LumexLibraryManager.ParseAppDate(fromDateTextBox.Text.Trim()); string toDate = LumexLibraryManager.ParseAppDate(toDateTextBox.Text.Trim()); DataTable dt = vendor.GetDeletedVendorListByDateRangeAll(fromDate, toDate, ""); deletedListGridView.DataSource = dt; deletedListGridView.DataBind(); if (deletedListGridView.Rows.Count > 0) { deletedListGridView.UseAccessibleHeader = true; deletedListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } else { msgbox.Visible = true; msgTitleLabel.Text = "Deleted Vendor List Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-info"); } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; MyAlertBox("MyOverlayStop();"); } }
protected void productVendorButton_Click(object sender, EventArgs e) { ProductBLL product = new ProductBLL(); VendorBLL vendor = new VendorBLL(); try { DataTable dt = product.GetProductByBarcodeIdName(productTextBox.Text.Trim()); if (dt.Rows.Count > 0) { barcodeLabel.Text = dt.Rows[0]["Barcode"].ToString(); productIdLabel.Text = dt.Rows[0]["ProductId"].ToString(); productNameLabel.Text = dt.Rows[0]["ProductName"].ToString(); productGroupNameLabel.Text = dt.Rows[0]["ProductGroupName"].ToString(); productVendorListListBox.Items.Clear(); DataTable dtVendor = vendor.GetProductVendorsByProductId(productIdLabel.Text.Trim()); for (int i = 0; i < dtVendor.Rows.Count; i++) { productVendorListListBox.Items.Add(new ListItem(dtVendor.Rows[i]["VendorName"].ToString(), dtVendor.Rows[i]["VendorId"].ToString())); } productVendorPane.Visible = true; } else { productVendorPane.Visible = false; msgbox.Visible = true; msgTitleLabel.Text = "Product Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { product = null; vendor = null; countProductVendorLabel.Text = "Total: " + productVendorListListBox.Items.Count.ToString(); MyAlertBox("MyOverlayStop();"); } }
public DataTable SaveVendor(VendorBLL vendor, LumexDBPlayer db) { try { db.AddParameters("@VendorName", vendor.VendorName.Trim()); db.AddParameters("@Address", vendor.Address.Trim()); db.AddParameters("@Country", vendor.Country.Trim()); db.AddParameters("@City", vendor.City.Trim()); //db.AddParameters("@District", vendor.District.Trim()); //db.AddParameters("@PostalCode", vendor.PostalCode.Trim()); db.AddParameters("@ContactPhone", vendor.Phone.Trim()); //db.AddParameters("@Mobile", vendor.Mobile.Trim()); // db.AddParameters("@Fax", vendor.Fax.Trim()); db.AddParameters("@ContactEmail", vendor.Email.Trim()); db.AddParameters("@WareHouse", vendor.WarehouseId.Trim()); //New Added db.AddParameters("@Description", vendor.Description); db.AddParameters("@OwnerName", vendor.OwnerName); db.AddParameters("@OwnerCell", vendor.OwnerCell); db.AddParameters("@ContactPerson", vendor.ContactPerson); db.AddParameters("@ContactAddress", vendor.ContactPersonAddress); db.AddParameters("@ContactDesignation", vendor.ContactPersonDesignation); //New Added Finished db.AddParameters("@SalesCenter", vendor.salescenter.Trim()); db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal()); DataTable dt = db.ExecuteDataTable("INSERT_VENDOR", true); return dt; } catch (Exception) { throw; } finally { vendor = null; } }
protected void GetVendorById(string vendorId) { VendorBLL vendor = new VendorBLL(); try { DataTable dt = vendor.GetVendorById(vendorId); if (dt.Rows.Count > 0) { vendorNameLabel.Text = dt.Rows[0]["VendorName"].ToString(); countryLabel.Text = dt.Rows[0]["Country"].ToString(); cityLabel.Text = dt.Rows[0]["City"].ToString(); // districtLabel.Text = dt.Rows[0]["District"].ToString(); // postalCodeLabel.Text = dt.Rows[0]["PostalCode"].ToString(); phoneLabel.Text = dt.Rows[0]["Phone"].ToString(); // mobileLabel.Text = dt.Rows[0]["Mobile"].ToString(); // faxLabel.Text = dt.Rows[0]["Fax"].ToString(); emailLabel.Text = dt.Rows[0]["Email"].ToString(); addressLabel.Text = dt.Rows[0]["Address"].ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Vendor Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; } }
protected void LoadVendors() { VendorBLL vendor = new VendorBLL(); try { vendor.WarehouseId = warehouseDropDownList.SelectedValue; DataTable dt = vendor.GetActiveVendorsByWHId();//vendor.GetVendorListByActivationStatus("True"); vendorDropDownList.DataSource = dt; vendorDropDownList.DataValueField = "VendorId"; vendorDropDownList.DataTextField = "VendorName"; vendorDropDownList.DataBind(); vendorDropDownList.Items.Insert(0, ""); vendorDropDownList.SelectedIndex = 0; } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; } }
//protected void LoadSalesCenter() //{ // SalesCenterBLL warehouse = new SalesCenterBLL(); // try // { // DataTable dt = warehouse.GetActiveSalesCenterListByUser(); // salescenterDropDownList.DataSource = dt; // salescenterDropDownList.DataValueField = "SalesCenterId"; // salescenterDropDownList.DataTextField = "SalesCenterName"; // salescenterDropDownList.DataBind(); // salescenterDropDownList.Items.Insert(0, "For all Sales Center"); // salescenterDropDownList.SelectedIndex = 0; // salescenterDropDownList.Items[0].Value = "A"; // salescenterDropDownList.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString(); // //warehouseDropDownList.SelectedValue = LumexSessionManager.Get("UserWareHouseId").ToString(); // } // catch (Exception ex) // { // string message = ex.Message; // if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } // MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); // } // finally // { // warehouse = null; // } //} protected void saveButton_Click(object sender, EventArgs e) { VendorBLL vendor = new VendorBLL(); int isaddanother = 1; Button btn = (Button)sender; if (btn.Text == "Save") { isaddanother = 0; } try { if (vendorNameTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Vendor Name field is required."; } else if (addressTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Address field is required."; } else { vendor.VendorName = vendorNameTextBox.Text.Trim(); vendor.Address = addressTextBox.Text.Trim(); vendor.Country = countryTextBox.Text.Trim(); vendor.City = cityTextBox.Text.Trim(); vendor.District = "";//districtTextBox.Text.Trim(); vendor.PostalCode = "";// postalCodeTextBox.Text.Trim(); vendor.Phone = phoneTextBox.Text.Trim(); vendor.Mobile = "";//mobileTextBox.Text.Trim(); vendor.Fax = "";//faxTextBox.Text.Trim(); vendor.Email = emailTextBox.Text.Trim(); vendor.salescenter = "";//salescenterDropDownList.SelectedValue; vendor.WarehouseId = warehouseDropDownList.SelectedValue; vendor.Description = txtbxDescription.Text.Trim(); vendor.OwnerName = txtbxOwnerName.Text.Trim(); vendor.OwnerCell = txtbxOwnerCell.Text.Trim(); vendor.ContactPerson = txtbxContactPerson.Text.Trim(); vendor.ContactPersonAddress = txtbxContactPersonAddress.Text.Trim(); vendor.ContactPersonDesignation = txtbxContactPersonDesignation.Text.Trim(); if (!vendor.CheckDuplicateVendor(vendor.VendorName, vendor.WarehouseId, vendor.salescenter)) { DataTable dt = vendor.SaveVendor(); if (dt.Rows.Count > 0) { if (isaddanother == 0) { string message = "Vendor <span class='actionTopic'>Created</span> Successfully with Vendor ID: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox( "var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Vendor/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "Vendor <span class='actionTopic'>Created</span> Successfully with Vendor ID: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox( "var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Vendor/Create.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } } else { string message = "<span class='actionTopic'>Failed</span> to Create Vendor."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } else { string message = "This Vendor <span class='actionTopic'>already exist</span>, try another one."; MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");"); } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; } }
protected void drpdwnSalesCenterOrWarehouse_OnSelectedIndexChanged(object sender, EventArgs e) { VendorBLL vendor = new VendorBLL(); try { vendor.WarehouseId = drpdwnSalesCenterOrWarehouse.SelectedValue; DataTable dt = vendor.GetActiveVendorsByWHId(); vendorDropDownList.DataSource = dt; vendorDropDownList.DataValueField = "VendorId"; vendorDropDownList.DataTextField = "VendorName"; vendorDropDownList.DataBind(); vendorDropDownList.Items.Insert(0, ""); vendorDropDownList.SelectedIndex = 0; } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { vendor = null; } }
protected void LoadPayToFromCompanyList() { PayToFromCompanyBLL payToFromCompany = new PayToFromCompanyBLL(); try { payToFromCompanyDropDownList.Items.Clear(); DataTable dt = new DataTable(); if (payToFromTypeDropDownList.SelectedValue == "com") { dt = payToFromCompany.GetActivePayToFromCompanyList(); payToFromCompanyDropDownList.DataSource = dt; payToFromCompanyDropDownList.DataValueField = "CompanyId"; payToFromCompanyDropDownList.DataTextField = "CompanyName"; payToFromCompanyDropDownList.DataBind(); lblPaytoFromType.Text = "Company"; } else if (payToFromTypeDropDownList.SelectedValue == "ven") { VendorBLL vendor = new VendorBLL(); dt = vendor.GetActiveVendors(); payToFromCompanyDropDownList.DataSource = dt; payToFromCompanyDropDownList.DataValueField = "VendorId"; payToFromCompanyDropDownList.DataTextField = "VendorName"; payToFromCompanyDropDownList.DataBind(); lblPaytoFromType.Text = "Vendor"; } else if (payToFromTypeDropDownList.SelectedValue == "cus") { CustomerBLL customer = new CustomerBLL(); dt = customer.GetActiveCustomerList(); payToFromCompanyDropDownList.DataSource = dt; payToFromCompanyDropDownList.DataValueField = "CustomerId"; payToFromCompanyDropDownList.DataTextField = "CustomerIdName"; payToFromCompanyDropDownList.DataBind(); lblPaytoFromType.Text = "Customer"; } payToFromCompanyDropDownList.Items.Insert(0, ""); payToFromCompanyDropDownList.Items.Insert(1, "N/A"); payToFromCompanyDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Pay To/From Company Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { payToFromCompany = null; } }
protected void deleteLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; VendorBLL vendor = new VendorBLL(); vendor.DeleteVendor(vendorListGridView.Rows[row.RowIndex].Cells[0].Text.ToString()); GetVendorList(); string message = "Product <span class='actionTopic'>Deleted</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
protected void saveButton_Click(object sender, EventArgs e) { VendorBLL vendor = new VendorBLL(); List<string> vendors = new List<string>(); try { if (productVendorListListBox.Items.Count > 0) { for (int i = 0; i < productVendorListListBox.Items.Count; i++) { vendors.Add(productVendorListListBox.Items[i].Value.Trim()); } vendor.SaveProductVendorsByProductId(productIdLabel.Text.Trim(), vendors); string message = "Product's Vendor List <span class='actionTopic'>Saved</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Product/ManageProductVendor.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "No Vendor is added for this product, must be added one or more vendor(s)."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; vendors = null; } }
protected void VendorList_SelectedIndexChanged(object sender, EventArgs e) { VendorBLL vendorbll = new VendorBLL(); try { // DropDownList vendorDropDownList = (DropDownList)purchaseRequisitionProductListGridView.Rows[i].FindControl("vendorDropDownList"); DropDownList vendorDropDown = (DropDownList)sender; vendorbll.WarehouseId = warehouseIdLabel.Text; if(vendorDropDown.SelectedItem.Text == "Select Others.") { DataTable dt = vendorbll.GetActiveVendorsByWHId(); vendorDropDown.DataSource = dt; vendorDropDown.DataValueField = "VendorId"; vendorDropDown.DataTextField = "VendorName"; vendorDropDown.DataBind(); vendorDropDown.Items.Insert(0, ""); vendorDropDown.SelectedIndex = 0; } } catch (Exception ex) { //throw; } }
protected void GetPurchaseRequisitionProductListById(string purchaseRequisitionId) { PurchaseRequisitionBLL purchaseRequisition = new PurchaseRequisitionBLL(); try { DataTable dt = purchaseRequisition.GetPurchaseRequisitionProductListById(purchaseRequisitionId); if (dt.Rows.Count > 0) { purchaseRequisitionProductListGridView.DataSource = dt; purchaseRequisitionProductListGridView.DataBind(); if (purchaseRequisitionProductListGridView.Rows.Count > 0) { approveButton.Enabled = true; purchaseRequisitionProductListGridView.UseAccessibleHeader = true; purchaseRequisitionProductListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; TextBox approveQuantityTextBox; TextBox unitPriceTextBox; DropDownList vendorDropDownList; VendorBLL vendor = new VendorBLL(); DataTable dtVendor=new DataTable(); for (int i = 0; i < purchaseRequisitionProductListGridView.Rows.Count; i++) { approveQuantityTextBox = (TextBox)purchaseRequisitionProductListGridView.Rows[i].FindControl("approveQuantityTextBox"); //approveQuantityTextBox.Text = purchaseRequisitionProductListGridView.Rows[i].Cells[3].Text.ToString(); approveQuantityTextBox.Text = dt.Rows[i][3].ToString(); unitPriceTextBox = (TextBox)purchaseRequisitionProductListGridView.Rows[i].FindControl("unitPriceTextBox"); unitPriceTextBox.Text = dt.Rows[i]["UnitPrice"].ToString(); dtVendor = vendor.GetProductVendorsByProductId(purchaseRequisitionProductListGridView.Rows[i].Cells[0].Text.ToString()); vendorDropDownList = (DropDownList)purchaseRequisitionProductListGridView.Rows[i].FindControl("vendorDropDownList"); vendorDropDownList.DataSource = dtVendor; vendorDropDownList.DataValueField = "VendorId"; vendorDropDownList.DataTextField = "VendorName"; vendorDropDownList.DataBind(); vendorDropDownList.Items.Insert(0, ""); vendorDropDownList.SelectedIndex = 0; vendorDropDownList.Items.Insert(dtVendor.Rows.Count+1, "Select Others."); } } else { approveButton.Enabled = false; } } else { msgbox.Visible = true; msgTitleLabel.Text = "Data Not Found!!!"; msgDetailLabel.Text = ""; } } catch (Exception ex) { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message; } finally { purchaseRequisition = null; } }
internal DataTable GetActiveVendorsByWHId(VendorBLL vendorBLL, LumexDBPlayer db) { try { db.AddParameters("@WHID", vendorBLL.WarehouseId); DataTable dt = db.ExecuteDataTable("[GET_ACTIVE_VENDORS_WH_ID]", true); return dt; } catch (Exception) { throw; } }
internal DataTable GetVendorListByWareHouseId(VendorBLL vendorBLL, LumexDBPlayer db) { try { db.AddParameters("@WHID", vendorBLL.WarehouseId); DataTable dt = db.ExecuteDataTable("GET_VENDORS_BY_WH_ID", true); return dt; } catch (Exception) { throw; } }
//protected void LoadSalesCenter() //{ // SalesCenterBLL warehouse = new SalesCenterBLL(); // try // { // DataTable dt = warehouse.GetActiveSalesCenterListByUser(); // salescenterDropDownList.DataSource = dt; // salescenterDropDownList.DataValueField = "SalesCenterId"; // salescenterDropDownList.DataTextField = "SalesCenterName"; // salescenterDropDownList.DataBind(); // salescenterDropDownList.Items.Insert(0, "For all Sales Center"); // // salescenterDropDownList.SelectedIndex = 0; // salescenterDropDownList.Items[0].Value = "A"; // // salescenterDropDownList.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString(); // } // catch (Exception ex) // { // string message = ex.Message; // if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } // MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); // } // finally // { // warehouse = null; // } //} protected void GetVendorById(string vendorId) { VendorBLL vendor = new VendorBLL(); try { DataTable dt = vendor.GetVendorById(vendorId); if (dt.Rows.Count > 0) { vendorNameForUpdateHiddenField.Value = vendorNameTextBox.Text = dt.Rows[0]["VendorName"].ToString(); countryTextBox.Text = dt.Rows[0]["Country"].ToString(); cityTextBox.Text = dt.Rows[0]["City"].ToString(); //districtTextBox.Text = dt.Rows[0]["District"].ToString(); // postalCodeTextBox.Text = dt.Rows[0]["PostalCode"].ToString(); phoneTextBox.Text = dt.Rows[0]["Phone"].ToString(); // mobileTextBox.Text = dt.Rows[0]["Mobile"].ToString(); // faxTextBox.Text = dt.Rows[0]["Fax"].ToString(); txtbxOwnerName.Text = dt.Rows[0]["OwnerName"].ToString(); txtbxOwnerCell.Text = dt.Rows[0]["OwnerCell"].ToString(); txtbxDescription.Text = dt.Rows[0]["Description"].ToString(); txtbxContactPersonDesignation.Text = dt.Rows[0]["ContactDesignation"].ToString(); txtbxContactPersonAddress.Text = dt.Rows[0]["ContactAddress"].ToString(); txtbxContactPerson.Text = dt.Rows[0]["ContactPerson"].ToString(); ListItem listItem = new ListItem(); listItem = warehouseDropDownList.Items.FindByValue(dt.Rows[0]["WareHouse"].ToString()); if (listItem != null) { warehouseDropDownList.SelectedValue = dt.Rows[0]["WareHouse"].ToString(); } else { warehouseDropDownList.Items.Insert(0, "Not Parmitted"); warehouseDropDownList.Items[0].Value = dt.Rows[0]["WareHouse"].ToString(); warehouseDropDownList.SelectedIndex = 0; warehouseDropDownList.Enabled = false; updateButton.Enabled = false; } emailTextBox.Text = dt.Rows[0]["Email"].ToString(); addressTextBox.Text = dt.Rows[0]["Address"].ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Vendor Data Not Found!!!"; msgDetailLabel.Text = ""; msgbox.Attributes.Add("class", "alert alert-warning"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; } }
protected void selectDropDownList_OnSelectedIndexChanged(object sender, EventArgs e) { if (selectDropDownList.SelectedValue == "CST") { CustomerBLL customerBll = new CustomerBLL(); DataTable dt = new DataTable(); dt = customerBll.GetActiveCustomerList(); customerListGridView.Visible = true; vendorGridView.Visible = false; companyGridView.Visible = false; NumberDiv.Visible = false; customerListGridView.DataSource = dt; customerListGridView.DataBind(); if (customerListGridView.Rows.Count > 0) { customerListGridView.UseAccessibleHeader = true; customerListGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } } else if (selectDropDownList.SelectedValue == "VND") { VendorBLL vendorBll = new VendorBLL(); DataTable dt = new DataTable(); dt = vendorBll.GetVendorList(); vendorGridView.Visible = true; customerListGridView.Visible = false; companyGridView.Visible = false; NumberDiv.Visible = false; vendorGridView.DataSource = dt; vendorGridView.DataBind(); if (vendorGridView.Rows.Count > 0) { vendorGridView.UseAccessibleHeader = true; vendorGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } } else if (selectDropDownList.SelectedValue == "COM") { CompanyBLL companyBll = new CompanyBLL(); DataTable dt = new DataTable(); dt = companyBll.GetActiveCompany(); companyGridView.Visible = true; customerListGridView.Visible = false; vendorGridView.Visible = false; NumberDiv.Visible = false; companyGridView.DataSource = dt; companyGridView.DataBind(); if (companyGridView.Rows.Count > 0) { companyGridView.UseAccessibleHeader = true; companyGridView.HeaderRow.TableSection = TableRowSection.TableHeader; } } else { customerListGridView.Visible = false; vendorGridView.Visible = false; companyGridView.Visible = false; NumberDiv.Visible = true; } }
protected void updateButton_Click(object sender, EventArgs e) { VendorBLL vendor = new VendorBLL(); try { if (vendorIdForUpdateHiddenField.Value.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Vendor not found to update."; } else if (vendorNameTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Vendor Name field is required."; } else if (addressTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Address field is required."; } else { vendor.VendorId = vendorIdForUpdateHiddenField.Value.Trim(); vendor.VendorName = vendorNameTextBox.Text.Trim(); vendor.Address = addressTextBox.Text.Trim(); vendor.Country = countryTextBox.Text.Trim(); vendor.City = cityTextBox.Text.Trim(); vendor.District = "";//districtTextBox.Text.Trim(); vendor.PostalCode = "";// postalCodeTextBox.Text.Trim(); vendor.Phone = phoneTextBox.Text.Trim(); vendor.Mobile = "";//mobileTextBox.Text.Trim(); vendor.Fax = "";//faxTextBox.Text.Trim(); vendor.Email = emailTextBox.Text.Trim(); vendor.salescenter = "";//salescenterDropDownList.SelectedValue; vendor.WarehouseId = warehouseDropDownList.SelectedValue; vendor.Description = txtbxDescription.Text.Trim(); vendor.OwnerName = txtbxOwnerName.Text.Trim(); vendor.OwnerCell = txtbxOwnerCell.Text.Trim(); vendor.ContactPerson = txtbxContactPerson.Text.Trim(); vendor.ContactPersonAddress = txtbxContactPersonAddress.Text.Trim(); vendor.ContactPersonDesignation = txtbxContactPersonDesignation.Text.Trim(); if (!vendor.CheckDuplicateVendor(vendorNameTextBox.Text.Trim(), warehouseDropDownList.SelectedValue, vendor.salescenter)) { vendor.UpdateVendor(); vendorNameForUpdateHiddenField.Value = ""; vendorIdForUpdateHiddenField.Value = ""; string message = "Vendor <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Vendor/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { if (vendorNameForUpdateHiddenField.Value == vendorNameTextBox.Text.Trim()) { vendor.VendorName = "WithOut"; vendor.UpdateVendor(); vendorNameForUpdateHiddenField.Value = ""; vendorIdForUpdateHiddenField.Value = ""; string message = "Vendor <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/Vendor/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "This Vendor <span class='actionTopic'>already exist</span>, try another one."; MyAlertBox("WarningAlert(\"" + "Data Duplicate" + "\", \"" + message + "\");"); } } } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } finally { vendor = null; } }