?? administer.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_administer : 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 GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
DisplayGrid(chanceid);
}
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.UpdatePlanResult(n, ab);
}
}
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
Response.Write("<script>alert('保存執行效果成功');location.href('administer.aspx?chanceid=" + chanceid + "');</script>");
}
protected void btnEnd_Click(object sender, EventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
Sal_chance chance = new Sal_chance();
chance.Chance_status = "4";
chance.Chance_id = chanceid;
int result = ChanceManager.UpdateStatus(chance);
if(result>0)
{
Response.Write("<script>alert('終止計劃成功');location.href('plan.aspx');</script>");
}
}
protected void btn_Click(object sender, EventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
Response.Redirect("constitute.aspx?chanceid=" + chanceid);
}
protected void btnSta_Click(object sender, EventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
Sal_chance chance = ChanceManager.GetChanceById(chanceid);
Cst_customer customers = new Cst_customer();
Random rd = new Random();
customers.Customer_no = rd.Next().ToString().Substring(0, 6).Trim();
customers.Customer_name = chance.Chance_customer_name;
customers.Customer_region = "";
customers.Customer_manager_id = chance.Chance_cue_id;
customers.Customer_manager_name = chance.Chance_due_to;
customers.Customer_level = 0;
customers.Customer_level_label = "";
customers.Customer_satisfy = 0;
customers.Customer_credit = 0;
customers.Customer_addr = "";
customers.Customer_zip = "";
customers.Customer_tel = "";
customers.Customer_fax = "";
customers.Customer_website = "";
customers.Customer_licence_no = "";
customers.Customer_chieftain = "";
customers.Customer_bankroll = 0;
customers.Customer_turnover = 0;
customers.Customer_bank = "";
customers.Customer_bank_account = "";
customers.Customer_local_tax_no = "";
customers.Customer_national_tax_no = "";
customers.Customer_status = "1";
CustomerManager.AddCustomer(customers);
Cst_linkman link = new Cst_linkman();
link.Customer = CustomerManager.GetCustomerByCustomerId(customers.Customer_no.Trim());
link.Linkman_memo = "";
link.Linkman_mobile = "";
link.Linkman_tel = chance.Chance_tel;
link.Linkman_sex = "男";
link.Linkman_postion = "";
link.Linkman_name = chance.Chance_linkman;
LinkManManager.AddLinkman(link);
chance.Chance_status = "3";
chance.Chance_id = chanceid;
int result = ChanceManager.UpdateStatus(chance);
if (result > 0)
{
Response.Write("<script>alert('開發計劃成功');location.href('plan.aspx');</script>");
}
}
protected void btnExit_Click(object sender, EventArgs e)
{
int chanceid = int.Parse(Request.Params["chanceid"].ToString());
Response.Redirect("constitute.aspx?chanceid=" + chanceid);
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button save = (Button)e.Row.FindControl("save");
save.CommandArgument = e.Row.RowIndex.ToString();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -