📄 constitute.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_constitute : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["User"] != null && Request.QueryString["chanceid"] != null)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
DisplayInfo(chanceid);
DisplayGrid(chanceid);
}
}
}
protected void DisplayInfo(int chanceid)
{
Sal_chance chance = ChanceManager.GetChanceById(chanceid);
num.Text = chance.Chance_id.ToString();
source.Text = chance.Chance_source;
name.Text = chance.Chance_customer_name;
title.Text = chance.Chance_title;
jl.Text = chance.Chance_rate.ToString();
lx.Text = chance.Chance_linkman;
tel.Text = chance.Chance_tel;
hap.Text = chance.Chance_desc;
ren.Text = chance.Chance_create_by;
time.Text = chance.Chance_create_date.ToString("yyyy年MM月dd日 HH时mm分ss秒");
zp.Text = chance.Chance_due_to;
zptime.Text = chance.Chance_due_date.ToString("yyyy年MM月dd日 HH时mm分ss秒");
}
protected void DisplayGrid(int chanceid)
{
GridView1.DataSource = PlanManager.GetPlanByChanceid(chanceid);
GridView1.DataBind();
}
protected void saves_Click(object sender, EventArgs e)
{
int chanceid = int.Parse(Request.QueryString["chanceid"]);
Sal_plan plan = new Sal_plan();
plan.Plan_date=DateTime.Parse(savetime.Text);
plan.Plan_todo = pan.Text.Trim();
plan.Plan_result = "";
plan.Chance = ChanceManager.GetChanceById(chanceid);
int result = PlanManager.AddPlan(plan);
if (result > 0)
{
Response.Write("<script>alert('添加计划项成功');location.href('constitute.aspx?chanceid=" + chanceid+"');</script>");
}
else
{
Response.Write("<script>alert('添加计划项失败');location.href('constitute.aspx?chanceid=" + chanceid + "');</script>");
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
int planid = Convert.ToInt32(e.CommandArgument);
if (e.CommandName == "edit")
{
TextBox txt = (TextBox)(this.GridView1.Rows[planid]).FindControl("txt");
string n = txt.Text;
int ab =int.Parse( txt.ToolTip);
if (n != null)
{
PlanManager.UpdatePlan(n,ab);
}
}
if (e.CommandName == "delete")
{
TextBox txt = (TextBox)(this.GridView1.Rows[planid]).FindControl("txt");
string n = txt.Text;
int ab = int.Parse(txt.ToolTip);
PlanManager.DelPlan(ab);
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
DisplayGrid(chanceid);
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
Response.Write("<script>alert('修改计划项成功');location.href('constitute.aspx?chanceid=" + chanceid + "');</script>");
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
Response.Write("<script>alert('删除计划项成功');location.href('constitute.aspx?chanceid=" + chanceid + "');</script>");
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button Delete = (Button)e.Row.FindControl("del");
Button save = (Button)e.Row.FindControl("save");
save.CommandArgument = e.Row.RowIndex.ToString();
Delete.Attributes.Add("onclick", "return confirm('确定要删除吗?');");
}
}
protected void btn_Click(object sender, EventArgs e)
{
string chanceid=Request.Params["chanceid"].ToString();
Response.Redirect("administer.aspx?chanceid=" + Server.UrlEncode(chanceid.Trim()) + "");
}
protected void btnExit_Click(object sender, EventArgs e)
{
Response.Redirect("plan.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -