protected void btnAdd_Click(object sender, EventArgs e) { string BrandId = this.txtBrandId.Text; string Name = this.txtName.Text; string Descn = this.txtDescn.Text; string CategoryId = DropCategory.SelectedValue; Maticsoft.Model.Brand model = new Maticsoft.Model.Brand(); model.BrandId = BrandId; model.Name = Name; model.Descn = Descn; model.CategoryId = CategoryId; Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); if (bll.Exists(BrandId)) { lblMsg.Visible = true; lblMsg.Text = "±àºÅÒѾ´æÔÚ£¡"; } else { bll.Add(model); if (chkAddContinue.Checked) { Response.Redirect("Add.aspx"); } else { Response.Redirect("index.aspx"); } } }
protected void gridView_Sorting(object sender, GridViewSortEventArgs e) { Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); string strWhere = ""; if (Session["strWhereBrand"] != null && Session["strWhereBrand"].ToString() != "") { strWhere += Session["strWhereBrand"].ToString(); } DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataView dv = ds.Tables[0].DefaultView; if (ViewState["SortDirection"] == null) { ViewState["SortDirection"] = "desc"; } else { if (ViewState["SortDirection"].ToString() == "asc") { ViewState["SortDirection"] = "desc"; } else { ViewState["SortDirection"] = "asc"; } } dv.Sort = e.SortExpression + " " + ViewState["SortDirection"].ToString(); gridView.DataSource = dv; gridView.DataBind(); }
private void BiudBrand(string CategoryId) { Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); DataSet ds = bll.GetlistByCategoryId(CategoryId); this.dropBrand.DataSource = ds.Tables[0].DefaultView; this.dropBrand.DataTextField = "Name"; this.dropBrand.DataValueField = "BrandId"; this.dropBrand.DataBind(); }
private void ShowInfo(string BrandId) { Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); Maticsoft.Model.Brand model = bll.GetModel(BrandId); this.lblBrandId.Text = model.BrandId; this.txtName.Text = model.Name; this.txtDescn.Text = model.Descn; this.Label1.Text = model.CategoryId; }
protected void btnAdd_Click(object sender, EventArgs e) { string BrandId = this.lblBrandId.Text; string Name = this.txtName.Text; string Descn = this.txtDescn.Text; Maticsoft.Model.Brand model = new Maticsoft.Model.Brand(); model.CategoryId = Label1.Text; model.BrandId = BrandId; model.Name = Name; model.Descn = Descn; Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); bll.Update(model); Response.Redirect("index.aspx"); }
private void BindData() { #region 权限检查 //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[7].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[8].Visible = true; //} #endregion Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); string strWhere = ""; if (Session["strWhereBrand"] != null && Session["strWhereBrand"].ToString() != "") { strWhere += Session["strWhereBrand"].ToString(); } DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataView dv = ds.Tables[0].DefaultView; gridView.DataSource = dv; gridView.DataBind(); //分页 int rows_Count = ds.Tables[0].Rows.Count; int page_Size = gridView.PageSize; int page_Count = gridView.PageCount; int page_Current = gridView.PageIndex + 1; lblRowsCount.Text = rows_Count.ToString(); lblPageCount.Text = page_Count.ToString(); lblCurrentPage.Text = page_Current.ToString(); #region 显示页导航 btnFirst.Enabled = true; btnPrev.Enabled = true; btnNext.Enabled = true; btnLast.Enabled = true; if (gridView.PageIndex == 0) { btnFirst.Enabled = false; btnPrev.Enabled = false; if (gridView.PageCount == 1) { btnLast.Enabled = false; btnNext.Enabled = false; } } else if (gridView.PageIndex == gridView.PageCount - 1) { btnLast.Enabled = false; btnNext.Enabled = false; } #endregion }
protected void gridView_Sorting(object sender, GridViewSortEventArgs e) { Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); string strWhere = ""; if (Session["strWhereProduct"] != null && Session["strWhereProduct"].ToString() != "") { strWhere += Session["strWhereProduct"].ToString(); } DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataView dv = ds.Tables[0].DefaultView; if (ViewState["SortDirection"] == null) { ViewState["SortDirection"] = "desc"; } else { if (ViewState["SortDirection"].ToString() == "asc") { ViewState["SortDirection"] = "desc"; } else { ViewState["SortDirection"] = "asc"; } } dv.Sort = e.SortExpression + " " + ViewState["SortDirection"].ToString(); gridView.DataSource = dv; gridView.DataBind(); }
private void BindData() { #region Ȩ��� //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[7].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[8].Visible = true; //} #endregion Maticsoft.BLL.Products.Brand bll = new Maticsoft.BLL.Products.Brand(); string strWhere = ""; if (Session["strWhereBrand"] != null && Session["strWhereBrand"].ToString() != "") { strWhere += Session["strWhereBrand"].ToString(); } DataSet ds = new DataSet(); ds = bll.GetList(strWhere); DataView dv = ds.Tables[0].DefaultView; gridView.DataSource = dv; gridView.DataBind(); //��ҳ int rows_Count = ds.Tables[0].Rows.Count; int page_Size = gridView.PageSize; int page_Count = gridView.PageCount; int page_Current = gridView.PageIndex + 1; lblRowsCount.Text = rows_Count.ToString(); lblPageCount.Text = page_Count.ToString(); lblCurrentPage.Text = page_Current.ToString(); #region ��ʾҳ���� btnFirst.Enabled = true; btnPrev.Enabled = true; btnNext.Enabled = true; btnLast.Enabled = true; if (gridView.PageIndex == 0) { btnFirst.Enabled = false; btnPrev.Enabled = false; if (gridView.PageCount == 1) { btnLast.Enabled = false; btnNext.Enabled = false; } } else if (gridView.PageIndex == gridView.PageCount - 1) { btnLast.Enabled = false; btnNext.Enabled = false; } #endregion }