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

📄 jigou.aspx.cs

📁 OA系统源码 办公应用软件源码 asp.net 开发
💻 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;
using MyOffice.Models;
using MyOffice.BLL;

public partial class PersonManage_jigou : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Button1.Enabled = true;
        Button2.Enabled = false;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (tbName.Text != "" && tbShortname.Text != "")
        {
            BranchInfoModel brin = new BranchInfoModel();
            brin.BranchName = tbName.Text;
            brin.BranchShortName = tbShortname.Text;
            int number = personManageBLL.BranchIn(brin);
            if (number == 0)
            {
                Response.Write("<script>alert('添加失败');</script>");
            }
            else
            {
                OperateLogModel opelm = new OperateLogModel();
                string userid = (string)Session["UserId"];
                opelm.UserId = userid;
                opelm.OperateName = "添加";
                opelm.OperateDesc = "添加机构";
                opelm.ObjectId = "101001";
                opelm.OperateTime = DateTime.Now;
                int Inoper = SysManageBLL.InsertOperate(opelm);
                tbName.Text = "";
                tbShortname.Text = "";
                GridView1.DataSourceID = null;
                GridView1.DataSource = personManageBLL.AllSeBr();
                GridView1.DataBind();
            }
        }
        else
        {
            Response.Write("<script>alert('机构名称和简称必须填写');</script>");
        }
    }
    protected void GridView1_DataBound(object sender, EventArgs e)
    {

    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ImageButton imb = (ImageButton)e.Row.FindControl("imBnDe");
            imb.Attributes.Add("onclick", "return confirm('您确定要删除吗?');");
        }
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string coname = e.CommandName;
        int id = Convert.ToInt32(e.CommandArgument);
        OperateLogModel operlom = new OperateLogModel();
        string userid = (string)Session["UserId"];
        operlom.UserId = userid;
        if (coname == "De")
        {
            operlom.OperateName = "删除";
            int number = personManageBLL.shanBranch(id);
            int num = personManageBLL.DeBrIdDe(id);
            if (number == 0)
            {
                Response.Write("<script>alert('删除失败!!!');</script>");
            }
            else
            {
                operlom.OperateDesc = "删除机构";
                operlom.OperateTime = DateTime.Now;
                operlom.ObjectId = "101001";
                int InPer = SysManageBLL.InsertOperate(operlom);
                GridView1.DataSourceID = null;
                GridView1.DataSource = personManageBLL.AllSeBr();
                GridView1.DataBind();
            }

        }
        else if (coname == "Up")
        {
            Button1.Enabled = false;
            BranchInfoModel br = personManageBLL.SeleBranchId(id);
            ViewState["Id"] = id;
            if (br != null)
            {
                tbName.Text = br.BranchName;
                tbShortname.Text = br.BranchShortName;
                Button2.Enabled = true;
            }
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (tbName.Text != "" && tbShortname.Text != "")
        {
            BranchInfoModel bran = new BranchInfoModel();
            int id = (int)ViewState["Id"];
            bran.BranchId = id;
            bran.BranchName = tbName.Text;
            bran.BranchShortName = tbShortname.Text;
            int number = personManageBLL.UpdateBran(bran);
            if (number == 0)
            {
                Response.Write("<script>alert('修改失败!!!');</script>");
            }
            else
            {
                OperateLogModel operm = new OperateLogModel();
                string userid=(string)Session["UserId"];
                operm.UserId = userid;
                operm.OperateName = "修改";
                operm.ObjectId = "101001";
                operm.OperateDesc = "修改机构信息";
                operm.OperateTime = DateTime.Now;
                int Inoper = SysManageBLL.InsertOperate(operm);
                GridView1.DataSourceID = null;
                GridView1.DataSource = personManageBLL.AllSeBr();
                GridView1.DataBind();
            }
        }
        else
        {
            Response.Write("<script>alert('机构名称和简称不能为空');</script>");
        }
    }
}

⌨️ 快捷键说明

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