⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dict.aspx.cs

📁 客户关系管理系统 客户关系管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MyCRM.BLL;
using MyCRM.Models;

public partial class base_dict : System.Web.UI.Page
{ 
    int i = 1;
    int count = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (!IsPostBack)
        {
            Display();
        }
    }
    protected void Display()
    {
        GridView1.DataSource = DictManager.GetAll();
        GridView1.DataBind();
    }
    
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string dicid = e.CommandArgument.ToString();
        if (e.CommandName == "edit")
        {
            Response.Redirect("New.aspx?dicid=" + Server.UrlEncode(dicid.Trim()) + "");
        }
        
        if (e.CommandName == "del")
        {
            int result = DictManager.Del(int.Parse(dicid));
            if (result > 0)
            {
                Response.Write("<script>alert('删除成功');location.href('dict.aspx');</script>");
            }
            else
            {
                Response.Write("<script>alert('删除失败');location.href('dict.aspx');</script>");
            }
        }
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {

    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Label lab = (Label)e.Row.FindControl("Label1");
            lab.Text = "" + (i++);
            ImageButton Delete = (ImageButton)e.Row.FindControl("imgbtnDelete");
            ImageButton edit = (ImageButton)e.Row.FindControl("ImageButton2");
            Label nums = (Label)e.Row.FindControl("Label2");
            if (nums.Text=="False")
            {
                nums.Text = "否";
                edit.Visible = false;
                Delete.Visible = false;
            }
            else
            {
                nums.Text = "是";
                edit.Visible = true;
                Delete.Visible = true;
            }

            Delete.Attributes.Add("onclick", "return confirm('确定要删除吗?');");
        }
    }
    protected void news_Click(object sender, EventArgs e)
    {
        Response.Redirect("New.aspx");
    }
    protected void sel_Click(object sender, EventArgs e)
    {
        source();
    }
    protected void source()
    {
        string nums = type.Text;
        string names = num.Text;
        string man = value.Text;

        GridView1.DataSource = DictManager.GetSelect(nums,names,man); ;
        GridView1.DataBind();
        if (GridView1.DataSource == null)
        {
            count = 1;
        }

    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        if (count == 1)
        {
            Display();
        }
        else
        {
            source();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -