ERP部门的添加(十一)

网友投稿 609 2022-10-06

ERP部门的添加(十一)

ERP部门的添加(十一)

功能需求:

1.有部门管理权限的人员进行添加部门基本信息。

2.有部门权限管理的人员查询部门基本信息。

3.有部门权限管理的人员进行修改部门基本信息。

4.在一个页面中实现,使用弹出对话框方式

存储过程:

-- =============================================ALTER PROCEDURE [dbo].[Department_Add] @DepartmentName nvarchar(50), @Tel1 nvarchar(20), @Tel2 nvarchar(20), @ReMark nvarchar(200) ASBEGIN INSERT INTO Department ( DepartmentName, Tel1, Tel2, ReMark ) VALUES ( @DepartmentName, @Tel1, @Tel2, @ReMark ) --修改部门显示顺序 DECLARE @id int SET @id=@@IDENTITY UPDATE Department SET Displayorder =@id WHERE DepartmentId=@idEND

修改:

------------------------------------ALTER PROCEDURE [dbo].[Department_Update]@DepartmentId int,@DepartmentName nvarchar(50),@Tel1 nvarchar(20),@Tel2 nvarchar(20),@Displayorder int,@ReMark nvarchar(200) AS UPDATE [Department] SET [DepartmentName] = @DepartmentName,[Tel1] = @Tel1,[Tel2] = @Tel2,[Displayorder] = @Displayorder,[ReMark] = @ReMark WHERE DepartmentId=@DepartmentId

前台的页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DepartMentManager.aspx.cs" Inherits="BioErpWeb.HRSystem.DepartMentManager" %><%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

部门信息添加
部门名
电话号码1
电话号码2
备注
部门信息编辑
部门名
电话号码1
电话号码2
显示顺序
备注
部门信息管理系统

BLL层:

public class DepartMentBLL { ///

/// 添加 /// /// /// public int DepartMentAdd(DepartMent de) { SqlParameter[] parameters = { new SqlParameter("@DepartmentName", SqlDbType.NVarChar,50), new SqlParameter("@Tel1", SqlDbType.NVarChar,20), new SqlParameter("@Tel2", SqlDbType.NVarChar,20), new SqlParameter("@ReMark", SqlDbType.NVarChar,200)}; parameters[0].Value = de.DepartmentName; parameters[1].Value = de.Tel1; parameters[2].Value = de.Tel2; parameters[3].Value = de.ReMark; return DataBaseHelper.ExcuteSqlReturnInt("Department_ADD", CommandType.StoredProcedure, parameters); } /// /// 修改 /// /// /// public int DepartMentUpdate(DepartMent de) { SqlParameter[] parameters = { new SqlParameter("@DepartmentId", SqlDbType.Int,4), new SqlParameter("@DepartmentName", SqlDbType.NVarChar,50), new SqlParameter("@Tel1", SqlDbType.NVarChar,20), new SqlParameter("@Tel2", SqlDbType.NVarChar,20), new SqlParameter("@Displayorder", SqlDbType.Int,4), new SqlParameter("@ReMark", SqlDbType.NVarChar,200)}; parameters[0].Value = de.DepartmentId; parameters[1].Value = de.DepartmentName; parameters[2].Value = de.Tel1; parameters[3].Value = de.Tel2; parameters[4].Value = de.Displayorder; parameters[5].Value = de.ReMark; return DataBaseHelper.ExcuteSqlReturnInt("Department_Update", CommandType.StoredProcedure, parameters); } /// /// 根据ID获取编号 /// /// /// public DepartMent getDepartMentById(string ID) { DepartMent d = new DepartMent(); return null; } }

界面层:

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { pagebind(); } } public static int pageindex = 0; public static int pagesize = 10; public static string condition = ""; protected void pagebind() { this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("Department", condition); this.AspNetPager1.PageSize = pagesize; this.GridView1.DataSource = SqlComm.getDataByPageIndex("Department", "*", "DepartmentId", condition, pageindex, pagesize); this.GridView1.DataBind(); } DepartMentBLL debll = new DepartMentBLL(); protected void btnAdd_Click(object sender, EventArgs e) { DepartMent de = new DepartMent(); de.DepartmentName = this.txtDepartMent0.Text; de.ReMark = this.txtReMark.Text; de.Tel1 = this.txtTel10.Text; de.Tel2 = this.txtTel20.Text; if (debll.DepartMentAdd(de) != 0) { pagebind(); } this.Modal_Add.Hide(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { pageindex = this.AspNetPager1.CurrentPageIndex - 1; pagebind(); } protected void btnUpdate_Click(object sender, EventArgs e) { } protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "imgEdit") { this.Modal_Update.Show(); } } protected void btnClose1_Click(object sender, EventArgs e) { this.Modal_Update.Hide(); }

修改BLL:

