/// <summary> /// 添加招聘活动 /// </summary> /// <param name="model">招聘活动信息</param> /// <returns></returns> public static bool InsertRectPlanInfo(RectPlanModel model) { #region 插入SQL拼写 StringBuilder insertSql = new StringBuilder(); insertSql.AppendLine(" INSERT INTO officedba.RectPlan "); insertSql.AppendLine(" (CompanyCD "); insertSql.AppendLine(" ,PlanNo "); insertSql.AppendLine(" ,Title "); insertSql.AppendLine(" ,StartDate "); insertSql.AppendLine(" ,EndDate "); insertSql.AppendLine(" ,Principal "); insertSql.AppendLine(" ,Status "); insertSql.AppendLine(" ,PlanFee "); insertSql.AppendLine(" ,FeeNote "); insertSql.AppendLine(" ,JoinMan "); insertSql.AppendLine(" ,JoinNote "); insertSql.AppendLine(" ,RequireNum "); insertSql.AppendLine(" ,ModifiedDate "); insertSql.AppendLine(" ,ModifiedUserID) "); insertSql.AppendLine(" VALUES "); insertSql.AppendLine(" (@CompanyCD "); insertSql.AppendLine(" ,@PlanNo "); insertSql.AppendLine(" ,@Title "); insertSql.AppendLine(" ,@StartDate "); insertSql.AppendLine(" ,@EndDate "); insertSql.AppendLine(" ,@Principal "); insertSql.AppendLine(" ,@Status "); insertSql.AppendLine(" ,@PlanFee "); insertSql.AppendLine(" ,@FeeNote "); insertSql.AppendLine(" ,@JoinMan "); insertSql.AppendLine(" ,@JoinNote "); insertSql.AppendLine(" ,@RequireNum "); insertSql.AppendLine(" ,getdate() "); insertSql.AppendLine(" ,@ModifiedUserID) "); #endregion //定义更新基本信息的命令 SqlCommand comm = new SqlCommand(); comm.CommandText = insertSql.ToString(); //设置保存的参数 SetSaveParameter(comm, model); //定义更新列表 ArrayList lstInsert = new ArrayList(); //添加基本信息更新命令 lstInsert.Add(comm); //登陆或者更新招聘目标信息 EditRectGoalInfo(lstInsert, model.GoalList, model.PlanNo, model.CompanyCD, model.ModifiedUserID); //登陆或者更新信息发布 EditRectPublishInfo(lstInsert, model.PublishList, model.PlanNo, model.CompanyCD, model.ModifiedUserID); //执行更新操作并返回更新结果 return(SqlHelper.ExecuteTransWithArrayList(lstInsert)); }
/// <summary> /// 保存时基本信息参数设置 /// </summary> /// <param name="comm">命令</param> /// <param name="model">人员信息</param> private static void SetSaveParameter(SqlCommand comm, RectPlanModel model) { //设置参数 comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD)); //企业代码 comm.Parameters.Add(SqlHelper.GetParameterFromString("@PlanNo", model.PlanNo)); //招聘计划编号 comm.Parameters.Add(SqlHelper.GetParameterFromString("@Title", model.Title)); //主题 comm.Parameters.Add(SqlHelper.GetParameterFromString("@StartDate", model.StartDate)); //开始时间 comm.Parameters.Add(SqlHelper.GetParameterFromString("@Principal", model.Principal)); //负责人(对应员工表ID) comm.Parameters.Add(SqlHelper.GetParameterFromString("@Status", model.Status)); //状态(0计划中,1实行中,2已结束) comm.Parameters.Add(SqlHelper.GetParameterFromString("@EndDate", model.EndDate)); //状态(0计划中,1实行中,2已结束) comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", model.ModifiedUserID)); //更新用户ID comm.Parameters.Add(SqlHelper.GetParameterFromString("@PlanFee", model.PlanFee)); //开始时间 comm.Parameters.Add(SqlHelper.GetParameterFromString("@FeeNote", model.FeeNote)); //负责人(对应员工表ID) comm.Parameters.Add(SqlHelper.GetParameterFromString("@JoinMan", model.JoinMan)); //状态(0计划中,1实行中,2已结束) comm.Parameters.Add(SqlHelper.GetParameterFromString("@JoinNote", model.JoinNote)); //状态(0计划中,1实行中,2已结束) comm.Parameters.Add(SqlHelper.GetParameterFromString("@RequireNum", model.RequireNum)); //更新用户ID }
/// <summary> /// 更新招聘活动以及相关信息 /// </summary> /// <param name="model">招聘活动信息</param> /// <returns></returns> public static bool UpdateRectPlanInfo(RectPlanModel model) { #region 更新SQL拼写 StringBuilder updateSql = new StringBuilder(); updateSql.AppendLine(" UPDATE officedba.RectPlan "); updateSql.AppendLine(" SET Title = @Title "); updateSql.AppendLine(" ,StartDate = @StartDate "); updateSql.AppendLine(" ,EndDate = @EndDate "); updateSql.AppendLine(" ,Principal = @Principal "); updateSql.AppendLine(" ,Status = @Status "); updateSql.AppendLine(" ,PlanFee=@PlanFee "); updateSql.AppendLine(" ,FeeNote=@FeeNote "); updateSql.AppendLine(" ,JoinMan=@JoinMan "); updateSql.AppendLine(" ,JoinNote=@JoinNote "); updateSql.AppendLine(" ,RequireNum=@RequireNum "); updateSql.AppendLine(" ,ModifiedDate = getdate() "); updateSql.AppendLine(" ,ModifiedUserID = @ModifiedUserID "); updateSql.AppendLine(" WHERE CompanyCD = @CompanyCD "); updateSql.AppendLine(" AND PlanNo = @PlanNo "); #endregion //定义更新基本信息的命令 SqlCommand comm = new SqlCommand(); comm.CommandText = updateSql.ToString(); //设置保存的参数 SetSaveParameter(comm, model); //定义更新列表 ArrayList lstUpdate = new ArrayList(); //添加基本信息更新命令 lstUpdate.Add(comm); //登陆或者更新招聘目标信息 EditRectGoalInfo(lstUpdate, model.GoalList, model.PlanNo, model.CompanyCD, model.ModifiedUserID); //登陆或者更新信息发布 EditRectPublishInfo(lstUpdate, model.PublishList, model.PlanNo, model.CompanyCD, model.ModifiedUserID); //执行更新操作并返回更新结果 return(SqlHelper.ExecuteTransWithArrayList(lstUpdate)); }
/// <summary> /// 编辑招聘活动信息 /// </summary> /// <param name="model">招聘申请活动</param> /// <returns></returns> public static bool SaveRectPlanInfo(RectPlanModel model) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 model.CompanyCD = userInfo.CompanyCD; model.ModifiedUserID = userInfo.UserID; //定义返回变量 bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(model.PlanNo); //更新 if (ConstUtil.EDIT_FLAG_UPDATE.Equals(model.EditFlag)) { try { logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //执行更新操作 isSucc = RectPlanDBHelper.UpdateRectPlanInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //插入 else { try { logModel.Element = ConstUtil.LOG_PROCESS_INSERT; //执行插入操作 isSucc = RectPlanDBHelper.InsertRectPlanInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }