Ejemplo n.º 1
0
        /// <summary>
        /// 编辑目标信息
        /// </summary>
        /// <param name="model">目标信息</param>
        /// <returns></returns>
        public static int SaveAimInfo(AimInfoModel model)
        {
            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //设置公司代码
            model.CompanyCD = userInfo.CompanyCD;
            //定义返回变量
            int isSucc = -1;

            //ID存在时,更新
            if (ConstUtil.EDIT_FLAG_UPDATE.Equals(model.EditFlag))
            {
                try
                {
                    //执行更新操作
                    isSucc = AimInfoDBHelper.UpdateAimInfo(model);
                }
                catch 
                {
                    //输出日志

                }
            }
            //插入
            else
            {
                try
                {
                    //执行插入操作
                    isSucc = AimInfoDBHelper.InsertAimInfo(model);
                }
                catch 
                {
                    //输出日志

                }
            }
            return isSucc;
        }
Ejemplo n.º 2
0
        public static void SetAimInfoParm(SqlCommand comm, AimInfoModel model)
        {

            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@CompanyCD", model.CompanyCD));//公司代码
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@AimNo", model.AimNO));//
            comm.Parameters.AddWithValue("@AimTypeID", SqlDbType.Int);
            comm.Parameters["@AimTypeID"].Value = model.AimTypeID;
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@AimTitle", model.AimTitle));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@AimContent", model.AimContent));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@AimStep", model.AimStep));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Resources", model.Resources));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Method", model.Method));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Qustion", model.Qustion));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@AimStandard", model.AimStandard));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@AimFlag", model.AimFlag));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@JoinUserIDList", model.JoinUserIDList));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@JoinUserNameList", model.JoinUserNameList));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@CanViewUser", model.CanViewUser  ));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@CanViewUserName", model.CanViewUserName));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@IsMobileNotice", model.IsMobileNotice));//
            comm.Parameters.AddWithValue("@PrincipalID", SqlDbType.Int);
            comm.Parameters["@PrincipalID"].Value = model.PrincipalID;
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Attachment", model.Attachment));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Critical", model.Critical));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Important", model.Important));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Priority", model.Priority));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@AttentionName", model.AttentionName));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Status", model.Status));//
            comm.Parameters.Add(SqlHelper.GetParameterFromString("@Remark", model.Remark));//

            comm.Parameters.AddWithValue("@Creator", SqlDbType.Int);
            comm.Parameters["@Creator"].Value = model.Creator;

            comm.Parameters.AddWithValue("@Checkor", SqlDbType.Int);
            comm.Parameters["@Checkor"].Value = model.Checkor;

            comm.Parameters.AddWithValue("@CreateDate", SqlDbType.DateTime);
            comm.Parameters["@CreateDate"].Value = model.CreateDate;

            comm.Parameters.AddWithValue("@Coordinator", SqlDbType.Int);
            comm.Parameters["@Coordinator"].Value = model.Coordinator;

            comm.Parameters.AddWithValue("@StartDate", SqlDbType.DateTime);
            comm.Parameters["@StartDate"].Value = model.StartDate;

            comm.Parameters.AddWithValue("@ModifiedDate", SqlDbType.DateTime);
            comm.Parameters["@ModifiedDate"].Value = model.ModifiedDate;

            comm.Parameters.AddWithValue("@EndDate", SqlDbType.DateTime);
            comm.Parameters["@EndDate"].Value = model.EndDate;

            comm.Parameters.AddWithValue("@IsDirection",SqlDbType.VarChar );
            comm.Parameters["@IsDirection"].Value = model.IsDirection;

            if (model.IsMobileNotice == "1")
            {
                comm.Parameters.AddWithValue("@RemindTime", SqlDbType.DateTime);
                comm.Parameters["@RemindTime"].Value = model.RemindTime;
            }
            comm.Parameters.AddWithValue("@AimDate", SqlDbType.VarChar);
            comm.Parameters["@AimDate"].Value = model.AimDate;

            comm.Parameters.AddWithValue("@AimNum", SqlDbType.Int);
            comm.Parameters["@AimNum"].Value = model.AimNum;

            comm.Parameters.AddWithValue("@ID", SqlDbType.Int);
            comm.Parameters["@ID"].Value = model.ID;

            comm.Parameters.AddWithValue("@DeptID", SqlDbType.Int);
            comm.Parameters["@DeptID"].Value = model.DeptID;

            comm.Parameters.Add(SqlHelper.GetParameterFromString("@ModifiedUserID", userInfo.UserID));//
        }
Ejemplo n.º 3
0
        public static int InsertAimInfo(AimInfoModel model)
        {
            #region  SQL语句拼写
            StringBuilder InsertAimSqlString = new StringBuilder();
            InsertAimSqlString.Append("INSERT INTO  officedba.PlanAim");
            InsertAimSqlString.Append("  (      CompanyCD,");
            InsertAimSqlString.Append("     AimNo ,");
            InsertAimSqlString.Append("      AimTypeID ,");
            InsertAimSqlString.Append("      AimTitle ,");
            InsertAimSqlString.Append("      AimContent,");
            InsertAimSqlString.Append("      AimStandard ,");
            InsertAimSqlString.Append("      AimFlag ,");
            InsertAimSqlString.Append("      JoinUserIDList ,");
            InsertAimSqlString.Append("      JoinUserNameList,");
            InsertAimSqlString.Append("      CanViewUser ,");
            InsertAimSqlString.Append("      CanViewUserName ,");
            InsertAimSqlString.Append("      IsMobileNotice ,");
            if (model.IsMobileNotice =="1" )
            InsertAimSqlString.Append("      RemindTime,");
            InsertAimSqlString.Append("      PrincipalID ,");
            InsertAimSqlString.Append("       Attachment,");
            InsertAimSqlString.Append("       Critical,");
            InsertAimSqlString.Append("      Important ,");
            InsertAimSqlString.Append("       Priority,");
            InsertAimSqlString.Append("      AttentionName ,");
            InsertAimSqlString.Append("      Status ,");
            InsertAimSqlString.Append("      Remark ,");
            InsertAimSqlString.Append("      AimStep ,");
            InsertAimSqlString.Append("      Resources ,");
            InsertAimSqlString.Append("      Qustion ,");
            InsertAimSqlString.Append("      Method ,");
            InsertAimSqlString.Append("      Creator ,");
            InsertAimSqlString.Append("      Checkor ,");
            InsertAimSqlString.Append("       CreateDate,");
            InsertAimSqlString.Append("       Coordinator,");
            InsertAimSqlString.Append("       StartDate,");
            InsertAimSqlString.Append("       EndDate,");
            InsertAimSqlString.Append("       ModifiedUserID,");
            InsertAimSqlString.Append("       AimDate,");
            InsertAimSqlString.Append("       AimNum,");
            InsertAimSqlString.Append("       IsDirection,");
            InsertAimSqlString.Append("       DeptID)");
            InsertAimSqlString.Append("   VALUES   ");
            InsertAimSqlString.Append(" (  @CompanyCD,           ");
            InsertAimSqlString.Append("    @AimNo                    ,          ");
            InsertAimSqlString.Append("    @AimTypeID                         ,");
            InsertAimSqlString.Append("    @AimTitle                   ,");
            InsertAimSqlString.Append("    @AimContent               ,");
            InsertAimSqlString.Append("    @AimStandard                  ,");
            InsertAimSqlString.Append("    @AimFlag                             ,");
            InsertAimSqlString.Append("    @JoinUserIDList                 ,");
            InsertAimSqlString.Append("    @JoinUserNameList          ,");
            InsertAimSqlString.Append("    @CanViewUser       ,");
            InsertAimSqlString.Append("    @CanViewUserName       ,");
            InsertAimSqlString.Append("    @IsMobileNotice        ,");
            if (model.IsMobileNotice == "1")
            InsertAimSqlString.Append("    @RemindTime     ,           ");
            InsertAimSqlString.Append("    @PrincipalID                       ,");
            InsertAimSqlString.Append("    @Attachment                              ,");
            InsertAimSqlString.Append("    @Critical                           ,");
            InsertAimSqlString.Append("    @Important                         ,");
            InsertAimSqlString.Append("    @Priority                        ,");
            InsertAimSqlString.Append("    @AttentionName                     ,");
            InsertAimSqlString.Append("    @Status                        ,");
            InsertAimSqlString.Append("    @Remark                                   ,");
            InsertAimSqlString.Append("    @AimStep                                   ,");
            InsertAimSqlString.Append("    @Resources                                   ,");
            InsertAimSqlString.Append("    @Qustion                                   ,");
            InsertAimSqlString.Append("    @Method                                   ,");
            InsertAimSqlString.Append("    @Creator                               ,");
            InsertAimSqlString.Append("    @Checkor                               ,");
            InsertAimSqlString.Append("    @CreateDate                             ,");
            InsertAimSqlString.Append("    @Coordinator                                ,");
            InsertAimSqlString.Append("    @StartDate                          ,");
            InsertAimSqlString.Append("    @EndDate                            ,");
            InsertAimSqlString.Append("    @ModifiedUserID                  ,");
            InsertAimSqlString.Append("    @AimDate,");
            InsertAimSqlString.Append("    @AimNum, ");
            InsertAimSqlString.Append("    @IsDirection, ");
            InsertAimSqlString.Append("    @DeptID  )");
            InsertAimSqlString.Append(";select @RID [email protected]@IDENTITY  ");
            #endregion
            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            comm.CommandText = InsertAimSqlString.ToString();
            //设置保存的参数
            SetAimInfoParm(comm, model);
            SqlParameter sqlp = new SqlParameter("@RID",SqlDbType.Int,4)  ;
            sqlp.Direction = ParameterDirection.Output;
            comm.Parameters.Add(sqlp);
             
            //返回操作结果  
            SqlHelper.ExecuteTransWithCommand(comm);

            if (model.IsMobileNotice == "1")
            {
              
                StringBuilder strSql = new StringBuilder(); 
                strSql.Append("insert into officedba.NoticeHistory(");
                strSql.Append("   CompanyCD,SourceFlag,SourceID,PlanNoticeDate  )  ");
                strSql.Append("      values(@CompanyCD, @SourceFlag,@SourceID,@PlanNoticeDate  ) ");
                SqlCommand commN = new SqlCommand();
                commN.Parameters.AddWithValue("@CompanyCD", SqlDbType.VarChar);
                commN.Parameters["@CompanyCD"].Value = model.CompanyCD;
                commN.Parameters.AddWithValue("@SourceFlag", SqlDbType.VarChar);
                commN.Parameters["@SourceFlag"].Value = "2";
                commN.Parameters.AddWithValue("@SourceID", SqlDbType.Int);
                commN.Parameters["@SourceID"].Value = sqlp.Value;
                commN.Parameters.AddWithValue("@PlanNoticeDate", SqlDbType.DateTime);
                commN.Parameters["@PlanNoticeDate"].Value = model.RemindTime;
                commN.CommandText = strSql.ToString();
                SqlHelper.ExecuteTransWithCommand(commN);
            }

            return (int)sqlp.Value;         
        }
