protected void ButtonAddEmployeeDepartment_Click(object sender, EventArgs e) { //if (Page.IsValid) //{ LabelError.Text = ""; bool hasError = false; PanelError.Visible = false; if (Convert.ToInt32(DropDownListEmployeeDepartment.SelectedValue) == 0) { LabelError.Text += "Department is required.\n"; PanelError.Visible = true; hasError = true; } if (hasError == false) { try { MerchandisingGroupCustom.InsertMerchandisingGroupCustomEmployee(this.employeeId, Convert.ToInt32(DropDownListEmployeeDepartment.SelectedValue), this.Master.LoggedOnAccount); BindEmployeeDepartmentList(); } 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; } } //} }
private void BindEmployeeDepartment() { DropDownListEmployeeDepartment.DataSource = MerchandisingGroupCustom.GetMerchandisingGroupCustomList(this.companyId); DropDownListEmployeeDepartment.DataTextField = "Description"; DropDownListEmployeeDepartment.DataValueField = "MerchandisingGroupCustomId"; DropDownListEmployeeDepartment.DataBind(); DropDownListEmployeeDepartment.Items.Insert(0, new ListItem("Please select", "0")); }
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 = MerchandisingGroupCustom.GetMerchandisingGroupCustomListByFilter(searchValue, Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).CompanyId); GridViewResult.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { this.storeId = Common.GetEncryptedQueryStringValue("StoreId", 0); LabelPageTitle.Text = String.Format("{0} - Merchandising Group Custom List", Store.GetStoreByStoreId(this.storeId).Description); if (!IsPostBack) { GridViewResult.DataSource = MerchandisingGroupCustom.GetMerchandisingGroupCustomListByFilter("%", Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).CompanyId); GridViewResult.DataBind(); } }
protected void ButtonSave_Click(object sender, EventArgs e) { if (Page.IsValid) { LabelError.Text = ""; MerchandisingGroupCustom merchandisingGroupCustom = new MerchandisingGroupCustom(); merchandisingGroupCustom.MerchandisingGroupCustomId = this.merchandisingGroupCustomId; merchandisingGroupCustom.Description = TextBoxDescription.Text; merchandisingGroupCustom.ModifiedUser = this.Master.LoggedOnAccount; merchandisingGroupCustom.CompanyId = Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).CompanyId; try { merchandisingGroupCustom.Save(); int merchandisingGroupCustomId = merchandisingGroupCustom.MerchandisingGroupCustomId; SaveMerhcandisingGroupCustomLink(); Button clickedButton = (Button)sender; switch (clickedButton.ID) { case "ButtonSaveList": Response.Redirect(String.Format("MerchandisingGroupCustomList.aspx?Description={0}", merchandisingGroupCustom.Description)); break; case "ButtonSaveNew": Response.Redirect("MerchandisingGroupCustomEdit.aspx"); break; case "ButtonSaveEdit": Response.Redirect(String.Format("MerchandisingGroupCustomEdit.aspx?merchandisingGroupCustomId={0}", merchandisingGroupCustom.MerchandisingGroupCustomId)); break; } } 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; } } }
protected void Page_Load(object sender, EventArgs e) { Page.Form.DefaultFocus = TextBoxSearchValue.ClientID; Page.Form.DefaultButton = ButtonSearch.UniqueID; if (!IsPostBack) { string[] alphabet = "A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;All".Split(';'); RepeaterAlphabet.DataSource = alphabet; RepeaterAlphabet.DataBind(); string searchValue = (Request.QueryString["Description"] == null) ? "" : Request.QueryString["Description"]; if (searchValue.Length != 0) { GridViewResult.DataSource = MerchandisingGroupCustom.GetMerchandisingGroupCustomListByFilter(searchValue, Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).CompanyId); GridViewResult.DataBind(); } } PanelError.Visible = false; }
private void BindMerchandisingGroupCustom() { try { MerchandisingGroupCustom merchandisingGroupCustom = MerchandisingGroupCustom.GetMerchandisingGroupCustomByMerchandisingGroupCustomId(this.merchandisingGroupCustomId); TextBoxDescription.Text = merchandisingGroupCustom.Description; } catch (System.Data.SqlClient.SqlException sqlEx) { for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } catch (Exception exception) { LabelError.Text += (exception.Message + "<br />"); PanelError.Visible = true; } }
protected void GridViewEmployeeDepartment_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName.ToLower()) { case "removeemployeedepartment": { MerchandisingGroupCustom.DeleteMerchandisingGroupCustomEmployeeByMerchandisingGroupCustomEmployeeId(Convert.ToInt32(e.CommandArgument)); BindEmployeeDepartmentList(); break; } } } 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; } }
protected void Page_Load(object sender, EventArgs e) { this.storeId = Common.GetEncryptedQueryStringValue("StoreId", 0); this.merchandisingGroupCustomId = Common.GetEncryptedQueryStringValue("MerchandisingGroupCustomId", 0); if (!IsPostBack) { if (ViewState["storeId"] != null) { this.storeId = Convert.ToInt32(ViewState["storeId"].ToString()); } if (ViewState["merchandisingGroupCustomId"] != null) { this.merchandisingGroupCustomId = Convert.ToInt32(ViewState["merchandisingGroupCustomId"].ToString()); } LabelPageTitle.Text = String.Format("{0} - {1}", Store.GetStoreByStoreId(this.storeId).Description, MerchandisingGroupCustom.GetMerchandisingGroupCustomByMerchandisingGroupCustomId(this.merchandisingGroupCustomId).Description); BindEmployee(); BindFrequencyType(); BindFrequencyIntervalRep(); BindFrequencyIntervalMerch(); BindEmployeeMerchandisingGroupCustomRep(); BindEmployeeMerchandisingGroupCustomMerch(); } }
private void BindEmployeeDepartmentList() { GridViewEmployeeDepartment.DataSource = MerchandisingGroupCustom.GetMerchandisingGroupCustomListByEmployeeId(this.employeeId); GridViewEmployeeDepartment.DataBind(); }
protected void ButtonSearch_Click(object sender, EventArgs e) { GridViewResult.DataSource = MerchandisingGroupCustom.GetMerchandisingGroupCustomListByFilter("%" + TextBoxSearchValue.Text + "%", Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).CompanyId); GridViewResult.DataBind(); }