private void BindDropDownListMcCoyOven(DropDownList dropDownMcCoyOven) { dropDownMcCoyOven.ClearSelection(); dropDownMcCoyOven.DataSource = StoreBrandFilter.GetStoreBrandApplianceList(1); //MMS dropDownMcCoyOven.DataTextField = "Description"; dropDownMcCoyOven.DataValueField = "StoreBrandApplianceId"; dropDownMcCoyOven.DataBind(); dropDownMcCoyOven.Items.Insert(0, new ListItem("Please select", "0")); }
private void BindStoreBrandFilterList() { GridViewResult.DataSource = StoreBrandFilter.GetStoreBrandFilterList("%", (CheckBoxLinked.Checked) ? 1 : 0, this.accountId); GridViewResult.DataBind(); if (GridViewResult.Rows.Count > 0) { ButtonSaveList.Visible = true; } else { ButtonSaveList.Visible = false; LabelError.Text = "No records returned."; PanelError.Visible = true; } }
protected void ButtonSearch_Click(object sender, EventArgs e) { LabelError.Text = ""; PanelError.Visible = false; GridViewResult.DataSource = StoreBrandFilter.GetStoreBrandFilterList("%" + TextBoxSearchValue.Text + "%", (CheckBoxLinked.Checked) ? 1 : 0, this.accountId); GridViewResult.DataBind(); if (GridViewResult.Rows.Count > 0) { ButtonSaveList.Visible = true; } else { ButtonSaveList.Visible = false; LabelError.Text = "No records returned."; PanelError.Visible = true; } }
protected void RepeaterAlphabet_ItemCommand(object source, RepeaterCommandEventArgs e) { string searchValue = (((LinkButton)e.CommandSource).Text == "All") ? "%" : ((LinkButton)e.CommandSource).Text + "%"; if (searchValue.Length != 0) { GridViewResult.DataSource = StoreBrandFilter.GetStoreBrandFilterList(searchValue, (CheckBoxLinked.Checked) ? 1 : 0, this.accountId); GridViewResult.DataBind(); if (GridViewResult.Rows.Count > 0) { ButtonSaveList.Visible = true; } else { ButtonSaveList.Visible = false; LabelError.Text = "No records returned."; PanelError.Visible = true; } } }
protected void ButtonSave_Click(object sender, EventArgs e) { if (Page.IsValid) { try { TextBoxSearchValue.Text = ""; LabelError.Text = ""; PanelError.Visible = false; LabelError.Text = ""; int companyId = Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).CompanyId; if (CheckBoxLinked.Checked) { foreach (GridViewRow gridViewRow in GridViewResult.Rows) { CheckBox checkBoxRepStoreLinkChickaChicken = (CheckBox)gridViewRow.Cells[5].FindControl("CheckBoxLinkChickaChicken"); //CheckBox checkBoxRepStoreLinkMcCoy = (CheckBox)gridViewRow.Cells[6].FindControl("CheckBoxLinkMcCoy"); DropDownList dropDownMcCoyOven = (DropDownList)gridViewRow.Cells[6].FindControl("DropDownListMcCoyOven"); HiddenField hiddenFieldSparStoreId = (HiddenField)gridViewRow.Cells[0].FindControl("HiddenFieldSparStoreId"); if (!checkBoxRepStoreLinkChickaChicken.Checked) { StoreBrandFilter.DeleteStoreBrandFilterByStoreBrand(Convert.ToInt32(hiddenFieldSparStoreId.Value), 1 /*Chicka Chicken*/, this.accountId, this.Master.LoggedOnAccount); } else { StoreBrandFilter.InsertStoreBrandFilter((Convert.ToInt32(hiddenFieldSparStoreId.Value)), 1 /*Chicka Chicken*/, 0, companyId, this.accountId, this.Master.LoggedOnAccount); } //if (!checkBoxRepStoreLinkMcCoy.Checked) if (dropDownMcCoyOven.SelectedValue == "0") { StoreBrandFilter.DeleteStoreBrandFilterByStoreBrand(Convert.ToInt32(hiddenFieldSparStoreId.Value), 2 /*McCoy Pies*/, this.accountId, this.Master.LoggedOnAccount); } else { StoreBrandFilter.InsertStoreBrandFilter((Convert.ToInt32(hiddenFieldSparStoreId.Value)), 2 /*McCoy Pies*/, Convert.ToInt32(dropDownMcCoyOven.SelectedValue), companyId, this.accountId, this.Master.LoggedOnAccount); } } BindStoreBrandFilterList(); } else { foreach (GridViewRow gridViewRow in GridViewResult.Rows) { CheckBox checkBoxRepStoreLinkChickaChicken = (CheckBox)gridViewRow.Cells[5].FindControl("CheckBoxLinkChickaChicken"); //CheckBox checkBoxRepStoreLinkMcCoy = (CheckBox)gridViewRow.Cells[6].FindControl("CheckBoxLinkMcCoy"); DropDownList dropDownMcCoyOven = (DropDownList)gridViewRow.Cells[6].FindControl("DropDownListMcCoyOven"); HiddenField hiddenFieldSparStoreId = (HiddenField)gridViewRow.Cells[0].FindControl("HiddenFieldSparStoreId"); if (checkBoxRepStoreLinkChickaChicken.Checked) { StoreBrandFilter.InsertStoreBrandFilter((Convert.ToInt32(hiddenFieldSparStoreId.Value)), 1 /*Chicka Chicken*/, 0, companyId, this.accountId, this.Master.LoggedOnAccount); } //if (checkBoxRepStoreLinkMcCoy.Checked) if (dropDownMcCoyOven.SelectedValue != "0") { StoreBrandFilter.InsertStoreBrandFilter((Convert.ToInt32(hiddenFieldSparStoreId.Value)), 2 /*McCoy Pies*/, Convert.ToInt32(dropDownMcCoyOven.SelectedValue), companyId, this.accountId, this.Master.LoggedOnAccount); } } BindStoreBrandFilterList(); } LabelError.Text = "Successfully updated."; PanelError.Visible = true; } catch (System.Data.SqlClient.SqlException sqlEx) { LabelError.Text = ""; for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } } }