protected void GetProductGroupList() { ProductGroupBLL productGroup = new ProductGroupBLL(); try { DataTable dt = productGroup.GetProductGroupList(); productGroupListGridView.DataSource = dt; productGroupListGridView.DataBind(); if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Product Group 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 { productGroup = null; } }
protected void LoadProductGroups() { ProductGroupBLL productGroup = new ProductGroupBLL(); try { productGroup.warehouse = warehouseDropDownList.SelectedValue; DataTable dt = productGroup.GetActiveProductGroupListByWHID(); productGroupDropDownList.DataSource = dt; productGroupDropDownList.DataValueField = "ProductGroupId"; productGroupDropDownList.DataTextField = "ProductGroupName"; productGroupDropDownList.DataBind(); productGroupDropDownList.Items.Insert(0, ""); productGroupDropDownList.SelectedIndex = 0; if (dt.Rows.Count < 1) { msgbox.Visible = true; msgTitleLabel.Text = "Product Group 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 { productGroup = null; } }
protected void GetProductGroupById(string productGroupId) { ProductGroupBLL productGroup = new ProductGroupBLL(); try { DataTable dt = productGroup.GetProductGroupById(productGroupId); if (dt.Rows.Count > 0) { productGroupNameLabel.Text = dt.Rows[0]["ProductGroupName"].ToString(); descriptionLabel.Text = dt.Rows[0]["Description"].ToString(); } else { msgbox.Visible = true; msgTitleLabel.Text = "Product Group 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 { productGroup = null; } }
protected void deletedListButton_Click(object sender, EventArgs e) { ProductGroupBLL productGroup = new ProductGroupBLL(); 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 = productGroup.GetDeletedProductGroupListByDateRangeAll(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 Product Group 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 { productGroup = null; MyAlertBox("MyOverlayStop();"); } }
public DataTable SaveProductGroup(ProductGroupBLL productGroup, LumexDBPlayer db) { try { db.AddParameters("@ProductGroupName", productGroup.ProductGroupName.Trim()); db.AddParameters("@Description", productGroup.Description.Trim()); db.AddParameters("@WareHouse", productGroup.warehouse.Trim()); db.AddParameters("@SalesCenter", productGroup.salescenter.Trim()); db.AddParameters("@CreatedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@CreatedFrom", LumexLibraryManager.GetTerminal()); DataTable dt = db.ExecuteDataTable("INSERT_PRODUCT_GROUP", true); return dt; } catch (Exception) { throw; } finally { productGroup = null; } }
internal DataTable GetActiveProductGroupListByWHID(ProductGroupBLL productGroupBLL, LumexDBPlayer db) { try { db.AddParameters("@WHID", productGroupBLL.warehouse); DataTable dt = db.ExecuteDataTable("[GET_ACTIVE_PRODUCT_GROUP_LIST_BY_WH_ID]", true); return dt; } catch (Exception) { throw; } }
public void UpdateProductGroup(ProductGroupBLL productGroup, LumexDBPlayer db) { try { db.AddParameters("@ProductGroupId", productGroup.ProductGroupId.Trim()); db.AddParameters("@ProductGroupName", productGroup.ProductGroupName.Trim()); db.AddParameters("@Description", productGroup.Description.Trim()); db.AddParameters("@WareHouse", productGroup.warehouse.Trim()); db.AddParameters("@SalesCenter", productGroup.salescenter.Trim()); db.AddParameters("@ModifiedBy", LumexSessionManager.Get("ActiveUserId").ToString()); db.AddParameters("@ModifiedFrom", LumexLibraryManager.GetTerminal()); db.ExecuteNonQuery("UPDATE_PRODUCT_GROUP_BY_ID", true); } catch (Exception) { throw; } finally { productGroup = 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.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString(); // salescenterDropDownList.Items[0].Value = "A"; // } // 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) { ProductGroupBLL productGroup = new ProductGroupBLL(); int isaddanother =1; Button btn = (Button) sender; if (btn.Text == "Save") { isaddanother = 0; } try { if (productGroupNameTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Group Name field is required."; } //else if (descriptionTextBox.Text == "") //{ // msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Description field is required."; //} else { productGroup.ProductGroupName = productGroupNameTextBox.Text.Trim(); productGroup.Description = descriptionTextBox.Text.Trim(); productGroup.warehouse = warehouseDropDownList.SelectedValue; productGroup.salescenter = "";//salescenterDropDownList.SelectedValue; if (!productGroup.CheckDuplicateProductGroup(productGroup.ProductGroupName.Trim(),productGroup.warehouse,productGroup.salescenter)) { DataTable dt = productGroup.SaveProductGroup(); if (dt.Rows.Count > 0) { if (isaddanother == 0) { string message = "Product Group <span class='actionTopic'>Created</span> Successfully with Product Group ID: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox( "var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/ProductGroup/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "Product Group <span class='actionTopic'>Created</span> Successfully with Product Group ID: <span class='actionTopic'>" + dt.Rows[0][0].ToString() + "</span>."; MyAlertBox( "var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/ProductGroup/Create.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } } else { string message = "<span class='actionTopic'>Failed</span> to Create Product Group."; MyAlertBox("ErrorAlert(\"" + "Process Failed" + "\", \"" + message + "\");"); } } else { string message = "This Product Group <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 { productGroup = null; } }
protected void deleteLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; string WareHouseID = warehouseDropDownList.SelectedValue; ProductGroupBLL productGroup = new ProductGroupBLL(); string status = productGroup.DeleteProductGroup(productGroupListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False"); if (status == "Deleted") { GetProductGroupListByWHId(WareHouseID); string message = "Product Group <span class='actionTopic'>Deleted</span> Successfully."; MyAlertBox("SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", \"\");"); } else { GetProductGroupListByWHId(WareHouseID); string message = "This Product Group contains " + status + " product(s). You can't delete this Product Group. You must move the product(s) first to another product group."; MyAlertBox("WarningAlert(\"" + "Data Dependency" + "\", \"" + message + "\", \"\");"); } } catch (Exception ex) { string message = ex.Message; if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; } MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");"); } }
protected void deactivateLinkButton_Click(object sender, EventArgs e) { try { LinkButton lnkBtn = (LinkButton)sender; GridViewRow row = (GridViewRow)lnkBtn.NamingContainer; ProductGroupBLL productGroup = new ProductGroupBLL(); productGroup.UpdateProductGroupActivation(productGroupListGridView.Rows[row.RowIndex].Cells[0].Text.ToString(), "False"); productGroupListGridView.Rows[row.RowIndex].Cells[3].Text = "False"; string message = "Product Group <span class='actionTopic'>Deactivated</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 updateButton_Click(object sender, EventArgs e) { ProductGroupBLL productGroup = new ProductGroupBLL(); try { if (productGroupIdForUpdateHiddenField.Value.Trim() == "") { msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "Product Group not found to update."; } else if (productGroupNameTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Product Group Name field is required."; } else if (descriptionTextBox.Text == "") { msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Description field is required."; } else { productGroup.ProductGroupId = productGroupIdForUpdateHiddenField.Value.Trim(); productGroup.ProductGroupName = productGroupNameTextBox.Text.Trim(); productGroup.Description = descriptionTextBox.Text.Trim(); productGroup.warehouse = warehouseDropDownList.SelectedValue; productGroup.salescenter = "";//salescenterDropDownList.SelectedValue; if (!productGroup.CheckDuplicateProductGroup(productGroupNameTextBox.Text.Trim(), warehouseDropDownList.SelectedValue, productGroup.salescenter)) { productGroup.UpdateProductGroup(); productGroupNameForUpdateHiddenField.Value = ""; productGroupIdForUpdateHiddenField.Value = ""; string message = "Product Group <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/ProductGroup/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { if (productGroupNameForUpdateHiddenField.Value == productGroupNameTextBox.Text.Trim()) { productGroup.ProductGroupName = "WithOut"; productGroup.UpdateProductGroup(); productGroupNameForUpdateHiddenField.Value = ""; productGroupIdForUpdateHiddenField.Value = ""; string message = "Product Group <span class='actionTopic'>Updated</span> Successfully."; MyAlertBox("var callbackOk = function () { MyOverlayStart(); window.location = \"/UI/ProductGroup/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);"); } else { string message = "This Product Group <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 { productGroup = 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.SelectedValue = LumexSessionManager.Get("UserSalesCenterId").ToString(); // salescenterDropDownList.Items[0].Value = "A"; // } // 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 GetProductGroupById(string productGroupId) { ProductGroupBLL productGroup = new ProductGroupBLL(); try { DataTable dt = productGroup.GetProductGroupById(productGroupId); if (dt.Rows.Count > 0) { productGroupNameForUpdateHiddenField.Value = productGroupNameTextBox.Text = dt.Rows[0]["ProductGroupName"].ToString(); descriptionTextBox.Text = dt.Rows[0]["Description"].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; } //listItem = salescenterDropDownList.Items.FindByValue(dt.Rows[0]["SalesCenter"].ToString()); //if (listItem != null) //{ // salescenterDropDownList.SelectedValue = dt.Rows[0]["SalesCenter"].ToString(); //} //else //{ // salescenterDropDownList.Items.Insert(0, "Not Parmitted"); // salescenterDropDownList.Items[0].Value = dt.Rows[0]["SalesCenter"].ToString(); // salescenterDropDownList.SelectedIndex = 0; // salescenterDropDownList.Enabled = false; // updateButton.Enabled = false; //} } else { msgbox.Visible = true; msgTitleLabel.Text = "Product Group 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 { productGroup = null; } }