/// <summary> /// 委员会名称校验 /// </summary> public bool CheckBoardName(string name, long id = 0) { d_change_board thisBoard = GetBoardByName(name); if (thisBoard != null && thisBoard.id != id) { return(false); } return(true); }
/// <summary> /// 新增变更委员会 /// </summary> public bool AddBoard(d_change_board board, string resIds, long userId) { if (!CheckBoardName(board.name)) { return(false); } board.id = _dal.GetNextIdCom(); board.create_time = board.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); board.create_user_id = board.update_user_id = userId; _dal.Insert(board); OperLogBLL.OperLogAdd <d_change_board>(board, board.id, userId, DicEnum.OPER_LOG_OBJ_CATE.CHANGE_BOARD, ""); BoardResourceManage(board.id, resIds, userId); return(true); }
/// <summary> /// 删除变更委员会 /// </summary> public bool DeleteBoard(long bId, long userId, ref string faileReason) { d_change_board thisBoard = GetBoard(bId); if (thisBoard == null) { return(false); } thisBoard.delete_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); thisBoard.delete_user_id = userId; EditBoard(thisBoard, "", userId); //_dal.SoftDelete(thisBoard,userId); //OperLogBLL.OperLogDelete<d_change_board>(thisBoard,thisBoard.id, userId, DicEnum.OPER_LOG_OBJ_CATE.CHANGE_BOARD, ""); return(true); }
/// <summary> /// 编辑变更委员会 /// </summary> public bool EditBoard(d_change_board board, string resIds, long userId) { d_change_board oldBoard = GetBoard(board.id); if (oldBoard == null) { return(false); } if (!CheckBoardName(board.name, board.id)) { return(false); } board.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); board.update_user_id = userId; _dal.Update(board); OperLogBLL.OperLogUpdate <d_change_board>(board, oldBoard, board.id, userId, DicEnum.OPER_LOG_OBJ_CATE.CHANGE_BOARD, ""); BoardResourceManage(board.id, resIds, userId); return(true); }
/// <summary> /// 激活/失活 变更委员会 /// </summary> public bool ActivBoard(long bId, long userId, bool isActive) { d_change_board thisBoard = GetBoard(bId); if (thisBoard == null) { return(false); } sbyte thisActive = (sbyte)(isActive ? 1 : 0); if (thisBoard.is_active != thisActive) { var oldBoard = GetBoard(bId); thisBoard.is_active = thisActive; thisBoard.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); thisBoard.update_user_id = userId; _dal.Update(thisBoard); OperLogBLL.OperLogUpdate <d_change_board>(thisBoard, oldBoard, thisBoard.id, userId, DicEnum.OPER_LOG_OBJ_CATE.CHANGE_BOARD, ""); } return(true); }
protected void Page_Load(object sender, EventArgs e) { long id = 0; if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out id)) { board = cbBll.GetBoard(id); } if (board != null) { isAdd = false; personList = cbBll.GerPersonList(board.id); } if (personList != null && personList.Count > 0) { personList.ForEach(_ => { resIds += _.resource_id.ToString() + ','; }); } if (!string.IsNullOrEmpty(resIds)) { resIds = resIds.Substring(0, resIds.Length - 1); } }
/// <summary> /// 变更委员会员工管理 /// </summary> public void BoardResourceManage(long boardId, string resIds, long userId) { d_change_board oldBoard = GetBoard(boardId); if (oldBoard == null) { return; } long timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); List <d_change_board_person> list = GerPersonList(boardId); d_change_board_person_dal cbpDal = new d_change_board_person_dal(); if (list != null && list.Count > 0) { if (!string.IsNullOrEmpty(resIds)) { string[] resArr = resIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var resId in resArr) { d_change_board_person boaPerson = list.FirstOrDefault(_ => _.resource_id.ToString() == resId); if (boaPerson != null) { list.Remove(boaPerson); continue; } boaPerson = new d_change_board_person() { id = cbpDal.GetNextIdCom(), change_board_id = boardId, create_time = timeNow, update_time = timeNow, create_user_id = userId, update_user_id = userId, resource_id = long.Parse(resId), }; cbpDal.Insert(boaPerson); OperLogBLL.OperLogAdd <d_change_board_person>(boaPerson, boaPerson.id, userId, DicEnum.OPER_LOG_OBJ_CATE.CHANGE_BOARD_PERSON, ""); } } if (list.Count > 0) { list.ForEach(_ => { cbpDal.SoftDelete(_, userId); OperLogBLL.OperLogDelete <d_change_board_person>(_, _.id, userId, DicEnum.OPER_LOG_OBJ_CATE.CHANGE_BOARD_PERSON, ""); }); } } else { if (!string.IsNullOrEmpty(resIds)) { string[] resArr = resIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (var resId in resArr) { d_change_board_person boaPerson = cbpDal.GetSingleByBoardRes(boardId, long.Parse(resId)); if (boaPerson != null) { continue; } boaPerson = new d_change_board_person() { id = cbpDal.GetNextIdCom(), change_board_id = boardId, create_time = timeNow, update_time = timeNow, create_user_id = userId, update_user_id = userId, resource_id = long.Parse(resId), }; cbpDal.Insert(boaPerson); OperLogBLL.OperLogAdd <d_change_board_person>(boaPerson, boaPerson.id, userId, DicEnum.OPER_LOG_OBJ_CATE.CHANGE_BOARD_PERSON, ""); } } } }
protected void save_close_Click(object sender, EventArgs e) { d_change_board pageBoard = AssembleModel <d_change_board>(); if (!string.IsNullOrEmpty(Request.Form["isActive"]) && Request.Form["isActive"] == "on") { pageBoard.is_active = 1; } else { pageBoard.is_active = 0; } if (!string.IsNullOrEmpty(Request.Form["isContact"]) && Request.Form["isContact"] == "on") { pageBoard.include_ticket_contact = 1; } else { pageBoard.include_ticket_contact = 0; } if (!string.IsNullOrEmpty(Request.Form["isPriContact"]) && Request.Form["isPriContact"] == "on") { pageBoard.include_primary_contact = 1; } else { pageBoard.include_primary_contact = 0; } if (!string.IsNullOrEmpty(Request.Form["isParPriContact"]) && Request.Form["isParPriContact"] == "on") { pageBoard.include_parent_account_primary_contact = 1; } else { pageBoard.include_parent_account_primary_contact = 0; } if (!string.IsNullOrEmpty(Request.Form["isAccMan"]) && Request.Form["isAccMan"] == "on") { pageBoard.include_account_resource = 1; } else { pageBoard.include_account_resource = 0; } if (!isAdd) { board.name = pageBoard.name; board.is_active = pageBoard.is_active; board.description = pageBoard.description; board.include_ticket_contact = pageBoard.include_ticket_contact; board.include_primary_contact = pageBoard.include_primary_contact; board.include_parent_account_primary_contact = pageBoard.include_parent_account_primary_contact; board.include_account_resource = pageBoard.include_account_resource; } string resIds = Request.Form["resIds"]; bool result = false; if (isAdd) { result = cbBll.AddBoard(pageBoard, resIds, LoginUserId); } else { result = cbBll.EditBoard(board, resIds, LoginUserId); } ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>"); }