/// <summary> /// 得到一个对象实体 /// </summary> public void InitControl() { if (!string.IsNullOrEmpty(_key)) { bpms_itemdetails = bpms_itemdetailsibll.GetEntity(_key); ControlBindHelper.SetWebControls(this.Page, bpms_itemdetails); } }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public int Insert(BPMS_ItemDetails entity) { entity.SortCode = CommonHelper.GetInt(this.GetMaxCode()); int IsOk = DataFactory.DbUtils().Insert(entity); #region 写日操作日志 if (IsOk > 0) { BPMS_SysLogDAL.Instance.AddTaskLog <BPMS_ItemDetails>(entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName); } #endregion return(IsOk); }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public int Update(BPMS_ItemDetails entity) { #region 获取旧值 var oldEntity = this.GetEntity(BPMS_SysLogDAL.Instance.GetKeyFieldValue <BPMS_ItemDetails>(entity).ToString()); #endregion int IsOk = DataFactory.DbUtils().Update(entity, "ItemDetailsId"); #region 写日操作日志 if (IsOk > 0) { BPMS_SysLogDAL.Instance.UpdateTaskLog <BPMS_ItemDetails>(oldEntity, entity, RequestSession.GetSessionUser().UserId, RequestSession.GetSessionUser().UserName); } #endregion return(IsOk); }
/// <summary> /// 确认事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Accept_Click(object sender, EventArgs e) { bool IsOk = false; bpms_itemdetails = ControlBindHelper.GetWebControls <BPMS_ItemDetails>(this.Page); bpms_itemdetails.Enabled = Enabled.Checked ? 1 : 0; bpms_itemdetails.AllowEdit = AllowEdit.Checked ? 1 : 0; bpms_itemdetails.AllowDelete = AllowDelete.Checked ? 1 : 0; if (!string.IsNullOrEmpty(_key))//判断是否编辑 { bpms_itemdetails.ItemDetailsId = _key; bpms_itemdetails.ModifyDate = DateTime.Now; bpms_itemdetails.ModifyUserId = RequestSession.GetSessionUser().UserId; bpms_itemdetails.ModifyUserName = RequestSession.GetSessionUser().UserName; IsOk = bpms_itemdetailsibll.Update(bpms_itemdetails); if (IsOk) { ShowMsgHelper.AlertParmCallback(MessageHelper.MSG0006); } } else { bpms_itemdetails.ItemDetailsId = CommonHelper.GetGuid; bpms_itemdetails.ItemsId = _ItemsId; bpms_itemdetails.CreateUserId = RequestSession.GetSessionUser().UserId; bpms_itemdetails.CreateUserName = RequestSession.GetSessionUser().UserName; IsOk = bpms_itemdetailsibll.Insert(bpms_itemdetails); if (IsOk) { ShowMsgHelper.AlertParmCallback(MessageHelper.MSG0005); } } if (!IsOk) { ShowMsgHelper.Alert_Error(MessageHelper.MSG0022); } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public bool Update(BPMS_ItemDetails entity) { return(dal.Update(entity) >= 0 ? true : false); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="entity">实体类</param> /// <returns></returns> public bool Insert(BPMS_ItemDetails entity) { return(dal.Insert(entity) >= 0 ? true : false); }