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

📄 client_add.aspx.cs

📁 OA系统,数据库为SQLSever 。net c#
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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;

public partial class ClientInfo_Client_Add : System.Web.UI.Page
{
    WebService webService = new WebService();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserID"] == null || Session["UserLevel"] == null)
        {
            Response.Redirect("~/Error.aspx");
        }
        if (Session["UserLevel"].ToString() == "职员")
        {
            this.CheckBox1.Visible = false;
            this.lblMsg.Text = "您所添加的客户需要得到部门经理的审核!";
        }
        else if (Session["UserLevel"].ToString() == "部门经理")
        {
            this.lblMsg.Text = "您可以在此审核客户,也可以以后再审核!";
        }
        else
        {
            Response.Redirect("~/Error.aspx");
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.tbAgentName.Text == "" || this.tbClientName.Text == "" || this.tbEmail.Text == "" || this.tbPhone.Text == "" || this.tbWeb.Text == "")
        {
            this.lblMsg.Text = "请填写完整信息!";
        }
        else
        {
            string strSql = "SELECT Person_DeptID FROM z_Person where z_Person.Person_ID='" + Session["UserID"].ToString() + "';";
            DataTable table = webService.ExcuteSelect(strSql);
            string strDeptID = table.Rows[0]["Person_DeptID"].ToString();
            string strCompanyName = this.tbClientName.Text;
            string strAgentName = this.tbAgentName.Text;
            string strEmail = this.tbEmail.Text;
            string strPhone = this.tbPhone.Text;
            string strWeb = this.tbWeb.Text;
            if (this.CheckBox1.Checked)
                strSql = "Insert into z_Client(Client_AddDate,Client_CompanyName,Client_AgentName,Client_Phone,Client_Email,Client_WebSite,Client_IsConfirm,Client_ConfirmDate,Client_AddPersonID,Dept_ID) values ('" + DateTime.Now + "','" + strCompanyName + "','" + strAgentName + "','" + strPhone + "','" + strEmail + "','" + strWeb + "','1','" + DateTime.Now + "','" + Session["UserID"].ToString() +"','"+strDeptID+ "');";
            else
                strSql = "Insert into z_Client(Client_AddDate,Client_CompanyName,Client_AgentName,Client_Phone,Client_Email,Client_WebSite,Client_IsConfirm,Client_AddPersonID,Dept_ID) values ('" + DateTime.Now + "','" + strCompanyName + "','" + strAgentName + "','" + strPhone + "','" + strEmail + "','" + strWeb + "','0','" + Session["UserID"].ToString() +"','"+strDeptID+ "');";
            webService.ExcuteSql(strSql);
            Response.Redirect("Client_List.aspx");
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Client_List.aspx");
    }
}

⌨️ 快捷键说明

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