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

📄 chance.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 department_chance : System.Web.UI.Page
{
    int count=0;
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            Display();
        }
    }
    protected void Display()
    {
        GridViewChance.DataSource = ChanceManager.GetAllChance();
        GridViewChance.DataBind();
    }

    protected void exit_Click(object sender, EventArgs e)
    {
        Response.Redirect("newchance.aspx");
    }
    protected void GridViewChance_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName=="edit")
        {
            string chanceid = e.CommandArgument.ToString();
            Response.Redirect("newchance.aspx?chanceid=" + Server.UrlEncode(chanceid.Trim()) + "");
        }
        if (e.CommandName == "del")
        {
            int chanceid = int.Parse(e.CommandArgument.ToString());
            Sal_chance chance = new Sal_chance();
            chance.Chance_id = chanceid;
            int result = ChanceManager.DelChance(chance);
            if(result>0)
            {
                Response.Write("<script>alert('删除机会成功');location.href('chance.aspx');</script>");
            }else{
                Response.Write("<script>alert('删除机会失败');location.href('chance.aspx');</script>");
            }
        }
        if (e.CommandName == "palto")
        {
            string chanceid = e.CommandArgument.ToString();
            Response.Redirect("assign.aspx?chanceid=" + Server.UrlEncode(chanceid.Trim()) + "");
        }
    }
    protected void GridViewChance_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ImageButton imgbtnDelete = (ImageButton)e.Row.FindControl("imgbtnDelete");//实例化image按钮控件
            imgbtnDelete.Attributes.Add("onclick", "return confirm('确定要删除吗?');");
        }
    }
   
    protected void save_Click(object sender, EventArgs e)
    {
        source();     
    }
    protected void source()
    {
        string names = name.Text.Trim();
        string titles = title.Text.Trim();
        string ren = telname.Text.Trim();
        GridViewChance.DataSource = ChanceManager.GetChanceSelect(names, titles, ren);
        GridViewChance.DataBind();
        if (GridViewChance.DataSource == null)
        {
            count = 1;
        }
    }
    protected void GridViewChance_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridViewChance.PageIndex = e.NewPageIndex;
        if (count == 1)
        {
            Display();
        }
        else
        {
            source();
        }

    }
}

⌨️ 快捷键说明

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