public string UpdateRecordDate(PrjInfoModel model) { string str = ""; StringBuilder builder = new StringBuilder(); builder.Append("update PT_PrjInfo set TypeCode=@TypeCode+ "); builder.Append("(SELECT TypeCode FROM PT_PrjInfo ppi WHERE ppi.PrjGuid = @PrjGuid1 ),"); builder.Append("RecordDate=@RecordDate"); builder.Append(" where PrjGuid=@PrjGuid AND [IsValid]=1 "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@PrjGuid1", SqlDbType.VarChar, 0x40), new SqlParameter("@PrjGuid", SqlDbType.VarChar, 0x40), new SqlParameter("@RecordDate", SqlDbType.DateTime), new SqlParameter("@TypeCode", SqlDbType.VarChar, 0x40) }; commandParameters[0].Value = model.PrjGuid; commandParameters[1].Value = model.PrjGuid; if (!string.IsNullOrEmpty(model.RecordDate)) { commandParameters[2].Value = model.RecordDate; } else { commandParameters[2].Value = DBNull.Value; } commandParameters[3].Value = model.TypeCode; str = publicDbOpClass.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters).ToString(); if (str == "1") { StringBuilder builder2 = new StringBuilder(); builder2.Append("UPDATE PT_PrjInfo SET "); builder2.Append(" i_ChildNum = i_ChildNum +1 "); builder2.Append(" WHERE TypeCode =@TypeCode AND [IsValid]=1"); SqlParameter[] parameterArray2 = new SqlParameter[] { new SqlParameter("@TypeCode", SqlDbType.VarChar, 0x40) }; parameterArray2[0].Value = model.TypeCode; str = publicDbOpClass.ExecuteNonQuery(CommandType.Text, builder2.ToString(), parameterArray2).ToString(); } return(str); }
public bool upDateStartItemByPrjGuid(PrjInfoModel model) { StringBuilder builder = new StringBuilder(); builder.Append("UPDATE [PT_PrjInfo] SET "); builder.Append(" [PrjState] = @PrjState,[ProjStartDate] = @ProjStartDate "); builder.Append(" ,[BusinessManager] = @BusinessManager,[StartManager] = @StartManager,[StartRemark] = @StartRemark "); builder.Append(" WHERE [PrjGuid] = @PrjGuid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@PrjState", SqlDbType.Int, 4), new SqlParameter("@ProjStartDate", SqlDbType.DateTime), new SqlParameter("@BusinessManager", SqlDbType.VarChar, 100), new SqlParameter("@StartManager", SqlDbType.VarChar, 100), new SqlParameter("@StartRemark", SqlDbType.VarChar), new SqlParameter("@PrjGuid", SqlDbType.VarChar, 0x40) }; commandParameters[0].Value = model.PrjState; commandParameters[1].Value = model.ProjStartDate; commandParameters[2].Value = model.BusinessManager; commandParameters[3].Value = model.StartManager; commandParameters[4].Value = model.StartRemark; commandParameters[5].Value = model.PrjGuid; return(publicDbOpClass.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) == 1); }