Ejemplo n.º 4
0
        public static bool AddAimCheck(AimInfoModel model)
        {
            string sqlStr = "UPDATE   officedba.PlanAim SET   CheckNote = @CheckNote,  Status='5', " +
                                   "   [email protected],  " +
                                   "    [email protected],  " +
                                   "  ScoreNote [email protected] ," +
                                   "   CheckDate = @CheckDate    " +
                                   " WHERE  ID = @ID ";
            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            //设置两个参数
            comm.CommandText = sqlStr;

            comm.Parameters.AddWithValue("@CheckUserID", SqlDbType.Int);
            comm.Parameters["@CheckUserID"].Value = model.CheckUserID;

            comm.Parameters.AddWithValue("@CheckNote", SqlDbType.VarChar);
            comm.Parameters["@CheckNote"].Value = model.CheckNote;

            comm.Parameters.AddWithValue("@ScoreNote", SqlDbType.VarChar);
            comm.Parameters["@ScoreNote"].Value = model.ScoreNote;

            comm.Parameters.AddWithValue("@CheckScore", SqlDbType.Int);
            comm.Parameters["@CheckScore"].Value = model.CheckScore;

            comm.Parameters.AddWithValue("@CheckDate", SqlDbType.VarChar);
            comm.Parameters["@CheckDate"].Value = DateTime.Now;

            comm.Parameters.AddWithValue("@ID", SqlDbType.Int);
            comm.Parameters["@ID"].Value = model.ID;

            //返回操作结果  
            return SqlHelper.ExecuteTransWithCommand(comm);
        }
Ejemplo n.º 5
0
        public static bool AddSummarizeNote(AimInfoModel model)
        {
            string sqlStr = "UPDATE   officedba.PlanAim SET   SummarizeNote = @SummarizeNote,  Status='4' ,[email protected], " +
                                    "   [email protected],  " +
                                    "      AddOrCut = @AddOrCut ,     " +
                                    "    [email protected],   " +
                                    "  CompletePercent [email protected] ," +
                                    "   SummarizeDate = @SummarizeDate    " +
                                    " WHERE  ID = @ID ";
            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            //设置两个参数
            comm.CommandText = sqlStr;

            comm.Parameters.AddWithValue("@Summarizer", SqlDbType.Int);
            comm.Parameters["@Summarizer"].Value = model.Summarizer;

            comm.Parameters.AddWithValue("@SummarizeNote", SqlDbType.VarChar);
            comm.Parameters["@SummarizeNote"].Value = model.SummarizeNote;

            comm.Parameters.AddWithValue("@CompletePercent", SqlDbType.Decimal);
            comm.Parameters["@CompletePercent"].Value = model.CompletePercent;

            comm.Parameters.AddWithValue("@AimRealResult", SqlDbType.VarChar);
            comm.Parameters["@AimRealResult"].Value = model.AimRealResult;

            comm.Parameters.AddWithValue("@AddOrCut", SqlDbType.VarChar);
            comm.Parameters["@AddOrCut"].Value = model.AddOrCut;

            comm.Parameters.AddWithValue("@Difference", SqlDbType.VarChar);
            comm.Parameters["@Difference"].Value = model.Difference;

            comm.Parameters.AddWithValue("@SummarizeDate", SqlDbType.VarChar);
            comm.Parameters["@SummarizeDate"].Value = DateTime.Now;

            comm.Parameters.AddWithValue("@ID", SqlDbType.Int);
            comm.Parameters["@ID"].Value = model.ID;

            //返回操作结果  
            return SqlHelper.ExecuteTransWithCommand(comm);

        }
Ejemplo n.º 6
0
        public static int UpdateAimInfo(AimInfoModel model)
        {

            #region  SQL语句拼写
            StringBuilder UpdateAimSqlString = new StringBuilder();
            UpdateAimSqlString.Append("UPDATE  officedba.PlanAim");
            UpdateAimSqlString.Append("   SET   ");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected],");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("       [email protected],");
            UpdateAimSqlString.Append("      [email protected] ,");
            UpdateAimSqlString.Append("      CanViewUserName [email protected] ,");
            UpdateAimSqlString.Append("      AttentionName [email protected] ,");
            UpdateAimSqlString.Append("      [email protected] ,");
            if (model.IsMobileNotice == "1")
                UpdateAimSqlString.Append("      RemindTime [email protected],");
            UpdateAimSqlString.Append("       [email protected],  ");
            UpdateAimSqlString.Append("       [email protected]  ");
            UpdateAimSqlString.Append("   WHERE   ID [email protected]  ");

            #endregion
            //定义更新基本信息的命令
            SqlCommand comm = new SqlCommand();
            comm.CommandText = UpdateAimSqlString.ToString();
            //设置保存的参数
            SetUpdateAimInfoParm(comm, model);

            //返回操作结果  
            if (SqlHelper.ExecuteTransWithCommand(comm))
            {
                if (model.IsMobileNotice == "1")
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("delete  from  officedba.NoticeHistory  where  [email protected] and  SourceFlag ='2'  ");
                strSql.Append("insert into officedba.NoticeHistory(");
                strSql.Append("   CompanyCD,SourceFlag,SourceID,PlanNoticeDate  )  ");
                strSql.Append("      values(@CompanyCD, @SourceFlag,@SourceID,@PlanNoticeDate  ) ");
                SqlCommand commN = new SqlCommand();
                commN.Parameters.AddWithValue("@CompanyCD", SqlDbType.VarChar);
                commN.Parameters["@CompanyCD"].Value = model.CompanyCD;
                commN.Parameters.AddWithValue("@SourceFlag", SqlDbType.VarChar);
                commN.Parameters["@SourceFlag"].Value ="2" ;
                commN.Parameters.AddWithValue("@SourceID", SqlDbType.Int);
                commN.Parameters["@SourceID"].Value = model.ID;
                commN.Parameters.AddWithValue("@PlanNoticeDate", SqlDbType.DateTime);
                commN.Parameters["@PlanNoticeDate"].Value = model.RemindTime;
                commN.Parameters.AddWithValue("@ID", SqlDbType.Int);
                commN.Parameters["@ID"].Value = model.ID;
                commN.CommandText = strSql.ToString();
                SqlHelper.ExecuteTransWithCommand(commN);
            } else
                {
                    StringBuilder strSql = new StringBuilder();
                    SqlCommand commN = new SqlCommand();
                    strSql.Append("delete  from  officedba.NoticeHistory  where  [email protected] and  SourceFlag ='2'  ");
                    commN.Parameters.AddWithValue("@ID", SqlDbType.Int);
                    commN.Parameters["@ID"].Value = model.ID;
                    commN.CommandText = strSql.ToString();
                    SqlHelper.ExecuteTransWithCommand(commN);
                }
                return 1;
            }
            else {
                return 0;
            }

        }