public static bool InsertUserDutyForSamp(string strUserId, string strDutyId, string isAuDefault) { bool flag = false; TSysUserDutyVo objUv = new TSysUserDutyVo(); objUv.DUTY_ID = strDutyId; objUv.USERID = strUserId; if (!String.IsNullOrEmpty(isAuDefault)) { if (isAuDefault == "true") { objUv.IF_DEFAULT = "0"; } else { objUv.IF_DEFAULT_EX = "0"; } } DataTable dt = new DataTable(); dt = new TSysUserDutyLogic().SelectByTable(objUv); if (dt.Rows.Count > 0) { flag = true; } else { objUv.ID = GetSerialNumber("user_duty_infor"); if (new TSysUserDutyLogic().Create(objUv)) { flag = true; } } return(flag); }
/// <summary> /// 检查当前用户是否已经进行了设置,如果没有设置则插入 /// </summary> /// <param name="strUserId"></param> /// <param name="strDutyId"></param> /// <returns></returns> public static bool UserDutyItem(string strUserId, string strMonitor, string strDutyId) { bool flag = false; DataTable dt = new DataTable(); TSysUserDutyVo objuv = new TSysUserDutyVo(); objuv.USERID = strUserId; objuv.DUTY_ID = strDutyId; dt = new TSysUserDutyLogic().SelectByTable(objuv); if (dt.Rows.Count < 1) { objuv.ID = GetSerialNumber("user_duty_infor"); if (new TSysUserDutyLogic().Create(objuv)) { flag = true; string strMessage = new PageBase().LogInfo.UserInfo.USER_NAME + "新增用户上岗资质" + objuv.ID + "成功"; new PageBase().WriteLog(i3.ValueObject.ObjectBase.LogType.AddUserDutyInfo, "", strMessage); } } return(flag); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tSysUserDuty_UpdateSet">UpdateSet用户对象</param> /// <param name="tSysUserDuty_UpdateWhere">UpdateWhere用户对象</param> /// <returns>是否成功</returns> public bool Edit(TSysUserDutyVo tSysUserDuty_UpdateSet, TSysUserDutyVo tSysUserDuty_UpdateWhere) { string strSQL = SqlHelper.BuildUpdateExpress(tSysUserDuty_UpdateSet, TSysUserDutyVo.T_SYS_USER_DUTY_TABLE); strSQL += this.BuildWhereStatement(tSysUserDuty_UpdateWhere); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tSysUserDuty">用户对象</param> /// <returns>是否成功</returns> public bool Edit(TSysUserDutyVo tSysUserDuty) { string strSQL = SqlHelper.BuildUpdateExpress(tSysUserDuty, TSysUserDutyVo.T_SYS_USER_DUTY_TABLE); strSQL += string.Format(" where ID='{0}' ", tSysUserDuty.ID); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tSysUserDuty">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TSysUserDutyVo tSysUserDuty, int iIndex, int iCount) { string strSQL = " select * from T_SYS_USER_DUTY {0} "; strSQL = String.Format(strSQL, BuildWhereStatement(tSysUserDuty)); return(SqlHelper.ExecuteDataTable(BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 根据对象构造条件语句 /// </summary> /// <param name="tSysUserDuty"></param> /// <returns></returns> public string BuildWhereStatement(TSysUserDutyVo tSysUserDuty) { StringBuilder strWhereStatement = new StringBuilder(" Where 1=1 "); if (null != tSysUserDuty) { //ID if (!String.IsNullOrEmpty(tSysUserDuty.ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND ID = '{0}'", tSysUserDuty.ID.ToString())); } //用户表ID if (!String.IsNullOrEmpty(tSysUserDuty.USERID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND USERID = '{0}'", tSysUserDuty.USERID.ToString())); } //已关联岗位职责ID if (!String.IsNullOrEmpty(tSysUserDuty.DUTY_ID.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND DUTY_ID = '{0}'", tSysUserDuty.DUTY_ID.ToString())); } //是否默认负责人 if (!String.IsNullOrEmpty(tSysUserDuty.IF_DEFAULT.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND IF_DEFAULT = '{0}'", tSysUserDuty.IF_DEFAULT.ToString())); } //是否默认协同人 if (!String.IsNullOrEmpty(tSysUserDuty.IF_DEFAULT_EX.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND IF_DEFAULT_EX = '{0}'", tSysUserDuty.IF_DEFAULT_EX.ToString())); } //备注1 if (!String.IsNullOrEmpty(tSysUserDuty.REMARK1.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK1 = '{0}'", tSysUserDuty.REMARK1.ToString())); } //备注2 if (!String.IsNullOrEmpty(tSysUserDuty.REMARK2.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK2 = '{0}'", tSysUserDuty.REMARK2.ToString())); } //备注3 if (!String.IsNullOrEmpty(tSysUserDuty.REMARK3.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK3 = '{0}'", tSysUserDuty.REMARK3.ToString())); } //备注4 if (!String.IsNullOrEmpty(tSysUserDuty.REMARK4.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK4 = '{0}'", tSysUserDuty.REMARK4.ToString())); } //备注5 if (!String.IsNullOrEmpty(tSysUserDuty.REMARK5.ToString().Trim())) { strWhereStatement.Append(string.Format(" AND REMARK5 = '{0}'", tSysUserDuty.REMARK5.ToString())); } } return(strWhereStatement.ToString()); }
/// <summary> /// 对象删除 /// </summary> /// <param name="Id">ID</param> /// <returns>是否成功</returns> public bool Delete(TSysUserDutyVo tSysUserDuty) { string strSQL = "delete from T_SYS_USER_DUTY "; strSQL += this.BuildWhereStatement(tSysUserDuty); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
public static bool InsertSelectedUser(string strUserId, string strItemID, string strDutyType) { string strDutyID = ""; string strMonitorID = new TBaseItemInfoLogic().Details(strItemID).MONITOR_ID; TSysDutyVo objDutySrh = new TSysDutyVo(); objDutySrh.MONITOR_TYPE_ID = strMonitorID; objDutySrh.MONITOR_ITEM_ID = strItemID; objDutySrh.DICT_CODE = strDutyType; DataTable dtDuty = new TSysDutyLogic().SelectByTable(objDutySrh); if (dtDuty.Rows.Count == 0) { //如果不存在岗位配置,增加 objDutySrh.ID = GetSerialNumber("duty_set_infor"); if (new TSysDutyLogic().Create(objDutySrh)) { strDutyID = objDutySrh.ID; } } else { strDutyID = dtDuty.Rows[0]["ID"].ToString(); } TSysUserDutyVo objUserDutySrh = new TSysUserDutyVo(); objUserDutySrh.DUTY_ID = strDutyID; DataTable dtUserDuty = new TSysUserDutyLogic().SelectByTable(objUserDutySrh); //删除移除的 for (int i = 0; i < dtUserDuty.Rows.Count; i++) { string strTmpUserID = dtUserDuty.Rows[i]["USERID"].ToString(); if (!strUserId.Contains(strTmpUserID)) { new TSysUserDutyLogic().Delete(dtUserDuty.Rows[i]["ID"].ToString()); } } string[] strUerArr = strUserId.Split(';'); new TSysUserDutyLogic().InsertSelectedUser(strUerArr, strDutyID); return(true); }
/// <summary> /// 获取对象List /// </summary> /// <param name="tSysUserDuty">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public List <TSysUserDutyVo> SelectByObject(TSysUserDutyVo tSysUserDuty, int iIndex, int iCount) { string strSQL = String.Format("select * from T_SYS_USER_DUTY " + this.BuildWhereStatement(tSysUserDuty)); return(SqlHelper.ExecuteObjectList(tSysUserDuty, BuildPagerExpress(strSQL, iIndex, iCount))); }
/// <summary> /// 根据对象特征获取单一对象 /// </summary> /// <param name="tSysUserDuty">对象</param> /// <returns></returns> public TSysUserDutyVo SelectByObject(TSysUserDutyVo tSysUserDuty) { return(access.SelectByObject(tSysUserDuty)); }
/// <summary> /// 对象明细 /// </summary> /// <param name="tSysUserDuty">对象条件</param> /// <returns>对象</returns> public TSysUserDutyVo Details(TSysUserDutyVo tSysUserDuty) { string strSQL = String.Format("select * from T_SYS_USER_DUTY " + this.BuildWhereStatement(tSysUserDuty)); return(SqlHelper.ExecuteObject(new TSysUserDutyVo(), strSQL)); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tSysUserDuty_UpdateSet">UpdateSet用户对象</param> /// <param name="tSysUserDuty_UpdateWhere">UpdateWhere用户对象</param> /// <returns>是否成功</returns> public bool Edit(TSysUserDutyVo tSysUserDuty_UpdateSet, TSysUserDutyVo tSysUserDuty_UpdateWhere) { return(access.Edit(tSysUserDuty_UpdateSet, tSysUserDuty_UpdateWhere)); }
/// <summary> /// 对象删除 /// </summary> /// <param name="Id">ID</param> /// <returns>是否成功</returns> public bool Delete(TSysUserDutyVo tSysUserDuty) { return(access.Delete(tSysUserDuty)); }
/// <summary> /// 获得查询结果总行数,用于分页 /// </summary> /// <param name="tSysUserDuty">对象</param> /// <returns>返回行数</returns> public int GetSelectResultCount(TSysUserDutyVo tSysUserDuty) { string strSQL = "select Count(*) from T_SYS_USER_DUTY " + this.BuildWhereStatement(tSysUserDuty); return(Convert.ToInt32(SqlHelper.ExecuteScalar(strSQL))); }
/// <summary> /// 获得查询结果总行数,用于分页 /// </summary> /// <param name="tSysUserDuty">对象</param> /// <returns>返回行数</returns> public int GetSelectResultCount(TSysUserDutyVo tSysUserDuty) { return(access.GetSelectResultCount(tSysUserDuty)); }
public TSysUserDutyLogic(TSysUserDutyVo _tSysUserDuty) { tSysUserDuty = _tSysUserDuty; access = new TSysUserDutyAccess(); }
/// <summary> /// 对象编辑 /// </summary> /// <param name="tSysUserDuty">用户对象</param> /// <returns>是否成功</returns> public bool Edit(TSysUserDutyVo tSysUserDuty) { return(access.Edit(tSysUserDuty)); }
/// <summary> /// 对象添加 /// </summary> /// <param name="tSysUserDuty">对象</param> /// <returns>是否成功</returns> public bool Create(TSysUserDutyVo tSysUserDuty) { string strSQL = SqlHelper.BuildInsertExpress(tSysUserDuty, TSysUserDutyVo.T_SYS_USER_DUTY_TABLE); return(SqlHelper.ExecuteNonQuery(CommandType.Text, strSQL) > 0 ? true : false); }
/// <summary> /// 根据对象获取全部数据,用Table承载 /// 数据量较小时使用【不推荐】 /// </summary> /// <param name="tSysUserDuty"></param> /// <returns></returns> public DataTable SelectByTable(TSysUserDutyVo tSysUserDuty) { string strSQL = "select * from T_SYS_USER_DUTY " + this.BuildWhereStatement(tSysUserDuty); return(SqlHelper.ExecuteDataTable(strSQL)); }
/// <summary> /// 根据对象获取全部数据,用Table承载 /// 数据量较小时使用【不推荐】 /// </summary> /// <param name="tSysUserDuty"></param> /// <returns></returns> public DataTable SelectByTable(TSysUserDutyVo tSysUserDuty) { return(access.SelectByTable(tSysUserDuty)); }
/// <summary> /// 获取对象DataTable /// </summary> /// <param name="tSysUserDuty">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public DataTable SelectByTable(TSysUserDutyVo tSysUserDuty, int iIndex, int iCount) { return(access.SelectByTable(tSysUserDuty, iIndex, iCount)); }
/// <summary> /// 获取对象List /// </summary> /// <param name="tSysUserDuty">对象</param> /// <param name="iIndex">起始页码</param> /// <param name="iCount">每页数目</param> /// <returns>返回结果</returns> public List <TSysUserDutyVo> SelectByObject(TSysUserDutyVo tSysUserDuty, int iIndex, int iCount) { return(access.SelectByObject(tSysUserDuty, iIndex, iCount)); }
/// <summary> /// 对象明细 /// </summary> /// <param name="tSysUserDuty">对象条件</param> /// <returns>对象</returns> public TSysUserDutyVo Details(TSysUserDutyVo tSysUserDuty) { return(access.Details(tSysUserDuty)); }
/// <summary> /// 根据对象特征获取单一对象 /// </summary> /// <param name="tSysUserDuty">对象</param> /// <returns></returns> public TSysUserDutyVo SelectByObject(TSysUserDutyVo tSysUserDuty) { string strSQL = "select * from T_SYS_USER_DUTY " + this.BuildWhereStatement(tSysUserDuty); return(SqlHelper.ExecuteObject(new TSysUserDutyVo(), strSQL)); }
/// <summary> /// 对象添加 /// </summary> /// <param name="sysRole">对象</param> /// <returns>是否成功</returns> public bool Create(TSysUserDutyVo tSysUserDuty) { return(access.Create(tSysUserDuty)); }