//新增 protected void btnInsert_Click(object sender, EventArgs e) { try { ACMS.VO.RoleUserMappingVO myRoleUserMappingVO = new ACMS.VO.RoleUserMappingVO(); myRoleUserMappingVO.role_id = Convert.ToInt32(ddlRole.SelectedValue); if (ddlRole.SelectedIndex > 1) { myRoleUserMappingVO.unit_id = Convert.ToInt32(ddlUnit.SelectedValue); } else { myRoleUserMappingVO.unit_id = 0; } myRoleUserMappingVO.emp_id = txtEmployee.Text.Replace("(", "").Replace(")", ""); ACMS.DAO.RoleUserMappingDAO myRoleUserMappingDAO = new ACMS.DAO.RoleUserMappingDAO(); myRoleUserMappingDAO.InsertRoleUserMapping(myRoleUserMappingVO); GridView1.DataBind(); } catch (Exception ex) { WriteErrorLog("Insert", ex.Message, "0"); } }
//刪除 protected void lbtnDelete_Click(object sender, EventArgs e) { try { string id = GridView1.DataKeys[((sender as LinkButton).NamingContainer as GridViewRow).RowIndex].Value.ToString(); ACMS.VO.RoleUserMappingVO myRoleUserMappingVO = new ACMS.VO.RoleUserMappingVO(); myRoleUserMappingVO.id = Convert.ToInt32(id); ACMS.DAO.RoleUserMappingDAO myRoleUserMappingDAO = new ACMS.DAO.RoleUserMappingDAO(); myRoleUserMappingDAO.DeleteRoleUserMapping(myRoleUserMappingVO); GridView1.DataBind(); } catch (Exception ex) { WriteErrorLog("Delete", ex.Message, "0"); } }