Пример #1
0
        /// <summary>
        /// 增加支持组
        /// </summary>
        /// <param name="wfSupportGroup">支持组对象实体</param>
        public static bool Add(WfSupportGroupEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into WF_SupportGroup (");
            strSql.Append(" SupportGroupID,  SupportGroupName,  SupportGroupLevel,  GroupType,  IsDefault,  DepartmentID,  BusinessType,  DepartmentName)");
            strSql.Append(" values ( ");
            strSql.Append("@SupportGroupID, @SupportGroupName, @SupportGroupLevel, @GroupType, @IsDefault, @DepartmentID, @BusinessType, @DepartmentName)");

            SqlParameter[] parameters = {
                new SqlParameter("@SupportGroupID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@SupportGroupName", SqlDbType.NVarChar),
                new SqlParameter("@SupportGroupLevel", SqlDbType.Int),
                new SqlParameter("@GroupType", SqlDbType.VarChar),
                new SqlParameter("@IsDefault", SqlDbType.Bit),
                new SqlParameter("@DepartmentID", SqlDbType.VarChar),
                new SqlParameter("@BusinessType", SqlDbType.VarChar),
                new SqlParameter("@DepartmentName", SqlDbType.NVarChar)
            };

            int i = 0;
            parameters[i++].Value = entity.SupportGroupID;
            parameters[i++].Value = entity.SupportGroupName;
            parameters[i++].Value = entity.SupportGroupLevel;
            parameters[i++].Value = entity.GroupType;
            parameters[i++].Value = entity.IsDefault;
            parameters[i++].Value = entity.DepartmentID;
            parameters[i++].Value = entity.BusinessType;
            parameters[i++].Value = entity.DepartmentName;

            return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0;
        }
Пример #2
0
        /// <summary>
        /// 更新支持组
        /// </summary>
        /// <param name="wF_SupportGroup">支持组</param>
        /// <returns>bool</returns>
        public static bool Update(WfSupportGroupEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update WF_SupportGroup set ");
            strSql.Append("SupportGroupID = @SupportGroupID, ");
            strSql.Append("SupportGroupName = @SupportGroupName, ");
            strSql.Append("SupportGroupLevel = @SupportGroupLevel, ");
            strSql.Append("GroupType = @GroupType, ");
            strSql.Append("IsDefault = @IsDefault, ");
            strSql.Append("DepartmentID = @DepartmentID, ");
            strSql.Append("BusinessType = @BusinessType, ");
            strSql.Append("DepartmentName = @DepartmentName");
            strSql.Append(" where ");
            strSql.Append(" SupportGroupID = @SupportGroupID ");

            SqlParameter[] parameters = {
                new SqlParameter("@SupportGroupID", SqlDbType.UniqueIdentifier),
                new SqlParameter("@SupportGroupName", SqlDbType.NVarChar),
                new SqlParameter("@SupportGroupLevel", SqlDbType.Int),
                new SqlParameter("@GroupType", SqlDbType.VarChar),
                new SqlParameter("@IsDefault", SqlDbType.Bit),
                new SqlParameter("@DepartmentID", SqlDbType.VarChar),
                new SqlParameter("@BusinessType", SqlDbType.VarChar),
                new SqlParameter("@DepartmentName", SqlDbType.NVarChar)
            };

            int i = 0;
            parameters[i++].Value = entity.SupportGroupID;
            parameters[i++].Value = entity.SupportGroupName;
            parameters[i++].Value = entity.SupportGroupLevel;
            parameters[i++].Value = entity.GroupType;
            parameters[i++].Value = entity.IsDefault;
            parameters[i++].Value = entity.DepartmentID;
            parameters[i++].Value = entity.BusinessType;
            parameters[i++].Value = entity.DepartmentName;

            return DataHelper.ExecuteNoneQuery(strSql.ToString(), parameters) > 0;
        }
Пример #3
0
        /// <summary>
        /// 获取实体信息
        /// </summary>
        /// <param name="row">数据行</param>
        /// <returns></returns>
        public static WfSupportGroupEntity GetEntity(DataRow row)
        {
            WfSupportGroupEntity entity = new WfSupportGroupEntity();

            if (row["SupportGroupID"] != DBNull.Value)
                entity.SupportGroupID = Guid.Parse(row["SupportGroupID"].ToString());
            entity.SupportGroupName = row["SupportGroupName"].ToString();
            if (row["SupportGroupLevel"] != DBNull.Value)
                entity.SupportGroupLevel = Convert.ToInt32(row["SupportGroupLevel"]);
            entity.GroupType = row["GroupType"].ToString();
            if (row["IsDefault"] != DBNull.Value)
                entity.IsDefault = Convert.ToBoolean(row["IsDefault"]);
            entity.DepartmentID = row["DepartmentID"].ToString();
            entity.BusinessType = row["BusinessType"].ToString();
            entity.DepartmentName = row["DepartmentName"].ToString();

            return entity;
        }
Пример #4
0
 /// <summary>
 /// 保存支持组(一线组、二线组。。。。)信息
 /// </summary>
 /// <param name="supportGroupName">组名</param>
 /// <param name="supportGroupLevel">组级别</param>
 /// <param name="groupType">组类型,对应BusinessType</param>
 /// <param name="isDefault">是否默认支持组</param>
 /// <param name="departmentID">所属单位id</param>
 /// <returns></returns>
 public static bool SaveSupportGroupInfo(string supportGroupName, int supportGroupLevel, string groupType,
     bool isDefault, string departmentID)
 {
     var result = WfSupportGroupBusiness.IsExist(supportGroupName, supportGroupLevel, departmentID); //先验重
     if (result)
     {
         throw new Exception("同一单位支持组名称与级别不能重复!");
     }
     else
     {
         var entity = new WfSupportGroupEntity(Guid.NewGuid(), supportGroupName, supportGroupLevel, groupType,
                                               isDefault, departmentID, "", "");
         return WfSupportGroupBusiness.Add(entity);
     }
 }