?? chance.aspx.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 + -