///

/// 根据ID获取编号 /// /// /// public DepartMent getDepartMentById(string ID) { DepartMent d = new DepartMent(); SqlDataReader reader= SqlComm.GetDataReaderByCondition("Department", "*", " DepartmentId= " + ID); while (reader.Read()) { d.DepartmentId=int.Parse(reader["DepartmentId"].ToString()); d.DepartmentName = reader["DepartmentName"].ToString(); d.Displayorder = int.Parse(reader["Displayorder"].ToString()); d.ReMark = reader["ReMark"].ToString(); d.Tel1 = reader["Tel1"].ToString(); d.Tel2 = reader["Tel2"].ToString(); } reader.Close(); return d; }

UI代码

protected void btnUpdate_Click(object sender, EventArgs e) { de.DepartmentName = this.txtDepartMent1.Text; de.ReMark = this.txtReMark1.Text; de.Tel1 = this.txtTel11.Text; de.Tel2 = this.txtTel21.Text; de.Displayorder = int.Parse(this.txtDisplayOrder1.Text.Trim()) ; if (debll.DepartMentUpdate(de) != 0) { pagebind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('修改失败')", true); } this.Modal_Update.Hide(); }

角色的管理:

公用层:

///

/// 获取员工角色列表 /// /// DataTable public static DataTable getUserRoseList() { return DataBaseHelper.SelectSQLReturnTable("getUserRoseList", CommandType.StoredProcedure); }

BLL层:

public class RoseBLL { ///

/// 添加一个角色信息 /// /// /// public int Rose_Add(tbRose rose) { SqlParameter[] parameters = { new SqlParameter("@RoseName", SqlDbType.NVarChar,50)}; parameters[0].Value = rose.RoseName; return DataBaseHelper.ExcuteSqlReturnInt("tbRose_ADD", CommandType.StoredProcedure, parameters); } /// /// 修改一个角色对象 /// /// /// public int Rose_Update(tbRose rose) { SqlParameter[] parameters = { new SqlParameter("@RoseID", SqlDbType.Int,4), new SqlParameter("@RoseName", SqlDbType.NVarChar,50)}; parameters[0].Value = rose.RoseID; parameters[1].Value = rose.RoseName; return DataBaseHelper.ExcuteSqlReturnInt("tbRose_Update", CommandType.StoredProcedure, parameters); } /// /// 根据ID获取Rose对象 /// /// id /// tbRose public tbRose getRoseById(string id) { tbRose r = new tbRose(); SqlDataReader reader = SqlComm.GetDataReaderByCondition("tbRose", "*", " RoseID=" + id); if (reader != null) { while (reader.Read()) { r.RoseID = int.Parse(reader["RoseID"].ToString()); r.RoseName = reader["RoseName"].ToString(); } reader.Close(); } return r; } }

页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RoseManager.aspx.cs" Inherits="BioErpWeb.HRSystem.RoseManager" %><%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

角色添加
角色名
角色编辑
角色名
企业角色管理系统

后端:

public partial class RoseManager : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { pagebind(); } } public static int pageindex = 0; public static int pagesize = 10; public static string condition = ""; protected void pagebind() { this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("tbRose", condition); this.AspNetPager1.PageSize = pagesize; this.GridView1.DataSource = SqlComm.getDataByPageIndex("tbRose", "RoseID,RoseName", "RoseID", condition, pageindex, pagesize); this.GridView1.DataBind(); } static tbRose r=new tbRose(); RoseBLL rosebll = new RoseBLL(); protected void btnAdd_Click(object sender, EventArgs e) { if (this.txtRose0.Text == "" || this.txtRose0.Text.Trim().Length == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('请填写角色名称');", true); return; } r.RoseName = this.txtRose0.Text; if (rosebll.Rose_Add(r) != 0) { pagebind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('提交失败');", true); } this.Modal_Add.Hide(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { pageindex = this.AspNetPager1.CurrentPageIndex - 1; pagebind(); } protected void btnUpdate_Click(object sender, EventArgs e) { if (this.txtRose1.Text == "" || this.txtRose1.Text.Trim().Length == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('请填写角色名称');", true); return; } r.RoseName = this.txtRose1.Text; if (rosebll.Rose_Update(r) != 0) { pagebind(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('编辑失败');", true); } this.Modal_Update.Hide(); } protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "imgEdit") { string roseid = e.CommandArgument.ToString(); r = rosebll.getRoseById(roseid); this.txtRose1.Text = r.RoseName; this.Modal_Update.Show(); } } protected void btnClose1_Click(object sender, EventArgs e) { this.Modal_Update.Hide(); } }

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:stm32mp157系统移植 | 移植ST官方5.10内核到小熊派开发板
下一篇:微信小程序的自定义模态弹窗的介绍(微信小程序模态框)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~