コード例 #1
0
        /// <summary>
        /// 编辑培训信息
        /// </summary>
        /// <param name="model">培训信息</param>
        /// <returns></returns>
        public static bool SaveTrainingPlanInfo(TrainingModel model)
        {
            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //设置公司代码
            model.CompanyCD = userInfo.CompanyCD;
            model.ModifiedUserID = userInfo.UserID;
            //定义返回变量
            bool isSucc = false;
            //操作日志
            LogInfoModel logModel = InitLogInfo(model.TrainingNo);

            //更新
            if (ConstUtil.EDIT_FLAG_UPDATE.Equals(model.EditFlag))
            {
                try
                {
                    logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
                    //执行更新操作
                    isSucc = TrainingDBHelper.UpdateTrainingInfo(model);
                }
                catch (Exception ex)
                {
                    //输出系统日志
                    WriteSystemLog(userInfo, ex);
                }
            }
            //插入
            else
            {
                try
                {
                    logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
                    //执行插入操作
                    isSucc = TrainingDBHelper.InsertTrainingInfo(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;
        }
コード例 #2
0
        /// <summary>
        /// 更新培训以及相关信息
        /// </summary>
        /// <param name="model">培训信息</param>
        /// <returns></returns>
        public static bool UpdateTrainingInfo(TrainingModel model)
        {

            #region 更新SQL拼写
            StringBuilder updateSql = new StringBuilder();
            updateSql.AppendLine(" UPDATE officedba.EmployeeTraining    ");
            updateSql.AppendLine(" SET TrainingName = @TrainingName     ");
            updateSql.AppendLine(" 	,ApplyDate = @ApplyDate             ");
            updateSql.AppendLine(" 	,EmployeeID = @EmployeeID           ");
            updateSql.AppendLine(" 	,ProjectNo = @ProjectNo             ");
            updateSql.AppendLine(" 	,ProjectName = @ProjectName         ");
            updateSql.AppendLine(" 	,TrainingOrgan = @TrainingOrgan     ");
            updateSql.AppendLine(" 	,PlanCost = @PlanCost               ");
            updateSql.AppendLine(" 	,TrainingCount = @TrainingCount     ");
            updateSql.AppendLine(" 	,Goal = @Goal                       ");
            updateSql.AppendLine(" 	,TrainingPlace = @TrainingPlace     ");
            updateSql.AppendLine(" 	,TrainingWay = @TrainingWay         ");
            updateSql.AppendLine(" 	,TrainingTeacher = @TrainingTeacher ");
            updateSql.AppendLine(" 	,StartDate = @StartDate             ");
            updateSql.AppendLine(" 	,EndDate = @EndDate                 ");
            updateSql.AppendLine(" 	,TrainingRemark = @TrainingRemark   ");
            updateSql.AppendLine(" 	,CheckPerson = @CheckPerson         ");
            updateSql.AppendLine(" 	,Attachment = @Attachment           ");
            updateSql.AppendLine(" 	,AttachmentName = @AttachmentName   ");
            updateSql.AppendLine(" 	,ModifiedDate = getdate()           ");
            updateSql.AppendLine(" 	,ModifiedUserID = @ModifiedUserID   ");
            updateSql.AppendLine("  WHERE                               ");
            updateSql.AppendLine(" 	   CompanyCD = @CompanyCD           ");
            updateSql.AppendLine("     AND TrainingNo = @TrainingNo     ");
            #endregion

            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            comm.CommandText = updateSql.ToString();
            //设置保存的参数
            SetSaveParameter(comm, model);
            //定义更新列表
            ArrayList lstUpdate = new ArrayList();
            //添加基本信息更新命令
            lstUpdate.Add(comm);
            //zzzzzzzzzzzzzzz
            EditJionInfo(lstUpdate, model.UserList, model.TrainingNo, model.CompanyCD, model.ModifiedUserID);
            //登陆或者更新进度安排信息
            EditScheduleInfo(lstUpdate, model.ScheduleList, model.TrainingNo, model.CompanyCD, model.ModifiedUserID);

            //执行更新操作并返回更新结果
            return SqlHelper.ExecuteTransWithArrayList(lstUpdate);
        }
コード例 #3
0
 /// <summary>
 /// 保存时基本信息参数设置
 /// </summary>
 /// <param name="comm">命令</param>
 /// <param name="model">人员信息</param>
 private static void SetSaveParameter(SqlCommand comm, TrainingModel model)
 {
     //设置参数
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD));//公司代码
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingNo", model.TrainingNo));//培训编号
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingName", model.TrainingName));//培训名称
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@ApplyDate", model.ApplyDate));//发起时间
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@EmployeeID", model.EmployeeID));//发起人ID(对应员工表ID)
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@ProjectNo", model.ProjectNo));//项目编号
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@ProjectName", model.ProjectName));//项目名称
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingOrgan", model.TrainingOrgan));//培训机构
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@PlanCost", model.PlanCost));//费用预算
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingCount", model.TrainingCount));//培训天数
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@Goal", model.Goal));//目的
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingPlace", model.TrainingPlace));//培训地点
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingWay", model.TrainingWay));//培训方式ID(对应分类代码表ID)
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingTeacher", model.TrainingTeacher));//培训老师
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@StartDate", model.StartDate));//开始时间
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@EndDate", model.EndDate));//结束时间
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@TrainingRemark", model.TrainingRemark));//培训备注
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@CheckPerson", model.CheckPerson));//考核人
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@Attachment", model.PageAttachment));//附件
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@AttachmentName", model.AttachmentName));//附件
     comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", model.ModifiedUserID));//更新用户ID
 }
コード例 #4
0
        /// <summary>
        /// 添加培训以及相关信息
        /// </summary>
        /// <param name="model">培训信息</param>
        /// <returns></returns>
        public static bool InsertTrainingInfo(TrainingModel model)
        {

            #region 插入SQL拼写
            StringBuilder insertSql = new StringBuilder();
            insertSql.AppendLine(" INSERT INTO officedba.EmployeeTraining ");
            insertSql.AppendLine("            (CompanyCD                  ");
            insertSql.AppendLine("            ,TrainingNo                 ");
            insertSql.AppendLine("            ,TrainingName               ");
            insertSql.AppendLine("            ,ApplyDate                  ");
            insertSql.AppendLine("            ,EmployeeID                 ");
            insertSql.AppendLine("            ,ProjectNo                  ");
            insertSql.AppendLine("            ,ProjectName                ");
            insertSql.AppendLine("            ,TrainingOrgan              ");
            insertSql.AppendLine("            ,PlanCost                   ");
            insertSql.AppendLine("            ,TrainingCount              ");
            insertSql.AppendLine("            ,Goal                       ");
            insertSql.AppendLine("            ,TrainingPlace              ");
            insertSql.AppendLine("            ,TrainingWay                ");
            insertSql.AppendLine("            ,TrainingTeacher            ");
            insertSql.AppendLine("            ,StartDate                  ");
            insertSql.AppendLine("            ,EndDate                    ");
            insertSql.AppendLine("            ,TrainingRemark             ");
            insertSql.AppendLine("            ,CheckPerson                ");
            insertSql.AppendLine("            ,Attachment                 ");
            insertSql.AppendLine("            ,AttachmentName             ");
            insertSql.AppendLine("            ,Status                     ");
            insertSql.AppendLine("            ,ModifiedDate               ");
            insertSql.AppendLine("            ,ModifiedUserID)            ");
            insertSql.AppendLine("      VALUES                            ");
            insertSql.AppendLine("            (@CompanyCD                 ");
            insertSql.AppendLine("            ,@TrainingNo                ");
            insertSql.AppendLine("            ,@TrainingName              ");
            insertSql.AppendLine("            ,@ApplyDate                 ");
            insertSql.AppendLine("            ,@EmployeeID                ");
            insertSql.AppendLine("            ,@ProjectNo                 ");
            insertSql.AppendLine("            ,@ProjectName               ");
            insertSql.AppendLine("            ,@TrainingOrgan             ");
            insertSql.AppendLine("            ,@PlanCost                  ");
            insertSql.AppendLine("            ,@TrainingCount             ");
            insertSql.AppendLine("            ,@Goal                      ");
            insertSql.AppendLine("            ,@TrainingPlace             ");
            insertSql.AppendLine("            ,@TrainingWay               ");
            insertSql.AppendLine("            ,@TrainingTeacher           ");
            insertSql.AppendLine("            ,@StartDate                 ");
            insertSql.AppendLine("            ,@EndDate                   ");
            insertSql.AppendLine("            ,@TrainingRemark            ");
            insertSql.AppendLine("            ,@CheckPerson               ");
            insertSql.AppendLine("            ,@Attachment                ");
            insertSql.AppendLine("            ,@AttachmentName            ");
            insertSql.AppendLine("            ,'0'                        ");
            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);
            //
            EditJionInfo(lstInsert, model.UserList, model.TrainingNo, model.CompanyCD, model.ModifiedUserID);
            //登陆或者更新进度安排信息
            EditScheduleInfo(lstInsert, model.ScheduleList, model.TrainingNo, model.CompanyCD, model.ModifiedUserID);

            //执行更新操作并返回更新结果
            return SqlHelper.ExecuteTransWithArrayList(lstInsert);

        }